(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // ---- | |
| // Sass (v3.4.14) | |
| // Compass (v1.0.3) | |
| // ---- | |
| // str-lastindex -- get last index of substr in string | |
| @function str-last-index($str, $substr) { | |
| $length: str-length($str); | |
| @for $n from $length - str-length($substr) through 1 { | |
| $index: str-index(str-slice($str, $n, $length), $substr); |
| @function str-last-index($string, $substr) { | |
| $index: null; | |
| $length: str-length($string); | |
| @for $n from $length through 1 { | |
| $index: str-index(str-slice($string, $n, $length), $substr); | |
| @if $index { @return $index + $n - 1; } | |
| } | |
| @return $index; | |
| } |
| // ---- | |
| // Sass (v3.3.14) | |
| // Compass (v1.0.1) | |
| // ---- | |
| //// | |
| // I have written a lot of different `str-replace` Sass functions over | |
| // the months yet none of my tries were succeeding in making the new substring | |
| // able to contain the one to replace (e.g. `str-replace($str, "a", "ab")`). | |
| // Thanks to Valérian Galliat (@valeriangalliat), I finally managed to build |
| // ---- | |
| // libsass (v3.2.5) | |
| // ---- | |
| @import "sass-maps-plus"; | |
| $map1: ( | |
| alpha: ( | |
| beta: ( | |
| gamma: 3 |
| // ---- | |
| // Sass (v3.4.14) | |
| // Compass (v1.0.3) | |
| // ---- | |
| @mixin foo($out: false) { | |
| @if $out { | |
| @at-root { @content; } | |
| } | |
| } |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // ---- | |
| // Sass (v3.4.14) | |
| // Compass (v1.0.3) | |
| // ---- | |
| @function slice($list, $start: 1, $end: length($list), $sep: list-separator($list)) { | |
| $output: (); | |
| @if $start >= 1 and $end >= $start { | |
| @for $i from $start through $end { | |
| $output: append($output, nth($list, $i), $sep); |
| // ---- | |
| // Sass (v3.4.14) | |
| // Compass (v1.0.3) | |
| // SassyLists (v2.2.1) | |
| // ---- | |
| @import "SassyLists"; | |
| @function last-sels() { | |
| $sel: &; $out: (); |
| // ---- | |
| // Sass (v3.4.14) | |
| // Compass (v1.0.3) | |
| // sass-maps-plus (ve4d32a1dc2) | |
| // ---- | |
| @import "sass-maps-plus"; | |
| $mixins: (); |
| // ---- | |
| // Sass (v3.3.14) | |
| // Compass (v1.0.3) | |
| // ---- | |
| @mixin reset($type){ | |
| $resets: ( | |
| ul: ( | |
| list-style: none, | |
| margin: 0, |