Saturday, March 29, 2008

More ruby: comics

My next foray into Ruby (see previous post) came to me while I was catching up on my favorite web comics over break. While ordinarily not much of a hassle, some of the pages were taking especially long to load all of the images, most of which were not the comic I actually cared about. Wouldn't it be nice to have a script that made me a page with just the comics themselves?

It turned out to be pretty straightforward. Here's the result: comics.rb

I then created a simple bash script to make loading comics.html into a browser cleaner:

#!/bin/bash
# Generate an updated comics page and load it in browser du jour

BROWSER='firefox -new-window'

ruby ~/bin/comics/comics.rb
$BROWSER comics.html &

No comments: