<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Snipplr</title>
    <description>Recent snippets posted on Snipplr.com</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 09 Jun 2026 12:48:35 +0000</lastBuildDate>
    <item>
      <title>(PHP) Drupal Format time ago - jonathanpglick</title>
      <link>https://snipplr.com/view/63570/drupal-format-time-ago</link>
      <description>&lt;p&gt;Foromat {timestamp} as a "x x ago" date/time.&lt;/p&gt;</description>
      <pubDate>Sat, 25 Feb 2012 05:18:52 UTC</pubDate>
      <guid>https://snipplr.com/view/63570/drupal-format-time-ago</guid>
    </item>
    <item>
      <title>(PHP) Trigger a Drupal Context programatically - jonathanpglick</title>
      <link>https://snipplr.com/view/58723/trigger-a-drupal-context-programatically</link>
      <description>&lt;p&gt;It's not immediately clear from the `context_set()` function how to trigger a context to be "active" using code.  Do it like this:&lt;/p&gt;</description>
      <pubDate>Fri, 16 Sep 2011 02:41:00 UTC</pubDate>
      <guid>https://snipplr.com/view/58723/trigger-a-drupal-context-programatically</guid>
    </item>
    <item>
      <title>(Apache) .htaccess disable magic_quotes - jonathanpglick</title>
      <link>https://snipplr.com/view/57013/htaccess-disable-magicquotes</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 22 Jul 2011 04:11:28 UTC</pubDate>
      <guid>https://snipplr.com/view/57013/htaccess-disable-magicquotes</guid>
    </item>
    <item>
      <title>(JavaScript) Drupal collapsible fieldset script with trigger to resize TinyMCE - jonathanpglick</title>
      <link>https://snipplr.com/view/54811/drupal-collapsible-fieldset-script-with-trigger-to-resize-tinymce</link>
      <description>&lt;p&gt;This override function for the default Drupal.toggleFieldset function adds code that looks for instances of TinyMCE inside the fieldset and triggers the autoresize on them when the fieldset is opened.  Otherwise TinyMCE renders with a weird height.&lt;/p&gt;</description>
      <pubDate>Fri, 03 Jun 2011 10:12:57 UTC</pubDate>
      <guid>https://snipplr.com/view/54811/drupal-collapsible-fieldset-script-with-trigger-to-resize-tinymce</guid>
    </item>
    <item>
      <title>(PHP) Render single node field - jonathanpglick</title>
      <link>https://snipplr.com/view/47887/render-single-node-field</link>
      <description>&lt;p&gt;Render the contents for a single node field.&lt;/p&gt;</description>
      <pubDate>Wed, 26 Jan 2011 10:51:22 UTC</pubDate>
      <guid>https://snipplr.com/view/47887/render-single-node-field</guid>
    </item>
    <item>
      <title>(PHP) OMBU Drupal string overrides - jonathanpglick</title>
      <link>https://snipplr.com/view/45206/ombu-drupal-string-overrides</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 03 Dec 2010 05:44:56 UTC</pubDate>
      <guid>https://snipplr.com/view/45206/ombu-drupal-string-overrides</guid>
    </item>
    <item>
      <title>(PHP) Split array into n arrays (columns) - jonathanpglick</title>
      <link>https://snipplr.com/view/44841/split-array-into-n-arrays-columns</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 25 Nov 2010 10:57:14 UTC</pubDate>
      <guid>https://snipplr.com/view/44841/split-array-into-n-arrays-columns</guid>
    </item>
    <item>
      <title>(JavaScript) Javascript Random number between - jonathanpglick</title>
      <link>https://snipplr.com/view/44702/javascript-random-number-between</link>
      <description>&lt;p&gt;Uses vars `to` and `from`.&lt;/p&gt;</description>
      <pubDate>Tue, 23 Nov 2010 06:17:59 UTC</pubDate>
      <guid>https://snipplr.com/view/44702/javascript-random-number-between</guid>
    </item>
    <item>
      <title>(PHP) Drupal 6 node_export inport don't make pathauto alias - jonathanpglick</title>
      <link>https://snipplr.com/view/43529/drupal-6-nodeexport-inport-dont-make-pathauto-alias</link>
      <description>&lt;p&gt;If you're importing nodes from a file and have pathauto setup, the existing paths for the nodes will be rewritten with pathauto.  To avoid this, simply add the following to the node export array for each node:&lt;/p&gt;</description>
      <pubDate>Thu, 04 Nov 2010 07:23:59 UTC</pubDate>
      <guid>https://snipplr.com/view/43529/drupal-6-nodeexport-inport-dont-make-pathauto-alias</guid>
    </item>
    <item>
      <title>(PHP) Drupal get total number of search results from pager - jonathanpglick</title>
      <link>https://snipplr.com/view/43453/drupal-get-total-number-of-search-results-from-pager</link>
      <description>&lt;p&gt;The total number of search results can be added in a hook_preprocess_search_results() function from the following variable:&lt;/p&gt;</description>
      <pubDate>Wed, 03 Nov 2010 04:52:52 UTC</pubDate>
      <guid>https://snipplr.com/view/43453/drupal-get-total-number-of-search-results-from-pager</guid>
    </item>
    <item>
      <title>(PHP) Drupal render Views pager from $view object - jonathanpglick</title>
      <link>https://snipplr.com/view/43273/drupal-render-views-pager-from-view-object</link>
      <description>&lt;p&gt;Drupal 6&#13;
&#13;
Do this after $view-&gt;execute() has already been called&lt;/p&gt;</description>
      <pubDate>Sat, 30 Oct 2010 06:07:46 UTC</pubDate>
      <guid>https://snipplr.com/view/43273/drupal-render-views-pager-from-view-object</guid>
    </item>
    <item>
      <title>(Bash) Remove untracked files from Mercurial repository - jonathanpglick</title>
      <link>https://snipplr.com/view/42950/remove-untracked-files-from-mercurial-repository</link>
      <description>&lt;p&gt;the -u flag only lists items that are "unknown", -0 prepares the filenames for xargs.&#13;
&#13;
xargs then runs "rm" on each of the listed files.&lt;/p&gt;</description>
      <pubDate>Tue, 26 Oct 2010 04:45:53 UTC</pubDate>
      <guid>https://snipplr.com/view/42950/remove-untracked-files-from-mercurial-repository</guid>
    </item>
    <item>
      <title>(PHP) Drupal - Programatically trigger another theme - jonathanpglick</title>
      <link>https://snipplr.com/view/37256/drupal--programatically-trigger-another-theme</link>
      <description>&lt;p&gt;This example triggers the admin theme when on any of the user/* pages (login, edit, etc.).  Put the name of your admin theme in {admin-theme-name} so there's a safe fallback in case variable_get doesn't find the admin_theme.&lt;/p&gt;</description>
      <pubDate>Wed, 14 Jul 2010 06:46:44 UTC</pubDate>
      <guid>https://snipplr.com/view/37256/drupal--programatically-trigger-another-theme</guid>
    </item>
    <item>
      <title>(PHP) Drupal Date Popup from Form API - jonathanpglick</title>
      <link>https://snipplr.com/view/36038/drupal-date-popup-from-form-api</link>
      <description>&lt;p&gt;I can never remember how to trigger the Date Popup widget when writing a $form in Drupal so I've pulled out the instructions below.&#13;
&#13;
This requires that the date_api, date_timezone and date_popup modules are all enabled.&lt;/p&gt;</description>
      <pubDate>Wed, 23 Jun 2010 09:59:25 UTC</pubDate>
      <guid>https://snipplr.com/view/36038/drupal-date-popup-from-form-api</guid>
    </item>
    <item>
      <title>(PHP) Trigger WYSIWYG editor in Drupal Form API - jonathanpglick</title>
      <link>https://snipplr.com/view/35992/trigger-wysiwyg-editor-in-drupal-form-api</link>
      <description>&lt;p&gt;The trick is having a "format" key for the textarea and using filter_form().&#13;
&#13;
Use two elements with the same parent; the textarea element and an element with the "format" key. (important!).&#13;
&#13;
Example below.&lt;/p&gt;</description>
      <pubDate>Tue, 22 Jun 2010 07:08:20 UTC</pubDate>
      <guid>https://snipplr.com/view/35992/trigger-wysiwyg-editor-in-drupal-form-api</guid>
    </item>
    <item>
      <title>(Bash) Postgres SQL dump - jonathanpglick</title>
      <link>https://snipplr.com/view/35235/postgres-sql-dump</link>
      <description>&lt;p&gt;**flags:**&#13;
&#13;
* -c : include commands to clean (drop) database objects prior to creating them   &#13;
* -C : include commands to create the database itself   &#13;
* -U : user to connect as&lt;/p&gt;</description>
      <pubDate>Wed, 26 May 2010 13:03:19 UTC</pubDate>
      <guid>https://snipplr.com/view/35235/postgres-sql-dump</guid>
    </item>
    <item>
      <title>(Bash) Postgres load / import SQL - jonathanpglick</title>
      <link>https://snipplr.com/view/35234/postgres-load--import-sql</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 26 May 2010 12:39:45 UTC</pubDate>
      <guid>https://snipplr.com/view/35234/postgres-load--import-sql</guid>
    </item>
    <item>
      <title>(PHP) Trigger Drupal Admin Theme - jonathanpglick</title>
      <link>https://snipplr.com/view/30708/trigger-drupal-admin-theme</link>
      <description>&lt;p&gt;Needs to execute before theme is initialized -- Ideally in hook_init() -- but also works in hook_nodeapi $op == 'view'&lt;/p&gt;</description>
      <pubDate>Thu, 01 Apr 2010 12:52:52 UTC</pubDate>
      <guid>https://snipplr.com/view/30708/trigger-drupal-admin-theme</guid>
    </item>
    <item>
      <title>(PHP) Drupal - get email addresses by role - jonathanpglick</title>
      <link>https://snipplr.com/view/29899/drupal--get-email-addresses-by-role</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 17 Mar 2010 12:54:43 UTC</pubDate>
      <guid>https://snipplr.com/view/29899/drupal--get-email-addresses-by-role</guid>
    </item>
    <item>
      <title>(Other) Standard Hosts File Locations - jonathanpglick</title>
      <link>https://snipplr.com/view/27263/standard-hosts-file-locations</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 28 Jan 2010 18:51:41 UTC</pubDate>
      <guid>https://snipplr.com/view/27263/standard-hosts-file-locations</guid>
    </item>
    <item>
      <title>(Other) Known Hosts file locations - jonathanpglick</title>
      <link>https://snipplr.com/view/27262/known-hosts-file-locations</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 28 Jan 2010 18:51:08 UTC</pubDate>
      <guid>https://snipplr.com/view/27262/known-hosts-file-locations</guid>
    </item>
    <item>
      <title>(CSS) IE8 Fieldset Legend bug fix - jonathanpglick</title>
      <link>https://snipplr.com/view/22523/ie8-fieldset-legend-bug-fix</link>
      <description>&lt;p&gt;This IE8  bug causes the top half of a fieldset's border to not show when it contains a `&lt;legend&gt;` that is hidden with `display: none;`&#13;
&#13;
The solution comes from [nicksnell.co.uk](http://nicksnell.co.uk/journal/2009/08/19/internet-explorer-8-fieldset-legend-bug).  Be sure to put the following CSS into an IE8 conditional comment because it *will* fuck with other browsers' rendering.&lt;/p&gt;</description>
      <pubDate>Wed, 04 Nov 2009 20:32:43 UTC</pubDate>
      <guid>https://snipplr.com/view/22523/ie8-fieldset-legend-bug-fix</guid>
    </item>
    <item>
      <title>(CSS) Font Family List - jonathanpglick</title>
      <link>https://snipplr.com/view/22052/font-family-list</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 28 Oct 2009 15:06:05 UTC</pubDate>
      <guid>https://snipplr.com/view/22052/font-family-list</guid>
    </item>
    <item>
      <title>(PHP) Manually execute a view, the right way - jonathanpglick</title>
      <link>https://snipplr.com/view/19397/manually-execute-a-view-the-right-way</link>
      <description>&lt;p&gt;If `views_embed_view()` or just `$view-&gt;execute()` are called, the default view settings are used (only shows 10 entries, etc.) so we have to call `$view-&gt;set_display()` &amp; `$view-&gt;pre_execute()`.&lt;/p&gt;</description>
      <pubDate>Tue, 08 Sep 2009 12:37:42 UTC</pubDate>
      <guid>https://snipplr.com/view/19397/manually-execute-a-view-the-right-way</guid>
    </item>
    <item>
      <title>(PHP) Drupal Setup to use another database - jonathanpglick</title>
      <link>https://snipplr.com/view/18465/drupal-setup-to-use-another-database</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 18 Aug 2009 15:09:22 UTC</pubDate>
      <guid>https://snipplr.com/view/18465/drupal-setup-to-use-another-database</guid>
    </item>
    <item>
      <title>(JavaScript) Clear Text Javascript Drupal Behavior - jonathanpglick</title>
      <link>https://snipplr.com/view/18464/clear-text-javascript-drupal-behavior</link>
      <description>&lt;p&gt;Takes any field with the class .clear-text and makes it clear it's default text (ex: 'search here') when it is focused on.  If nothing is changed or the field is left blank, the original text appears when focus leaves the field.&lt;/p&gt;</description>
      <pubDate>Tue, 18 Aug 2009 14:05:12 UTC</pubDate>
      <guid>https://snipplr.com/view/18464/clear-text-javascript-drupal-behavior</guid>
    </item>
    <item>
      <title>(CSS) Hide text on input[type=submit] - jonathanpglick</title>
      <link>https://snipplr.com/view/18286/hide-text-on-inputtypesubmit</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 13 Aug 2009 20:54:25 UTC</pubDate>
      <guid>https://snipplr.com/view/18286/hide-text-on-inputtypesubmit</guid>
    </item>
    <item>
      <title>(PHP) Views default function - jonathanpglick</title>
      <link>https://snipplr.com/view/17520/views-default-function</link>
      <description>&lt;p&gt;This function goes in the {module\_name}.views\_default.inc file&lt;/p&gt;</description>
      <pubDate>Mon, 27 Jul 2009 14:30:18 UTC</pubDate>
      <guid>https://snipplr.com/view/17520/views-default-function</guid>
    </item>
    <item>
      <title>(PHP) Views API module declaration - jonathanpglick</title>
      <link>https://snipplr.com/view/17518/views-api-module-declaration</link>
      <description>&lt;p&gt;This will trigger views to load the views in the file {module\_name}.views\_default.inc&lt;/p&gt;</description>
      <pubDate>Mon, 27 Jul 2009 14:26:45 UTC</pubDate>
      <guid>https://snipplr.com/view/17518/views-api-module-declaration</guid>
    </item>
    <item>
      <title>(PHP) Form validate email address - jonathanpglick</title>
      <link>https://snipplr.com/view/14125/form-validate-email-address</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 17 Apr 2009 13:29:49 UTC</pubDate>
      <guid>https://snipplr.com/view/14125/form-validate-email-address</guid>
    </item>
    <item>
      <title>(PHP) Load node form from menu callback - jonathanpglick</title>
      <link>https://snipplr.com/view/14124/load-node-form-from-menu-callback</link>
      <description>&lt;p&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 17 Apr 2009 13:17:20 UTC</pubDate>
      <guid>https://snipplr.com/view/14124/load-node-form-from-menu-callback</guid>
    </item>
  </channel>
</rss>
