Skip to content

Instantly share code, notes, and snippets.

View Whitespace's full-sized avatar

Tom Clark Whitespace

View GitHub Profile
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
@Whitespace
Whitespace / cleanup.sh
Created August 28, 2012 22:56 — forked from jessedearing/cleanup.sh
Git branch cleanup
git checkout master
git fetch
git remote prune origin
git branch --merged master | grep -v 'master$' | xargs git branch -d
echo "The following remote branches are fully merged and will be removed:"
git branch -r --merged master | sed 's/ *origin\///' | grep -v 'master$'
git branch -r --merged master | sed 's/ *origin\///' | grep -v 'master$' | xargs -I% git push origin :%
# We're going to store number that match in here
sum = 0
# Use a Range object to iterate over every number from 0 to 1000 (inclusive)
(0..1000).each do |n|
# Add n to the sum if n is a multiple of 5 or 3
sum += n if n % 5 == 0 || n % 3 == 0
end
# Print the answer