Skip to content

Instantly share code, notes, and snippets.

Brad Gessler bradgessler

Block or report user

Report or block bradgessler

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
bradgessler /
Last active Dec 16, 2015
Why merge backburner with quebert?

Assessment of Quebert & Backburner to figure out how to merge the two.


  1. Build out an async proxy in place of #async_send so that TTR, delays, and priority can be specified in a cleaner way. This looks something like 3).send(:notify_user) as opposed to the current, :quebert => {delay: 3, pri: 1000})
  2. Quebert supports many back-ends: InProcess, Sync, and Beanstalk. Sync and InProcess were created to aid with testing assertions so that Quebert.backend.queue.should have(1).items is possible. It only needs Beanstalk, so the multiple-backends could be removed for the sake of simplicity. A stub could be provided for peeps that want to assert jobs are thrown on the queue in a test env.
  3. There's a controller layer between the Job and the Backend that communicates using exceptions, which is suppose to deal with multiple backends. Eww. I want to just pass a controller into the job and have it deal.



How we upgraded UserVoice, a Rails 2.3.14 app, to Ruby 1.9.3.

Blog post here:
bradgessler / cors_policy.rb
Last active Dec 11, 2015
An idea for a Rails CORS policy DSL implementation.
View cors_policy.rb
# Configuration DSL, probably in config/initializers/cors.rb
CORS::Policy.configure do
policy :polleverywhere do
origins '', ''
# I think allowable request method can be inferred by Rails routing.
# methods :get, :put, :post, :delete, :patch
headers 'X-Custom-Request-Header'
expose 'X-Custom-Response-Header'
bradgessler / phone_numbers.rb
Created Nov 7, 2012
A list of all US and Canadian phone numbers
View phone_numbers.rb
#!/usr/bin/env ruby
("000-000-0000").upto("999-999-9999").each do |number|
puts number
bradgessler / blinksale_report.rb
Created Nov 7, 2012
Generate a report by month for the amount of payment received in Blinksale
View blinksale_report.rb
require 'open-uri'
require 'nokogiri'
require 'filecache'
require 'logger'
require 'date'
require 'pry'
# When do you want to grab invoices? Default is 90 days ago.
@since = ENV.include?('SINCE') ? Date.parse(ENV['SINCE']) : - 90
# Blinksale username
bradgessler / posterous-importer.php
Created Jul 27, 2012
Posterous WordPress importer (this one makes sure that the links don't break)
View posterous-importer.php
Plugin Name: Posterous Importer
Plugin URI:
Description: Import posts, comments, tags, and attachments from a blog.
Author: Automattic, Brian Colinger, Peter Westwood, Daryl L. L. Houston
Author URI:
Version: 0.10
License: GPL v2 -
bradgessler / forkin_manifest.rb
Created Apr 18, 2012
A faster Sprockets compiler that breaks apart the job into subprocesses
View forkin_manifest.rb
require 'sprockets'
module Sprockets
module Forkin
class Manifest < ::Sprockets::Manifest
attr_reader :workers
# The last argument should be the number of workers
def initialize(environment, path, workers=1)
@workers = workers
View gist:2357908
A [common criticism]( of building applications outside of Rails is the loss of a great, integrated tool chain.
> You don't pick Rails as the engine for powering your API simply for the asset pipeline, you pick it for all the other stuff @macaw pointed out! If you hook up Sinatra and Sprockets, you are without Rails' ORM, migrations, generators, routing, test infrastructure, plugin ecosystem, and arguably most importantly, the conventions and agility.
There is some truth to that, but it doesn't have to be that way.
I'm going to pick on ActiveRecord. The internet is [littered]( [with]( [posts]( about using ActiveRecord outside of Rails. Most solutions involve hacking together a Rake file that deals with this stuff. Its a pain.
Rails has alread
bradgessler /
Created Feb 15, 2012
Say any URL on a Mac
curl -s | sed -n -e 's/.*<p>\(.*\)<\/p>.*/\1/p' | sed -e "s/<[^>]*>//g" | say
bradgessler / crash.rb
Created Sep 23, 2011
Fiber seg fault
View crash.rb
require 'rubygems'
require 'eventmachine'
require 'fiber'{{}.resume }
/Users/bgessler/Desktop/crash.rb:6: [BUG] Segmentation fault
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
You can’t perform that action at this time.