snipt

Ctrl+h for KB shortcuts

Bash

Convert XML docs to HTML

// Assumes xalan is installed on machine
find . -name '*.xml' | xargs -I PARAM java org.apache.xalan.xslt.Process -IN PARAM -XSL dir/file.xsl -OUT PARAM.html
https://snipt.net/embed/d84e5b7b4f2ad3870576c11fca85ee3c/
/raw/d84e5b7b4f2ad3870576c11fca85ee3c/
d84e5b7b4f2ad3870576c11fca85ee3c
bash
Bash
2
2019-07-16T06:01:04
True
False
False
/api/public/snipt/3028/
convert-xml-docs-to-html
<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>// Assumes xalan is installed on machine </span><span id="L-2"><a name="L-2"></a>find . -name <span class="s1">&#39;*.xml&#39;</span> <span class="p">|</span> xargs -I PARAM java org.apache.xalan.xslt.Process -IN PARAM -XSL dir/file.xsl -OUT PARAM.html </span></pre></div> </td></tr></table>
find, html, xalan, xargs, xml, xsl, xslt

HTML

Add a class to the body with JavaScript

<script type="text/javascript">document.getElementsByTagName('body')[0].className+=' js'</script>
https://snipt.net/embed/6322b8873ff8524160691103fd67bfb4/
/raw/6322b8873ff8524160691103fd67bfb4/
6322b8873ff8524160691103fd67bfb4
html
HTML
1
2019-07-15T01:01:50
True
False
False
/api/public/snipt/2827/
add-a-class-to-the-body-with-javascript
<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><span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/javascript&quot;</span><span class="p">&gt;</span><span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span><span class="p">(</span><span class="s1">&#39;body&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">].</span><span class="nx">className</span><span class="o">+=</span><span class="s1">&#39; js&#39;</span><span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
body, html, javascript

HTML

Include Favicon

<link rel="shortcut icon" href="favicon.ico" />
https://snipt.net/embed/c66d4cfb371f0bda721baed025e21364/
/raw/c66d4cfb371f0bda721baed025e21364/
c66d4cfb371f0bda721baed025e21364
html
HTML
1
2019-07-14T09:45:29
True
False
False
/api/public/snipt/2762/
include-favicon
<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><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;shortcut icon&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;favicon.ico&quot;</span> <span class="p">/&gt;</span> </span></pre></div> </td></tr></table>
favicon, html

HTML

Include JavaScipt

<script type="text/javascript" src="mootools-1.2.1-core.js"></script>
https://snipt.net/embed/befec5dee3c32c0502a7ef9a3dab6f5c/
/raw/befec5dee3c32c0502a7ef9a3dab6f5c/
befec5dee3c32c0502a7ef9a3dab6f5c
html
HTML
1
2019-07-13T17:02:36
True
False
False
/api/public/snipt/2761/
include-javascipt
<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><span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;mootools-1.2.1-core.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
html, js

HTML

drupal tutorial page title structure

<title>(current-page) | (site-title) - (slogan)</title>
https://snipt.net/embed/10835e4ad57769b06735778848d49105/
/raw/10835e4ad57769b06735778848d49105/
10835e4ad57769b06735778848d49105
html
HTML
1
2019-07-17T19:32:54
True
False
False
/api/public/snipt/2400/
drupal-tutorial-page-title-structure
<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><span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>(current-page) | (site-title) - (slogan)<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
drupal, html

HTML+PHP

print drupal primary links with custom class

1
2
3
4
5
<div id="navigation">
	<?php if (isset($primary_links)) : ?>
		<?php print theme('links', $primary_links, array('class' => 'nav-links primary-nav-links')) ?>
	<?php endif; ?>
</div>
https://snipt.net/embed/88fc4073a9c00645089f02d0c780fca8/
/raw/88fc4073a9c00645089f02d0c780fca8/
88fc4073a9c00645089f02d0c780fca8
html+php
HTML+PHP
5
2019-07-07T10:35:09
True
False
False
/api/public/snipt/2399/
print-drupal-primary-links-with-custom-class
<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="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;navigation&quot;</span><span class="p">&gt;</span> </span><span id="L-2"><a name="L-2"></a> <span class="cp">&lt;?php</span> <span class="k">if</span> <span class="p">(</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$primary_links</span><span class="p">))</span> <span class="o">:</span> <span class="cp">?&gt;</span> </span><span id="L-3"><a name="L-3"></a> <span class="cp">&lt;?php</span> <span class="k">print</span> <span class="nx">theme</span><span class="p">(</span><span class="s1">&#39;links&#39;</span><span class="p">,</span> <span class="nv">$primary_links</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;class&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;nav-links primary-nav-links&#39;</span><span class="p">))</span> <span class="cp">?&gt;</span> </span><span id="L-4"><a name="L-4"></a> <span class="cp">&lt;?php</span> <span class="k">endif</span><span class="p">;</span> <span class="cp">?&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
drupal, html, php

HTML

default drupal menu list items

1
2
3
4
5
<ul>
  <li>Menu Item 1</li>
  <li>Menu Item 2</li>
  <li>Menu Item 3</li>
</ul>
https://snipt.net/embed/c8b0f1e1660cc949bde57c3765540241/
/raw/c8b0f1e1660cc949bde57c3765540241/
c8b0f1e1660cc949bde57c3765540241
html
HTML
5
2019-07-18T13:26:22
True
False
False
/api/public/snipt/2381/
default-drupal-menu-list-items
<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="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span> </span><span id="L-2"><a name="L-2"></a> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>Menu Item 1<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> </span><span id="L-3"><a name="L-3"></a> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>Menu Item 2<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> </span><span id="L-4"><a name="L-4"></a> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>Menu Item 3<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
drupal, html