Skip to content

Instantly share code, notes, and snippets.

View mig's full-sized avatar

Matthew Swasey mig

  • LivingSocial
  • Washington DC
View GitHub Profile
@mig
mig / base.css
Created January 17, 2009 00:25
base styles for my personal projects
body {
background-color: #FFF;
font-family: Verdana, Helvetica, Arial;
font-size: 14px;
}
a img {
border: none;
}
@mig
mig / clojure
Created January 19, 2009 07:12
#!/bin/sh
export SRC=/Users/mig/src
export CLOJURE=$SRC/clojure
export CLASSPATH=$CLOJURE/clojure-contrib/clojure-contrib.jar:$CLOJURE/clojure-trunk/clojure.jar
for file in $SRC/jars/*.jars; do
JARS=$JARS:$file
done
CLASSPATH=$CLASSPATH$JARS
java -cp $CLASSPATH jline.ConsoleRunner clojure.lang.Repl
@mig
mig / mocha_stub_path.rb
Created January 21, 2009 15:51 — forked from kommen/mocha_stub_path.rb
Mocha stub_path
module Mocha
module ObjectMethods
def stub_path(path)
path = path.split('.') if path.is_a? String
raise "Invalid Argument" if path.empty?
part = path.shift
mock = Mocha::Mockery.instance.named_mock(part)
exp = self.stubs(part)
if path.length > 0
exp.returns(mock)
# Sending Public Key to Remote Servers
function authme {
ssh $1 'cat >>.ssh/authorized_keys' <~/.ssh/id_rsa.pub
}
(defun refresh-file ()
(interactive)
(revert-buffer t t t)
)
(global-set-key [f5] 'refresh-file)
@mig
mig / gist:128909
Created June 12, 2009 20:48
Installing Erlang on OSX w/o ports
curl -O http://ftp.gnu.org/pub/gnu/gettext/gettext-0.17.tar.gz
tar xvzf gettext-0.17.tar.gz
cd gettext-0.17
./configure --prefix=/usr/local
make
sudo make install
cd ..
sudo perl -MCPAN -e 'shell'
cpan> install Locale::gettext
@mig
mig / cookie_auth.rb
Created June 16, 2009 16:08
extracted cookie auth from restful_authentication
class TopExitPagesReport
include Garb::Resource
include ReportHelper
metrics :pageviews, :exit_rate, :exits
dimensions :request_uri
def self.results_for(profile, date)
new(profile, date)
end
document.cookie.split(';').each(function(cookie) {
if(cookie.indexOf('__utmz') != '-1') utmz = cookie;
});
var cpc_regex = new RegExp(".*?utmcmd=([a-z]+)\|");
medium = utmz.match(cpc_regex)[1];
var gclid_regex = new RegExp(".*?utmgclid=([\_0-9A-Za-z]+)\|");
adwords = utmz.match(gclid_regex)[1];
# mig_rails_template.rb
file 'config/routes.rb', <<-CODE
ActionController::Routing::Routes.draw do |map|
end
CODE
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/favicon.ico"