Skip to content

Instantly share code, notes, and snippets.

@mikhailov
mikhailov / ruby_gc.sh
Created Mar 11, 2011
Ruby’s GC Configuration
View ruby_gc.sh
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration
article’s settings: ("spec spec" took 17-23!sec)
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_HEAP_SLOTS_INCREMENT=100000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
@mislav
mislav / aprompt.png
Last active Feb 25, 2021
My zsh prompt. No oh-my-zsh needed
@mrrooijen
mrrooijen / .gitignore
Created Feb 1, 2012
MiddleMan on Heroku configuration.
View .gitignore
.DS_Store
*.swp
*.swo
Gemfile.lock
@brandonb927
brandonb927 / osx-for-hackers.sh
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.
View osx-for-hackers.sh
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

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 = git@github.com:joyent/node.git

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
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"
end
end
def y_intercept
mean(@ys) - (slope * mean(@xs))
@joho
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
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.

jQuery

  1. It's monolithic.

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

@ndbroadbent
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"