Skip to content

Instantly share code, notes, and snippets.

@Veejay
Created August 7, 2010 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Veejay/512837 to your computer and use it in GitHub Desktop.
Save Veejay/512837 to your computer and use it in GitHub Desktop.
def photo_set_helper(photos, row_size=8)
quotient, remainder = photos.count.divmod(row_size)
capture do
- for i in 0..quotient-1
.row
- for j in 0..row_size-1
= image_tag @photos[i * row_size + j]["s3_url"], :id => "#{@photos[i * row_size +j]["id"]}"
- if remainder > 0
.row
- for j in 0..remainder-1
= image_tag @photos[quotient * row_size + j]["s3_url"], :id => "#{@photos[quotient * row_size +j]["id"]}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment