Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

PHP

Include Wordpress Path

<?php include (TEMPLATEPATH . '/header2.php'); ?>
https://snipt.net/embed/74e84630d10615934ffa3a4f9a18ab86/
https://snipt.net/raw/74e84630d10615934ffa3a4f9a18ab86/
74e84630d10615934ffa3a4f9a18ab86
php
PHP
1
2016-12-09T02:47:33
True
False
False
May 29, 2013 at 03:29 PM
/api/public/snipt/62530/
include-wordpress-path
<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">include</span> <span class="p">(</span><span class="nx">TEMPLATEPATH</span> <span class="o">.</span> <span class="s1">&#39;/header2.php&#39;</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
Wordpress, include, path

Python

Show python lib folder

python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
https://snipt.net/embed/20466cfca66a21e37b54fbc72d3a99d4/
https://snipt.net/raw/20466cfca66a21e37b54fbc72d3a99d4/
20466cfca66a21e37b54fbc72d3a99d4
python
Python
2
2016-12-09T23:27:31
True
False
False
/api/public/snipt/25389/
show-python-lib-folder
<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="n">python</span> <span class="o">-</span><span class="n">c</span> <span class="s2">&quot;from distutils.sysconfig import get_python_lib; print get_python_lib()&quot;</span> </span></pre></div> </td></tr></table>
commandline, config, environment, folder, path, python

PHP

Retourner les arguments des urls réécrites

1
2
3
    $alias = drupal_get_path_alias($_GET['q']);
    $alias_parts = explode('/', $alias);
    dsm($alias_parts);
https://snipt.net/embed/948d72206a793665377e2e6bbda5c4e2/
https://snipt.net/raw/948d72206a793665377e2e6bbda5c4e2/
948d72206a793665377e2e6bbda5c4e2
php
PHP
3
2016-12-10T02:11:25
True
False
False
/api/public/snipt/24593/
retourner-les-arguments-des-urls-reecrites
<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="x"> $alias = drupal_get_path_alias($_GET[&#39;q&#39;]);</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> $alias_parts = explode(&#39;/&#39;, $alias);</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> dsm($alias_parts);</span> </span></pre></div> </td></tr></table>
alias, drupal, path, url

Python

absolute directory path in python

1
2
3
4
5
# Find current directory
DIR_ROOT = os.path.dirname(os.path.abspath(__file__))

# Absolute path for subfolder(s)
LOG_ROOT = os.path.join(DIR_ROOT, 'logs')
https://snipt.net/embed/c0504f2f7c262bc718291e7c9f59bc9e/
https://snipt.net/raw/c0504f2f7c262bc718291e7c9f59bc9e/
c0504f2f7c262bc718291e7c9f59bc9e
python
Python
5
2016-12-10T08:04:06
True
False
False
/api/public/snipt/12842/
absolute-directory-path-in-python
<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 current directory</span> </span><span id="L-2"><a name="L-2"></a><span class="n">DIR_ROOT</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">__file__</span><span class="p">))</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># Absolute path for subfolder(s)</span> </span><span id="L-5"><a name="L-5"></a><span class="n">LOG_ROOT</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">DIR_ROOT</span><span class="p">,</span> <span class="s1">&#39;logs&#39;</span><span class="p">)</span> </span></pre></div> </td></tr></table>
absolute, directory, os.path, path, python

PHP

testing set_include_path with php

1
2
3
4
5
<?
set_include_path('testinc');
$filename = 'include.txt';
include $filename;
?>
https://snipt.net/embed/619dc524c41a2993798b27553370f88d/
https://snipt.net/raw/619dc524c41a2993798b27553370f88d/
619dc524c41a2993798b27553370f88d
php
PHP
5
2016-12-09T11:32:29
True
False
False
/api/public/snipt/10209/
testing-set_include_path-with-php
<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;?</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">set_include_path</span><span class="p">(</span><span class="s1">&#39;testinc&#39;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="nv">$filename</span> <span class="o">=</span> <span class="s1">&#39;include.txt&#39;</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a><span class="k">include</span> <span class="nv">$filename</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
include, path, php, set, set_include_path

Bash

path, dv2

Logs -/home/httpd/vhosts/mt-example.com/statistics/logs
https://snipt.net/embed/9645920c361eac524c170d09a64089ae/
https://snipt.net/raw/9645920c361eac524c170d09a64089ae/
9645920c361eac524c170d09a64089ae
bash
Bash
1
2016-12-08T04:56:00
True
False
False
/api/public/snipt/5083/
path-dv2
<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>Logs -/home/httpd/vhosts/mt-example.com/statistics/logs </span></pre></div> </td></tr></table>
dv, dv2, logs, path
Copyrighted, illegal, or inappropriate content? Email [email protected].