Skip to content

Instantly share code, notes, and snippets.

@benbotto
Created May 23, 2017 22:27
Show Gist options
  • Save benbotto/4fa66ec1a12ac75ebc6fbf85b90619df to your computer and use it in GitHub Desktop.
Save benbotto/4fa66ec1a12ac75ebc6fbf85b90619df to your computer and use it in GitHub Desktop.
Greatest common divisor function in SASS
@function gcd($a, $b) {
@if $b == 0 {
@return $a;
}
@return gcd($b, $a%$b);
}
@for $i from 1 through 11 {
@for $j from $i+1 through 12 {
@if gcd($i, $j) == 1 {
.cell-#{$i}_#{$j} {
width: percentage($i/$j);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment