Skip to content

Instantly share code, notes, and snippets.

View lunelson's full-sized avatar
👀
Reading

Lu Nelson lunelson

👀
Reading
View GitHub Profile
@lunelson
lunelson / _contrast_mixin.scss
Created June 23, 2012 18:29 — forked from aaronrussell/_contrast_mixin.scss
Sass function and mixin for setting contrasting background and foreground colors
$contrasted-default-dark: #000;
$contrasted-default-light: #fff;
@mixin contrasted($bg, $dark:$contrasted-default-dark, $light:$contrasted-default-light){
background-color: $bg;
color: get_contrast_yiq($bg, $dark, $light);
}
@lunelson
lunelson / SassMeister-input.scss
Created February 3, 2013 16:00
GCD and Reduce to chain extension of column width classes
// Sass v3.2.5
@function gcd($n,$d) {
$numerator: if($n < $d,$d,$n);
$denominator: if($n < $d,$n,$d);
$remainder: $numerator;
$last_remainder: $numerator;
@while $remainder != 0 {
$last_remainder: $remainder;
$remainder: $denominator % $numerator;
@lunelson
lunelson / husl.rb
Created April 23, 2013 18:21
SassScript to expose "husler" HUSL color functions
require 'sass'
require 'husler'
module Sass::Script::Functions
module Husl
def husl_to_rgb(h, s, l) # assume h (0-360) s, l (0-100)
h = h.to_f
Husler.husl_to_rgb(h,s,l)
end
{
"folders":
[
{
"path": "Leanpub/sublime-productivity",
"folder_exclude_patterns": ["epub_images", "convert_html", "preview", "published"],
"file_exclude_patterns": [".gitignore", "*.sublime*", "*Icon*"]
},
{
"path": "SublimeTextTips"
@lunelson
lunelson / SassMeister-input.sass
Created April 28, 2013 20:28
Generated by SassMeister.com, the Sass playground.
=position($type, $params...)
position: #{$type}
@each $param in $params
#{nth($param,1)}: #{nth($param,2)}
.test
+position(absolute, bottom 0px, top 0px)
@lunelson
lunelson / SassMeister-input.sass
Created April 28, 2013 20:29
Generated by SassMeister.com, the Sass playground.
=position($type, $params...)
position: #{$type}
@each $param in $params
#{nth($param,1)}: #{nth($param,2)}
.test
+position(absolute, bottom 0px, top 0px)
@lunelson
lunelson / SassMeister-input.sass
Created April 29, 2013 10:48
Generated by SassMeister.com, the Sass playground.
//========== REM dimensions, pixel fallback
$base-font-size: 10px !default
=rem($prop, $rems...)
@if type-of($prop) == 'list' and nth($prop,1) == position
@lunelson
lunelson / SassMeister-input.scss
Last active December 16, 2015 18:59
Generated by SassMeister.com, the Sass playground.
// SCRATCH
// typo source definitions
@font-face {}
$base-family: Helvetica;
$heading-family: Georgia;
// basic typo sizing
$base-font-size: 16px !default;
@lunelson
lunelson / SassMeister-input.scss
Last active December 16, 2015 19:49
Generated by SassMeister.com, the Sass playground.
// HTML5 section-heading outline style generation
// not actually the right way of dealing with doc outline but just a test
$heading-font-sizes: 12px 14px 16px 20px 24px 30px;
$s: h1;
@for $n from 0 through 5 {
#{$s} { font-size: nth($heading-font-sizes, length($heading-font-sizes) - $n); }
$s: append((section), $s);
}
@lunelson
lunelson / SassMeister-input.scss
Last active December 16, 2015 19:49
Generated by SassMeister.com, the Sass playground.
// hack of map/hash functionality, works best with SCSS syntax
// works with list of tuples; can accept key-value in either order.
@function value($map, $key) {
@each $pair in $map {
$i: index($pair, $key);
@if $i {
@return nth($pair, 3 - $i);
}
}