Skip to content

Instantly share code, notes, and snippets.

View nateborr's full-sized avatar

Nate Borrebach nateborr

  • 18F
  • Portland, OR
View GitHub Profile
@nateborr
nateborr / en-montperc.yml
Last active December 20, 2015 13:59
Custom locale file for the Faker gem to create names where the first name is a Montana city, town, or county, and the last name is based on a General MIDI Level 1 percussion sound.
# config/locales/en-montperc.yml
# Faker::Config.locale = "en-montperc"
en-montperc:
faker:
name:
# First names from: http://en.wikipedia.org/wiki/List_of_cities_and_towns_in_Montana
# $.map($("table.wikitable.sortable.jquery-tablesorter tr td a:first-of-type"), function (v){return v.text;}).join(", ")
first_name: [Alberton, Anaconda, Bainville, Baker, Bearcreek, Beaverhead, Belgrade, Belt, Big Horn, Big Sandy, Big Timber, Billings, Blaine, Boulder, Bozeman, Bridger, Broadus, Broadview, Broadwater, Brockton, Browning, Butte, Carbon, Carter, Cascade, Chester, Chinook, Choteau, Chouteau, Circle, Clyde Park, Colstrip, Columbia Falls, Columbus, Conrad, Culbertson, Custer, Cut Bank, Daniels, Darby, Dawson, Deer Lodge, Denton, Dillon, Dodson, Drummond, Dutton, East Helena, Ekalaka, Ennis, Eureka, Fairfield, Fairview, Fallon, Fergus, Flathead, Flaxville, Forsyth, Fort Benton, Fort Peck, Froid, Fromberg, Gallatin, Garfield, Geraldine, Geyser, Glacier, Glasgow, Glendive, Golden Valley, Granite,
@nateborr
nateborr / redis_cloud_heroku_cli.rb
Last active August 29, 2015 14:00
Open redis-cli for a Redis Cloud Heroku add-on
heroku_app_name = ARGV[0]
# For Heroku's new hk command line tool:
#url_matcher = %r{REDISCLOUD_URL=redis://rediscloud:(\w+)@([\w-.]+):(\d+)}
#env_string = `hk -a #{heroku_app_name} | grep REDISCLOUD_URL`
url_matcher = %r{REDISCLOUD_URL:\s*redis://rediscloud:(\w+)@([\w\-.]+):(\d+)}
env_string = `heroku config -a #{heroku_app_name} | grep REDISCLOUD_URL`
env_settings = env_string.split('\n')
@nateborr
nateborr / cory.rb
Last active August 29, 2015 14:27
beer for cory
#!/usr/bin/env ruby
# Here is an alphabet including a beer mug
beer = "\u{1F37A}"
letters = ('a'..'z').to_a << beer
# Here are the words for the beer numbers
number_words = %w{one two three four five}
# Here are the number words padded out to equal lengths with prepended beers
max_number_word_length = number_words.map(&:length).max