Skip to content

Instantly share code, notes, and snippets.

Blair Anderson blairanderson

Block or report user

Report or block blairanderson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
blairanderson / JStwitter.rb
Created Jun 7, 2012
This is a JStwitter client lesson
View JStwitter.rb
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def run
puts "Welcome to the JSL Twitter Client!"
command = ""
while command != "q"
printf "enter command: "
blairanderson / home-buying-101
Created Oct 25, 2012
Checklist for Buying a Home
View home-buying-101
Home Buying Checklist
Property Address
Asking Price
Real Estate Taxes
The Neighborhood
Near Work
Near Schools
Near Shopping
Near Expressways
Near Public Transportation
View fizzbuzz.rb
(1..100).each do |each|
if each % 3 == 0 and each % 5 == 0
puts "FizzBuzz"
elsif each % 3 == 0
puts "Fizz"
elsif each % 5 == 0
puts "Buzz"
puts each
blairanderson / gist:4719918
Created Feb 6, 2013
to create an array of hashes
View gist:4719918
def parse_file(filename)
@people = []
@contents.each do |row|
person = {}
person[:id] = row[0]
person[:regdate] = row[:regdate]
person[:first_name] = clean_first_name(row[:first_name])
person[:last_name] = clean_last_name(row[:last_name])
person[:email] = clean_email(row[:email_address])
person[:phone] = clean_phone(row[:homephone])
blairanderson / gist:4736331
Last active Dec 12, 2015
Before and After!
View gist:4736331
def width #column width for 'queue print'
first_name_length = [12]
last_name_length = [12]
email_length = []
city_length = []
street_length = []
@queue.each do |person|
first_name_length << person[:first_name].length
last_name_length << person[:last_name].length
View router.rb
require 'rubygems'
require 'sinatra'
require 'json'
require 'sequel'
require 'pg'
require 'haml'
require 'shotgun'
get '/' do
haml :index
View route.rb
def process_params(params)
@identifier = params[:identifier]
@rooturl = params[:rootUrl]
if missing_parameters?(params)
halt 400, "Bad Request! missing required parameters"
"#{{identifier: @identifier}.to_json}"
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" }
blairanderson / query.rb
Last active Dec 15, 2015 — forked from pjb3/query.rb
Create a ruby hash by chaining methods.
View query.rb
class Query
def initialize
@hash = {}
def method_missing(name, *args)
value = args.length > 0 ? args.first : true
@hash.merge!(name => value)
View series.rb
class Series
attr_reader :digits
def initialize(input)
@digits = input.split("").map{|i| i.to_i}
def slices(input)
slices = []
digits.count.times do |i|
slices << digits[i...i+input]
You can’t perform that action at this time.