Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Text only

Checking which ES6 features are supported by NodeJS

node --v8-options | grep harmony
https://snipt.net/embed/879f10c855416ad18f4aba097095f996/
https://snipt.net/raw/879f10c855416ad18f4aba097095f996/
879f10c855416ad18f4aba097095f996
text
Text only
1
2016-12-06T01:39:25
True
False
False
Oct 12, 2015 at 02:19 AM
/api/public/snipt/141626/
checking-which-es6-features-are-supported-by-nodejs
<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>node --v8-options | grep harmony </span></pre></div> </td></tr></table>
cli, es6, harmony, node

PHP

Load author of node and render custom fields from user profile in D7

1
2
3
4
5
6
<?php
// load author
// user this inside of custom node template, e.g. node--blog.tpl.php
$author = user_load($node->uid);
?>
<div class="blog-author-name"><h3>Posted by <?php print $author->field_user_first_name['und'][0]['value'].' '.$author->field_user_last_name['und'][0]['value']; ?></h3></div>
https://snipt.net/embed/39847a535de37041f0e17950e8e00d8e/
https://snipt.net/raw/39847a535de37041f0e17950e8e00d8e/
39847a535de37041f0e17950e8e00d8e
php
PHP
6
2016-12-06T05:20:10
True
False
False
/api/public/snipt/35625/
load-author-of-node-and-render-custom-fields-from-user-profile-in-d7
<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></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">// load author</span> </span><span id="L-3"><a name="L-3"></a><span class="c1">// user this inside of custom node template, e.g. node--blog.tpl.php</span> </span><span id="L-4"><a name="L-4"></a><span class="nv">$author</span> <span class="o">=</span> <span class="nx">user_load</span><span class="p">(</span><span class="nv">$node</span><span class="o">-&gt;</span><span class="na">uid</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><span id="L-6"><a name="L-6"></a><span class="x">&lt;div class=&quot;blog-author-name&quot;&gt;&lt;h3&gt;Posted by </span><span class="cp">&lt;?php</span> <span class="k">print</span> <span class="nv">$author</span><span class="o">-&gt;</span><span class="na">field_user_first_name</span><span class="p">[</span><span class="s1">&#39;und&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">&#39;value&#39;</span><span class="p">]</span><span class="o">.</span><span class="s1">&#39; &#39;</span><span class="o">.</span><span class="nv">$author</span><span class="o">-&gt;</span><span class="na">field_user_last_name</span><span class="p">[</span><span class="s1">&#39;und&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="s1">&#39;value&#39;</span><span class="p">];</span> <span class="cp">?&gt;</span><span class="x">&lt;/h3&gt;&lt;/div&gt;</span> </span></pre></div> </td></tr></table>
"drupal 7", "user profile", author, node

PHP

Devel output

<?php 
  dpm($node)
https://snipt.net/embed/67974c623097053ec70c4c0d61dcc5ce/
https://snipt.net/raw/67974c623097053ec70c4c0d61dcc5ce/
67974c623097053ec70c4c0d61dcc5ce
php
PHP
2
2016-12-06T17:36:38
True
False
False
/api/public/snipt/35183/
devel-output
<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="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">dpm</span><span class="p">(</span><span class="nv">$node</span><span class="p">)</span> </span></pre></div> </td></tr></table>
drupal, node
Copyrighted, illegal, or inappropriate content? Email [email protected].