Tag: site


Human Time

I recently added the capability to display time in more human friendly terms. Basically, instead of saying Posted at 2007-11-30 20:18:36, a relevant post will say "posted 3 days ago". You can see this on every post or twitter on my site. I did not realize the full potential of Ruby until I sat down to write the code to make this happen. I simply extended Ruby's default Time class with the following:

class Time
   def humantime
            age = Time.now.to_i - self.to_i
            seconds_max = 60
            minutes_max = 3600
            hours_max   = 86400
            days_max    = 604800
            weeks_max   = 2629743
            months_max  = 31556926
            p = ''
            unit = ' second'
            if age < seconds_max
                amt = age
            elsif age < minutes_max
                amt = age/seconds_max
                unit = ' minute'
            elsif age < hours_max
                amt = age/minutes_max
                unit = ' hour'
            elsif age < days_max
                amt = age/hours_max
                unit = ' day'
            elsif age < weeks_max
                amt = age/days_max
                unit = ' week'
            elsif age < months_max
                amt = age/weeks_max
                unit = ' month'
            else
                amt = age/months_max
                unit = ' year'
            end

            if amt > 1
              p = 's'
            end

            humantime = amt.to_s + unit + p + " ago"
       end
end

So now, to get the time in human time, I just call the .humantime method that is now a part of every Time object.

added tags

Last night I added the tagging capability to this site. I figured that tags seem like a better way to keep things organized, rather than categories.

new website

Welcome to my new website :)

It is still very much under construction, but the jist of it is here. This site has been built using Ruby on Rails as an experiment, and then it turned into a full site. Ruby is awesome.

Tag cloud

  1. 1 entries are tagged with 2007
  2. 1 entries are tagged with 2008
  3. 1 entries are tagged with 2009
  4. 1 entries are tagged with 2010
  5. 2 entries are tagged with applevalley
  6. 1 entries are tagged with archlinux
  7. 1 entries are tagged with artichoke
  8. 1 entries are tagged with automation
  9. 1 entries are tagged with batcountry
  10. 1 entries are tagged with beats
  11. 1 entries are tagged with bigsur
  12. 3 entries are tagged with bm2009
  13. 8 entries are tagged with burningman
  14. 1 entries are tagged with christmas
  15. 5 entries are tagged with code
  16. 1 entries are tagged with cplusplus
  17. 1 entries are tagged with desert
  18. 1 entries are tagged with drinks
  19. 1 entries are tagged with dspam
  20. 2 entries are tagged with dunes
  21. 1 entries are tagged with energy
  22. 1 entries are tagged with esplanade
  23. 5 entries are tagged with europe
  24. 1 entries are tagged with evdo
  25. 2 entries are tagged with flv
  26. 1 entries are tagged with gadgets
  27. 1 entries are tagged with government
  28. 1 entries are tagged with haiku
  29. 1 entries are tagged with icecast
  30. 1 entries are tagged with internetradio
  31. 1 entries are tagged with iphone
  32. 2 entries are tagged with losangeles
  33. 3 entries are tagged with mix
  34. 1 entries are tagged with motivation
  35. 1 entries are tagged with moving
  36. 2 entries are tagged with music
  37. 1 entries are tagged with newserver
  38. 1 entries are tagged with obama
  39. 1 entries are tagged with productivity
  40. 1 entries are tagged with radio
  41. 1 entries are tagged with rails
  42. 3 entries are tagged with recipe
  43. 1 entries are tagged with redmine
  44. 2 entries are tagged with reflections
  45. 1 entries are tagged with rmine
  46. 8 entries are tagged with ruby
  47. 1 entries are tagged with salmon
  48. 1 entries are tagged with salsa
  49. 1 entries are tagged with shoutcast
  50. 3 entries are tagged with site
  51. 2 entries are tagged with snow
  52. 1 entries are tagged with spotmanradio
  53. 1 entries are tagged with streamtranscoder
  54. 1 entries are tagged with tecate
  55. 1 entries are tagged with thanksgiving
  56. 6 entries are tagged with travel
  57. 1 entries are tagged with trip
  58. 1 entries are tagged with turkey
  59. 3 entries are tagged with twitter
  60. 1 entries are tagged with website
  61. 2 entries are tagged with work
  62. 1 entries are tagged with x4200
  63. 3 entries are tagged with yz250

Twitter Updates

Links to check out

Subscribe RSS