Skip to content

Instantly share code, notes, and snippets.

mikhailov /
Created Mar 11, 2011
Ruby’s GC Configuration
article’s settings: ("spec spec" took 17-23!sec)
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
mislav / aprompt.png
Last active Feb 25, 2021
My zsh prompt. No oh-my-zsh needed
mrrooijen / .gitignore
Created Feb 1, 2012
MiddleMan on Heroku configuration.
View .gitignore
brandonb927 /
Last active Feb 2, 2021
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see
# Alot of these configs have been taken from the various places
# on the web, most from here
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

rweald / simple-linear-regression.rb
Created Aug 29, 2012
Simple Linear Regression in Ruby
View simple-linear-regression.rb
class SimpleLinearRegression
def initialize(xs, ys)
@xs, @ys = xs, ys
if @xs.length != @ys.length
raise "Unbalanced data. xs need to be same length as ys"
def y_intercept
mean(@ys) - (slope * mean(@xs))
joho / deploy.rb
Created Sep 13, 2012
How to serve emergency "signed out" views from page cache without affecting signed in users in rails.
View deploy.rb
set :path_to_repo, "/path_to_repo/"
set :running_app_user, "appusername"
namespace :webscale do
desc "Cache a signed out version of the path. Usage: cap webscale:signed_out_cache_page -s path_to_cache=/films/on_netflix"
task :signed_out_cache, roles: :app do
cache_base_path = "#{path_to_repo}/public/signed_out"
cached_destination_path = "#{cache_base_path}#{path_to_cache}.html"
working_path = "#{cached_destination_path}.tmp"
djanowski / gist:3750231
Created Sep 19, 2012
Why I don't use...
View gist:3750231

Why I don't use...

I'm numbering my arguments just to be able to reference them. Order does not reflect priority.


  1. It's monolithic.

  2. It's huge, both in terms of complexity and in resulting file size.

ndbroadbent / deploy.rake
Created Sep 28, 2012
Rake task for precompiling assets locally before deploying to Heroku
View deploy.rake
require 'fileutils'
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku.
# The deploy branch is rebased onto master, so the push needs to be forced.
desc "Deploy app to Heroku after precompiling assets"
task :deploy do
deploy_branch = 'heroku'
remote = 'heroku'
deploy_repo_dir = "tmp/heroku_deploy"