A bit of nothing.
A little more on Twitter.
Some code on GitHub.
A few photographs on Flickr.
Recent HD video on Vimeo.
Cool phone apps on Cloudvox.

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 format
    code = open(“http://gist.github.com/#{@gist_id}.pibb”).read
 
    # Remove the <pre> tag
    #
    # Tumblr wrap lines at of HTML at times and having the additional
    # whitespace in a <pre> is very undesirable.
    h = Hpricot(code)
 
    h.search(‘pre’).each do |pre|
      pre.swap(pre.inner_html)
    end
 
    @gist_code = h.to_html
  end
 
  private
  def post_to_tumblr(email, password, title, body)
    post_private = post_private ? 1 : 0
 
    Net::HTTP.start(“www.tumblr.com”) do |http|
      req = Net::HTTP::Post.new(“/api/write”)
      req.set_form_data :email => email, :password => password,
        :title => title, :body => body, :format => ‘html’,
        :private => post_private
 
      http.request(req)
    end
  end
end
view raw This Gist brought to you by GitHub.

# Parallel map
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 in some scenarios,
# much slower in others.
 
# e.g.
def expensive_operation
  open(‘http://google.com’).read
end
# Expensive operation 50 times
# user system total real
# map 50x 0.3400 0.2100 0.5500 ( 17.334429)
# pmap 50x 0.3000 0.2500 0.5500 ( 1.200705)
view raw This Gist brought to you by GitHub.

#
# 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|
    span.search(‘a’).remove
    span.inner_text.strip.gsub(/(^|\s+)@($|\W+)/, )
  end
end
 
def gather_all_tweets(username, password)
  agent = WWW::Mechanize.new
  agent.user_agent_alias = ‘Mac Safari’
  page = agent.get(‘http://twitter.com/account/archive’)
 
  login_form = page.forms.action(‘https://twitter.com/sessions’).first
 
  login_form[‘username_or_email’] = username
  login_form[‘password’] = password
  login_form.submit
 
  page = agent.get(‘http://twitter.com/account/archive’)
  
  unless page.forms.action(‘https://twitter.com/sessions’).first.nil?
    raise “The username or password was invalid”
  end
 
  text = collect_entries(page)
 
  while link = page.links.text(/Older/).first
    page = link.click
    text += collect_entries(page)
  end
 
  text.flatten
end
  
username, password = ARGV[0], ARGV[1]
puts gather_all_tweets(username, password).join(\n)
view raw This Gist brought to you by GitHub.

25% Organic, eh?: As Seen At Chipotle.

25% Organic, eh?: As Seen At Chipotle.


Drobo Unmasked: My Drobo with three 750GB disks. Contact me for a discount code that&#8217;ll save you $25 if you&#8217;re thinking about buying one.

Drobo Unmasked: My Drobo with three 750GB disks. Contact me for a discount code that’ll save you $25 if you’re thinking about buying one.