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 /
Created Nov 15, 2016
First CLI commands
$ docker run ubuntu /bin/echo 'Hello world'
Hello world
bradgessler / initializer.rb
Last active Mar 10, 2017
MIddleware for making legacy versions of Internet Explorer (anything below 11) work with rails. I release this code under MIT license.
View initializer.rb
# ./config/initializers/rewrite_ie_header.rb
# Don't forget to include the middleware file! If you have a ./lib/middleware folder in rails
# a `require './lib/middleware/rewrite_ie_header.rb'` should do the trick
# IE has a really stupid accept header, so here we scope its domain of mime-types that it can negotiate, otherwise we'll
# end up with weird bugs where if you hit /mcp/:id, IE will download a .ppt file instead of the .html content.
# Issue documented in more detail at
Rails.application.config.middleware.use RewriteIEAcceptHeader do |ie_mime_types|
View bundle
#!/usr/bin/env bash
export IMAGE_NAME=my_app
CONTAINER_ID=$(docker run -d $IMAGE_NAME bundle $@)
docker logs -f $CONTAINER_ID
View pundit_matcher.rb
module PunditExampleGroup
extend ::RSpec::Matchers::DSL
matcher :permit do |action|
match do |policy|
failure_message do |policy|
"#{policy.class} does not permit #{action} on #{policy.record} for #{policy.user.inspect}."
bradgessler / license.rb
Created Jul 2, 2014
Print a list of licenses for gems in a bundle.
View license.rb
require 'bundler'
require 'yaml'
def format(hash)
Bundler.load.specs.each do |spec|
puts format({
bradgessler / list.hon
Last active Dec 29, 2015
JSON is too verbose for hypermedia APIs. HON (Hypermedia Object Notation) preserves the readability and implicit data structure of JSON while with the addition of line attributes for URL and pagination metadata. From
View list.hon
name: "Todo List",
items(href: '/lists/1203/items', next_href: "/lists/1203/items?page=2"): [
item(href: '/items/1'): {
description: "Pick up pizza",
status: "completed"
item(href: '/items/12'): {
description: "Eat pizza",
status: "non_started"
View a.json
a: {
attributes {
href: 'foo.html'
value: 'Click Here'
View link.json
bradgessler /
Last active Dec 16, 2015
Sketch for a Tilt/Markdown extension that makes it a little easier to add structure to markdown after its rendered.
# How to tie your shoes
<%= toc.each do |id, text| %>
* [<%= text %>](#<%= id %>)
<% end %>
## Unlace them
Gotta make sure its untied before you tie it!
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.


You can’t perform that action at this time.