This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run with: god -c /path/to/worker.god | |
# | |
# Keep workers up & running | |
God.load File.join(File.dirname(__FILE__), 'email.god') | |
4.times do |worker_id| | |
God.watch do |w| | |
w.name = "asset-worker-#{worker_id}" | |
w.interval = 10.seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: god control | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Starts god at boot time | |
# Description: Starts god and all the services it is supposed to watch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def summer_monthly_usage | |
@summer_monthly_usage ||= rates.summer_months_nbr. | |
map{ |month| monthly_usage[month - 1] }. | |
inject(0, &:+) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yup. Ich weiss das Fibonacci als Benchmark selbst bestenfalls nur bedingt geeignet ist, aber dieses Programm: | |
def fib(n) | |
if (n < 2) | |
n | |
else | |
fib(n-1) + fib(n-2) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
» git clone git://github.com/petdance/ack.git Ack | |
Initialized empty Git repository in /Users/cypher/Code/Ack/.git/ | |
fatal: protocol error: expected sha/ref, got ' | |
*********' | |
Permission denied. Repository is not public. | |
*********' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define a handler for multiple http verbs at once | |
def any(url, verbs = %w(get post put delete), &block) | |
verbs.each do |verb| | |
send(verb, url, &block) | |
end | |
end | |
any '/url' do | |
# ... | |
"return value" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# A hook script to verify that only syntactically valid ruby code is commited. | |
# Called by git-commit with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
# | |
# Put this code into a file called "pre-commit" inside your .git/hooks | |
# directory, and make sure it is executable ("chmod +x .git/hooks/pre-commit") | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.track '! track() { | |
branch=$(git branch | sed -ne "s/^\*\ \(.*\)$/\1/p") | |
remote=$1 | |
git config "branch.$branch.remote" $(dirname "$remote") | |
git config "branch.$branch.merge" "refs/heads/$(basename "$remote")" | |
} | |
track' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git push ${1:-origin} $(git branch | sed -ne 's/^\*\ \(.*\)$/\1/p') | |
# Put this file somewhere in your PATH, call it 'git-up', make it +x, | |
# and then you can call "git up" to push to origin, or "git up foo" | |
# to push to 'foo' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--sort-files | |
--color | |
--context=1 | |
--follow | |
--group | |
--all |