This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.feature-hero .feature-heading { | |
margin-bottom: 2rem; | |
font-size: 2.5rem; | |
color: #E8BD36; | |
text-shadow: 1px 1px #2d343a, 2px 2px #2d343a, 3px 3px #2d343a, 4px 4px #2d343a, 5px 5px #2d343a, 6px 6px #2d343a, 7px 7px #2d343a, 8px 8px #2d343a, 9px 9px #2d343a, 10px 10px #2d343a, 11px 11px #2d343a, 12px 12px #2d343a, 13px 13px #2d343a, 14px 14px #2d343a, 15px 15px #2d343a, 16px 16px #2d343a, 17px 17px #2d343a, 18px 18px #2d343a, 19px 19px #2d343a, 20px 20px #2d343a, 21px 21px #2d343a, 22px 22px #2d343a, 23px 23px #2d343a, 24px 24px #2d343a, 25px 25px #2d343a, 26px 26px #2d343a, 27px 27px #2d343a, 28px 28px #2d343a, 29px 29px #2d343a, 30px 30px #2d343a, 31px 31px #2d343a, 32px 32px #2d343a, 33px 33px #2d343a, 34px 34px #2d343a, 35px 35px #2d343a, 36px 36px #2d343a, 37px 37px #2d343a, 38px 38px #2d343a, 39px 39px #2d343a, 40px 40px #2d343a, 41px 41px #2d343a, 42px 42px #2d343a, 43px 43px #2d343a, 44px 44px #2d343a, 45px 45px #2d343a, 46px 46px #2d343a, 47px 47px #2d343a, 48px 48px #2d343a, 49px 49px #2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Elements with `data-observe` toggle `data-visible` | |
// between `true` and `false` | |
if ('IntersectionObserver' in window) { | |
const callback = (entries, observer) => { | |
entries.forEach(entry => { | |
entry.target.setAttribute('data-visible', entry.isIntersecting) | |
}) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rand = () => Math.floor(Math.random() * 256) | |
const r = () => (`rgb(${rand()}, ${rand()}, ${rand()})`) | |
const divs = document.querySelectorAll('div') | |
const viewDestroy = () => divs.forEach(d => d.style.background = r()) | |
setInterval(viewDestroy, 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
const asyncForEach = (array, callback) => { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array) | |
} | |
} | |
const start = async () => { | |
await asyncForEach([1, 2, 3], async (num) => { | |
await waitFor(50) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asyncFunc(e) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => resolve(e), e * 1000); | |
}); | |
} | |
const arr = [1, 2, 3]; | |
let final = []; | |
function workMyCollection(arr) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react" | |
import { Machine } from "xstate" | |
import * as PropTypes from "prop-types" | |
class FiniteMachine extends Component { | |
machine = Machine(this.props.chart) | |
state = { | |
data: this.props.reducer(undefined, { type: "@init" }), | |
machineState: this.machine.getInitialState() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Frame extends Component { | |
componentDidMount() { | |
this.iframeHead = this.node.contentDocument.head | |
this.iframeRoot = this.node.contentDocument.body | |
this.forceUpdate() | |
} | |
render() { | |
const { children, head, ...rest } = this.props | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author ebidel@ (Eric Bidelman) | |
* License Apache-2.0 | |
*/ | |
// Prints the size of each cache in the Cache Storage API and the overall bytes cached. | |
async function getCacheStoragesAssetTotalSize() { | |
// Note: opaque (i.e. cross-domain, without CORS) responses in the cache will return a size of 0. | |
const cacheNames = await caches.keys(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myScript = document.createElement('script'); | |
myScript.src = 'http://code.jquery.com/jquery-2.1.4.min.js'; | |
myScript.onload = function() { | |
console.log('jQuery loaded.'); | |
}; | |
document.body.appendChild(myScript); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cache = new Map(); | |
let pending = new Map(); | |
function fetchTextSync(url) { | |
if (cache.has(url)) { | |
return cache.get(url); | |
} | |
if (pending.has(url)) { | |
throw pending.get(url); | |
} |