Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
def sortint(f,items) items.map{|item| [f.call(item).scan(/\d+|[^\d]/).map{|e| # split string on numeral and other symbols if e.to_i.to_s == e # is_int? 256+e.to_i # up char code else e[0] # char code end }, item] }.sort{|a,b| n = [a[0].count,b[0].count].min-1 # minimum length of two strings r = a[0][0..n] <=> b[0][0..n] r == 0 ? a[0].count <=> b[0].count : r }.map{|_,e| e} end
This paste will be private.
From the Design Piracy series on my blog: