This file contains 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
class Proc | |
def <<(other) | |
case other | |
when Proc | |
Proc.new do |*args| | |
call(other.call(*args)) | |
end | |
else | |
call(other) | |
end |
This file contains 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
/*-------- Here's how your Gists render in #newtwitter's details pane --------*/ | |
twttr.mediaType('twttr.media.types.Gist') | |
.url('http://gist.github.com') | |
.matcher(/\b(?:https?\:\/\/)?gist\.github\.com\/(\S+)/g) | |
.icon('generic') |
This file contains 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 'java' | |
begin | |
require 'jar/netty-3.2.2.Final' | |
rescue LoadError | |
require 'fileutils' | |
FileUtils.mkdir_p 'jar' | |
system "wget -O jar/netty-3.2.2.Final.jar http://repository.jboss.org/nexus/content/groups/public-jboss/org/jboss/netty/netty/3.2.2.Final/netty-3.2.2.Final.jar" | |
require 'jar/netty-3.2.2.Final' | |
end |
This file contains 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
--- mongrel/ext/http11/http11_parser_common.rl 2010-10-13 01:08:57.000000000 -0700 | |
+++ thin/ext/thin_parser/common.rl 2010-06-18 18:36:01.000000000 -0700 | |
@@ -11,11 +11,12 @@ | |
safe = ("$" | "-" | "_" | "."); | |
extra = ("!" | "*" | "'" | "(" | ")" | ","); | |
reserved = (";" | "/" | "?" | ":" | "@" | "&" | "=" | "+"); | |
- unsafe = (CTL | " " | "\"" | "#" | "%" | "<" | ">"); | |
+ sorta_safe = ("\"" | "<" | ">"); | |
+ unsafe = (CTL | " " | "#" | "%" | sorta_safe); | |
national = any -- (alpha | digit | reserved | extra | safe | unsafe); |
This file contains 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
export RUBY_HEAP_MIN_SLOTS=1000000 | |
export RUBY_HEAP_SLOTS_INCREMENT=1000000 | |
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
export RUBY_GC_MALLOC_LIMIT=1000000000 | |
export RUBY_HEAP_FREE_MIN=500000 |
This file contains 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
# load balancing | |
# send incoming requests to one of 10 backends running on ports 5000-5009 | |
HttpProxyMachine.start do | |
{ :host => 'localhost', :port => 5000 + rand(10) } | |
end | |
# host based routing | |
# send requests for media.server/file to localhost:3000/media/file | |
# all other requests are unmodified | |
HttpProxyMachine.start do |request| |
This file contains 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 'eventmachine' | |
require 'net/dns' | |
require 'net/dns/resolver' | |
module EM # :nodoc: | |
module Protocols | |
include Logger::Severity | |
class AsyncResolver < Net::DNS::Resolver |
This file contains 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 'fileutils' | |
start_time = Time.now | |
SOURCE_DB = { | |
:name => 'db_name', | |
:user => 'db_user', | |
:password => 'db_pass', | |
:host => 'localhost' |
This file contains 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
$ sudo jruby -S gem install dubious | |
Successfully installed bitescript-0.0.7 | |
Successfully installed mirah-0.0.4-java | |
Successfully installed thor-0.13.8 | |
Successfully installed activesupport-3.0.3 | |
Successfully installed i18n-0.4.2 | |
Successfully installed appengine-sdk-1.3.8 | |
Successfully installed dubious-0.0.1-java | |
7 gems installed |
This file contains 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
Gemfile.lock |