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
» 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
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
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
#!/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
# 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
#!/usr/bin/env ruby | |
# | |
# Released under MIT License | |
# Copyright (c) 2009 Markus Prinz | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is |
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
require 'sinatra' | |
class App < Sinatra::Base | |
get '' do | |
request.script_name | |
end | |
end | |
map '/foo' do | |
run App |
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
From 6a9579d52d531a29ea1b8bc9e9dbb61385f53197 Mon Sep 17 00:00:00 2001 | |
From: Markus Prinz <[email protected]> | |
Date: Wed, 28 Oct 2009 22:21:02 +0100 | |
Subject: [PATCH] You have to run ./configure before running rake when compiling Rubinius for the first time | |
--- | |
doc/getting_started.txt | 1 + | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
diff --git a/doc/getting_started.txt b/doc/getting_started.txt |
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
require 'sinatra' | |
class SinatraApp < Sinatra::Base | |
get '/' do | |
SinatraApp.environment.inspect | |
end | |
end | |
run SinatraApp |