Skip to content

Instantly share code, notes, and snippets.

@willread
Last active October 13, 2015 12:58
Show Gist options
  • Save willread/4199560 to your computer and use it in GitHub Desktop.
Save willread/4199560 to your computer and use it in GitHub Desktop.
Solve for number of columns, width of columns and padding given width
var width = 620;
var minSize = 100;
var maxPadding = 10;
for(var padding = 1; padding < maxPadding; padding++){
for(var size = minSize; size < width; size++){
var cols = (width + padding) / (size + padding);
if(cols % 1 == 0)
console.log("columns: " + cols + " size: " + size + " padding: " + padding);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment