August 2008
7 posts
require ‘open-uri’
require ‘hpricot’
class Gistr
def initialize(gist_id)
@gist_id = gist_id
end
def post(email, password, title)
post_to_tumblr(email, password, title, gist_code)
end
def gist_code
return @gist_code if @gist_code
# Use the secret .pibb...
# 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
threads.collect {|thread| thread.value}
end
end
# Trade-off between resource consumption
# and speed of execution.
# Much faster...
#
# Created by Eric Lindvall <eric@5stops.com>
#
# Making it simple to provide input for http://wordle.net/create
#
#
require ‘rubygems’
gem ‘mechanize’
require ‘mechanize’
def collect_entries(page)
page.parser.search(‘.entry-content’).collect do |span|...