brownrl


Member since 06/19/2009

Name: Robert Brown

brownrl

Location: Belgium

Website: http://www.itsgotto.be

26 snippets

5382 profile views

9 Comment(s) Posted

View their favorites

Profile

Achievement

first submission:submitting first snipplet

brownrl's Recent Snippets



« Prev 1 Next »
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.
0 961 posted 9 years ago by brownrl
Moving a wordpress site for local dev, to staging, to production? This SQL snippet has done the job more often than not. It may not be 100% full proof but it has saved my butt hundreds of times. Please, if you know other tables or enhancements share...
0 965 posted 9 years ago by brownrl
This piece of sql is used to find the similarity of one item to other items based on a 3 table tag system, cities, cities_tags, tags. It works in sQlite and MySQL. Use this code to get the idea of how you would make a "item" has "related items" based...
0 837 posted 9 years ago by brownrl
This will print out a variable to a <pre>
0 812 posted 11 years ago by brownrl
Generate a generic file comment
0 877 posted 11 years ago by brownrl
Generate a generic function comment block
0 731 posted 11 years ago by brownrl
This is a quick sublime snippet to quickly setup a DB table for pagination. Ideally from here you will be into a smarty template.
0 730 posted 11 years ago by brownrl
When using PDO with sQlite ->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.
0 800 posted 11 years ago by brownrl
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. There are probably ways to d...
0 817 posted 11 years ago by brownrl
This is my simple image resizer on the fly thing. -- WARNING -- Resizing and showing images on the fly could potentially kill your server or make the website slow. Ideally, this should save the resized image in a cache. However, more often th...
0 1231 posted 11 years ago by brownrl
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. My Downl...
1 750 posted 11 years ago by brownrl
This is a simple wrapper to bc to perform basic calculator duties. with up to 4 decimal place precision. its just one of those things you might find useful. Then again all the os's out there have a gui calc easily ready too.
0 806 posted 11 years ago by brownrl
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 dire...
0 840 posted 11 years ago by brownrl
This will get the arguments on the query string and put them into a handy array.
0 1007 posted 13 years ago by brownrl
This is a skeleton mock up for showing a database table in a basic datagrid with sorting and pagination.
0 1124 posted 13 years ago by brownrl
Simple simple simple function to make a checkbox for a form. Retains checked status.
0 726 posted 13 years ago by brownrl
Some times you need to generate a code for a field in a db and that code can't be repeated either... 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...
0 766 posted 13 years ago by brownrl
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"...
0 1029 posted 13 years ago by brownrl
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 t...
0 729 posted 14 years ago by brownrl
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. Download the ISO countries list to make a country table and Bam! with this function you got a country select box... Also grea...
1 716 posted 15 years ago by brownrl
Quick little function to give you a select box for numbers ranging from min to max. Perfect for birthday date selectors.
0 702 posted 15 years ago by brownrl
Here is a small function that I use to update records in a database. It coincides with the insertFromPost function that I have posted earlier. The element names in the form need to have the same name as in the DB and the field names should all...
1 873 posted 15 years ago by brownrl
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...
3 853 posted 15 years ago by brownrl
Face it! 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. So Here are 3 little functions and a sample skeleton that I use fro...
6 1291 posted 15 years ago by brownrl
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:-)
1 683 posted 15 years ago by brownrl
This is a good way to validate form input from PHP, in essence this could be a blue print for your forms.
5 957 posted 15 years ago by brownrl
« Prev 1 Next »