snipt

Ctrl+h for KB shortcuts

Text only

Fluid Mixin

1
2
3
4
5
6
// Can take any property so you don't need separate mixins for widths, margins or 
positioning properties (left, right, etc)

@mixin fluid($property, $element-width, $container-width) {
    #{$property}: ($element-width / $container-width) * 100%;
}
https://snipt.net/embed/402d1c8111ee5ccf5c8bba902db09294/
/raw/402d1c8111ee5ccf5c8bba902db09294/
402d1c8111ee5ccf5c8bba902db09294
text
Text only
6
2019-06-08T18:04:01
True
False
False
/api/public/snipt/58385/
fluid-mixin
<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>// Can take any property so you don&#39;t need separate mixins for widths, margins or </span><span id="L-2"><a name="L-2"></a>positioning properties (left, right, etc) </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>@mixin fluid($property, $element-width, $container-width) { </span><span id="L-5"><a name="L-5"></a> #{$property}: ($element-width / $container-width) * 100%; </span><span id="L-6"><a name="L-6"></a>} </span></pre></div> </td></tr></table>

JavaScript

Simple WP Search form validator

1
2
3
4
5
6
7
$('.search-form form').submit(function(){
    if ( $('input[type="text"]').val() ) {
        return true;
    }
    window.alert('Please enter a search term');
    return false;
});
https://snipt.net/embed/eba716c13b7c26c2f8fa4e3e12aa97af/
/raw/eba716c13b7c26c2f8fa4e3e12aa97af/
eba716c13b7c26c2f8fa4e3e12aa97af
js
JavaScript
7
2019-06-05T04:17:39
True
False
False
Oct 22, 2012 at 01:19 PM
/api/public/snipt/48876/
simple-wp-search-form-validator
<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="nx">$</span><span class="p">(</span><span class="s1">&#39;.search-form form&#39;</span><span class="p">).</span><span class="nx">submit</span><span class="p">(</span><span class="kd">function</span><span class="p">(){</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">if</span> <span class="p">(</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;input[type=&quot;text&quot;]&#39;</span><span class="p">).</span><span class="nx">val</span><span class="p">()</span> <span class="p">)</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="kc">true</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="p">}</span> </span><span id="L-5"><a name="L-5"></a> <span class="nb">window</span><span class="p">.</span><span class="nx">alert</span><span class="p">(</span><span class="s1">&#39;Please enter a search term&#39;</span><span class="p">);</span> </span><span id="L-6"><a name="L-6"></a> <span class="k">return</span> <span class="kc">false</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>
jquery, search, validatior, wordpress

Markdown

Currently Installed ST2 Packages

Alignment, DocBlocker, Goto-CSS-Declaration, HTML5, JQuery, LiveCSS, PackageControl, Phix Color Scheme, Placeholders, Ruby Haml, SASS, SCSS, Sublime Linter, SublimeCodeIntel, WordPress, Zen Coding.

https://snipt.net/embed/76151152aff84fd4f4d6e97c7eba3963/
/raw/76151152aff84fd4f4d6e97c7eba3963/
76151152aff84fd4f4d6e97c7eba3963
markdown
Markdown
2
2019-06-12T20:28:54
True
False
False
/api/public/snipt/46857/
currently-installed-st2-packages
<p>Alignment, DocBlocker, Goto-CSS-Declaration, HTML5, JQuery, LiveCSS, PackageControl, Phix Color Scheme, Placeholders, Ruby Haml, SASS, SCSS, Sublime Linter, SublimeCodeIntel, WordPress, Zen Coding.</p>