--------------enig7DC932B9294D328A92337843
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Happy holidays, everyone!
Here's mine, it takes the New Years countdown to the next level and will start
counting down from whatever time you run it. Once it counts down to zero,t
says "Happy New Year!" and stops.
For example:
1,046,667!
1,046,666!
1,046,665!
...
3!
2!
1!
Happy New Year!
class Integer
def commafy
n = self.to_s.reverse
n.gsub!(/(\d\d\d)(?=\d)(?!\d*\.)/){ $1 + ',' }
n.reverse!
end
end
last = 0
begin
new_years = Time.local(Time.now.year+1,"jan",1,0,0,0).to_i
now = Time.now.to_i
cur = new_years - now
puts cur.commafy + "!" if (cur != last)
last = cur
end while now != new_years
puts "Happy New Year!"
--
Dana Merrick - System Administrator
Integrated Computer Solutions, Inc.
54B Middlesex Tpke, Bedford, MA 01730
617.621.0060 x112 - http://www.ics.com
--------------enig7DC932B9294D328A92337843
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)
iD8DBQFJTFbE7b+8UB5G/wMRAljRAKCHs5jC8l5py4wzyLvUiDWJfaNdzQCfRijS
vOsk8KHhMuFMVsUetonPL4sJ
-----END PGP SIGNATURE-----
--------------enig7DC932B9294D328A92337843--