Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Fairchild fairchild

  • Procore
  • California
View GitHub Profile
View gist:2759
Merb.logger.info("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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>bundleUUID</key>
<string>5A9D4FC6-6CBE-11D9-A21B-000D93589AF6</string>
<key>command</key>
<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) - 1.day).to_s(:qb_date))
xml.gsub!('{to_modified_date}', (Time.now + 1.day).to_s(:qb_date))
xml
end
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&http%3A%2F%2Fterm.ie%2Foauth%2Fexample%2Frequest_token.php&oauth_consumer_key%3Dkey%26oauth_nonce%3DuhnyjcnYEyO9vUxPAcdttE0OqbFPgBOp2xv7XmN6bw%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1223595784%26oauth_token%3Dtoken%26oauth_version%3D1.0'
@oa.signature(bs, 'secret', '').should == "cumMcmS4gQG5pcrtlgckPv/V0WU="
end
end
View gist:16842
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'fileutils'
require 'yaml'
# TODO
# - 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[lh_project.id]
project.update_from_lighthouse
else
@fairchild
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 http://github.com/Caged/lighthouse-api/tree/master
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
end
end
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.