Outputting progress to the command-line using the print command with \r

When outputting progress, use print with a \r to get a nice counter. e.g.

100.times {|i| print "\r#{i}/100"; sleep(0.2)}

Copied from a @thechrisoshow tweet.[twitter.com]