From: Dana Merrick Date: 2008-12-20T11:13:48+09:00 Subject: Re: [QUIZ] Dreaming of a Ruby Christmas (#187) --------------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,= it says "Happy New Year!" and stops. For example: 1,046,667! 1,046,666! 1,046,665! =2E.. 3! 2! 1! Happy New Year! class Integer def commafy n =3D self.to_s.reverse n.gsub!(/(\d\d\d)(?=3D\d)(?!\d*\.)/){ $1 + ',' } n.reverse! end end last =3D 0 begin new_years =3D Time.local(Time.now.year+1,"jan",1,0,0,0).to_i now =3D Time.now.to_i cur =3D new_years - now puts cur.commafy + "!" if (cur !=3D last) last =3D cur end while now !=3D new_years puts "Happy New Year!" --=20 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 vOsk8KHhMuFMVsUetonPL4s= =Dw6J -----END PGP SIGNATURE----- --------------enig7DC932B9294D328A92337843--