Skip to content

Instantly share code, notes, and snippets.

View halorgium's full-sized avatar

Tim Carey-Smith halorgium

View GitHub Profile
require 'celluloid/autostart'
class Manager
include Celluloid
trap_exit :processor_died
def initialize
@ready = 2.times.map { Processor.new_link }
end
@halorgium
halorgium / wtf.rb
Last active December 19, 2015 02:29 — forked from walski/wtf.rb
class WTF
attr_reader :color
def initialize
@color = 'red'
end
def color_with_self
color = self.color
color
@halorgium
halorgium / gist:5745422
Last active December 18, 2015 07:19 — forked from quamen/gist:2020715

Plain dough

Makes 680g dough (enough for 4 × 30 cm pizza)

  • 4 teaspoons dried yeast
  • 4 teaspoons salt
  • 400 ml warm water
  • 8 teaspoons olive oil, plus extra, for greasing
  • 640 g plain (all-purpose) flour, sifted
@halorgium
halorgium / Output
Last active December 17, 2015 04:58 — forked from tbuehlmann/Output
foo
D, [2013-05-11T00:39:46.596057 #48493] DEBUG -- : Terminating 2 actors...
D, [2013-05-11T00:39:46.596526 #48493] DEBUG -- : Shutdown completed cleanly
@halorgium
halorgium / Gemfile
Last active December 16, 2015 08:18 — forked from romansergey/Gemfile
source 'https://rubygems.org'
gem 'celluloid-io', :git => 'https://github.com/celluloid/celluloid-io.git'
gem 'celluloid', :git => 'https://github.com/celluloid/celluloid.git'
gem 'reel',:git => 'https://github.com/celluloid/reel.git'
@halorgium
halorgium / 01E.rb
Last active December 15, 2015 21:59 — forked from digitalextremist/01E.rb
require 'rubygems'
require "bundler/setup"
require 'reel/app'
Celluloid.task_class = Celluloid::TaskThread
class Wu
include Reel::App
get '/' do |request|
puts "Request came in //"
@halorgium
halorgium / gist:5131182
Last active December 14, 2015 18:39 — forked from reset/gist:5131168
require 'celluloid'
class Something
class RemoteScriptError < RuntimeError; end
include Celluloid
def ssh_command(*)
[false, Struct.new(:stdout, :stderr).new("out", "err")]
end
@halorgium
halorgium / gist:1221268
Created September 16, 2011 05:24 — forked from mkb/gist:1218376
#!/usr/bin/env ruby -wKU
@actions = Hash.new {|h,k| h[k] = []}
def tell_program(name, &block)
@actions['songstart'] << lambda do |*args|
IO.popen("osascript", "w") do |f|
f.puts %Q{
tell application "System Events"
if exists process "#{name}" then
@halorgium
halorgium / app.rb
Created June 2, 2009 03:01 — forked from kematzy/app.rb
# Example of how to use multiple Routes in external files/modules
require 'rubygems'
require 'sinatra/base'
# set the root of the whole app
APP_ROOT = File.dirname(File.expand_path(__FILE__)) unless defined?(APP_ROOT)
require "sinatra-external_routes_example"