View temp.rb
class LocalResource | |
attr_reader :uri | |
def initialize(uri) | |
@uri = uri | |
end | |
def file | |
@file ||= Tempfile.new(tmp_filename, tmp_folder, encoding: encoding).tap do |f| | |
io.rewind |
View Lews_guide_to_delivering.md
#Lew's Opinionated Guide to Delivering Features#
- First, understand the story.
Do you understand the story completely? If not, talk to the product owner to clarify your understanding.
Is the story a logically cohesive grouping of functionality? If not, can it be broken into multiple stories?
Do the points assigned make sense given your current level of understanding of the story? If not, can it be broken into multiple stories?
View query.rb
class Query | |
def initialize | |
@hash = {} | |
end | |
def method_missing(name, *args) | |
value = args.length > 0 ? args.first : true | |
@hash.merge!(name => value) | |
self | |
end |
View Guardfile
guard 'rspec', :cli => "--color --format nested --fail-fast --drb" do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch(%r{^(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch('spec/spec_helper.rb') { "spec" } | |
end |
View .zshrc
gifify() { | |
if [[ -n "$1" ]]; then | |
if [[ $2 == '--good' ]]; then | |
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png | |
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif | |
rm out-static*.png | |
else | |
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif | |
fi | |
else |
View csv2json.py
# Go to http://mlb.mlb.com/mlb/schedule/team_by_team.jsp | |
# Click on Regular Schedule | |
# Scroll down and click on Downloadable schedule | |
# e.g. http://sanfrancisco.giants.mlb.com/schedule/downloadable.jsp?c_id=sf&year=2012 | |
# Download Full Season Schedule | |
# Suggestions for future enhancements: | |
# TODO: come up with a column schema way of representing the csv | |
# (referring to column names is more elegant than num indices) | |
# TODO: take file names as command line arguments |
View Gemfile
# ... | |
gem 'carrierwave' | |
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL |
View 0_README.md
Continuous CoffeeScript testing with Guard and Jasmine
This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo
- Install Gems with Bundler with
bundle install
- Define your guards with
mate Guardfile
- Initialize Jasmine with
bundle exec jasmine init
- Configure Jasmine with
mate spec/support/yasmine.ym
- Start Guard with
bundle exec guard
NewerOlder