Skip to content

Instantly share code, notes, and snippets.


Michael Fairchild fairchild

  • Procore
  • California
View GitHub Profile
View gist:2759"Compiling routes...")
Merb::Router.prepare do |r|
# RESTful routes
r.resources :songs
# This is the default route for /:controller/:action/:id
# This is fine for most cases. If you're heavily using resource-based
# routes, you may want to comment/remove this line to prevent
View Grep in Project.tmCommand
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>#!/usr/bin/env ruby -rcgi
View gist:4380
def parameterize(xml)
xml.gsub!('{iterator}', iterator_id.blank? ? 'Start' : 'Continue')
xml.gsub!('{iterator_id}', iterator_id || '')
xml.gsub!('{from_modified_date}', ((transactions_last_synced_on || 10.years.ago) -
xml.gsub!('{to_modified_date}', ( +
View gist:10963
in routes.rb
map.resources :staff, :member => {:graph_code=>:get}
in controller,
@graph = open_flash_chart_object(500,300, graph_code_staff_path( {:title=>'Timesheet', :conditions=>@conditions}))
in view, error:
View spec for oauth hmac-sha1 signauture
it "should get another hmac" do
bs = 'GET&'
@oa.signature(bs, 'secret', '').should == "cumMcmS4gQG5pcrtlgckPv/V0WU="
View gist:16842
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'fileutils'
require 'yaml'
# - pulling a specific UUID/Tag (gitspec hash) with clone/update
# - a 'deploy' task (in addition to 'redeploy' ?)
# - add merb:gems:refresh to refresh all gems (from specifications)
View gist:17246
class Project < Sequel::Model
one_to_many :milestones
one_to_many :tickets
def self.update_from_lighthouse(project_id=nil, updated_at=nil)
#TODO: allow scoping this call to only records updated_at>?
Lighthouse::Project.find(:all).each do |lh_project|
if project=Project[]
fairchild / bugflow
Created Oct 17, 2008 — forked from jdhuntington/bugflow
shell script to assist in working with lighthouse and git
View bugflow
#!/usr/bin/env ruby
# 2008.10.03
# JD Huntington
# shell script to assist in working with lighthouse and git
# requires lighthouse api ruby wrapper from
LIB_DIR='~/lib' # Absolute location of lighthouse.rb and lighthouse-api.rb
TOKEN='' # Insert your lighthouse token
ACCOUNT='' # Insert your lighthouse account name
View gist:17496
class TicketNumbersMigration < Sequel::Migration
def up
alter_table(:tickets) do
add_column 'number', :integer
def down
alter_table(:tickets) do
View gist:18223
abbot(fairchild@abbot) :~/WebApps/lightsheet2
> ls gems/gems/httparty-0.1.3/lib/
httparty/ httparty.rb
abbot(fairchild@abbot) :~/WebApps/lightsheet2
> merb -i
Warning: please use bin/merb to load merb-core-0.9.9 from ./gems
Loading init file from /home/fairchild/WebApps/lightsheet2/config/init.rb
Loading /home/fairchild/WebApps/lightsheet2/config/environments/development.rb
~ Loaded DEVELOPMENT Environment...
You can’t perform that action at this time.