Skip to content

Instantly share code, notes, and snippets.

View thybzi's full-sized avatar

Evgeni Dmitriev thybzi

View GitHub Profile
@thybzi
thybzi / combinate.styl
Created February 23, 2016 01:41
Stylus selector combinator mixin: http://codepen.io/thybzi/pen/GobVEX
//**
//* Put CSS combinator between current selector and subj -- in direct and reversed order
//* Apply CSS rules block to resulting selector
//* Example output: .parent .curr + .subj, .parent .subj + .curr { color: red; }
//* Limitation: current selector must have a separent level in selector tree (e.g. & > .curr)
//* @param {string} subj Another selector to combinate with
//* @param {string='+'} comb CSS combinator (can be: '+', '~', '>' or ' ')
//*/
combinate(subj, comb='+')
scurr = selectors()[-1]
@thybzi
thybzi / types.styl
Last active April 28, 2016 13:24
Stylus detected types — for use with `typeof()` and `is a`: http://codepen.io/thybzi/pen/MKMGoK
/*! bool, null */
typeof() // -> "null"
typeof(null) // -> "null"
typeof(undefined) // -> "ident"
typeof(false) // -> "boolean"
typeof(no) // -> "ident"
/*! color */
typeof(#ff0000) // -> "rgba"
typeof(#f00) // -> "rgba"