Skip to content

Instantly share code, notes, and snippets.


Blair Anderson blairanderson

View GitHub Profile
cheeyeo / temp.rb
Created Apr 6, 2014
Using ruby tempfile to fetch a remote resource for custom formatting
View temp.rb
class LocalResource
attr_reader :uri
def initialize(uri)
@uri = uri
def file
@file ||=, tmp_folder, encoding: encoding).tap do |f|

#Lew's Opinionated Guide to Delivering Features#

  1. 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?

pjb3 / query.rb
Created Mar 20, 2013
It's things like this that make Ruby fun :)
View query.rb
class Query
def initialize
@hash = {}
def method_missing(name, *args)
value = args.length > 0 ? args.first : true
@hash.merge!(name => value)
blairanderson / Guardfile
Last active Dec 14, 2015
My favorite guardfile
View Guardfile
guard 'rspec', :cli => "--color --format nested --fail-fast --drb" do
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" }
SlexAxton / .zshrc
Last active Jan 2, 2021
My gif workflow
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
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
ajaswa / fancy-radio-buttons.css
Last active Oct 9, 2015
Fancy radio buttons
View fancy-radio-buttons.css
.radios .radio label {
background-color: #fff;
color: #666;
display: inline-block;
border: 1px solid black;
margin: 4px;
padding: 4px;
.radios .radio input[type='radio'] {
display: none;
sharonw /
Created Apr 29, 2012
Translate MLB team schedule from csv into json
# Go to
# Click on Regular Schedule
# Scroll down and click on Downloadable schedule
# e.g.
# 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
cblunt / Gemfile
Created Oct 21, 2011
Configure Carrierwave for Amazon S3 Storage and Heroku
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
mikegehard /
Created May 5, 2011 — forked from netzpirat/
Continuous CoffeeScript testing with Guard and Jasmine

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
You can’t perform that action at this time.