How to Merge a YAML File Into a Single Hash in Ruby
require 'yaml'
# Nested YAML structure from something-nested.yml
#
# nested:
# key: value
# key_two: value_two
# Procedural Approach to building a single Hash from nested YAML data structure.
@yaml = YAML.load_file("something-nested...
Written by Sean Behan on 06/17/2012
Rails Find All by Birthday: How to Find Upcoming Birthdays with ActiveRecord
There are a few ways to solve this problem. However, I think the easiest is to cache the day of the year that the user is born on as an integer. If stored alongside the timestamp we can quickly get a list but properly handle the full birthday elsewhere, s...
Written by Sean Behan on 06/17/2012
Git: How to Delete a Branch with an Invalid Name
If you've named a branch beginning with two dashes "--", you're sort of in trouble because git interprets your branch name as a switch/flag. You can skip switches all together
by supplying two dashes before your branch name
git branch -d -- --index_for_...
Written by Sean Behan on 06/17/2012
Set Cron Job to Run Every Five Minutes for a Ruby on Rails Rake Task
First off you'll need to edit your cron file. Normally, the cron files are kept under /etc/cron.daily or /etc/cron.hourly but we can just use the command line tool, crontab and pass it the -e flag, so that we can edit the file without any fuss.
sudo cron...
Written by Sean Behan on 06/17/2012