Skip to content

Instantly share code, notes, and snippets.

God.watch do |w|
w.name = 'starling'
w.interval = 5.seconds
w.start = 'starling'
w.stop = 'killall starling'
w.restart = 'killall starling && starling'
w.pid_file = '/var/run/starling.pid'
# determine when process has finished starting
w.transition(:init, { true => :up, false => :start }) do |on|
setenv LC_CTYPE en_US.UTF-8
defutf8 on
autodetach on
crlf off
deflogin off
hardcopy_append on
startup_message off
vbell off
Server Software: Mongrel
Server Hostname: 127.0.0.1
Server Port: 3000
Document Path: /
Document Length: 1335 bytes
Concurrency Level: 20
Time taken for tests: 382.962628 seconds
Complete requests: 4000
#!/usr/bin/env ruby
require 'rubygems'
require 'simple-daemon'
class Daemon < SimpleDaemon::Base
SimpleDaemon::WorkingDirectory = File.join(File.dirname(__FILE__), '..', 'log')
def self.start
puts "Starting"
Apple Cider
INGREDIENTS (Nutrition)
6 cups apple cider
1/4 cup real maple syrup
2 cinnamon sticks
6 whole cloves
6 whole allspice berries
1 orange peel, cut into strips
1 lemon peel, cut into strips
class Admin::SearchesController < AdminController
def index
end
def show
@customers = case params[:query]
when 'customer': Search.find_customers(params[:value])
when 'product': Search.find_customers_from_sku(params[:value])
end
end
require 'rubygems'
require 'rack'
require 'lsapi'
require 'datamapper'
DataMapper.setup( :default,
:adapter => 'mysql',
:host => 'localhost',
:username => 'root',
:password => '',
def render_esi(path)
if Rails.env == 'development'
div_id = Digest::MD5.hexdigest(path + rand.to_s)
out = content_tag(:div, :id => div_id) do '' end
out += content_tag(:script, :type => 'text/javascript') do
'$.ajax({ type:"GET", url:"' + path + '", dataType:"html", success:function(html) { $("#' + div_id + '").html(html)
} });'
end
else
'<esi:include src="' + path + '" />'
module Deck
( make
, shuffle
) where
import System.Random
data Suit = Club | Diamond | Heart | Spade
deriving (Eq, Show, Read, Enum)
module Deck
( make
, shuffle
) where
import System.Random
data Suit = Club | Diamond | Heart | Spade
deriving (Eq, Show, Read, Enum)