made with esnextbin
const CHARSET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz$_'; | |
const MASK = parseInt('111100', 2); | |
let guesses = [...Array(11)].map((item, index) => { | |
return Math.floor(Math.random() * 4); | |
// return index % 4; | |
}); | |
console.log(guesses); |
I have been watching the current discussions about running a virtual DOM in a web worker with a great deal of interest. In 2011, I built a research project, [Treehouse][] ([USENIX Talk][] ([DOMTRIS][] demo at 20:25), [paper][]), which ran a hacked-up version of jsdom in a worker. My goal was fine-grained containment of untrusted scripts, while still providing access to browser APIs that existing code expected.
Treehouse achieved a small amount of influence in academic circles, but it had problems and was ultimately unsuccessful. Virtual DOMs were not a widespread or well-understood idea at the time, so the advantages of running one in a worker
var hyperstyles = require('hyperstyles'); | |
var styles = { /* Mock CSS Module */ | |
'root': 'Car__root___fg434', | |
'front-door': 'Car__front-door___b85f9', | |
'back-door': 'Car__back-door___p9h7j' | |
}; | |
var crel = hyperstyles(require('crel'), styles); | |
function render() { | |
return crel('div.root', |
var vdom = require('virtual-dom'); | |
var hyperx = require('hyperx'); | |
var hyperstyles = require('hyperstyles'); | |
var styles = { /* Mock CSS Module */ | |
'root': 'Car__root___fg434', | |
'front-door': 'Car__front-door___b85f9', | |
'back-door': 'Car__back-door___p9h7j' | |
}; | |
var hx = hyperx(hyperstyles(vdom.h, styles)); |
data:text/html, <style>body{font-size:6rem;font-family:sans-serif;text-align:center;}div{display:inline-block;margin:2rem;width:10rem;height:10rem;line-height:10rem;padding:2rem;border-radius:50%;border:0.5rem solid black;}div+div{background-color:blue;color:white;}div+div+div{background-color:red;}div+div+div+div{background-color:black;}p{text-align:center;}</style><div>25</div><div>50</div><div>100</div><div>500</div><p>Total: $10,000</p> |
Quickly preview embeddable widget code such as a Twitter card or Instagram post, before adding it to your website code.
Copy the text of bookmarklet.txt
(below) into a new bookmark with a memorable name like "Preview Embed Code" and place it on your bookmarks bar.
var uniquify = require('uniquifier')(); | |
console.log(uniquify(1)); | |
// > "1" | |
console.log(uniquify(2)); | |
// > "2" | |
console.log(uniquify(1)); | |
// > "1_1" |
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |