// Leaflet JS - note the *className* attribute
// [...]
L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
className: 'map-tiles'
}).addTo(map);
// [...]
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
// Open a supplied HTML file and record whatever's going on to an MP4. | |
// | |
// Usage: node recorder.cjs <path_to_html_file> | |
// Dependencies: npm install puppeteer fluent-ffmpeg | |
// (and yes, you need ffmpeg installed) | |
// | |
// It expects a <canvas> element to be on the page as it waits for | |
// that to load in first, but you can edit the code below if you | |
// don't want that. | |
// |
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
git log --pretty=format:"%h%x09%an%x09%ad%x09%s" |
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
:root {font-size: 16px; line-height: 1.5; font-family: sans-serif; padding: 20px} | |
body {} | |
h1 {font-size:2rem; margin-bottom:1rem; line-height: 1} | |
h2 {font-size:1.5rem; margin-bottom: .5rem;} | |
p {margin-bottom: 1rem;} |
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 now, dt, | |
rate = 0.5, | |
last = performance.now(); | |
function frame() { | |
now = performance.now(); | |
dt = (now - last) / 1000; // duration in seconds | |
if(dt >= rate){ | |
console.log("bing") | |
last = now; |
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 angle = null, | |
step = 20, | |
rate = 90; | |
draw = () => { | |
if (!angle) { | |
angle = 0; | |
} | |
console.clear(); |
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
// From browser source/snippets | |
// TODO: use selection API | |
// IDEA: selecting -> uppercase => voices -> yelling one word at a time (AWS?) | |
//noting line breaks in chrome devtools between selection and post slice | |
//FIXME: better attach | |
document.styleSheets[document.styleSheets.length - 1].addRule("::selection", "background: red !important; color: pink !important; text-transform: uppercase !important"); | |
//get whole parent |
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
console.clear() | |
let used = [], | |
replaced = [] | |
/* | |
TODO: only needed for early testing. can del | |
len = 20, | |
createArr = function(N) { | |
return Array.apply(null, { | |
length: N |
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 r = document.querySelector('input[type="range"]'), | |
initVal = 20, | |
story = []; | |
let currVal = null; | |
r.value = initVal; | |
r.addEventListener('change', (e) => { | |
let finalVal = e.target.value, |
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
nextNumOfType = (n, d) => { | |
let opts = {true: {'even': 2,'odd': 1}, false:{'even': 1,'odd': 2}} | |
return n + opts[n%2 == 0][d]; | |
} | |
nextNumOfType(3,'odd') // 5 | |
nextNumOfType(3,'even') // 4 | |
nextNumOfType(4,'odd') // 5 | |
nextNumOfType(4,'even') // 6 |
NewerOlder