The Accidental Rubyist

invalid byte sequence in UTF-8

Runner’s Time calculator

leave a comment »

Some days back (while watching the Olympics), I wrote (in ruby) a command line program that given a distance and time, would calculate how much time it would take to complete some other distance.

So if Haile runs 1000 meters in 2:32.1 (2 minutes, 32.1 seconds), how much time will he take for the 10000 meters, or 5000 meters, or marathon.

Or if Bekele ran the 5000 meters in 12:56.33, how much time did he take per 400 meters, and what were his splits for each 1000m. This is something that runner’s keep calculating, and we need to keep converting to seconds, doing arithmetic and converting back. This little program does the job.

I wanted to put this program up on a site for people to use, but ruby is typically not available on apache. Most servers have php. Yesterday, I started doing this in php (my first php!), but then decided that javascript would be better. Users can download the file and run it on their computers. So now I have my first javascript program, too.

The program sits here. If you know any runners, do point them to the program (free and open source, of course).

Javascript online version:
Ruby command-line version:

Let me make it clear that McCusker is a complete barking lunatic.
This is just about the stupidest file format I’ve ever seen.
– Jamie Zawinski on Mozilla’s History format (mork)


Written by totalrecall

August 26, 2008 at 9:37 pm

Posted in ruby

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: