Skip to content

Instantly share code, notes, and snippets.

View bradgessler's full-sized avatar

Brad Gessler bradgessler

View GitHub Profile
@bradgessler
bradgessler / a.json
Created November 21, 2013 03:20
JSON vs XML
{
a: {
attributes {
href: 'foo.html'
}
value: 'Click Here'
}
}
@bradgessler
bradgessler / link.json
Created August 13, 2013 23:50
JSON vs XML
@bradgessler
bradgessler / doc.erb.bd
Last active December 16, 2015 18:29
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
bradgessler / sketch.md
Last active December 16, 2015 13:09
Why merge backburner with quebert?

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

Quebert

  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 User.new.async(delay: 3).send(:notify_user) as opposed to the current User.new.async_send(:notify_user, :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.

Backburner

@bradgessler
bradgessler / README.md
Last active December 14, 2015 19:49 — forked from cypriss/README.md
@bradgessler
bradgessler / cors_policy.rb
Last active December 11, 2015 03:09
An idea for a Rails CORS policy DSL implementation.
# Configuration DSL, probably in config/initializers/cors.rb
CORS::Policy.configure do
policy :polleverywhere do
origins 'pollev.com', 'www.polleverywhere.com'
# 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'
end
@bradgessler
bradgessler / phone_numbers.rb
Created November 7, 2012 23:48
A list of all US and Canadian phone numbers
#!/usr/bin/env ruby
("000-000-0000").upto("999-999-9999").each do |number|
puts number
end
@bradgessler
bradgessler / blinksale_report.rb
Created November 7, 2012 01:12
Generate a report by month for the amount of payment received in Blinksale
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']) : Date.today - 90
# Blinksale username
@bradgessler
bradgessler / posterous-importer.php
Created July 27, 2012 00:01
Posterous WordPress importer (this one makes sure that the links don't break)
<?php
/*
Plugin Name: Posterous Importer
Plugin URI: http://wordpress.org/extend/plugins/posterous-importer/
Description: Import posts, comments, tags, and attachments from a Posterous.com blog.
Author: Automattic, Brian Colinger, Peter Westwood, Daryl L. L. Houston
Author URI: http://automattic.com/
Version: 0.10
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@bradgessler
bradgessler / forkin_manifest.rb
Created April 18, 2012 05:51
A faster Sprockets compiler that breaks apart the job into subprocesses
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