snipt

Ctrl+h for KB shortcuts

Text only

Useful functions

1
2
3
4
// old style confirm
if (confirm('Your question')) { 
 // do things if OK
}
https://snipt.net/embed/46565c36e9ee3a613e98d89be8acd926/
https://snipt.net/raw/46565c36e9ee3a613e98d89be8acd926/
46565c36e9ee3a613e98d89be8acd926
text
Text only
4
2016-02-10T20:30:22
True
False
Dec 16, 2015 at 06:50 PM
/api/public/snipt/143125/
useful-functions-b6df2e9d
<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 id="L-1"><a name="L-1"></a>// old style confirm </span><span id="L-2"><a name="L-2"></a>if (confirm(&#39;Your question&#39;)) { </span><span id="L-3"><a name="L-3"></a> // do things if OK </span><span id="L-4"><a name="L-4"></a>} </span></pre></div> </td></tr></table>
javascript, jquery

Text only

Reload page on resize

1
2
3
4
5
<script>
$(window).resize(function() {
        location.reload();
});
</script>
https://snipt.net/embed/1512d05d3cbba71deb661a507c119be3/
https://snipt.net/raw/1512d05d3cbba71deb661a507c119be3/
1512d05d3cbba71deb661a507c119be3
text
Text only
5
2016-02-10T20:30:54
True
False
Dec 15, 2015 at 08:58 AM
/api/public/snipt/143077/
reload-page-on-resize
<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 id="L-1"><a name="L-1"></a>&lt;script&gt; </span><span id="L-2"><a name="L-2"></a>$(window).resize(function() { </span><span id="L-3"><a name="L-3"></a> location.reload(); </span><span id="L-4"><a name="L-4"></a>}); </span><span id="L-5"><a name="L-5"></a>&lt;/script&gt; </span></pre></div> </td></tr></table>
javascript, responsive

Text only

Make div same height as width javascript

1
2
3
4
5
<script>
    $('.responsive').each(function(){
        $(this).height($(this).width());
});
</script>
https://snipt.net/embed/8f0dbcf6a292830373cd910ca69cb1c9/
https://snipt.net/raw/8f0dbcf6a292830373cd910ca69cb1c9/
8f0dbcf6a292830373cd910ca69cb1c9
text
Text only
5
2016-02-10T20:31:10
True
False
/api/public/snipt/143076/
make-div-same-height-as-width-javascript
<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 id="L-1"><a name="L-1"></a>&lt;script&gt; </span><span id="L-2"><a name="L-2"></a> $(&#39;.responsive&#39;).each(function(){ </span><span id="L-3"><a name="L-3"></a> $(this).height($(this).width()); </span><span id="L-4"><a name="L-4"></a>}); </span><span id="L-5"><a name="L-5"></a>&lt;/script&gt; </span></pre></div> </td></tr></table>
javascript, responsive

JavaScript

Unit Tests

1
2
3
it('should fail this test', function () {
    expect(4).toBe(545);
});
https://snipt.net/embed/9f6da1483692f8dcc131bddfe86a63aa/
https://snipt.net/raw/9f6da1483692f8dcc131bddfe86a63aa/
9f6da1483692f8dcc131bddfe86a63aa
js
JavaScript
3
2016-02-11T23:52:56
True
False
Dec 14, 2015 at 11:24 AM
/api/public/snipt/143055/
b67521bc
<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 id="L-1"><a name="L-1"></a><span class="nx">it</span><span class="p">(</span><span class="s1">&#39;should fail this test&#39;</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">expect</span><span class="p">(</span><span class="mi">4</span><span class="p">).</span><span class="nx">toBe</span><span class="p">(</span><span class="mi">545</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
javascript

Text only

Script voor automatisch forwarden naar andere pagina

1
2
3
<script>// <![CDATA[
setTimeout("top.location.href = 'http://app.argenta.be/nl/'",100);
// ]]></script>
https://snipt.net/embed/89e15258da2f1495066fa3d13e0af683/
https://snipt.net/raw/89e15258da2f1495066fa3d13e0af683/
89e15258da2f1495066fa3d13e0af683
text
Text only
3
2016-02-10T20:31:57
True
False
Oct 08, 2015 at 03:20 AM
/api/public/snipt/141573/
script-voor-automatisch-forwarden-naar-andere-pagina
<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 id="L-1"><a name="L-1"></a>&lt;script&gt;// &lt;![CDATA[ </span><span id="L-2"><a name="L-2"></a>setTimeout(&quot;top.location.href = &#39;http://app.argenta.be/nl/&#39;&quot;,100); </span><span id="L-3"><a name="L-3"></a>// ]]&gt;&lt;/script&gt; </span></pre></div> </td></tr></table>
Wordpress, automatisch, foward, javascript, redirect
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.