Skip to content

Instantly share code, notes, and snippets.

View bschwartz's full-sized avatar

Brendan Schwartz bschwartz

View GitHub Profile
@bschwartz
bschwartz / random_maker.rb
Created January 27, 2012 17:34
How Wistia names its video encoding workers
module RandomMaker
ADJECTIVES = %w(red blue yellow fuschia orange teal smokey the a some greyest lovely hyped
another justa speedy quick fast worldly scholarly slow sloth-like understated overestimated
leftover worthless optimistic friendly venerable quixotic lowkey shiny glowing hot cold tepid
lukewarm fairweather winning elusive secret ancient ruined rare unique extra thebest my-greatest
string-like towering confused insulant brave cowardly cycling rolling uncle aunt nostalgic
beastly slanted enchanted top-notch grade-a primo grand creepy)
NOUNS = %w(cadillac smith carl fish sticks car mechanic smoothie art cabbage screen kiwi yam
silent !mkdir -p ~/.vim/swap
silent !mkdir -p ~/.vim/backups
set directory=~/.vim/swap//
set backupdir=~/.vim/backups
#
# Put this in a directory and create a `Gemfile` with this in it:
#
# source 'https://rubygems.org'
# gem 'nsq-cluster'
# gem 'nsq-ruby'
#
# Then run `bundle install` to install the require gems.
# Then run this like so: `ruby fin-failer.rb`
#
@bschwartz
bschwartz / full-scrub.js
Created November 6, 2014 18:15
Scrub all query params with FreshURL
FreshUrl.waitsFor(function(){freshUrl.allReady()}).then(function(){
// This will fire once all analytics platforms are ready
// Scrub everything in the query string, not just utm_*
window.history.replaceState({}, '', window.location.pathname + window.location.hash);
});
@bschwartz
bschwartz / multitopic.rb
Created November 11, 2014 13:52
Consume from multiple topics into a single queue
require 'nsq'
require 'thread'
queue = Queue.new
consumer_for_topic1 = Nsq::Consumer.new(
topic: 'topic1',
channel: 'multi-topic-consumer',
queue: queue
)

Keybase proof

I hereby claim:

  • I am bschwartz on github.
  • I am brendanschwartz (https://keybase.io/brendanschwartz) on keybase.
  • I have a public key whose fingerprint is 92F6 2F9A 12AC 4855 8BDF 6567 0E25 A3D0 2002 85B4

To claim this, I am signing this object: