Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Lloyd corse32

View GitHub Profile
View gist:2fbd988ff37226c40131cab00e3bf779

##Quick changelog git log staging..HEAD --no-merges --pretty=format:%s

@corse32
corse32 / zip.js
Created Mar 23, 2018
Variable Arity Array Zip
View zip.js
function zip() {
const [arr1, ...rest] = arguments
return arr1.map((e, i) => [e, ...rest.reduce((accum, arrN) => [...accum, arrN[i]], [])])
}
@corse32
corse32 / dump-styles.js
Created Dec 13, 2017
JS (ES 6) one liner for extracting CSS rules from a DOM element
View dump-styles.js
//blah is a reference to the dom node in question, e.g. const blah = document.getElementById('popover882889')
Array.from(window.getMatchedCSSRules(blah)).reduce((acc, rule) => `${acc} \n ${rule.cssText}`)