snipt

Ctrl+h for KB shortcuts

Text only

W3C Keyword Colors

var colors = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","navyblue","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];
https://snipt.net/embed/c256caf16f701b062a6fcbe739aac7ab/
/raw/c256caf16f701b062a6fcbe739aac7ab/
c256caf16f701b062a6fcbe739aac7ab
text
Text only
1
2019-08-14T20:08:28
True
False
False
Jun 08, 2014 at 01:19 AM
/api/public/snipt/135283/
w3c-keyword-colors-90c153dd
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>var colors = [&quot;aliceblue&quot;,&quot;antiquewhite&quot;,&quot;aqua&quot;,&quot;aquamarine&quot;,&quot;azure&quot;,&quot;beige&quot;,&quot;bisque&quot;,&quot;black&quot;,&quot;blanchedalmond&quot;,&quot;blue&quot;,&quot;blueviolet&quot;,&quot;brown&quot;,&quot;burlywood&quot;,&quot;cadetblue&quot;,&quot;chartreuse&quot;,&quot;chocolate&quot;,&quot;coral&quot;,&quot;cornflowerblue&quot;,&quot;cornsilk&quot;,&quot;crimson&quot;,&quot;cyan&quot;,&quot;darkblue&quot;,&quot;darkcyan&quot;,&quot;darkgoldenrod&quot;,&quot;darkgray&quot;,&quot;darkgreen&quot;,&quot;darkkhaki&quot;,&quot;darkmagenta&quot;,&quot;darkolivegreen&quot;,&quot;darkorange&quot;,&quot;darkorchid&quot;,&quot;darkred&quot;,&quot;darksalmon&quot;,&quot;darkseagreen&quot;,&quot;darkslateblue&quot;,&quot;darkslategray&quot;,&quot;darkturquoise&quot;,&quot;darkviolet&quot;,&quot;deeppink&quot;,&quot;deepskyblue&quot;,&quot;dimgray&quot;,&quot;dodgerblue&quot;,&quot;firebrick&quot;,&quot;floralwhite&quot;,&quot;forestgreen&quot;,&quot;fuchsia&quot;,&quot;gainsboro&quot;,&quot;ghostwhite&quot;,&quot;gold&quot;,&quot;goldenrod&quot;,&quot;gray&quot;,&quot;green&quot;,&quot;greenyellow&quot;,&quot;honeydew&quot;,&quot;hotpink&quot;,&quot;indianred&quot;,&quot;indigo&quot;,&quot;ivory&quot;,&quot;khaki&quot;,&quot;lavender&quot;,&quot;lavenderblush&quot;,&quot;lawngreen&quot;,&quot;lemonchiffon&quot;,&quot;lightblue&quot;,&quot;lightcoral&quot;,&quot;lightcyan&quot;,&quot;lightgoldenrodyellow&quot;,&quot;lightgreen&quot;,&quot;lightgrey&quot;,&quot;lightpink&quot;,&quot;lightsalmon&quot;,&quot;lightseagreen&quot;,&quot;lightskyblue&quot;,&quot;lightslategray&quot;,&quot;lightsteelblue&quot;,&quot;lightyellow&quot;,&quot;lime&quot;,&quot;limegreen&quot;,&quot;linen&quot;,&quot;magenta&quot;,&quot;maroon&quot;,&quot;mediumaquamarine&quot;,&quot;mediumblue&quot;,&quot;mediumorchid&quot;,&quot;mediumpurple&quot;,&quot;mediumseagreen&quot;,&quot;mediumslateblue&quot;,&quot;mediumspringgreen&quot;,&quot;mediumturquoise&quot;,&quot;mediumvioletred&quot;,&quot;midnightblue&quot;,&quot;mintcream&quot;,&quot;mistyrose&quot;,&quot;moccasin&quot;,&quot;navajowhite&quot;,&quot;navy&quot;,&quot;navyblue&quot;,&quot;oldlace&quot;,&quot;olive&quot;,&quot;olivedrab&quot;,&quot;orange&quot;,&quot;orangered&quot;,&quot;orchid&quot;,&quot;palegoldenrod&quot;,&quot;palegreen&quot;,&quot;paleturquoise&quot;,&quot;palevioletred&quot;,&quot;papayawhip&quot;,&quot;peachpuff&quot;,&quot;peru&quot;,&quot;pink&quot;,&quot;plum&quot;,&quot;powderblue&quot;,&quot;purple&quot;,&quot;red&quot;,&quot;rosybrown&quot;,&quot;royalblue&quot;,&quot;saddlebrown&quot;,&quot;salmon&quot;,&quot;sandybrown&quot;,&quot;seagreen&quot;,&quot;seashell&quot;,&quot;sienna&quot;,&quot;silver&quot;,&quot;skyblue&quot;,&quot;slateblue&quot;,&quot;slategray&quot;,&quot;snow&quot;,&quot;springgreen&quot;,&quot;steelblue&quot;,&quot;tan&quot;,&quot;teal&quot;,&quot;thistle&quot;,&quot;tomato&quot;,&quot;turquoise&quot;,&quot;violet&quot;,&quot;wheat&quot;,&quot;white&quot;,&quot;whitesmoke&quot;,&quot;yellow&quot;,&quot;yellowgreen&quot;]; </span></pre></div> </td></tr></table>
W3C, colors, css, javascript

JavaScript

This will open external links and any PDF, Office Documents in a new window. Good for WordPress type sites.

1
2
3
$("a[href^='http:']").not("[href*='YOUR-DOMAIN']").attr('target','_blank');
	$("a[href^='https:']").not("[href*='YOUR-DOMAIN']").attr('target','_blank');
	$("a[href*='.pdf'], a[href*='.docx'], a[href*='.xlsx'], a[href*='.doc']").attr('target','_blank');
https://snipt.net/embed/5d247bdb4e398ea67057b299d15dd85a/
/raw/5d247bdb4e398ea67057b299d15dd85a/
5d247bdb4e398ea67057b299d15dd85a
js
JavaScript
3
2019-08-19T00:44:24
True
False
False
/api/public/snipt/29219/
this-will-open-external-links-and-any-pdf-office-documents-in-a-new-window-good-for-wordpress-type-sites
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;a[href^=&#39;http:&#39;]&quot;</span><span class="p">).</span><span class="nx">not</span><span class="p">(</span><span class="s2">&quot;[href*=&#39;YOUR-DOMAIN&#39;]&quot;</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">&#39;target&#39;</span><span class="p">,</span><span class="s1">&#39;_blank&#39;</span><span class="p">);</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">$</span><span class="p">(</span><span class="s2">&quot;a[href^=&#39;https:&#39;]&quot;</span><span class="p">).</span><span class="nx">not</span><span class="p">(</span><span class="s2">&quot;[href*=&#39;YOUR-DOMAIN&#39;]&quot;</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">&#39;target&#39;</span><span class="p">,</span><span class="s1">&#39;_blank&#39;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">$</span><span class="p">(</span><span class="s2">&quot;a[href*=&#39;.pdf&#39;], a[href*=&#39;.docx&#39;], a[href*=&#39;.xlsx&#39;], a[href*=&#39;.doc&#39;]&quot;</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">&#39;target&#39;</span><span class="p">,</span><span class="s1">&#39;_blank&#39;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
"external links", jquery, links

PHP

Makes directory if it doesn't exist

1
2
3
4
// The following line if you want to make the directory if it doesn't exist
$targetPath = YOUR TARGET PATH
if(!file_exists(str_replace('//','/',$targetPath))) {						mkdir(str_replace('//','/',$targetPath), 0775, true);
}
https://snipt.net/embed/e1b564d05b227faa4506c52302a9cdae/
/raw/e1b564d05b227faa4506c52302a9cdae/
e1b564d05b227faa4506c52302a9cdae
php
PHP
4
2019-08-19T04:33:21
True
False
False
/api/public/snipt/28426/
makes-directory-if-it-doesnt-exist
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">// The following line if you want to make the directory if it doesn&#39;t exist</span> </span><span id="L-2"><a name="L-2"></a><span class="x">$targetPath = YOUR TARGET PATH</span> </span><span id="L-3"><a name="L-3"></a><span class="x">if(!file_exists(str_replace(&#39;//&#39;,&#39;/&#39;,$targetPath))) { mkdir(str_replace(&#39;//&#39;,&#39;/&#39;,$targetPath), 0775, true);</span> </span><span id="L-4"><a name="L-4"></a><span class="x">}</span> </span></pre></div> </td></tr></table>
php

PHP

For our MSI sites to know whether to show testing items or not.

1
2
3
4
5
6
7
8
function msitest() {
     if(isset($_GET['msitest'])) {
        return true;
     }
     else {
        return false;
     }
}
https://snipt.net/embed/b6421543abda7397995045ccc4af971d/
/raw/b6421543abda7397995045ccc4af971d/
b6421543abda7397995045ccc4af971d
php
PHP
8
2019-08-19T11:06:03
True
False
False
/api/public/snipt/27533/
for-our-msi-sites-to-know-whether-to-show-testing-items-or-not
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">function msitest() {</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> if(isset($_GET[&#39;msitest&#39;])) {</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> return true;</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> }</span> </span><span id="L-5"><a name="L-5"></a><span class="x"> else {</span> </span><span id="L-6"><a name="L-6"></a><span class="x"> return false;</span> </span><span id="L-7"><a name="L-7"></a><span class="x"> }</span> </span><span id="L-8"><a name="L-8"></a><span class="x">}</span> </span></pre></div> </td></tr></table>
msi, php, wordpress

PHP

Prints out print_r in a readable format

1
2
3
4
5
6
// PRINTS OUT PRINT_R REALLY PRETTY
function print_r_html ($arr) {
        ?><pre><?
        print_r($arr);
        ?></pre><?
}
https://snipt.net/embed/99a15bb788a27cb61f7fc75da5a40e5b/
/raw/99a15bb788a27cb61f7fc75da5a40e5b/
99a15bb788a27cb61f7fc75da5a40e5b
php
PHP
7
2019-08-19T17:16:52
True
False
False
/api/public/snipt/17578/
prints-out-print_r-in-a-readable-format
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">// PRINTS OUT PRINT_R REALLY PRETTY</span> </span><span id="L-2"><a name="L-2"></a><span class="x">function print_r_html ($arr) {</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> ?&gt;&lt;pre&gt;</span><span class="cp">&lt;?</span> </span><span id="L-4"><a name="L-4"></a> <span class="nb">print_r</span><span class="p">(</span><span class="nv">$arr</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a> <span class="cp">?&gt;</span><span class="x">&lt;/pre&gt;</span><span class="cp">&lt;?</span> </span><span id="L-6"><a name="L-6"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
function, php