Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

NYC Standup 08/10/2011: Cycles

Steve Ellis
Wednesday, August 10, 2011

Interesting

  • cycle(even, odd): Jonathan pointed out a method in rails that allows you to apply classes to the even and odd numbered indexes of collections, allowing you to easily apply zebra striping patterns to a collection. Peter mentioned the alternative CSS pseudo-selector “nth-child,” which does the same thing with CSS and properly recalculates in the case where you remove an element with AJAX. Unfortunately, nth-child does not work with IE so if you have to support IE, use cycles, otherwise use nth-child.

  • will_paginate 3.0: Ian mentioned that version 3 of the will_paginate gem was recently released. It now uses scopes, bringing it up to speed with Kaminari, another popular pagination gem.

  • home_run hates ActiveSupport: JT and Micah pointed out that if you’re adding a duration to a DateTime using home_run, like “DateTime.now + 1.day,” it doesn’t play well with ActiveSupport. It assumes that the number on the right is supposed to be days, which it converts to seconds 86,400 and then changes to days again(86,400 days). The ‘+’ operator has been fixed in edge rails, but not yet back ported. They pointed out that although it doesn’t read well, using #since on any instance of DateTime will act how you would hope the ‘+’ operator would.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Add New Comment Cancel reply

Your email address will not be published.

Steve Ellis

Steve Ellis
New York

Recent Posts

  • BetterReceive: A More Assertive Mock
  • Tuesday Brown Bag: @ykatz
  • NYC Standup: 2/5-10 Batched
Subscribe to Steve's Feed

Author Topics

mocks (1)
rspec (1)
stubs (1)
testing (1)
agile (6)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >