Skip to content

Instantly share code, notes, and snippets.

View joshhepworth's full-sized avatar
👾

Josh Hepworth joshhepworth

👾
  • Huckberry
  • Oklahoma City
View GitHub Profile
@subelsky
subelsky / puma_rails_heroku.rb
Created October 31, 2012 13:51
Setting up Puma and Rails on Heroku
# Gemfile
gem "puma"
# Procfile
web: bundle exec puma -p $PORT -e $RACK_ENV -C config/puma.rb
# add to config block config/environments/production.rb
config.threadsafe!
# get rid of NewRelic after_fork code, if you were doing this:
@joshhepworth
joshhepworth / lockdown.rb
Created September 3, 2013 18:28
Setup basic auth as a middleware for a rack application.
class Lockdown
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
if request.path != '/'
auth = Rack::Auth::Basic::Request.new(env)
@ngauthier
ngauthier / bink.rb
Created March 31, 2014 14:08
Bink CLI Example
#!/usr/bin/env ruby
require_relative '../config/environment'
Bundler.require :bot
name = ARGV[1]
csv = "#{name}.csv"
bot = Bink.new csv
command = ARGV[0]