Skip to content

Instantly share code, notes, and snippets.


Eric Hurst erichurst

View GitHub Profile
erichurst / mod_machine.rb
Last active Aug 29, 2015
Simple module for dynamic values
View mod_machine.rb
module ModMachine
extend ActiveSupport::Concern
included do
module ClassMethods
# Builds a module with constants assigned to the index passed in the `options` array. Be sure
# to pass all arguments as you would write them manually. In other words `attribute` and any
erichurst / US Zip Codes from 2013 Government Data
Created Dec 9, 2013
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source:
View US Zip Codes from 2013 Government Data
This file has been truncated, but you can view the full file.
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
erichurst / User.rb
Created Feb 2, 2012
Custom callback notification with Rails 3
View User.rb
class User < ActiveRecord::Base
def self.new_sitter(user, params)
if user.parent?
transaction do
sitter = create! do |u|
u.sub_type = 'sitter'
u.first_name = params[:first_name]
u.last_name = params[:last_name] = params[:email]
erichurst / .irbrc
Created Jul 1, 2011
Pimp Your IRB
View .irbrc
# Make gems available
require 'rubygems'
require "ap"
alias pp ap
rescue LoadError
puts "Please install the 'awesome_print' gem."
View gist:973783
gideon:beyond_the_shock eh$ cap staging deploy
triggering start callbacks for `staging'
* executing `moonshine:configure'
* executing `staging'
triggering start callbacks for `deploy'
* executing `moonshine:configure'
* executing `multistage:ensure'
triggering after callbacks for `multistage:ensure'
* executing `moonshine:configure_stage'
* executing `deploy'
View database.yml.example mysql2
# MySQL. Versions 4.1 and 5.0 are recommended.
# Install the MySQL driver:
# gem install mysql2
# And be sure to use new-style password hashing:
adapter: mysql2
encoding: utf8
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
View reset_js_default_a_better_way.rb
module ActionView::Helpers::AssetTagHelper
self.register_javascript_expansion :jquery => ["", "", "rails.js", "application.js"]
View reset_js_default.rb
module ActionView::Helpers::AssetTagHelper
View BasicTextileFormat.css
table {
border-spacing: 0;
width: 100%; }
table th {
color: #555555;
padding: 1em 0.5em;
text-align: left;
background-color: #a7d3ff; }
table td {
padding: 7px 3em 7px 0.5em; }
You can’t perform that action at this time.