@ -0,0 +1,15 @@ | |||||
.highlight { | |||||
position: relative; | |||||
} | |||||
.highlight button { | |||||
position: absolute; | |||||
top: 4px; | |||||
right: 4px; | |||||
opacity: 0; | |||||
transition: opacity 0.1s linear; | |||||
} | |||||
.highlight:hover button { | |||||
opacity: 1 | |||||
} |
@ -0,0 +1,41 @@ | |||||
$(function() { | |||||
if (/Mac/i.test(navigator.userAgent)) { | |||||
// No support for Safari :( | |||||
return; | |||||
} | |||||
var markup = '<button class="btn btn-default hidden-sm">' + | |||||
'<span class="icon-clippy"></span>' + | |||||
'</button>'; | |||||
$(".highlight").append(markup); | |||||
var reBlankLines = new RegExp("^\\s*[\\r\\n]", "gm"); | |||||
var reTrailingWhitespace = new RegExp("\\s+$"); | |||||
var clipboard = new Clipboard(".highlight button", { | |||||
text: function (trigger) { | |||||
var snippetElement = $(trigger).parent().children().clone(); | |||||
/* remove pygmentize comment elements */ | |||||
snippetElement.find(".c, .cm, .cp, .c1, .cs").remove(); | |||||
/* remove blank lines and trailing whitespace */ | |||||
return snippetElement.text().replace(reBlankLines, '').replace(reTrailingWhitespace, ''); | |||||
} | |||||
}); | |||||
clipboard.on("success", function(e) { | |||||
$(e.trigger) | |||||
.tooltip({title: "Copied!", trigger: "hover"}) | |||||
.tooltip("show") | |||||
.on("hidden.bs.tooltip", function(){ | |||||
$(this).tooltip("destroy"); | |||||
}) | |||||
}); | |||||
clipboard.on("error", function(e) { | |||||
prompt("Press Ctrl+C to select:", e.text) | |||||
}); | |||||
}); |
@ -0,0 +1,3 @@ | |||||
<div class="highlight"><pre><span></span><span class="c1"># using wget:</span> | |||||
wget {{ ping_url }} -O /dev/null | |||||
</pre></div> |
@ -0,0 +1,2 @@ | |||||
# using wget: | |||||
wget PING_URL -O /dev/null |
@ -1,4 +1,5 @@ | |||||
<div class="highlight"><pre><span></span><span class="kd">var</span> <span class="nx">xhr</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">XMLHttpRequest</span><span class="p">();</span> | |||||
<div class="highlight"><pre><span></span><span class="c1">// the server returns appropriate CORS headers so cross-domain AJAX requests should work:</span> | |||||
<span class="kd">var</span> <span class="nx">xhr</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">XMLHttpRequest</span><span class="p">();</span> | |||||
<span class="nx">xhr</span><span class="p">.</span><span class="nx">open</span><span class="p">(</span><span class="s1">'GET'</span><span class="p">,</span> <span class="s1">'{{ ping_url }}'</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span> | <span class="nx">xhr</span><span class="p">.</span><span class="nx">open</span><span class="p">(</span><span class="s1">'GET'</span><span class="p">,</span> <span class="s1">'{{ ping_url }}'</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span> | ||||
<span class="nx">xhr</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="kc">null</span><span class="p">);</span> | <span class="nx">xhr</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="kc">null</span><span class="p">);</span> | ||||
</pre></div> | </pre></div> |
@ -1,3 +1,4 @@ | |||||
// the server returns appropriate CORS headers so cross-domain AJAX requests should work: | |||||
var xhr = new XMLHttpRequest(); | var xhr = new XMLHttpRequest(); | ||||
xhr.open('GET', 'PING_URL', true); | xhr.open('GET', 'PING_URL', true); | ||||
xhr.send(null); | xhr.send(null); |
@ -1,7 +0,0 @@ | |||||
curl SITE_ROOT/api/v1/checks/ \ | |||||
--header "X-Api-Key: your-api-key" \ | |||||
--data '{"name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}' | |||||
# Or, alternatively: | |||||
curl SITE_ROOT/api/v1/checks/ \ | |||||
--data '{"api_key": "your-api-key", "name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}' |
@ -0,0 +1,3 @@ | |||||
curl SITE_ROOT/api/v1/checks/ \ | |||||
--header "X-Api-Key: your-api-key" \ | |||||
--data '{"name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}' |
@ -0,0 +1,3 @@ | |||||
<div class="highlight"><pre><span></span>curl {{ SITE_ROOT }}/api/v1/checks/ <span class="se">\</span> | |||||
--data <span class="s1">'{"api_key": "your-api-key", "name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}'</span> | |||||
</pre></div> |
@ -0,0 +1,2 @@ | |||||
curl SITE_ROOT/api/v1/checks/ \ | |||||
--data '{"api_key": "your-api-key", "name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}' |
@ -1,8 +0,0 @@ | |||||
<div class="highlight"><pre><span></span><span class="o">>>></span> <span class="c1"># using urllib2:</span> | |||||
<span class="o">>>></span> <span class="kn">import</span> <span class="nn">urllib2</span> | |||||
<span class="o">>>></span> <span class="n">urllib2</span><span class="o">.</span><span class="n">urlopen</span><span class="p">(</span><span class="s2">"{{ ping_url }}"</span><span class="p">)</span> | |||||
<span class="o">>>></span> <span class="c1"># using requests:</span> | |||||
<span class="o">>>></span> <span class="kn">import</span> <span class="nn">requests</span> | |||||
<span class="o">>>></span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"{{ ping_url }}"</span><span class="p">)</span> | |||||
</pre></div> |
@ -1,7 +0,0 @@ | |||||
>>> # using urllib2: | |||||
>>> import urllib2 | |||||
>>> urllib2.urlopen("PING_URL") | |||||
>>> # using requests: | |||||
>>> import requests | |||||
>>> requests.get("PING_URL") |
@ -0,0 +1,4 @@ | |||||
<div class="highlight"><pre><span></span><span class="c1"># using requests:</span> | |||||
<span class="kn">import</span> <span class="nn">requests</span> | |||||
<span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"{{ ping_url }}"</span><span class="p">)</span> | |||||
</pre></div> |
@ -0,0 +1,3 @@ | |||||
# using requests: | |||||
import requests | |||||
requests.get("PING_URL") |
@ -0,0 +1,4 @@ | |||||
<div class="highlight"><pre><span></span><span class="c1"># using urllib2:</span> | |||||
<span class="kn">import</span> <span class="nn">urllib2</span> | |||||
<span class="n">urllib2</span><span class="o">.</span><span class="n">urlopen</span><span class="p">(</span><span class="s2">"{{ ping_url }}"</span><span class="p">)</span> | |||||
</pre></div> |
@ -0,0 +1,3 @@ | |||||
# using urllib2: | |||||
import urllib2 | |||||
urllib2.urlopen("PING_URL") |