Skip to content

Instantly share code, notes, and snippets.

@pcreux
pcreux / delegate_matcher.rb
Created Dec 1, 2011 — forked from txus/delegate_matcher.rb
RSpec matcher for delegations
View delegate_matcher.rb
# RSpec matcher to spec delegations.
#
# Usage:
#
# describe Post do
# it { should delegate(:title).to(:name) } # post.title => post.name
# it { should delegate(:month).to(:created_at) } # post.month => post.created_at
# it { should delegate(:author_name).to(:author, :name) } # post.author_name => post.author.name
# end
View basecamp-time-report-prettyprint.rb
#!/usr/bin/env ruby
require 'csv'
require 'date'
CSV::Reader.parse(File.open(ARGV[0])) do |row|
date = row[0].match(/^\d{4}-\d{2}-\d{2}/) ? Date.strptime(row[0], "%Y-%m-%d") : row[0]
hours = row[2]
memo = "#{row[3]} #{row[4]}"
puts "#{date} | #{hours} | #{memo}"
end
View chpwd_update_git_vars.sh
update_current_git_vars