snipt

Ctrl+h for KB shortcuts

HTML

Untitled

1
2
3
<script id="headertmpl" type="text/x-dot-template">
<h1>{{=it.title}}</h1>
</script>
https://snipt.net/embed/a7f5f1c57d360e3ea07d122844464ddb/
/raw/a7f5f1c57d360e3ea07d122844464ddb/
a7f5f1c57d360e3ea07d122844464ddb
html
HTML
3
2019-06-13T21:05:20
True
False
False
Aug 21, 2012 at 02:12 PM
/api/public/snipt/46066/
-715
<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="p">&lt;</span><span class="nt">script</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;headertmpl&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/x-dot-template&quot;</span><span class="p">&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="o">&lt;</span><span class="nx">h1</span><span class="o">&gt;</span><span class="p">{{</span><span class="o">=</span><span class="nx">it</span><span class="p">.</span><span class="nx">title</span><span class="p">}}</span><span class="o">&lt;</span><span class="err">/h1&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>

JavaScript

Untitled

var tmplString = "<h1>{{=it.title}}</h1>";
var tmpl = doT.template(tmplString);
https://snipt.net/embed/94d1020d02ab521b2d98d68741844216/
/raw/94d1020d02ab521b2d98d68741844216/
94d1020d02ab521b2d98d68741844216
js
JavaScript
2
2019-06-10T20:00:24
True
False
False
Aug 21, 2012 at 02:11 PM
/api/public/snipt/46065/
-714
<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="kd">var</span> <span class="nx">tmplString</span> <span class="o">=</span> <span class="s2">&quot;&lt;h1&gt;{{=it.title}}&lt;/h1&gt;&quot;</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a><span class="kd">var</span> <span class="nx">tmpl</span> <span class="o">=</span> <span class="nx">doT</span><span class="p">.</span><span class="nx">template</span><span class="p">(</span><span class="nx">tmplString</span><span class="p">);</span> </span></pre></div> </td></tr></table>

HTML

Untitled

<script type="text/javascript" src="doT.js"></script>
https://snipt.net/embed/8ad14066a57e9cc76efebe41561f313e/
/raw/8ad14066a57e9cc76efebe41561f313e/
8ad14066a57e9cc76efebe41561f313e
html
HTML
1
2019-06-13T01:54:44
True
False
False
Aug 21, 2012 at 02:11 PM
/api/public/snipt/46064/
-713
<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;doT.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>

PHP

Terrific Module with Skin

<?php terrific_module('Flickr', array('skin' => 'Blue')); ?>
https://snipt.net/embed/d0076505ce585da8c176dbca610a564e/
/raw/d0076505ce585da8c176dbca610a564e/
d0076505ce585da8c176dbca610a564e
php
PHP
1
2019-06-06T11:01:23
True
False
False
/api/public/snipt/29599/
terrific-module-with-skin
<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="cp">&lt;?php</span> <span class="nx">terrific_module</span><span class="p">(</span><span class="s1">&#39;Flickr&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;skin&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Blue&#39;</span><span class="p">));</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
terrific

PHP

Terrific Module with Template

<?php terrific_module('Flickr', array('template' => 'tiny')); ?>
https://snipt.net/embed/d340488fa48fc47186f1f108e27b08ea/
/raw/d340488fa48fc47186f1f108e27b08ea/
d340488fa48fc47186f1f108e27b08ea
php
PHP
1
2019-06-12T20:19:53
True
False
False
/api/public/snipt/29598/
terrific-module-with-template
<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="cp">&lt;?php</span> <span class="nx">terrific_module</span><span class="p">(</span><span class="s1">&#39;Flickr&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;template&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;tiny&#39;</span><span class="p">));</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
terrific

PHP

Terrific Module

<?php terrific_module('Flickr'); ?>
https://snipt.net/embed/8b763790c452ed8820ab9cac14b11195/
/raw/8b763790c452ed8820ab9cac14b11195/
8b763790c452ed8820ab9cac14b11195
php
PHP
1
2019-06-15T14:46:46
True
False
False
/api/public/snipt/29597/
terrific-module
<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="cp">&lt;?php</span> <span class="nx">terrific_module</span><span class="p">(</span><span class="s1">&#39;Flickr&#39;</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
terrific

SQL

data model sql example

1
2
3
4
5
6
7
CREATE TABLE IF NOT EXISTS `user` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `created` datetime NOT NULL,
    `username` varchar(255) NOT NULL,
    `firstname` varchar(255) NOT NULL COMMENT 'First name',
    PRIMARY KEY (id)
);
https://snipt.net/embed/b35ed9a11489e1b2e0849cf88289ba6e/
/raw/b35ed9a11489e1b2e0849cf88289ba6e/
b35ed9a11489e1b2e0849cf88289ba6e
sql
SQL
7
2019-06-13T04:37:15
True
False
False
/api/public/snipt/16252/
data-model-sql-example
<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="k">CREATE</span> <span class="k">TABLE</span> <span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span> <span class="o">`</span><span class="k">user</span><span class="o">`</span> <span class="p">(</span> </span><span id="L-2"><a name="L-2"></a> <span class="o">`</span><span class="n">id</span><span class="o">`</span> <span class="nb">int</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span> <span class="k">NOT</span> <span class="k">NULL</span> <span class="n">AUTO_INCREMENT</span><span class="p">,</span> </span><span id="L-3"><a name="L-3"></a> <span class="o">`</span><span class="n">created</span><span class="o">`</span> <span class="n">datetime</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span> </span><span id="L-4"><a name="L-4"></a> <span class="o">`</span><span class="n">username</span><span class="o">`</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">)</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span> </span><span id="L-5"><a name="L-5"></a> <span class="o">`</span><span class="n">firstname</span><span class="o">`</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">)</span> <span class="k">NOT</span> <span class="k">NULL</span> <span class="k">COMMENT</span> <span class="s1">&#39;First name&#39;</span><span class="p">,</span> </span><span id="L-6"><a name="L-6"></a> <span class="k">PRIMARY</span> <span class="k">KEY</span> <span class="p">(</span><span class="n">id</span><span class="p">)</span> </span><span id="L-7"><a name="L-7"></a><span class="p">);</span> </span></pre></div> </td></tr></table>
"data model", sql