Skip to content

Instantly share code, notes, and snippets.

View ged's full-sized avatar
President of the ByteBuffer fanclub

Michael Granger ged

President of the ByteBuffer fanclub
View GitHub Profile
def bisect(suspects, victim)
return suspects[0] if suspects.size == 1
pivot = suspects.size / 2
suspects.partition {|file| suspects.index(file) < pivot }.each do |part|
command = %[ruby -r test/unit -I ./vendor/gems/dependency_detection-0.0.1.build/lib -r dependency_detection -r./#{part.join(' -r ./')} #{victim}]
print command + "\n"
if system(command)
puts "------ PASSED: #{$?} -------"
@gnarg
gnarg / drb_socket_pair.rb
Created October 26, 2012 09:03
socketpair protocol for druby
require 'socket'
require 'drb/drb'
module DRbSocketPair
def self.open(uri, config={})
tag = parse_uri(uri)
parent_socket, child_socket = @parent.sockets[tag]
parent_socket.close unless parent_socket.closed?
Child.new(child_socket, config)
end
@raggi
raggi / eventmachine_is_web_scale.rb
Created September 1, 2010 01:34
the secrets of the web scale sauce
require 'eventmachine'
EM.run do
SEKRET_SAUCE = EM.attach(
open(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null', 'w')
)
EM.start_server('0.0.0.0', 80, Module.new do
def post_init; proxy_incoming_to(SEKRET_SAUCE); end
end)
end