How to Use Named Variables with Postgres and PHP PDO Driver
You can write reusable scripts with Postgres by taking advantage of named variables.
A named variable starts with a `:` in your sql script. Here is an example
select :a_number
You can then use this statement with `psql` and the `--variable` fl...
Written by Sean Behan on 11/11/2017
Intercepting the Wordpress Loop with Pre_get_posts
#deprecated (see http://codex.wordpress.org/Function_Reference/query_posts#Post_.26_Page_Parameters)
Using the "pre_get_posts" filter you can intercept the Wordpress loop and override or set attributes in the "$query" object. This is useful because you c...
Written by Sean Behan on 06/17/2012
Ruby Rand Range
I assumed that rand would take a range as an argument. Something like rand(10..20), generating a random number between 10 and 20. Seems like you'd do this fairly often when working with random numbers and therefore, included. However, it doesn't work. But...
Written by Sean Behan on 06/17/2012
A List of Every High School in the United States in Pipe Delimitted Form (2005)
Here is a text file containing every high school in the United States(2005), including city, state, zip code and high school name.
us_high_schools_pd
Written by Sean Behan on 06/17/2012
Manage Sinatra Server in Development Mode with Shotgun
Sinatra won't reload your files. So if you're developing your app and want to see any changes made in the browser, install the shotgun gem.
gem install shotgun
You can then use shotgun to run your server
shotgun your_sinatra_ditty.rb
Presto, your ditt...
Written by Sean Behan on 06/17/2012