Skip to content

Instantly share code, notes, and snippets.

@pjaspers
pjaspers / gist:247182
Created December 2, 2009 13:05
Simple script to get the links to all of Steve Yegge's articles
require 'rubygems'
require 'hpricot'
require 'open-uri'
# Steve's *cough* new blog
doc = open("http://steve-yegge.blogspot.com/") { |f| Hpricot(f) }
steves_new_blog = Array.new()
(doc/"ul.posts").each { |post|steves_new_blog << post.search("li/a").collect { |a| a.attributes['href']}}
# Steves old blog
@pjaspers
pjaspers / gist:241851
Created November 24, 2009 12:48
Beech · Tweet from your homerow
# A quick way to tweet from the command line
# As for the name: http://itunes.com/app/oak by @10to1
# Added 'oak' as source.
function beech(){
# Twitter != Rocket Science, so security is not that much of an issue
TWITTER_BEECH_USER="username"
TWITTER_BEECH_PASS="password"
if [ $# -ge 1 ]; then
@pjaspers
pjaspers / gist:241847
Created November 24, 2009 12:40
A class to generate a Haiku in ruby (prototype for haikuherman.eu)
require 'lingua/en/readability'
class Haiku
def initialize(text)
@report = Lingua::EN::Readability.new(text)
@used_words = Array.new
end
def get_most_used_words(words)
top_words = Array.new
words.sort{|a,b| a[1]<=>b[1]}.slice(words.length/2..words.length).each do |a|