snipt

Ctrl+h for KB shortcuts

CSS

Force a page break when printing a web page

1
2
3
4
5
<style type="text/css">
.pagebreak {page-break-after: always;}
</style>

<br class="pagebreak" />
https://snipt.net/embed/dc37749658f5ad304f88da92b21cba4a/
/raw/dc37749658f5ad304f88da92b21cba4a/
dc37749658f5ad304f88da92b21cba4a
css
CSS
5
2019-07-17T14:04:42
True
False
False
/api/public/snipt/14221/
force-a-page-break-when-printing-a-web-page
<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="o">&lt;</span><span class="nt">style</span> <span class="nt">type</span><span class="o">=</span><span class="s2">&quot;text/css&quot;</span><span class="o">&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="nc">.pagebreak</span> <span class="p">{</span><span class="nb">page-break-after</span><span class="o">:</span> <span class="nb">always</span><span class="p">;}</span> </span><span id="L-3"><a name="L-3"></a><span class="o">&lt;/</span><span class="nt">style</span><span class="o">&gt;</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="o">&lt;</span><span class="nt">br</span> <span class="nt">class</span><span class="o">=</span><span class="s2">&quot;pagebreak&quot;</span> <span class="o">/&gt;</span> </span></pre></div> </td></tr></table>
break, css, page, print, printer

PHP

Get permalink to a page by id

<?php echo get_permalink(get_page_id('articles')); ?>
https://snipt.net/embed/ab466f189e59fde778a5b95fad3c5dff/
/raw/ab466f189e59fde778a5b95fad3c5dff/
ab466f189e59fde778a5b95fad3c5dff
php
PHP
1
2019-07-20T14:15:43
True
False
False
/api/public/snipt/10001/
get-permalink-to-a-page-by-id
<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;?php</span> <span class="k">echo</span> <span class="nx">get_permalink</span><span class="p">(</span><span class="nx">get_page_id</span><span class="p">(</span><span class="s1">&#39;articles&#39;</span><span class="p">));</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
get, id, page, permalink, wordpress

PHP

Get the slug of the current post/page

1
2
3
4
<?php
echo $post->post_name;
// the $post array also contains other useful/interesting data
?>
https://snipt.net/embed/3ef2a10a858f5431b7e3d646d0df7faa/
/raw/3ef2a10a858f5431b7e3d646d0df7faa/
3ef2a10a858f5431b7e3d646d0df7faa
php
PHP
4
2019-07-18T05:05:58
True
False
False
/api/public/snipt/7252/
get-the-slug-of-the-current-postpage
<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="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="k">echo</span> <span class="nv">$post</span><span class="o">-&gt;</span><span class="na">post_name</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a><span class="c1">// the $post array also contains other useful/interesting data</span> </span><span id="L-4"><a name="L-4"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
page, post, slug, wordpress

Bash

clear memory cache in linux

sync; echo 3 > /proc/sys/vm/drop_caches
https://snipt.net/embed/467ff4ee4dc1647748e2f1b684046777/
/raw/467ff4ee4dc1647748e2f1b684046777/
467ff4ee4dc1647748e2f1b684046777
bash
Bash
1
2019-07-06T12:24:53
True
False
False
/api/public/snipt/2070/
clear-memory-cache-in-linux
<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>sync<span class="p">;</span> <span class="nb">echo</span> <span class="m">3</span> &gt; /proc/sys/vm/drop_caches </span></pre></div> </td></tr></table>
cache, clear, linux, page