Skip to content

Instantly share code, notes, and snippets.

View burtlo's full-sized avatar

Lynn Frank burtlo

View GitHub Profile
@burtlo
burtlo / private.xml
Created September 26, 2012 13:30
TMUX: Rebinding CAPS LOCK to CTRL + B
<?xml version="1.0"?>
<root>
<appdef>
<appname>Terminal</appname>
<equal>com.apple.Terminal</equal>
</appdef>
<item>
<name>TMUX Key Remappings</name>
<item>
<name>TMUX: Right Control to Ctrl+B</name>
@burtlo
burtlo / google.rb
Created September 7, 2012 22:05
Capybara without other testing frameworks
require 'capybara'
require 'capybara/dsl'
Capybara.configure do |config|
config.run_server = false
config.app_host = 'http://www.google.com'
end
Capybara.current_driver = :selenium
@burtlo
burtlo / string.rb
Created September 6, 2012 15:10
Monkeypatching
class String
  def capitalize
    self.gsub(/^[a-z]|\s+[a-z]/) { |a| a.upcase }
  end
end
@burtlo
burtlo / data.yml
Created September 5, 2012 22:31
Working with YAML
name: 'La Crosse, WI'
code: LSE
directions: http://g.co/maps/62ufz
image: 'lacrosse-image.jpg'
website: http://www.cityoflacrosse.org/index.aspx?NID=851
rental_cars: http://www.cityoflacrosse.org/index.aspx?NID=882
description: La Crosse is the closest flight destination. It is right
on the Mississippi and about an hour away. It is a small airport so we
<strong>definitely recommend</strong> making a rental car reservation ahead of time.
@burtlo
burtlo / sunlight.rb
Created September 5, 2012 22:07
Sinatra with Sunlight
require 'csv'
require 'sunlight'
require 'sinatra'
Sunlight::Base.api_key = 'e179a6973728c4dd3fb1204283aaccb5'
representatives = Sunlight::Legislator.all_in_zipcode(90210)
filename = ARGV.first || "event_attendees.csv"
@burtlo
burtlo / Rakefile
Created September 5, 2012 21:03
Rakefile to run Event Manager
task :default => :first
def open_file(filename)
system "ruby event_manager.rb #{filename}"
end
desc "open the first event attendees"
task :first do
open_file "event_attendees.csv"
end
@burtlo
burtlo / sunlight.rb
Created September 5, 2012 18:26
Using the Sunlight API
require 'csv'
require 'sunlight'
Sunlight::Base.api_key = 'e179a6973728c4dd3fb1204283aaccb5'
filename = ARGV.first || "event_attendees.csv"
options = {:headers => true, :header_converters => :symbol}
def clean_zipcode(zipcode)
@burtlo
burtlo / etchosts
Created May 15, 2012 18:07
Subdomains
127.0.0.1 pod.local my.pod.local
module BeginState
def add_player
# really add the player
end
def add_ship
# really do it
end
@burtlo
burtlo / dsl.rb
Created May 6, 2012 03:15
Ruby DSL, the hard way
require 'rspec'
class Recipe
attr_accessor :name
def initialize(name)
@name = name
end
end