Created
September 19, 2014 15:14
-
-
Save yratof/cc5ef4415554d5a08ab5 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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
| // ---- | |
| // Sass (v3.4.4) | |
| // Compass (v1.0.1) | |
| // ---- | |
| $px-only: true; | |
| $pxBase : 16; /* 1 */ | |
| @function parseInt($n) { | |
| @return $n / ($n * 0 + 1); /* 2 */ | |
| } | |
| @function u($values){ /* 3 */ | |
| $list: (); /* 4 */ | |
| @each $value in $values { /* 5 */ | |
| $unit : unit($value); /* 6 */ | |
| $val : parseInt($value); /* 2 */ | |
| @if $value == 0 or type-of($value) != "number" { | |
| $list: append($list, $value); | |
| } | |
| @else if ($px-only) and ($unit == 'rem') { /* 7 */ | |
| $list: append($list, ($val * $pxBase) + px); /* 7 */ | |
| } | |
| @else if($unit == 'px') or ($unit == 'rem'){ /* 8 */ | |
| $list: append($list, $value); /* 8 */ | |
| } | |
| @else { | |
| $list: append($list, $value); /* 8 */ | |
| } | |
| } | |
| @return $list(); /* 10 */ | |
| } | |
| /************************ | |
| SQUARE ROOTS | |
| *************************/ | |
| $pi: 3.1415926535897932384626433832795028841971693993751; | |
| $e: 2.71828182845904523536028747135266249775724709369995; | |
| $iter: 50; | |
| ////////////////////////////// | |
| // Random Number | |
| // Working from http://xkcd.com/221/ | |
| // Chosen by fair dice roll. | |
| // Guarenteed to be random. | |
| ////////////////////////////// | |
| @function rand() { | |
| @return 4; | |
| } | |
| /*///////////////////////////// | |
| // Exponent | |
| /////////////////////////////*/ | |
| @function exponent($base, $exponent) { | |
| // reset value | |
| $value: $base; | |
| // positive intergers get multiplied | |
| @if $exponent > 1 { | |
| @for $i from 2 through $exponent { | |
| $value: $value * $base; | |
| } | |
| } | |
| // negitive intergers get divided. A number divided by itself is 1 | |
| @if $exponent < 1 { | |
| @for $i from 0 through -$exponent { | |
| $value: $value / $base; | |
| } | |
| } | |
| // return the last value written | |
| @return $value; | |
| } | |
| @function pow($base, $exponent) { | |
| @return exponent($base, $exponent); | |
| } | |
| @function sqrt($number) { | |
| $guess: rand(); | |
| $root: $guess; | |
| @for $i from 1 through $iter { | |
| $root: $root - (pow($root, 2) - $number) / (2 * $root); | |
| } | |
| @return $root; | |
| } | |
| /************************************* | |
| This converts columns to pixels based | |
| on the $content width | |
| *************************************/ | |
| @function column-px( $content, $column){ | |
| $container: ($content) / 12 * $column; | |
| @return ($container) * $column; | |
| } | |
| @mixin diamond( $width ){ | |
| $sqrt: sqrt(2); | |
| $math: ($sqrt * $width); | |
| $diag: ($math / 2); | |
| width: $diag; | |
| height: $diag; | |
| overflow: hidden; | |
| display: inline-block; | |
| margin: 0 auto; | |
| > img, | |
| > div { | |
| width: $diag * 1.42105263158; | |
| height: $diag * 1.42105263158; | |
| max-width: $diag * 1.42105263158; | |
| } | |
| } | |
| $wrap: u(20rem); | |
| $small:column-px($wrap, 4); | |
| .cutout{ | |
| &-small{ @include diamond($small); } | |
| } |
This file contains hidden or 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
| Undefined operation: "320px/12 times 4". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment