Currently showing 2 posts tagged php
... at least according to the TIOBE index, which measures language popularity based on the number of web searches:
The ratings are calculated by counting hits of the most popular search engines. The search query that is used is +”<language> programming” The search query is executed for the regular Google, Google Blogs, MSN, Yahoo!, and YouTube web search for the last 12 months. The web site Alexa.com has been used to determine the most popular search engines.
Having switched to Ruby on Rails (for now), I was looking for the same functionality as the popular time_since() function and after hours of searching, I found that Ruby has this exact function built in.
No need to download a 3rd party module and add it to your project, simply use:
time_ago_in_words() does exactly this. Simply pass it a Date or a Time object and it will spit out time since in words. API
This is another cool function I just added to the comment bit. Instead of simply saying how long has passed since comment was added to now, I wanted to say how long has passed after the post was created to when the comment was added. Ex: about 10 minutes after. API
Here’s my code in the post view:
<% for comment in @post.comments %>
... stuff here ...
<%= distance_of_time_in_words(@post.added, comment.added) %>
... stuff here ...
<% end %>
Hope these help out. I spend ridiculous amount of time looking for functions like this so you won’t have to :)
RSS Feed Really Simple Syndication for you!
This blog focuses primarily on technology, web development, and entrepreneurship. 50% of the time I'm right every time, so stick around and enjoy the show.