Skip to content

Instantly share code, notes, and snippets.

brianburridge / gist:934644
Created April 21, 2011 14:34
Clear default text when user selects the input field
$('input[data-default]').select(function () {
if ($(this).val() == $(this).attr('data-default')) {
$('input[data-default]').click(function () {
if ($(this).val() == $(this).attr('data-default')) {
brianburridge /
Created May 23, 2011 18:57
Rack mounting with Rails app
require "config/environment"
require 'api'
rails_app = do
use Rails::Rack::LogTailer
use Rails::Rack::Static
brianburridge / global_settings.rb
Created June 30, 2011 13:31
An easy and flexible way to set global variables for a Rails app using Ostruct.
require "ostruct"
when "staging"
google_maps_key = 'staging google maps key'
support_email = ''
ssl_subdomain = 'secure'
original_subdomain = 'www'
when "production"
google_maps_key = 'production google maps key'
brianburridge / gist:2219745
Created March 27, 2012 20:00
Using html_safe and collect to create links to a post's tags
<%= post.tags.collect{|tag| link_to, forum_index_path(:tags =>}.join(' ').html_safe %>
def Tumblr.youtube_views(post)
doc = Hpricot.parse(post)
video_count = 0
if doc.present?
embed_doc ="embed")
embed_doc ="iframe") if embed_doc.class != Hpricot::Elem
if !embed_doc.nil?
video_url = embed_doc.attributes["src"]
video_id = video_url.split("/")[4]
brianburridge / caveatPatchor.js
Created July 10, 2012 16:13
My Propane Customizations
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
brianburridge / gist:3828703
Created October 3, 2012 18:11
Check Hash for key and append to it
if options.class != Hash
options = {class: "required"}
options[:class] = ((options[:class] || "") + " required").split(" ").uniq.join(" ")
brianburridge / gist:5310983
Created April 4, 2013 14:48
Create a gemspec from the currently installed gems within a Heroku app
`gem list`.split("\n").each do |gem| a = gem.split(" ");puts "gem '#{a[0]}', '#{a[1].gsub(/[()]/, "")}'";end ;nil
brianburridge / gist:7362537
Last active December 27, 2015 17:29
Wifi, inefficiencies and a bizarre trip to the library

After dropping my son off at football practice, I attempted to work at Panera Bread for a bit today but the wifi was horribly slow. Sadly, my tethering was unable to bail me out this time because of the poor connection my phone was getting. I packed up and drove down the road to the library. Been meaning to try it anyway.

It's a nice new library. Very modern with all the newest amenities and in great condition. I attempted to use the wifi but it required a username and password. I inquired at the 'Information Desk' and was guided over to another desk to get a library card. Signing up for a card was in itself inefficient, as I had to both present my driver's license and enter the information from it onto another card. Really?

Once I had my new library card, with a password (never had a library card before that required a password) I went back to the information desk. Here I was told that I now had to get signed up for the wifi into a different system and then, an even more bizarre process was explained to me

brianburridge / gist:11298396
Last active October 8, 2023 12:49
How to load MySQL time zone tables from Mac OS time zone files

The easiest way to load the Mysql Time Zone tables from your Mac OS time zone fields is via this command:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

However, on many systems like mine that will fail because some of the time zone information is incompatible with the database schema for the time zone tables.

Therefore, you'll want to load the time zone information into a text file and edit it to only include the time zones you need. (Or, attempt to find the data breaking the import.)

mysql_tzinfo_to_sql /usr/share/zoneinfo > zone_import.sql