[ Content | View menu ]

Archive for 'Programming'

Implementing the Self-Shunt Testing Pattern in Ruby

February 14, 2006

Sometimes you want to test an object that is tightly coupled to another object, and you need to capture the conversation between the two objects to ensure the right information is being sent back and forth. Maybe you want to know what a barcode scanner is sending to the display device. You could use a [...]

Programming - 0 Comments

Crossing The Road

March 12, 2005

How would the chicken cross the road, in Borland Object Pascal, as seen on RandomChicken.com:

program KFC;

uses
Salt, Pepper, Flour, HotOil, Poultry, MackTruck;

const
MPH = 90;

var
{Don’t reference your chickens before they’re declared!}
Chicken : Poultry.Fowl;
Truck : MackTruck.EighteenWheeler;

begin
Chicken.Hatch; {Constructor}
Truck.Start; {Constructor}
Truck.Rev(MPH);
Chicken.Cross(Road);
Truck.Horn.Honk;
[...]

Humour, Programming - 0 Comments

Netflix RSS

December 30, 2004

Did you know that Netflix has RSS feeds?
Here’s a bit of Python code I whipped up for a friend to fetch one of their feeds and print out the titles. All you need is this script and Mark Pilgrim’s ultra-liberal feed parser and away you go.

import feedparser
url = ‘http://rss.netflix.com/Top25RSS?gid=296′

def main():
feed = feedparser.parse(url)
[...]

Programming - 2 Comments