Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mmmurf's full-sized avatar

Matt Murphy mmmurf

  • San Francisco, CA
View GitHub Profile
@mmmurf
mmmurf / morse.js
Last active August 29, 2015 14:08 — forked from eholk/morse.js
function MorseNode(ac, rate) {
// ac is an audio context.
this._oscillator = ac.createOscillator();
this._gain = ac.createGain();
this._gain.gain.value = 0;
this._oscillator.frequency.value = 750;
this._oscillator.connect(this._gain);
# Run: curl https://gist.github.com/raw/719970/locale_diff.rb | ruby - en fi
require 'rubygems'
require 'yaml'
l1 = ARGV[0]
l2 = ARGV[1]
first = YAML.load_file(l1 + ".yml")
second = YAML.load_file(l2 + ".yml")
def diff(root, compared, structure = [])
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@mmmurf
mmmurf / gist:1313698
Created October 25, 2011 18:10 — forked from rkh/gist:1313690
class DomainSession < Rack::Session::Cookie
def set_cookie(env, headers, cookie)
cookie[:domain] ||= Rack::Request.new(env).host[/(\.[^\.]+){2}$/]
super
end
end
use DomainSession
@mmmurf
mmmurf / carbon.md
Created November 8, 2009 15:55 — forked from defunkt/carbon.md

Vim

autocmd BufWritePre * :%s/\s\+$//e

Emacs

(add-hook 'before-save-hook 'delete-trailing-whitespace)

Textmate

config.after_initialize do
#CACHE
MEMCACHE_SERVER = case RAILS_ENV
when 'development' then 'localhost:11211'
when 'staging' then '127.0.0.1:11211'
when 'production' then '192.168.2.26:11211'
when 'test' then nil
else raise
end