Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

PHP

Disable installing/updating new themes and plugins in WordPress

1
2
3
4
5
6
7
8
<?php
/** 
 * Disable new plugins and themes
 * ref: http://wp.tutsplus.com/tutorials/security/conquering-the-wp-config-php-file-11-good-practices/
 */

define('DISALLOW_FILE_MODS',true);
?>
https://snipt.net/embed/a376c64832c05d9284ec0cd66bf7e34d/
https://snipt.net/raw/a376c64832c05d9284ec0cd66bf7e34d/
a376c64832c05d9284ec0cd66bf7e34d
php
PHP
8
2016-12-04T08:29:31
True
False
False
Aug 16, 2012 at 11:53 AM
/api/public/snipt/45787/
disable-installingupdating-new-themes-and-plugins-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> <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="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="sd">/** </span> </span><span id="L-3"><a name="L-3"></a><span class="sd"> * Disable new plugins and themes</span> </span><span id="L-4"><a name="L-4"></a><span class="sd"> * ref: http://wp.tutsplus.com/tutorials/security/conquering-the-wp-config-php-file-11-good-practices/</span> </span><span id="L-5"><a name="L-5"></a><span class="sd"> */</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="nb">define</span><span class="p">(</span><span class="s1">&#39;DISALLOW_FILE_MODS&#39;</span><span class="p">,</span><span class="k">true</span><span class="p">);</span> </span><span id="L-8"><a name="L-8"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
disable, plugins, themes, wordpress, wp-config

HTML

Html Image Protection

 <img oncontextmenu="return false" onselectstart="return false"
      ondragstart="return false"  src="#" />
https://snipt.net/embed/05544c86621b4b75b28722904d00a781/
https://snipt.net/raw/05544c86621b4b75b28722904d00a781/
05544c86621b4b75b28722904d00a781
html
HTML
3
2016-12-07T17:21:34
True
False
False
/api/public/snipt/30793/
html-image-protection
<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="p">&lt;</span><span class="nt">img</span> <span class="na">oncontextmenu</span><span class="o">=</span><span class="s">&quot;return false&quot;</span> <span class="na">onselectstart</span><span class="o">=</span><span class="s">&quot;return false&quot;</span> </span><span id="L-2"><a name="L-2"></a> <span class="na">ondragstart</span><span class="o">=</span><span class="s">&quot;return false&quot;</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;#&quot;</span> <span class="p">/&gt;</span> </span></pre></div> </td></tr></table>
click, code, disable, drag, hofberg, html, image, mack, no, photo, pic, picture, protect, protection, right

JavaScript

Disallow doubleclick of form submit buttons

1
2
3
4
5
// Find ALL <form> tags on your page
$('form').submit(function(){
  // On submit disable its submit button
  $('input[type=submit]', this).attr('disabled', 'disabled');
});
https://snipt.net/embed/1496d75bda78a345f1d4dba2b3d89244/
https://snipt.net/raw/1496d75bda78a345f1d4dba2b3d89244/
1496d75bda78a345f1d4dba2b3d89244
js
JavaScript
5
2016-12-11T03:12:22
True
False
False
/api/public/snipt/12621/
disallow-doubleclick-of-form-submit-buttons
<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="c1">// Find ALL &lt;form&gt; tags on your page</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;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-3"><a name="L-3"></a> <span class="c1">// On submit disable its submit button</span> </span><span id="L-4"><a name="L-4"></a> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;input[type=submit]&#39;</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;disabled&#39;</span><span class="p">,</span> <span class="s1">&#39;disabled&#39;</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
disable, form, javascript, submit

JavaScript

Disable "No Right-Click" Script Bookmark

1
2
3
// Save this as a bookmark and click whenever
// some idiot tries a No Right-Click Script.
javascript:void(document.onmousedown=null);void(document.onclick=null);void(document.oncontextmenu=null)
https://snipt.net/embed/0cd55ac8dce8fbde34b94d36ed46cee8/
https://snipt.net/raw/0cd55ac8dce8fbde34b94d36ed46cee8/
0cd55ac8dce8fbde34b94d36ed46cee8
js
JavaScript
3
2016-12-10T18:43:38
True
False
False
/api/public/snipt/9911/
disable-no-right-click-script-bookmark
<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="c1">// Save this as a bookmark and click whenever</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">// some idiot tries a No Right-Click Script.</span> </span><span id="L-3"><a name="L-3"></a><span class="nx">javascript</span><span class="o">:</span><span class="k">void</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">onmousedown</span><span class="o">=</span><span class="kc">null</span><span class="p">);</span><span class="k">void</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">onclick</span><span class="o">=</span><span class="kc">null</span><span class="p">);</span><span class="k">void</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">oncontextmenu</span><span class="o">=</span><span class="kc">null</span><span class="p">)</span> </span></pre></div> </td></tr></table>
bookmark, click, disable, enable, javascript, right

JavaScript

Disable Enter Key in jQuery

1
2
3
4
5
$(document).ready(function(){
	$('#targetId').keypress(function (event){  
		return event.keyCode == 13 ? false : true; 
	});
});
https://snipt.net/embed/44990ac84e727909a5cfff1bfd97fa94/
https://snipt.net/raw/44990ac84e727909a5cfff1bfd97fa94/
44990ac84e727909a5cfff1bfd97fa94
js
JavaScript
5
2016-12-10T07:40:50
True
False
False
/api/public/snipt/9182/
disable-enter-key-in-jquery
<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="nx">$</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">ready</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="nx">$</span><span class="p">(</span><span class="s1">&#39;#targetId&#39;</span><span class="p">).</span><span class="nx">keypress</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">event</span><span class="p">){</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="nx">event</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">==</span> <span class="mi">13</span> <span class="o">?</span> <span class="kc">false</span> <span class="o">:</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="p">});</span> </span></pre></div> </td></tr></table>
disable, enter, jquery, key

Bash

Turn off the system speaker

rmmod pcspkr
https://snipt.net/embed/30202e5b1e69479701cebf438d6bef2f/
https://snipt.net/raw/30202e5b1e69479701cebf438d6bef2f/
30202e5b1e69479701cebf438d6bef2f
bash
Bash
1
2016-12-10T08:53:31
True
False
False
/api/public/snipt/8650/
turn-off-the-system-speaker
<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>rmmod pcspkr </span></pre></div> </td></tr></table>
beep, disable, linux, speaker, ubuntu
Copyrighted, illegal, or inappropriate content? Email [email protected].