snipt

Ctrl+h for KB shortcuts

Text only

Drush change password of user

drush upwd <username> --password=<password>
https://snipt.net/embed/6eda162bbba949390e710e96bb022bfe/
/raw/6eda162bbba949390e710e96bb022bfe/
6eda162bbba949390e710e96bb022bfe
text
Text only
1
2019-06-21T12:28:29
True
False
False
Apr 09, 2014 at 12:10 PM
/api/public/snipt/128696/
drush-change-password-of-user
<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>drush upwd &lt;username&gt; --password=&lt;password&gt; </span></pre></div> </td></tr></table>
drush
https://snipt.net/embed/bbce195e8098aa7fb3bee437adf98453/
/raw/bbce195e8098aa7fb3bee437adf98453/
bbce195e8098aa7fb3bee437adf98453
text
Text only
1
2019-06-26T11:00:18
True
False
False
Feb 17, 2014 at 11:15 AM
/api/public/snipt/114452/
prune-remove-stale-branches-in-a-git-repo-ones-that-show-despite-being-deleted-already
<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>git remote prune origin </span></pre></div> </td></tr></table>
git

Text only

Drush - create admin one time login link

drush uli
https://snipt.net/embed/1aeca05879833fc88eaaad46af55ea36/
/raw/1aeca05879833fc88eaaad46af55ea36/
1aeca05879833fc88eaaad46af55ea36
text
Text only
1
2019-06-23T04:08:27
True
False
False
Feb 12, 2014 at 08:23 AM
/api/public/snipt/113017/
drush-create-admin-one-time-login-link
<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>drush uli </span></pre></div> </td></tr></table>
drush

Text only

IRC Help commands

/msg ChanServ help
https://snipt.net/embed/601ab90af48e1df5d23c7b960a58b2c2/
/raw/601ab90af48e1df5d23c7b960a58b2c2/
601ab90af48e1df5d23c7b960a58b2c2
text
Text only
1
2019-06-25T20:52:04
True
False
False
Jan 21, 2014 at 09:54 AM
/api/public/snipt/107517/
irc-help-commands
<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>/msg ChanServ help </span></pre></div> </td></tr></table>
irc

PHP

Add a class or other attribute to a Drupal form

1
2
3
function <your_theme_name_>_<your_module_name>_<your_form_name>_form_alter(&$form, &$form_state) {
  $form['#attributes'] = array('class' => '<your_class_name>');
}
https://snipt.net/embed/fb6a4b7ea1368b0d5cc8c11fefcdf78d/
/raw/fb6a4b7ea1368b0d5cc8c11fefcdf78d/
fb6a4b7ea1368b0d5cc8c11fefcdf78d
php
PHP
3
2019-06-20T13:41:44
True
False
False
Jan 20, 2014 at 11:10 AM
/api/public/snipt/107206/
add-a-class-or-other-attribute-to-a-drupal-form
<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">function &lt;your_theme_name_&gt;_&lt;your_module_name&gt;_&lt;your_form_name&gt;_form_alter(&amp;$form, &amp;$form_state) {</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> $form[&#39;#attributes&#39;] = array(&#39;class&#39; =&gt; &#39;&lt;your_class_name&gt;&#39;);</span> </span><span id="L-3"><a name="L-3"></a><span class="x">}</span> </span></pre></div> </td></tr></table>
drupal7, php

PHP

Add class to field group on Drupal form using hook form alter

1
2
3
4
5
function <your_theme_name>_<your_form_name>_form_alter(&$form, &$form_state) {

  $form['#groups']['<your_field_group_name>']->format_settings['instance_settings']['classes'] .= ' <your_class_name>';
  
 }
https://snipt.net/embed/3e146f6c6284276e2e7a420c0663bbe0/
/raw/3e146f6c6284276e2e7a420c0663bbe0/
3e146f6c6284276e2e7a420c0663bbe0
php
PHP
5
2019-06-17T16:14:04
True
False
False
Jan 20, 2014 at 09:35 AM
/api/public/snipt/107200/
add-class-to-field-group-on-drupal-form-using-hook-form-alter
<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="x">function &lt;your_theme_name&gt;_&lt;your_form_name&gt;_form_alter(&amp;$form, &amp;$form_state) {</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="x"> $form[&#39;#groups&#39;][&#39;&lt;your_field_group_name&gt;&#39;]-&gt;format_settings[&#39;instance_settings&#39;][&#39;classes&#39;] .= &#39; &lt;your_class_name&gt;&#39;;</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> </span> </span><span id="L-5"><a name="L-5"></a><span class="x"> }</span> </span></pre></div> </td></tr></table>
drupal7, form, php

PHP

Drupal 7 load block view in a template file

1
2
3
4
5
<?php
      $block_to_load = block_load('views', 'your_block_name'); 
      $output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block_to_load))));       
      print $output;
?>
https://snipt.net/embed/788cb4c2cf52fd4307a1966341e748c6/
/raw/788cb4c2cf52fd4307a1966341e748c6/
788cb4c2cf52fd4307a1966341e748c6
php
PHP
5
2019-06-25T06:32:41
True
False
False
/api/public/snipt/104787/
drupal-7-load-block-view-in-a-template-file
<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="nv">$block_to_load</span> <span class="o">=</span> <span class="nx">block_load</span><span class="p">(</span><span class="s1">&#39;views&#39;</span><span class="p">,</span> <span class="s1">&#39;your_block_name&#39;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a> <span class="nv">$output</span> <span class="o">=</span> <span class="nx">drupal_render</span><span class="p">(</span><span class="nx">_block_get_renderable_array</span><span class="p">(</span><span class="nx">_block_render_blocks</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="nv">$block_to_load</span><span class="p">))));</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">print</span> <span class="nv">$output</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>
drupal7, php, tpl

Text only

Raspberry pi update and upgrade OS

sudo apt-get update && sudo apt-get upgrade
https://snipt.net/embed/52c73ba8bb58780c6f9d597b0018dfbc/
/raw/52c73ba8bb58780c6f9d597b0018dfbc/
52c73ba8bb58780c6f9d597b0018dfbc
text
Text only
1
2019-06-19T17:27:20
True
False
False
Dec 31, 2013 at 03:53 AM
/api/public/snipt/103160/
raspberry-pi-update-and-upgrade-os
<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>sudo apt-get update &amp;&amp; sudo apt-get upgrade </span></pre></div> </td></tr></table>
pi, raspberry

Text only

Use Recess to compile a LESS file to CSS

recess path/to/style.less --compress --compile > ../path/to/compiled-file.css
https://snipt.net/embed/8a14f8b4cc88cdde8f2500fbeb87f631/
/raw/8a14f8b4cc88cdde8f2500fbeb87f631/
8a14f8b4cc88cdde8f2500fbeb87f631
text
Text only
1
2019-06-24T17:12:12
True
False
False
/api/public/snipt/97913/
use-recess-to-compile-a-less-file-to-css
<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>recess path/to/style.less --compress --compile &gt; ../path/to/compiled-file.css </span></pre></div> </td></tr></table>
LESS, bootstrap, css, javascript, recess