Created
March 28, 2014 17:28
-
-
Save anonymous/9838192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_grid(options) | |
results = [] | |
(0..options[:width]).each do |n| | |
gutter = n.to_f | |
col = (options[:width] - (gutter * (options[:cols] + 1))) / options[:cols] | |
break if col < 0 | |
results << "col: #{col.to_i}px / gutter: #{gutter.to_i}px" if col % 1 == 0 | |
end | |
results | |
end | |
puts calculate_grid cols: 7, width: 1100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment