Skip to content

Instantly share code, notes, and snippets.

View danivovich's full-sized avatar

Dan Ivovich danivovich

View GitHub Profile
@danivovich
danivovich / factory_girl_step_helpers.rb
Created March 22, 2012 01:39
Factory Girl steps for Turnip
module FactoryGirlStepHelpers
def convert_human_hash_to_attribute_hash(human_hash, associations = [])
HumanHashToAttributeHash.new(human_hash, associations).attributes
end
class HumanHashToAttributeHash
attr_reader :associations
def initialize(human_hash, associations)
@human_hash = human_hash
@danivovich
danivovich / deploy_count.rb
Created March 1, 2012 02:42
Count deploys from airbrake
require 'nokogiri'
require 'open-uri'
auth_token = 'AUTH_TOKEN'
site = 'https://ACCOUNT_NAME.airbrake.io/projects/PROJECT_NUMBER'
counts = {
:staging => 0,
:production => 0
}
@danivovich
danivovich / rspec_shallow_dup_spec.rb
Created January 25, 2012 01:04
Shallow copy issue with rspec metadata
describe 'outer', :one => { :two => 2 } do
context 'inner1' do
before do
example.metadata[:one][:three] = 3
end
it 'should have 3' do
example.metadata[:one][:three].should == 3
end
end
@danivovich
danivovich / mdfind_test_log.sh
Created January 18, 2012 19:54
mdfind test.log files in homedir
ls -lh `mdfind -onlyin $HOME -name test.log`
@danivovich
danivovich / main.rb
Created October 11, 2011 19:10
Pivotal feature points by label
require 'pivotal-tracker'
TOKEN = 'API_TOKEN'
PROJECT_NUM = -1
def estimate_to_hours(estimate)
2 ** estimate
end
PivotalTracker::Client.token = TOKEN