Skip to content

Instantly share code, notes, and snippets.

View bschwartz's full-sized avatar

Brendan Schwartz bschwartz

View GitHub Profile

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:

silent !mkdir -p ~/.vim/swap
silent !mkdir -p ~/.vim/backups
set directory=~/.vim/swap//
set backupdir=~/.vim/backups
@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
@bschwartz
bschwartz / list_view
Created June 16, 2011 21:29 — forked from joelbschwartz/list_view
cooktwice list view
--------------- the page ------------------
<li class="recipe">
<a href="#" class="star"/>
<h3><%= "Chile-Braised Pork Shoulder Tacos" %></h3>
<p class="details"><%= "Added by you, shared with 3 others, edited by 2 others, 5 comments" %></p>
<p class="source"><%= "Bon Apetit" %></li>
<div class="actions">
<a href="#" class="share">Share</a>
</div>
<html>
<head>
</head>
<body style="padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;">
<div id="wistia_253852" width="438" height="320">Almost there...</div>
<script src="http://embed.wistia.com/embeds/v.js" charset="ISO-8859-1"></script>
<script>
Wistia.VideoEmbed('wistia_253852',438,320,{videoUrl:'http://embed.wistia.com/deliveries/f429e644d5d0f46bd36496d4caab604379382ce5.bin',stillUrl:'http://embed.wistia.com/deliveries/0a87e488223ac510058dad6ec742d9e8b4b50fe1.bin',distilleryUrl:'http://distillery.wistia.com/x',accountKey:'wistia-production_3176',mediaId:'wistia-production_253852',mediaDuration:44.78,autoPlay:true});
var v = document.getElementById('wistia_253852');v.load();v.play();
#!/usr/bin/env ruby
#
# Send your exact HTTP request back to you in the response body.
# Useful for debugging.
#
require 'proxymachine'
proxy do |data|
@bschwartz
bschwartz / vswap.wistia-tracker.js
Created May 6, 2010 16:06
Track Wistia videos using Vertster
/*
* Tracks a video's play progress via Vertster
*
* Usage:
*
* Vswap.trackWistiaVideo(560, 'wistia_123', 63.0);
*
* Note: This currently only works with a Wistia video embed but could be easily adapted to
* work with YouTube or other video players.
*/
# if this is for a Rails app, drop it in /config/initializers
class Module
if defined?(:rake_original_const_missing)
def const_missing(const)
rake_original_const_missing(const)
end
end
// This is a jQuery monkey-patch that changes all PUT and DELETE requests
// into POST requests and sets a "_method" param to the original request method.
//
// This is a workaround for the fact that some corporate networks and
// environments don't allow PUT and DELETE requests.
//
// This whole thing works because Rails implements the _method hack.
(function(){
var ajaxWithoutMethodHack = jQuery.ajax;
jQuery.ajax = function( s ) {
<!-- Begin MailChimp Signup Form -->
<!--[if IE]>
<style type="text/css" media="screen">
#mc_embed_signup fieldset {
position: relative;
}
#mc_embed_signup legend {
position: absolute;
top: -1em;
left: .2em;