Skip to content

Instantly share code, notes, and snippets.

View rares's full-sized avatar
🌑

(╯°□°)╯︵ ┻━┻ rares

🌑
View GitHub Profile
@rares
rares / gist:8152
Created August 30, 2008 23:21 — forked from defunkt/gist:6857
module URI
def self.parse_with_options(uri_str, opts = {})
parsed_uri = self.parse(uri_str)
sing = (class << parsed_uri; self end)
sing.send :define_method, :options do
opts
end
parsed_uri
end
end
# Parallel map
# Originally from http://project.ioni.st/post/2332#snippet_2332
class Array
def pmap
threads = []
0.upto(size - 1) do |n|
threads << Thread.new do
yield(at(n))
end
end