M = [["a", "b"], ["c", "d"], ["e", "f"]] x = [] ...
Ruby Array parsing in a block
by https://www.google.com/accounts/o8/id?id=AItOawmWMRp7fAci9domcwhxD3fNikoTak9bkYc,
January 26, 2012 05:59,
1 refactoring, tagged with arrays, blocks, loops, array syntax
@visits_by_day_and_hour = visits.group_by{|day| day.created_at.strftime("%Y-%m-%d")}.map {|d, items| [d, items.group_by{|hour| hour.created_at.strftime("%H")}.map{|k,v| [k, v.length]}]}
Ruby Group array elements by day...
by https://www.google.com/accounts/o8/id?id=AItOawlsPHX5ps6aEa58SFp7fTjKFgMmK9Hi-Dg,
August 07, 2011 23:45,
2 refactorings, tagged with ruby, arrays, group_by, map array
Hi, I have a set of objects...
screen = [ [9,9,4,7,4,8,9,9,9,9,2,5,6,7,8,9], [1,2,3,9,9,6,7,8,9,9,9,9,9,9,9,9] ...
Ruby find a horizontal line in a...
Somewhere in an image, I kn...
class Item def raw_tag_list; "one, two, three, four, five"; end def public_tags; [<#Tag name=two>, <#Tag name=five>, <#Tag name=one>, <#Tag name=four>, <#Tag name=three>]; end ...
Ruby Tag ordering code
Is there a faster way to do...
def first_day_of_month(selected_date) ...
Ruby Splitting array into define...
I'm mainly interested in op...
pools = {1 => [1,2,3], 2=> [3,4,5], 3=> [5,6,7]}
intersection = []
pools.each do |k,v|
...
Ruby Find the Intersection of Ar...
Find the intersection of ar...
x should be ["a","c","e"] i...