25 Sep '13, 7am

Got to use ActionView's `cycle` helper for the first time in ages. Kind of a hidden(?) gem:

Creates a Cycle object whose to_s method cycles through elements of an array every time it is called. This can be used for example, to alternate classes for table rows. You can use named cycles to allow nesting in loops. Passing a Hash as the last parameter with a :name key will create a named cycle. The default name for a cycle without a :name key is "default" . You can manually reset a cycle by calling #reset_cycle and passing the name of the cycle. The current cycle string can be obtained anytime using the #current_cycle method. # Alternate CSS classes for even and odd numbers... @items = [1,2,3,4] <table> <% @items.each do |item| %> <tr class="<%= cycle("odd", "even") -%>"> <td>item</td> </tr> <% end %> </table> # Cycle CSS classes for rows, and text colors for values within each row @items = x = [{first: 'Robert', middle: 'Daniel', last: 'James'}, {first: 'Emily', mid...

Full article: http://api.rubyonrails.org/classes/ActionView/Helpers/Tex...

Tweets

Matching Content to the Customer Life Cycle

Matching Content to the Customer Life Cycle

searchenginewatch.com 25 Sep '13, 11am

It's not what you say. Sometime it's not even how you say it. It's when you say it. The right message, at the right time, ...

Solar Growth Outpaces Wind for First Time

renewableenergyworld.com 26 Sep '13, 10am

predicts that 36.7 GW in new solar PV capacity will be added worldwide in 2013, compared with 35.5 GW in new wind installa...

Solar Growth Outpaces Wind for First Time

renewableenergyworld.com 26 Sep '13, 1pm

predicts that 36.7 GW in new solar PV capacity will be added worldwide in 2013, compared with 35.5 GW in new wind installa...

New car club service becomes first in Japan to use electric vehicles: Nissan electric quadricyc…

New car club service becomes first in Japan to ...

thegreencarwebsite.co.uk 25 Sep '13, 2pm

The Japanese city of Yokohama is to get a new car club service that will be the first in the country to make significant u...

Phusion Passenger Enterprise gem server

blog.phusion.nl 19 Sep '13, 11am

It is now possible to install Phusion Passenger Enterprise through our gem server. Previously, customers were able to down...

Buzzworthy: W Austin's high-rise rooftop #apiary is the first of its kind in the Texas city. @WH…

Buzzworthy: W Austin's high-rise rooftop #apiar...

Since opening in Austin’s 2nd Street District in 2010, the 37-story building Block 21 has been a hive of activity. Its 1.1...

Solar installations set to overtake wind for th...

businessgreen.com 26 Sep '13, 9am

New solar capacity is likely to outpace wind energy capacity for the first time this year as cost reductions and new subsi...

Sir Bradley Wiggins aims to become a time trial great at world championships in Tuscany #Toscana2013

Sir Bradley Wiggins aims to become a time trial...

skysports.com 24 Sep '13, 11pm

Bradley Wiggins is the reigning Olympic champion Sky Bet Sky Bet are offering all new customers a £10 Free Bet £10 complet...

When you need a bit of positivity in your life,...

irunfar.com 24 Sep '13, 2pm

The next day, my neighbor Dave calls upon me to enlist with the Gold Hill Fire Department to help with search-and-rescue e...

@drymaxsocks runner Joe Grant @alpineworks writ...

irunfar.com 24 Sep '13, 2pm

The next day, my neighbor Dave calls upon me to enlist with the Gold Hill Fire Department to help with search-and-rescue e...

It's about time I learnt mum's recipes: Zoe

It's about time I learnt mum's recipes: Zoe

soshiok.com 22 Sep '13, 4am

After veteran home-grown actress Zoe Tay played a character in a recent telemovie who mastered her mother's secret curry r...

How did I not know about the content_for and di...

api.rubyonrails.org 26 Sep '13, 12pm

You can also pass an array of objects which this method will loop through and yield the current object to the supplied blo...