Skip to content

Instantly share code, notes, and snippets.

View jamiehodge's full-sized avatar

Jamie Hodge jamiehodge

  • Zendesk
  • Copenhagen, Denmark
View GitHub Profile
require "minitest/autorun"
require "mocha"
require "watchable"
describe Watchable do
subject do
Object.new.extend Watchable
end
it "has an empty list of watchers by default" do
@hassox
hassox / base_app.rb
Created February 21, 2012 10:37
Mounted sinatra apps with http_router_sinatra
require 'sinatra/base'
require 'http_router_sinatra'
# With this simplistic approach, Sinatra apps must be leaf nodes in the rack graph
# Mounter nodes may be nested arbitrarily deeply however.
# Include Warden to authenticate whole sub-branches of the graph
class Mounter < HttpRouter
def mount(path, app)
route = add(path).partial.to(app)
mounter = app.respond_to?(:url_mount) ? app : nil
require 'minitest/autorun'
class MyTest < MiniTest::Unit::TestCase
class SomeClass
def calls_takes_args
takes_args "hello world"
end
private
def takes_args arg
@aaronrussell
aaronrussell / _contrast_mixin.scss
Created January 15, 2011 16:33
Sass function and mixin for setting contrasting background and foreground colors
$contrasted-default-dark: #000;
$contrasted-default-light: #fff;
@mixin contrasted($bg, $dark:$contrasted-default-dark, $light:$contrasted-default-light){
background-color: $bg;
color: get_contrast_yiq($bg, $dark, $light);
}
@jefftriplett
jefftriplett / gist:776425
Created January 12, 2011 16:41
various video encoding settings
#!/bin/bash
# via: http://johndyer.name/post/ffmpeg-Settings-for-HTML5-h264-mp4-theora-ogg-vp8-webm.aspx
#
# Also, noteworthy for actually displaying said videos:
# http://mediaelementjs.com/
# mp4 (H.264 / ACC)
ffmpeg -i %1 -b 1500k -vcodec libx264 -vpre slow -vpre baseline \
-g 30 -s 640x360 %1.mp4