View sanitizeDOM.js
// sanitize an element using a whitelisted selector string
function sanitizeDOM(ELEMENT, WHITELISTED_SELECTORS, WHITELISTED_ATTRIBUTES) {
// get all elements within an ELEMENT
[].slice.call(ELEMENT.querySelectorAll('*')).forEach(node => {
// if the element does not match a WHITELIST_SELECTOR_STRING
if (!node.matches(WHITELISTED_SELECTORS)) {
// create a new document fragment
const fragment = document.createDocumentFragment();
// append all the children of the invalid node into the new fragment
View postcss-node-sass.js
import postcss from 'postcss';
import sass from 'node-sass';
// transform css with sass as a postcss plugin
export default postcss.plugin('postcss-node-sass', () => (css, result) => {
// result options with a forced inline sourcemap
const resultOpts = Object.assign({}, result.opts, { map: { inline: true } });
// result-css
const resultCSS = css.toResult(resultOpts).css;
View harlem-shake.js
javascript: (function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
document.body.appendChild(e)
}
function h() {
View scrollr.js
(function (win, doc) {
//
var
_defined = function(valA, valB) {
return valA != undefined ? valA : valB;
};
hasTouch = 'ontouchstart' in win;
startEvent = hasTouch ? 'touchstart' : 'mousedown',
moveEvent = hasTouch ? 'touchmove' : 'mousemove',
endEvent = hasTouch ? 'touchend' : 'mouseup',
View README.md

Calcite Font Sizes

Font Class Natural Medium Narrow
font-size--3 13.8125px - -
font-size--2 14.875px - -
font-size--1 15.9375px - -
font-size-0 17px - -
font-size-1 20.4323px 19.2185px 18.0625px
font-size-2 24.038px 22.61px 21.25px
View README.md

Install Brew and Brew Cask:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
View README.sh
ssh-add -K ~/.ssh/id_rsa
View README.sh
sudo find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
View challenge.css
h { font-size: 2em; }
:matches(article, aside, nav, section) h { font-size: 1.5em; }
:matches(article, aside, nav, section) :matches(article, aside, nav, section) h { font-size: 1.17em; }
:matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) h { font-size: 1em; }
:matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) :matches(article, aside, nav, section) h { font-size: .83em; }
View deep-assign.js
const isObject = (item) => Object(item) === item && !Array.isArray(item);
const deepAssign = module.exports = (target, ...sources) => {
sources.forEach(
(source) => {
Object.keys(source).map(
(key) => {
target[key] = isObject(target[key]) && isObject(source[key]) ? deepAssign(target[key], source[key]) : source[key];
}
)