Created
May 23, 2017 22:27
-
-
Save benbotto/4fa66ec1a12ac75ebc6fbf85b90619df to your computer and use it in GitHub Desktop.
Greatest common divisor function in SASS
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
@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