autocmd BufWritePre * :%s/\s\+$//e
(add-hook 'before-save-hook 'delete-trailing-whitespace)
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 |
class DomainSession < Rack::Session::Cookie | |
def set_cookie(env, headers, cookie) | |
cookie[:domain] ||= Rack::Request.new(env).host[/(\.[^\.]+){2}$/] | |
super | |
end | |
end | |
use DomainSession |
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 |