Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
class Array def shuzzle providers = Provider.find(:all).map {|it| it.id} set = [] providers.each do |p| grp = [] self.each {|it| grp << it if it.provider_id == p} set << grp end result = [] set.each {|it| result.push(it.pop) if it.any?} while set.flatten.any? return result end end Products.find(:all).shuzzle
This paste will be private.
From the Design Piracy series on my blog: