Skip to content

Instantly share code, notes, and snippets.

View snapper's full-sized avatar

Jason Crane snapper

  • Sydney, Australia
View GitHub Profile
@snapper
snapper / config.ru
Created March 2, 2012 09:11
A sample config.ru file
# 301 rewrite!
require 'rack/rewrite'
use Rack::Rewrite do
r301 %r{.*}, 'http://somedomain.com$&', :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != 'somedomain.com'
}
end
# Attribution goes to https://github.com/rack/rack-contrib/blob/master/lib/rack/contrib/try_static.rb
@snapper
snapper / gist:1016056
Created June 9, 2011 04:25 — forked from whalec/gist:1015901
Not tested. Probably doesn't even run. Hacked together jquery plugin. Now plus ninja tip
(function($) {
$.fn.credit_card = function(opts) {
this.opts = opts
this.change(function(){
var val = $(this).val()
if (val[0] == "4"){
$(opts.visa).addClass("highlighted");
return false;
}