Skip to content

Instantly share code, notes, and snippets.

View nickhoffman's full-sized avatar

Nick Hoffman nickhoffman

  • Toronto, Canada
View GitHub Profile
@nickhoffman
nickhoffman / spreadsheet_importer.rb
Created August 29, 2011 15:32
Why does this error occur in the spec?: undefined method `each_pair'
$ bundle exec rspec --fail-fast -b spec/models/spreadsheet_importer_spec.rb
No examples were matched by {:focus=>true}, running all
F
Failures:
1) SpreadsheetImporter instance variables has a reader for @catalog
Failure/Error: @importer = SpreadsheetImporter.new @catalog, @excel, @photos_dir
NoMethodError:
undefined method `each_pair' for #<Catalog:0xb0475bc>
@nickhoffman
nickhoffman / changed_specs.rb
Created August 27, 2011 19:21
A rake task for running all of the spec files that've been modified.
RSpec::Core::RakeTask.new('spec:changed') do |t|
changed_files = `git status -s | grep '^ M spec/' | grep '_spec.rb$'`.split "\n"
changed_files.each {|file| file.sub! /\A M /, '' }
puts
puts "Found #{changed_files.count} changed spec file(s):"
changed_files.each {|file| puts " #{file}"}
puts
@nickhoffman
nickhoffman / DB stuff
Created June 8, 2011 14:30
pcalendar joins stuff
rails g scaffold user name:string
rails g scaffold prediction title:string
rails g scaffold position believes_it:boolean
rails g migration position_belongs_to_user
#class PositionBelongsToUser < ActiveRecord::Migration
# def self.up
# add_column :positions, :user_id, :integer
# end
#
@nickhoffman
nickhoffman / setup-statsd.sh
Created April 19, 2011 16:16 — forked from collegeman/setup-statsd.sh
Turn an Ubuntu 10.04 linode into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use