<?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 17:56:13 +0000</lastBuildDate>
    <item>
      <title>(PHP) Distance in SQLITE - brownrl</title>
      <link>https://snipplr.com/view/100901/distance-in-sqlite</link>
      <description>&lt;p&gt;This is damn crazy! sQlite does not have all the trig functions need to do distances. So here is how you load that into sQlite on the fly.&lt;/p&gt;</description>
      <pubDate>Wed, 20 May 2015 01:54:01 UTC</pubDate>
      <guid>https://snipplr.com/view/100901/distance-in-sqlite</guid>
    </item>
    <item>
      <title>(PHP) CKEditor Simple Filemanager - brownrl</title>
      <link>https://snipplr.com/view/89238/ckeditor-simple-filemanager</link>
      <description>&lt;p&gt;This is a plain jane very simple file manager for ckeditor, this has very limited... ^NO^ features.&lt;/p&gt;</description>
      <pubDate>Tue, 03 Feb 2015 00:04:53 UTC</pubDate>
      <guid>https://snipplr.com/view/89238/ckeditor-simple-filemanager</guid>
    </item>
    <item>
      <title>(PHP) Sublime Snippet: dieout - brownrl</title>
      <link>https://snipplr.com/view/72191/sublime-snippet-dieout</link>
      <description>&lt;p&gt;This will print out a variable to a &lt;pre&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 23 Aug 2013 22:26:16 UTC</pubDate>
      <guid>https://snipplr.com/view/72191/sublime-snippet-dieout</guid>
    </item>
    <item>
      <title>(PHP) Sublimee Snippet: Fic - brownrl</title>
      <link>https://snipplr.com/view/72190/sublimee-snippet-fic</link>
      <description>&lt;p&gt;Generate a generic file comment&lt;/p&gt;</description>
      <pubDate>Fri, 23 Aug 2013 20:21:07 UTC</pubDate>
      <guid>https://snipplr.com/view/72190/sublimee-snippet-fic</guid>
    </item>
    <item>
      <title>(PHP) Sublime Snippet: fuc - brownrl</title>
      <link>https://snipplr.com/view/72189/sublime-snippet-fuc</link>
      <description>&lt;p&gt;Generate a generic function comment block&lt;/p&gt;</description>
      <pubDate>Fri, 23 Aug 2013 20:19:55 UTC</pubDate>
      <guid>https://snipplr.com/view/72189/sublime-snippet-fuc</guid>
    </item>
    <item>
      <title>(PHP) Sublime Snippet: pageit - brownrl</title>
      <link>https://snipplr.com/view/72188/sublime-snippet-pageit</link>
      <description>&lt;p&gt;This is a quick sublime snippet to quickly setup a DB table for pagination. Ideally from here you will be into a smarty template.&lt;/p&gt;</description>
      <pubDate>Fri, 23 Aug 2013 19:59:44 UTC</pubDate>
      <guid>https://snipplr.com/view/72188/sublime-snippet-pageit</guid>
    </item>
    <item>
      <title>(PHP) Sublime Snippet: dbNumRows - brownrl</title>
      <link>https://snipplr.com/view/72180/sublime-snippet-dbnumrows</link>
      <description>&lt;p&gt;When using PDO with sQlite -&gt;rowCount() doesn't work. the recommendation is to do a pre query to get the number. Thus, I created this snippet to help things along.&lt;/p&gt;</description>
      <pubDate>Thu, 22 Aug 2013 18:40:30 UTC</pubDate>
      <guid>https://snipplr.com/view/72180/sublime-snippet-dbnumrows</guid>
    </item>
    <item>
      <title>(PHP) Custom Drupal View Field - brownrl</title>
      <link>https://snipplr.com/view/71639/custom-drupal-view-field</link>
      <description>&lt;p&gt;This is a custom field handler for a Drupal view. Sometimes you have two or more fields in a content type and you want to do a test on them to see if both are empty or both full or exclusive and return that as a field.&#13;
&#13;
There are probably ways to do this in the admin/view configuration. However, this code also serves as a general skeleton for just any old custom field handler.&#13;
&#13;
* Make sure that all files that you make/add to your module that you add to your .info file. If you forget this you will bash your head in later trying to figure WTF this is not working.&lt;/p&gt;</description>
      <pubDate>Wed, 26 Jun 2013 20:28:56 UTC</pubDate>
      <guid>https://snipplr.com/view/71639/custom-drupal-view-field</guid>
    </item>
    <item>
      <title>(PHP) Image Resize on the Fly - brownrl</title>
      <link>https://snipplr.com/view/71224/image-resize-on-the-fly</link>
      <description>&lt;p&gt;This is my simple image resizer on the fly thing. &#13;
&#13;
-- WARNING --&#13;
Resizing and showing images on the fly could potentially kill your server or make the website slow.&#13;
&#13;
Ideally, this should save the resized image in a cache. However, more often than not this method just works, no one complains, and I don't have to make some writable caching directory thing.&#13;
&#13;
If anyting this could give you a good start on how you really want to handle your images.&lt;/p&gt;</description>
      <pubDate>Sat, 18 May 2013 08:21:43 UTC</pubDate>
      <guid>https://snipplr.com/view/71224/image-resize-on-the-fly</guid>
    </item>
    <item>
      <title>(PHP) Cleanup Downloads Directory - brownrl</title>
      <link>https://snipplr.com/view/71223/cleanup-downloads-directory</link>
      <description>&lt;p&gt;This is a simple script to go into your downloads directory ( mac ). Move everything to a .YYYY-MM-DD folder. Thus you Downloads directory gets cleaned up and anything that was there has been placed into a hidden folder for finding later.&#13;
&#13;
My Downloads folder is just always full of things but I don't want to blast it empty. Re-getting a file from some website is sometimes hard to remember. So I move everything to a backup and start again.&lt;/p&gt;</description>
      <pubDate>Sat, 18 May 2013 07:56:52 UTC</pubDate>
      <guid>https://snipplr.com/view/71223/cleanup-downloads-directory</guid>
    </item>
    <item>
      <title>(PHP) Drupal Auto Blocks - brownrl</title>
      <link>https://snipplr.com/view/69905/drupal-auto-blocks</link>
      <description>&lt;p&gt;This is a hook_block_info and hook_block_view template that will allow you to quickly create blocks in a Drupal module. When you use this all you have to do is create a directory "blocks" in the module and then create block.block_name.php in the directory. Inside the php you need to define a function block_block_name_content().&lt;/p&gt;</description>
      <pubDate>Tue, 12 Feb 2013 20:33:39 UTC</pubDate>
      <guid>https://snipplr.com/view/69905/drupal-auto-blocks</guid>
    </item>
    <item>
      <title>(PHP) PHP DB Table to HTML Datagrid - brownrl</title>
      <link>https://snipplr.com/view/57337/php-db-table-to-html-datagrid</link>
      <description>&lt;p&gt;This is a skeleton mock up for showing a database table in a basic datagrid with sorting and pagination.&lt;/p&gt;</description>
      <pubDate>Fri, 29 Jul 2011 19:49:16 UTC</pubDate>
      <guid>https://snipplr.com/view/57337/php-db-table-to-html-datagrid</guid>
    </item>
    <item>
      <title>(PHP) PHP getCheckBox - brownrl</title>
      <link>https://snipplr.com/view/55778/php-getcheckbox</link>
      <description>&lt;p&gt;Simple simple simple function to make a checkbox for a form. Retains checked status.&lt;/p&gt;</description>
      <pubDate>Mon, 27 Jun 2011 19:55:47 UTC</pubDate>
      <guid>https://snipplr.com/view/55778/php-getcheckbox</guid>
    </item>
    <item>
      <title>(PHP) PHP generateCode - brownrl</title>
      <link>https://snipplr.com/view/51510/php-generatecode</link>
      <description>&lt;p&gt;Some times you need to generate a code for a field in a db and that code can't be repeated either...&#13;
&#13;
Yes, I know that if two people submit their data at almost the exact same time that it could be possible that they have the same code. OMG OMG OMG! I'll take the 0.0000000001% chance that it will happen. You could get around this by generating a separate table of pre-made codes and each time you use one you take it and mark it as used.&lt;/p&gt;</description>
      <pubDate>Mon, 04 Apr 2011 18:35:42 UTC</pubDate>
      <guid>https://snipplr.com/view/51510/php-generatecode</guid>
    </item>
    <item>
      <title>(PHP) Get Width and Height From a Filename - brownrl</title>
      <link>https://snipplr.com/view/48846/get-width-and-height-from-a-filename</link>
      <description>&lt;p&gt;I use this little guy to get the width and height from a filename. Often when I need to show a flash swf file I don't have an easy way to tell the width and the height of the file for display. However is the file name is "some_flash_file 300x250.swf" then this litte guy will help a lot.&lt;/p&gt;</description>
      <pubDate>Fri, 11 Feb 2011 19:56:04 UTC</pubDate>
      <guid>https://snipplr.com/view/48846/get-width-and-height-from-a-filename</guid>
    </item>
    <item>
      <title>(PHP) PHP getDateSelect - brownrl</title>
      <link>https://snipplr.com/view/44318/php-getdateselect</link>
      <description>&lt;p&gt;Here is a little bit of code I use from time to time to make a generic some what safe date selector for forms. I wanted something easy, small, and not relying on images, jquery, libraries, etc... Most importantly I wanted the date that was selected to be in INT format for storing directly into the database as an INT. Mind you the point of this snippet is the function, not the example tester code.&lt;/p&gt;</description>
      <pubDate>Thu, 18 Nov 2010 02:18:55 UTC</pubDate>
      <guid>https://snipplr.com/view/44318/php-getdateselect</guid>
    </item>
    <item>
      <title>(PHP) PHP getSelectFromTable - brownrl</title>
      <link>https://snipplr.com/view/17670/php-getselectfromtable</link>
      <description>&lt;p&gt;This is one of my favs to use and reuse. Essentially, we make a select box on what is in the table filled  values/labels.&#13;
&#13;
Download the ISO countries list to make a country table and Bam! with this function you got a country select box... Also great for foreign keys...&#13;
&#13;
Other Examples:&#13;
&#13;
auto\_maker, auto\_maker\_id&#13;
color\_name, color\_id&lt;/p&gt;</description>
      <pubDate>Thu, 30 Jul 2009 08:49:22 UTC</pubDate>
      <guid>https://snipplr.com/view/17670/php-getselectfromtable</guid>
    </item>
    <item>
      <title>(PHP) PHP getNumberSelect - brownrl</title>
      <link>https://snipplr.com/view/17558/php-getnumberselect</link>
      <description>&lt;p&gt;Quick little function to give you a select box for numbers ranging from min to max. Perfect for birthday date selectors.&lt;/p&gt;</description>
      <pubDate>Tue, 28 Jul 2009 05:03:10 UTC</pubDate>
      <guid>https://snipplr.com/view/17558/php-getnumberselect</guid>
    </item>
    <item>
      <title>(PHP) PHP updateFromVals - brownrl</title>
      <link>https://snipplr.com/view/17429/php-updatefromvals</link>
      <description>&lt;p&gt;Here is a small function that I use to update records in a database.&#13;
&#13;
It coincides with the insertFromPost function that I have posted earlier.&#13;
&#13;
The element names in the form need to have the same name as in the DB and the  field names should all have a sort of prefix  ex, auto_  user_  survey\_taker\_, etc...&lt;/p&gt;</description>
      <pubDate>Fri, 24 Jul 2009 11:08:01 UTC</pubDate>
      <guid>https://snipplr.com/view/17429/php-updatefromvals</guid>
    </item>
    <item>
      <title>(PHP) PHP isValidEmail - brownrl</title>
      <link>https://snipplr.com/view/16326/php-isvalidemail</link>
      <description>&lt;p&gt;This is a slightly hard core email check. I work for clients that want real email addresses. They pay quite a bit of money so yes, I am going to give what they want...&lt;/p&gt;</description>
      <pubDate>Fri, 26 Jun 2009 05:37:52 UTC</pubDate>
      <guid>https://snipplr.com/view/16326/php-isvalidemail</guid>
    </item>
    <item>
      <title>(PHP) PHP Export MySql Table to Xls - brownrl</title>
      <link>https://snipplr.com/view/16324/php-export-mysql-table-to-xls</link>
      <description>&lt;p&gt;Face it!&#13;
&#13;
Whenever you make a website/app you always need to make XLS export for the simple people. I mean heaven to betsy if they have to take a csv file, or use phpMyAdmin.&#13;
&#13;
So&#13;
&#13;
Here are 3 little functions and a sample skeleton that I use from time to time when I need to export out some data to an xls file.&#13;
&#13;
Place the file in a safe place or if you want a completely open to the world place... :D   Then replace the XXXXX's with the appropriate data.&#13;
&#13;
Give the pointy haired boss the links!&lt;/p&gt;</description>
      <pubDate>Fri, 26 Jun 2009 05:15:44 UTC</pubDate>
      <guid>https://snipplr.com/view/16324/php-export-mysql-table-to-xls</guid>
    </item>
    <item>
      <title>(PHP) PHP InsertFromVals - brownrl</title>
      <link>https://snipplr.com/view/16258/php-insertfromvals</link>
      <description>&lt;p&gt;This is a long over due update to my db insert building function. Please not that the function is the important part the code below is just prove that it works... l:-)&lt;/p&gt;</description>
      <pubDate>Wed, 24 Jun 2009 06:58:56 UTC</pubDate>
      <guid>https://snipplr.com/view/16258/php-insertfromvals</guid>
    </item>
    <item>
      <title>(PHP) PHP Form Validation - brownrl</title>
      <link>https://snipplr.com/view/16109/php-form-validation</link>
      <description>&lt;p&gt;This is a good way to validate form input from PHP, in essence this could be a blue print for your forms.&lt;/p&gt;</description>
      <pubDate>Fri, 19 Jun 2009 05:16:35 UTC</pubDate>
      <guid>https://snipplr.com/view/16109/php-form-validation</guid>
    </item>
  </channel>
</rss>
