snipt

Ctrl+h for KB shortcuts

JavaScript

Test if href points image

1
2
3
4
if($(this).attr('href').indexOf('.jpg') > 0) // or any other extension
{
    //do what you want
}
https://snipt.net/embed/6b6e76de0f8d48d7e980f025b5f0f153/
/raw/6b6e76de0f8d48d7e980f025b5f0f153/
6b6e76de0f8d48d7e980f025b5f0f153
js
JavaScript
4
2019-06-15T04:34:29
True
False
False
Mar 17, 2014 at 01:11 PM
/api/public/snipt/122560/
test-if-href-points-image
<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></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="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">&#39;href&#39;</span><span class="p">).</span><span class="nx">indexOf</span><span class="p">(</span><span class="s1">&#39;.jpg&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="c1">// or any other extension</span> </span><span id="L-2"><a name="L-2"></a><span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="c1">//do what you want</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
check, href, image, img, javascript, jpeg, jpg, jquery, js, test

PHP

Localize dates in Wordpress

1
2
3
<?php 
echo date_i18n(get_option('date_format') ,strtotime("11/15-1976"));
?>
https://snipt.net/embed/e7b487b882a71fd1dbf55f6c235b3df1/
/raw/e7b487b882a71fd1dbf55f6c235b3df1/
e7b487b882a71fd1dbf55f6c235b3df1
php
PHP
3
2019-06-06T05:20:03
True
False
False
Dec 11, 2013 at 07:25 AM
/api/public/snipt/99832/
localize-dates-in-wordpress
<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="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="k">echo</span> <span class="nx">date_i18n</span><span class="p">(</span><span class="nx">get_option</span><span class="p">(</span><span class="s1">&#39;date_format&#39;</span><span class="p">)</span> <span class="p">,</span><span class="nb">strtotime</span><span class="p">(</span><span class="s2">&quot;11/15-1976&quot;</span><span class="p">));</span> </span><span id="L-3"><a name="L-3"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
date, localize, wordpress, wp

PHP

Get attached file size

1
2
3
<?php
filesize( get_attached_file( $attachment->ID ) );
?>
https://snipt.net/embed/b6f8a64ff28dbbfbf082660c07534b17/
/raw/b6f8a64ff28dbbfbf082660c07534b17/
b6f8a64ff28dbbfbf082660c07534b17
php
PHP
3
2019-06-14T23:10:53
True
False
False
Aug 01, 2013 at 07:11 AM
/api/public/snipt/71160/
get-attached-file-size
<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="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">filesize</span><span class="p">(</span> <span class="nx">get_attached_file</span><span class="p">(</span> <span class="nv">$attachment</span><span class="o">-&gt;</span><span class="na">ID</span> <span class="p">)</span> <span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
attach, attached, file, get, size, wordpress, wp

Bash

svn update with no interaction and accept certificate from cli

svn up --username <user> --password <psw> --non-interactive --trust-server-cert
https://snipt.net/embed/8ee9a30e7f44092e596ab7820a8c1502/
/raw/8ee9a30e7f44092e596ab7820a8c1502/
8ee9a30e7f44092e596ab7820a8c1502
bash
Bash
1
2019-06-16T16:37:20
True
False
False
Jul 19, 2013 at 09:24 AM
/api/public/snipt/68603/
svn-update-with-no-interaction-and-accept-certificate-from-cli
<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>svn up --username &lt;user&gt; --password &lt;psw&gt; --non-interactive --trust-server-cert </span></pre></div> </td></tr></table>
accept, certificate, cli, command, line, linux, shell, svn, up, update