snipt

Ctrl+h for KB shortcuts

CSS

truncated text with css

1
2
3
4
5
6
7
8
.link_truncated {
    text-overflow: ellipsis;
    display: inline-block;
    width: 275px; /* width of the container */
    white-space: nowrap;
    overflow: hidden;
    vertical-align: top;
}
https://snipt.net/embed/add2a47c1dba5912e5453db15d21ce2a/
/raw/add2a47c1dba5912e5453db15d21ce2a/
add2a47c1dba5912e5453db15d21ce2a
css
CSS
8
2019-06-08T16:35:58
True
False
False
/api/public/snipt/34670/
truncated-text-with-css
<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> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nc">.link_truncated</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nb">text</span><span class="o">-</span><span class="nb">overflow</span><span class="o">:</span> <span class="n">ellipsis</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="nb">display</span><span class="o">:</span> <span class="nb">inline</span><span class="o">-</span><span class="nb">block</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="nb">width</span><span class="o">:</span> <span class="m">275px</span><span class="p">;</span> <span class="c">/* width of the container */</span> </span><span id="L-5"><a name="L-5"></a> <span class="nb">white-space</span><span class="o">:</span> <span class="nb">nowrap</span><span class="p">;</span> </span><span id="L-6"><a name="L-6"></a> <span class="nb">overflow</span><span class="o">:</span> <span class="nb">hidden</span><span class="p">;</span> </span><span id="L-7"><a name="L-7"></a> <span class="nb">vertical-align</span><span class="o">:</span> <span class="nb">top</span><span class="p">;</span> </span><span id="L-8"><a name="L-8"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
css, shorten, truncate

JavaScript

jquery if exists DOM element

1
2
3
4
5
if ( $('#myDiv').length ) {

  //do something

}
https://snipt.net/embed/cf1dbea1e1b6f0baa01c2301f1824d97/
/raw/cf1dbea1e1b6f0baa01c2301f1824d97/
cf1dbea1e1b6f0baa01c2301f1824d97
js
JavaScript
5
2019-06-14T08:30:29
True
False
False
/api/public/snipt/33933/
jquery-if-exists-dom-element
<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="k">if</span> <span class="p">(</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;#myDiv&#39;</span><span class="p">).</span><span class="nx">length</span> <span class="p">)</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a> <span class="c1">//do something</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
dom, jquery

Text only

google translate auto language detection custom search query for alfred

http://translate.google.com/translate_t?text=&hl=en&q={query}&um=1&ie=UTF-8&sa=N&tab=wT#
https://snipt.net/embed/b94f705362953ab54b8253fa24464b39/
/raw/b94f705362953ab54b8253fa24464b39/
b94f705362953ab54b8253fa24464b39
text
Text only
1
2019-06-14T05:56:06
True
False
False
/api/public/snipt/24535/
google-translate-auto-to-dutch-custom-search-query-for-alfred
<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>http://translate.google.com/translate_t?text=&amp;hl=en&amp;q={query}&amp;um=1&amp;ie=UTF-8&amp;sa=N&amp;tab=wT# </span></pre></div> </td></tr></table>
alfred, google, search, translate

CSS

disable copy on iDevice

1
2
3
* {
-webkit-user-select: none;
}
https://snipt.net/embed/ce92b1f249fd9efab4fbd3e7c39b9a76/
/raw/ce92b1f249fd9efab4fbd3e7c39b9a76/
ce92b1f249fd9efab4fbd3e7c39b9a76
css
CSS
3
2019-06-13T09:30:36
True
False
False
/api/public/snipt/22685/
disable-copy-on-idevice
<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="o">*</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a><span class="o">-</span><span class="n">webkit</span><span class="o">-</span><span class="n">user</span><span class="o">-</span><span class="n">select</span><span class="o">:</span> <span class="nb">none</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>
css, idevice, ipad, iphone