Skip to content

Instantly share code, notes, and snippets.

@kyleburton
Created May 25, 2011 15:47
Show Gist options
  • Save kyleburton/991215 to your computer and use it in GitHub Desktop.
Save kyleburton/991215 to your computer and use it in GitHub Desktop.
OOCSS Grids, generate additional sizings (eg: size1of10)
# ruby oocssgrid-gen.rb 10
# prints:
# .size1of10{width:10.0%;}
# .size2of10{width:20.0%;}
# .size3of10{width:30.0%;}
# .size4of10{width:40.0%;}
# .size5of10{width:50.0%;}
# .size6of10{width:60.0%;}
# .size7of10{width:70.0%;}
# .size8of10{width:80.0%;}
# .size9of10{width:90.0%;}
n = (ARGV[0] || 8).to_f
(1..(n.to_i-1)).each do |x|
printf ".size%dof%d{width:%.1f%%;}\n", x, n, 100*((1.0/n)*x)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment