Skip to content

Instantly share code, notes, and snippets.

View pedrozath's full-sized avatar

Pedro Maciel pedrozath

View GitHub Profile
def calculate_grid(width, cols)
results = []
(0..width).each do |n|
gutter = n.to_f
col = (width - (gutter * (cols + 1))) / cols
break if col < 0
results << "col: #{col.to_i}px / gutter: #{gutter.to_i}px" if col % 1 == 0
end
results
end