snipt

Ctrl+h for KB shortcuts

Text only

.htaccess Gzip Compression

1
2
3
4
5
# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP
https://snipt.net/embed/31208984d23e86248954e9a43d8214b9/
/raw/31208984d23e86248954e9a43d8214b9/
31208984d23e86248954e9a43d8214b9
text
Text only
5
2019-06-22T18:18:36
True
False
False
/api/public/snipt/122411/
htaccess-gzip-compression-1
<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># BEGIN GZIP </span><span id="L-2"><a name="L-2"></a>&lt;ifmodule mod_deflate.c&gt; </span><span id="L-3"><a name="L-3"></a>AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript </span><span id="L-4"><a name="L-4"></a>&lt;/ifmodule&gt; </span><span id="L-5"><a name="L-5"></a># END GZIP </span></pre></div> </td></tr></table>
gzip, htaccess

PHP

ISO to UTF conversion

iconv('ISO-8859-1', 'UTF-8',$str);
https://snipt.net/embed/81ece0f218e8520d4a9ba8cce68a6907/
/raw/81ece0f218e8520d4a9ba8cce68a6907/
81ece0f218e8520d4a9ba8cce68a6907
php
PHP
1
2019-06-22T18:18:48
True
False
False
/api/public/snipt/120490/
iso-to-utf-conversion
<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="x">iconv(&#39;ISO-8859-1&#39;, &#39;UTF-8&#39;,$str);</span> </span></pre></div> </td></tr></table>
"character conversion", iso, php, utf-8

PHP

debug to console

1
2
3
4
5
6
7
8
function debug_to_console($data) {
	if(is_array($data))
	{
		echo("<script>console.log('PHP: ".implode(',', $data)."');</script>");
	} else {
		echo("<script>console.log('PHP: ".$data."');</script>");
	}
}
https://snipt.net/embed/22b6862696547ec52a3767d352d39778/
/raw/22b6862696547ec52a3767d352d39778/
22b6862696547ec52a3767d352d39778
php
PHP
8
2019-06-22T18:19:15
True
False
False
Jan 29, 2014 at 04:37 AM
/api/public/snipt/104369/
debug-to-console
<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="x">function debug_to_console($data) {</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> if(is_array($data))</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> {</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> echo(&quot;&lt;script&gt;console.log(&#39;PHP: &quot;.implode(&#39;,&#39;, $data).&quot;&#39;);&lt;/script&gt;&quot;);</span> </span><span id="L-5"><a name="L-5"></a><span class="x"> } else {</span> </span><span id="L-6"><a name="L-6"></a><span class="x"> echo(&quot;&lt;script&gt;console.log(&#39;PHP: &quot;.$data.&quot;&#39;);&lt;/script&gt;&quot;);</span> </span><span id="L-7"><a name="L-7"></a><span class="x"> }</span> </span><span id="L-8"><a name="L-8"></a><span class="x">}</span> </span></pre></div> </td></tr></table>

SQL

ADD Days To Date and Compare to current Date

AND DATE_ADD(date(lastUpdated),INTERVAL 5 DAY) >= CURDATE();
https://snipt.net/embed/0d9e8ddaef6004d7d4b29c08945fb289/
/raw/0d9e8ddaef6004d7d4b29c08945fb289/
0d9e8ddaef6004d7d4b29c08945fb289
sql
SQL
1
2019-06-22T18:19:21
True
False
False
/api/public/snipt/103411/
add-days-to-date-and-compare-to-current-date
<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="k">AND</span> <span class="n">DATE_ADD</span><span class="p">(</span><span class="nb">date</span><span class="p">(</span><span class="n">lastUpdated</span><span class="p">),</span><span class="nb">INTERVAL</span> <span class="mi">5</span> <span class="k">DAY</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="n">CURDATE</span><span class="p">();</span> </span></pre></div> </td></tr></table>
ADD-DAYS, CURDATE, SQL