Skip to content

Instantly share code, notes, and snippets.

View wlib's full-sized avatar
🔙
delete all code

Daniel Ethridge wlib

🔙
delete all code
View GitHub Profile
// TODO: make `pages` optional and measure the div when unspecified, this will
// allow more normal document flow and make it easier to do both mobile and
// desktop.
import {
createContext,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
@wlib
wlib / task.js
Last active March 8, 2019 21:23
Super simple Task implementation. Lazy evaluation of anything sequentially.
const Task = run => ({
// (a -> e) -> (a -> r) -> Task(a) // Might be inaccurate idk
run,
// undefined -> undefined
log: () =>
run(console.error)
(console.log),
// (a -> b) -> Task(b)
<a href="javascript:(function(){if(document.body.contentEditable==='true'){document.body.contentEditable='false';}else{document.body.contentEditable='true';}})();">Edit this</a>
<br>
<a href="javascript:(function(){regex=/\/(edit|view)/;path=location.pathname;if(regex.test(path))location.pathname=path.replace(regex, '/preview');})();">Preview google drive</a>
<br>
<a href="javascript:(function(){Runner.instance_.loadImages();style=document.createElement('style');document.head.appendChild(style);style.sheet.insertRule('.snackbar-show { animation: unset }');})();">Unblock chrome://dino</a>
<br>
<a href="javascript:(function(){editor=document.querySelector('div.commit-create > div.CodeMirror');editor.setAttribute('style'%2C'height%3A50%25');})();">Enlarge gist edit window</a>
<br>
<a href="javascript:Array.from(document.querySelectorAll('.tv-dialog__modal-wrap, .tv-dialog__overlay')).forEach(e => e.remove());">Clean tradingview</a>
<br>
@ooflorent
ooflorent / webpack.config.js
Last active August 28, 2017 19:05
Simplify extension management in webpack
const ext = (...suffix) => new RegExp(`\\.(?:${ suffix.join('|') })(?:[?#].*)?$`)
const loaders = [
// Traditional cases
{ test: ext('css'), loaders: ['style', 'css'] }, // single
{ test: ext('js', 'jsx', 'es6'), loaders: ['babel'] }, // multiple
// Complex case: Font-Awesome adds query strings and/or hashs to files
{ test: ext('otf', 'eot', 'svg', 'ttf', 'woff', 'woff2'), loaders: ['file?name=[name].[ext]'] },
]