Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

JavaScript

Add viewport tag to head with jQuery

//useful for jsfiddle
$('head').append('<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />');
https://snipt.net/embed/436b83cbffb758473413035d5f34ed3b/
https://snipt.net/raw/436b83cbffb758473413035d5f34ed3b/
436b83cbffb758473413035d5f34ed3b
js
JavaScript
2
2016-12-04T17:03:55
True
False
False
Feb 18, 2014 at 11:15 AM
/api/public/snipt/114793/
add-viewport-tag-to-head-with-jquery
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">//useful for jsfiddle</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;head&#39;</span><span class="p">).</span><span class="nx">append</span><span class="p">(</span><span class="s1">&#39;&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1&quot; /&gt;&#39;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
head, javascript, jquery, viewport

HTML

Nagłówek HTML5 z RDF

1
2
3
4
5
6
<!DOCTYPE html>
<!--[if IEMobile 7]><html class="iem7" lang="pl" dir="ltr"><![endif]-->
<!--[if lte IE 6]><html class="lt-ie9 lt-ie8 lt-ie7" lang="pl" dir="ltr"><![endif]-->
<!--[if (IE 7)&(!IEMobile)]><html class="lt-ie9 lt-ie8" lang="pl" dir="ltr"><![endif]-->
<!--[if IE 8]><html class="lt-ie9" lang="pl" dir="ltr"><![endif]-->
<!--[if (gte IE 9)|(gt IEMobile 7)]><!--><html lang="pl" dir="ltr" prefix="content: http://purl.org/rss/1.0/modules/content/ dc: http://purl.org/dc/terms/ foaf: http://xmlns.com/foaf/0.1/ og: http://ogp.me/ns# rdfs: http://www.w3.org/2000/01/rdf-schema# sioc: http://rdfs.org/sioc/ns# sioct: http://rdfs.org/sioc/types# skos: http://www.w3.org/2004/02/skos/core# xsd: http://www.w3.org/2001/XMLSchema#"><!--<![endif]-->
https://snipt.net/embed/3d5f6663a7cc4aefb4d6c1ebbbf4d203/
https://snipt.net/raw/3d5f6663a7cc4aefb4d6c1ebbbf4d203/
3d5f6663a7cc4aefb4d6c1ebbbf4d203
html
HTML
6
2016-12-05T02:21:24
True
False
False
/api/public/snipt/51039/
nagowek-html5-z-rdf
<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="cp">&lt;!DOCTYPE html&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="c">&lt;!--[if IEMobile 7]&gt;&lt;html class=&quot;iem7&quot; lang=&quot;pl&quot; dir=&quot;ltr&quot;&gt;&lt;![endif]--&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="c">&lt;!--[if lte IE 6]&gt;&lt;html class=&quot;lt-ie9 lt-ie8 lt-ie7&quot; lang=&quot;pl&quot; dir=&quot;ltr&quot;&gt;&lt;![endif]--&gt;</span> </span><span id="L-4"><a name="L-4"></a><span class="c">&lt;!--[if (IE 7)&amp;(!IEMobile)]&gt;&lt;html class=&quot;lt-ie9 lt-ie8&quot; lang=&quot;pl&quot; dir=&quot;ltr&quot;&gt;&lt;![endif]--&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="c">&lt;!--[if IE 8]&gt;&lt;html class=&quot;lt-ie9&quot; lang=&quot;pl&quot; dir=&quot;ltr&quot;&gt;&lt;![endif]--&gt;</span> </span><span id="L-6"><a name="L-6"></a><span class="c">&lt;!--[if (gte IE 9)|(gt IEMobile 7)]&gt;&lt;!--&gt;</span><span class="p">&lt;</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">&quot;pl&quot;</span> <span class="na">dir</span><span class="o">=</span><span class="s">&quot;ltr&quot;</span> <span class="na">prefix</span><span class="o">=</span><span class="s">&quot;content: http://purl.org/rss/1.0/modules/content/ dc: http://purl.org/dc/terms/ foaf: http://xmlns.com/foaf/0.1/ og: http://ogp.me/ns# rdfs: http://www.w3.org/2000/01/rdf-schema# sioc: http://rdfs.org/sioc/ns# sioct: http://rdfs.org/sioc/types# skos: http://www.w3.org/2004/02/skos/core# xsd: http://www.w3.org/2001/XMLSchema#&quot;</span><span class="p">&gt;</span><span class="c">&lt;!--&lt;![endif]--&gt;</span> </span></pre></div> </td></tr></table>
HTML5, RDF, head, html

PHP

header and footer tags

1
2
3
4
5
6
<head>
<?php wp_head();?>


<?php wp_footer();?>
</body>
https://snipt.net/embed/428fa203115fa4459fadc99960cf047e/
https://snipt.net/raw/428fa203115fa4459fadc99960cf047e/
428fa203115fa4459fadc99960cf047e
php
PHP
6
2016-11-18T02:08:22
True
False
False
/api/public/snipt/25544/
header-and-footer-tags
<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">&lt;head&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="cp">&lt;?php</span> <span class="nx">wp_head</span><span class="p">();</span><span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="cp">&lt;?php</span> <span class="nx">wp_footer</span><span class="p">();</span><span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-6"><a name="L-6"></a><span class="x">&lt;/body&gt;</span> </span></pre></div> </td></tr></table>
foot, head, php, wordpress

Text only

Google Chrome Application

1
2
3
4
<meta name="title" content="NAME" /> 
<meta name="description" content="a short description"/>

<link rel="icon" href="http://DOMAIN.COM/icon.png" sizes="48x48" />
https://snipt.net/embed/438b5926c5419123f0b8d8ed8aec4d68/
https://snipt.net/raw/438b5926c5419123f0b8d8ed8aec4d68/
438b5926c5419123f0b8d8ed8aec4d68
text
Text only
4
2016-11-30T18:10:55
True
False
False
/api/public/snipt/16178/
google-chrome-application
<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>&lt;meta name=&quot;title&quot; content=&quot;NAME&quot; /&gt; </span><span id="L-2"><a name="L-2"></a>&lt;meta name=&quot;description&quot; content=&quot;a short description&quot;/&gt; </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>&lt;link rel=&quot;icon&quot; href=&quot;http://DOMAIN.COM/icon.png&quot; sizes=&quot;48x48&quot; /&gt; </span></pre></div> </td></tr></table>
chrome, google, head, icon, link

Bash

Find out the top 10 resources consuming processes

1
2
3
4
5
# memory consuming processes
ps -auxf | sort -nr -k 4 | head -10

# CPU consuming processes
ps -auxf | sort -nr -k 3 | head -10
https://snipt.net/embed/eaf9dc7e2993ffecb8a27cc06bbfbdc7/
https://snipt.net/raw/eaf9dc7e2993ffecb8a27cc06bbfbdc7/
eaf9dc7e2993ffecb8a27cc06bbfbdc7
bash
Bash
5
2016-11-25T12:42:36
True
False
False
/api/public/snipt/9291/
find-out-the-top-10-resources-consuming-processes
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># memory consuming processes</span> </span><span id="L-2"><a name="L-2"></a>ps -auxf <span class="p">|</span> sort -nr -k <span class="m">4</span> <span class="p">|</span> head -10 </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># CPU consuming processes</span> </span><span id="L-5"><a name="L-5"></a>ps -auxf <span class="p">|</span> sort -nr -k <span class="m">3</span> <span class="p">|</span> head -10 </span></pre></div> </td></tr></table>
bash, cpu, head, memory, ps, sort

HTML

Document setup

1
2
3
4
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-AU">
<head>
</head>
https://snipt.net/embed/90c8e2b369f67367f97a820b9c47c5ea/
https://snipt.net/raw/90c8e2b369f67367f97a820b9c47c5ea/
90c8e2b369f67367f97a820b9c47c5ea
html
HTML
4
2016-12-03T11:46:05
True
False
False
/api/public/snipt/7251/
document-setup
<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="cp">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="p">&lt;</span><span class="nt">html</span> <span class="na">xmlns</span><span class="o">=</span><span class="s">&quot;http://www.w3.org/1999/xhtml&quot;</span> <span class="na">xml:lang</span><span class="o">=</span><span class="s">&quot;en-AU&quot;</span><span class="p">&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span> </span><span id="L-4"><a name="L-4"></a><span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
doctype, head, html, xhtml

HTML

Well Formed Meta Tags

1
2
3
4
5
6
7
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="abstract" content="" />
<meta http-equiv="last-modified" content="Mon, 1 Jan 2009 12:00:00 -0700" />
https://snipt.net/embed/159c78dafb1bf447d9c564a72537223d/
https://snipt.net/raw/159c78dafb1bf447d9c564a72537223d/
159c78dafb1bf447d9c564a72537223d
html
HTML
7
2016-11-25T10:11:54
True
False
False
/api/public/snipt/7211/
well-formed-meta-tags
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;Content-Script-Type&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;text/javascript&quot;</span> <span class="p">/&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;Content-Style-Type&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;text/css&quot;</span> <span class="p">/&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;Content-Type&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;text/html; charset=UTF-8&quot;</span> <span class="p">/&gt;</span> </span><span id="L-4"><a name="L-4"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;keywords&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;&quot;</span> <span class="p">/&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;description&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;&quot;</span> <span class="p">/&gt;</span> </span><span id="L-6"><a name="L-6"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;abstract&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;&quot;</span> <span class="p">/&gt;</span> </span><span id="L-7"><a name="L-7"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;last-modified&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;Mon, 1 Jan 2009 12:00:00 -0700&quot;</span> <span class="p">/&gt;</span> </span></pre></div> </td></tr></table>
date, head, meta
Copyrighted, illegal, or inappropriate content? Email [email protected].