snipt

Ctrl+h for KB shortcuts

Text only

Show current year in php

<?php echo date("Y")?>
https://snipt.net/embed/766fe8a613da35ef37bf28312bb7021c/
/raw/766fe8a613da35ef37bf28312bb7021c/
766fe8a613da35ef37bf28312bb7021c
text
Text only
1
2019-08-14T07:37:47
True
False
False
Sep 13, 2012 at 05:58 AM
/api/public/snipt/47127/
show-current-year-in-php
<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>&lt;?php echo date(&quot;Y&quot;)?&gt; </span></pre></div> </td></tr></table>
date, php, year

JavaScript

javascript redirect with timeout

1
2
3
4
5
6
<script>
	function Redirect(){
		location.href = 'http://www.anothersite.com';
	}
	setTimeout('Redirect()',2000);
</script>
https://snipt.net/embed/c7712b90ab216c7fb3021def94be87fe/
/raw/c7712b90ab216c7fb3021def94be87fe/
c7712b90ab216c7fb3021def94be87fe
js
JavaScript
6
2019-07-28T19:00:12
True
False
True
Jun 13, 2013 at 03:21 AM
/api/public/snipt/46100/
javascript-redirect-with-timeout
<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><span class="o">&lt;</span><span class="nx">script</span><span class="o">&gt;</span> </span><span id="L-2"><a name="L-2"></a> <span class="kd">function</span> <span class="nx">Redirect</span><span class="p">(){</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">location</span><span class="p">.</span><span class="nx">href</span> <span class="o">=</span> <span class="s1">&#39;http://www.anothersite.com&#39;</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="nx">setTimeout</span><span class="p">(</span><span class="s1">&#39;Redirect()&#39;</span><span class="p">,</span><span class="mi">2000</span><span class="p">);</span> </span><span id="L-6"><a name="L-6"></a><span class="o">&lt;</span><span class="err">/script&gt;</span> </span></pre></div> </td></tr></table>
javascript, redirect

Text only

Clean completely OSX launchpad

sqlite3 ~/Library/Application\ Support/Dock/*.db "DELETE from apps; DELETE from groups WHERE title<>''; DELETE from items WHERE rowid>2;"; killall Dock;
https://snipt.net/embed/3db82e91bc7a3354933ae3b1987b307c/
/raw/3db82e91bc7a3354933ae3b1987b307c/
3db82e91bc7a3354933ae3b1987b307c
text
Text only
1
2019-08-17T15:44:55
True
False
False
Nov 16, 2012 at 06:32 AM
/api/public/snipt/45430/
pulire-completamente-il-launchpad-di-mac-os-lion
<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>sqlite3 ~/Library/Application\ Support/Dock/*.db &quot;DELETE from apps; DELETE from groups WHERE title&lt;&gt;&#39;&#39;; DELETE from items WHERE rowid&gt;2;&quot;; killall Dock; </span></pre></div> </td></tr></table>
mac

PHP

remove "edit this entry" in wordpress frontend (when you're logged)

//add it in your functions.php (on the actual theme)
add_filter( 'edit_post_link', '__return_false' );
https://snipt.net/embed/791331d65f6c0f1a69edebf37474777c/
/raw/791331d65f6c0f1a69edebf37474777c/
791331d65f6c0f1a69edebf37474777c
php
PHP
2
2019-06-21T13:55:53
True
False
True
Nov 16, 2012 at 06:33 AM
/api/public/snipt/43754/
remove-edit-this-entry-in-wordpress-frontend-when-youre-loggen
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">//add it in your functions.php (on the actual theme)</span> </span><span id="L-2"><a name="L-2"></a><span class="x">add_filter( &#39;edit_post_link&#39;, &#39;__return_false&#39; );</span> </span></pre></div> </td></tr></table>
wordpress

Text only

Always show library folder on Mountain Lion

1
2
3
chflags nohidden ~/Library

Otherwise you just can hold ALT in the "Go" Finder menu
https://snipt.net/embed/8b2e4058c1c41bda20ae4a4fcd52ce41/
/raw/8b2e4058c1c41bda20ae4a4fcd52ce41/
8b2e4058c1c41bda20ae4a4fcd52ce41
text
Text only
3
2016-12-17T18:13:44
True
False
True
Nov 16, 2012 at 06:33 AM
/api/public/snipt/43607/
mostrare-la-cartella-libreria-su-mac-osx-lion
<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>chflags nohidden ~/Library </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>Otherwise you just can hold ALT in the &quot;Go&quot; Finder menu </span></pre></div> </td></tr></table>
mac

Text only

Ftp configuration for wordpress (to avoid digit it everytime)

1
2
3
define('FTP_USER', 'ftpuser');
define('FTP_PASS', 'ftpPassword');
define('FTP_HOST', 'localhost');
https://snipt.net/embed/b03ed27cd3d0a73298841ee910c6c59f/
/raw/b03ed27cd3d0a73298841ee910c6c59f/
b03ed27cd3d0a73298841ee910c6c59f
text
Text only
3
2016-12-17T07:02:03
True
False
True
Nov 16, 2012 at 06:34 AM
/api/public/snipt/43075/
ftp-configuration-for-wordpress-to-avoid-digit-it-everytime
<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>define(&#39;FTP_USER&#39;, &#39;ftpuser&#39;); </span><span id="L-2"><a name="L-2"></a>define(&#39;FTP_PASS&#39;, &#39;ftpPassword&#39;); </span><span id="L-3"><a name="L-3"></a>define(&#39;FTP_HOST&#39;, &#39;localhost&#39;); </span></pre></div> </td></tr></table>
wordpress

PHP

PHP redirect

<? header("location: http://www.yoursite.net"); ?>
https://snipt.net/embed/34a1d41ba3e2a752313a71c99b9e09e6/
/raw/34a1d41ba3e2a752313a71c99b9e09e6/
34a1d41ba3e2a752313a71c99b9e09e6
php
PHP
1
2016-12-13T19:46:01
True
False
True
Nov 16, 2012 at 06:34 AM
/api/public/snipt/42632/
redirect-in-php
<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><span class="cp">&lt;?</span> <span class="nb">header</span><span class="p">(</span><span class="s2">&quot;location: http://www.yoursite.net&quot;</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
php