snipt

Ctrl+h for KB shortcuts

PHP

WP : exclude certain categories from search engines

1
2
3
4
5
<?php
// code to insert inside your head section in header.php template file
	if(in_category('xxx') || in_category('xxx')) : ?>
	<meta name="robots" content="noindex" />
	<?php endif; ?>
https://snipt.net/embed/058afbf496497cd1645ca38c12f5f5ad/
/raw/058afbf496497cd1645ca38c12f5f5ad/
058afbf496497cd1645ca38c12f5f5ad
php
PHP
5
2019-08-14T21:18:13
True
False
False
Dec 17, 2012 at 04:04 PM
/api/public/snipt/52005/
wp-exclude-certain-categories-from-search-engines
<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="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">// code to insert inside your head section in header.php template file</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">if</span><span class="p">(</span><span class="nx">in_category</span><span class="p">(</span><span class="s1">&#39;xxx&#39;</span><span class="p">)</span> <span class="o">||</span> <span class="nx">in_category</span><span class="p">(</span><span class="s1">&#39;xxx&#39;</span><span class="p">))</span> <span class="o">:</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-4"><a name="L-4"></a><span class="x"> &lt;meta name=&quot;robots&quot; content=&quot;noindex&quot; /&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="x"> </span><span class="cp">&lt;?php</span> <span class="k">endif</span><span class="p">;</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
Wordpress

JavaScript

Reverse a string in javascript

1
2
3
var str='abcd';
alert(str.split('').reverse().join(''));
// returns 'dcba'
https://snipt.net/embed/3dff571453f4b21ed97ecfdf9076c913/
/raw/3dff571453f4b21ed97ecfdf9076c913/
3dff571453f4b21ed97ecfdf9076c913
js
JavaScript
3
2019-07-11T06:53:57
True
False
False
/api/public/snipt/24405/
reverse-a-string-in-javascript
<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="kd">var</span> <span class="nx">str</span><span class="o">=</span><span class="s1">&#39;abcd&#39;</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">alert</span><span class="p">(</span><span class="nx">str</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">).</span><span class="nx">reverse</span><span class="p">().</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">));</span> </span><span id="L-3"><a name="L-3"></a><span class="c1">// returns &#39;dcba&#39;</span> </span></pre></div> </td></tr></table>
javascript, string

Bash

Remote Joomla backup using Akeeba

1
2
3
4
5
#!/bin/sh
#Remote backup of administered Joomla websites using Akeeba component

# Website1
wget --max-redirect=1000 --spider "http://www.website1.com/index.php?action=com_akeeba&view=backup&key=YOURKEY&format=raw"
https://snipt.net/embed/532943fe592d3c7b799cf7713590e157/
/raw/532943fe592d3c7b799cf7713590e157/
532943fe592d3c7b799cf7713590e157
bash
Bash
5
2019-08-15T21:20:27
True
False
False
/api/public/snipt/22490/
remote-joomla-backup-using-akeeba
<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="ch">#!/bin/sh</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">#Remote backup of administered Joomla websites using Akeeba component</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># Website1</span> </span><span id="L-5"><a name="L-5"></a>wget --max-redirect<span class="o">=</span><span class="m">1000</span> --spider <span class="s2">&quot;http://www.website1.com/index.php?action=com_akeeba&amp;view=backup&amp;key=YOURKEY&amp;format=raw&quot;</span> </span></pre></div> </td></tr></table>
akeeba, backup, joomla, server, shell

Batchfile

add tasks to Windows Task Scheduler

1
2
3
@echo off
:: add all xml-defined tasks in the folder to the Task Scheduler
for %%a in (*.xml) do schtasks.exe /create /tn "%%~na" /xml "%%a" /f
https://snipt.net/embed/198066988f7922210fbb93a10e18d276/
/raw/198066988f7922210fbb93a10e18d276/
198066988f7922210fbb93a10e18d276
bat
Batchfile
3
2019-07-26T16:55:50
True
False
False
/api/public/snipt/22008/
add-tasks-to-windows-task-scheduler
<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="p">@</span><span class="k">echo</span> off </span><span id="L-2"><a name="L-2"></a><span class="p">:</span><span class="c1">: add all xml-defined tasks in the folder to the Task Scheduler</span> </span><span id="L-3"><a name="L-3"></a><span class="k">for</span> <span class="se">%%</span>a <span class="k">in</span> <span class="p">(</span>*.xml<span class="p">)</span> <span class="k">do</span> schtasks.exe /create /tn <span class="s2">&quot;</span><span class="se">%%</span><span class="s2">~na&quot;</span> /xml <span class="s2">&quot;</span><span class="se">%%</span><span class="s2">a&quot;</span> /f </span></pre></div> </td></tr></table>
batch, windows

Batchfile

g.cmd

1
2
3
4
@echo off
SET app=C:\googlecl

%app%\google.exe %*
https://snipt.net/embed/6d4b05b8ca07622346bf1abee1c56f23/
/raw/6d4b05b8ca07622346bf1abee1c56f23/
6d4b05b8ca07622346bf1abee1c56f23
bat
Batchfile
4
2019-08-14T17:34:04
True
False
False
/api/public/snipt/21991/
gcmd
<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="p">@</span><span class="k">echo</span> off </span><span id="L-2"><a name="L-2"></a><span class="k">SET</span> <span class="nv">app</span><span class="p">=</span>C:\googlecl </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="nv">%app%</span>\google.exe <span class="nv">%*</span> </span></pre></div> </td></tr></table>
batch, windows