snipt

Ctrl+h for KB shortcuts

Text only

Reload page on resize

1
2
3
4
5
<script>
$(window).resize(function() {
        location.reload();
});
</script>
https://snipt.net/embed/1512d05d3cbba71deb661a507c119be3/
/raw/1512d05d3cbba71deb661a507c119be3/
1512d05d3cbba71deb661a507c119be3
text
Text only
5
2019-06-26T01:54:31
True
False
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></span><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/
/raw/8f0dbcf6a292830373cd910ca69cb1c9/
8f0dbcf6a292830373cd910ca69cb1c9
text
Text only
5
2019-06-04T01:01:52
True
False
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></span><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/
/raw/9f6da1483692f8dcc131bddfe86a63aa/
9f6da1483692f8dcc131bddfe86a63aa
js
JavaScript
3
2019-06-09T17:32:29
True
False
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></span><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