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 h(tag, attrs = {}, children = []) { | |
const node = document.createElement(tag); | |
node.__children = children; | |
Object.entries(attrs).forEach(([k, v]) => { | |
/^on/.test(k) | |
? node.addEventListener(k.slice(2), v) | |
: node.setAttribute(k, v); | |
}); | |
return node; | |
} |
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 { | |
str, | |
char, | |
digits, | |
letters, | |
sequenceOf, | |
anythingExcept, | |
anyOfString, | |
many, | |
choice, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Fetti</title> | |
<style> | |
div { | |
left: 50%; | |
right: 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 combineProviders(providers) { | |
return class Combined extends React.Component { | |
render() { | |
return ( | |
providers.reverse().reduce((acc, Provider) => ( | |
<Provider>{acc}</Provider> | |
), this.props.children) | |
); | |
} | |
} |
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
// custom hook: useStore | |
const ctx = createContext(); | |
export const Store = ({ children }) => { | |
const [state, setState] = useState(initialState); | |
const mergeState = useCallback((obj) => { | |
setState(state => ({ ...state, ...obj })); | |
}, []); |
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
#[derive(Debug, Clone, PartialEq)] | |
enum Token { | |
Op(char), | |
Num(f64), | |
} | |
fn prec(op: char) -> usize { | |
match op { | |
'*' | '/' => 3, | |
'+' | '-' => 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
// regpack version | |
_="m=zInstance(zModule(v[0,97q5{9~|||~^3Z,96|~`7,3^0Zj4^2Zq2|j5^1Z|~,6`9}j7~46},2,6{9{1{9q1q4`1,2j5{4_||{^8Z^2}Yq~46ZY`,72_,32,87q1q4{8{0|])));h=vkmemory.buffer);s='';for(i=khello();h[i];i++)s+=String.fromCharCode(h[i]);console.log(s)~,1}`8`8`8|j0{~0znew WebAssembly.vnew Uint8Array(q~1km.exports.j|,`~2_{1{8{8q1^~3Z}~Yj65~6q";for(i of"YZ^_`jkqvz{|}~")with(_.split(i))_=join(pop());eval(_) | |
https://wasdk.github.io/WasmFiddle/?wvzhb | |
// failed idea | |
WebAssembly.instantiate(new Int8Array([0,97,115,109,1,0,0,0,4,132,128,128,128,0,1,112,0,0,5,131,128,128,128,0,1,0,1,6,129,128,128,128,0,0,7,138,128,128,128,0,1,6,109,101,109,111,114,121,2,0,11,155,128,128,128,0,2,0,65,16,11,12,72,101,108,108,111,32,87,111,114,108,100,0,0,65,28,11,4,16,0,0,0])).then(q=>console.log([...new Int8Array(q.instance.exports.memory.buffer)].slice(16,27).map(a=>String.fromCharCode(a)).join``)) | |
// change name to e | |
m=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,133,128,128,128,0,1,96,0,1 |
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 http = new Proxy({}, { | |
get(t, k) { | |
const url = `https://crossorigin.me/http://${k.replace(/_/g, '.')}`; | |
return new Proxy({}, { | |
get(t, k) { | |
fetch(url) | |
.then(res => res.text()) | |
.then(res => { | |
(new Function(`return (${k})(\`${res.replace(/`/g, '\\`')}\`)`))() | |
}); |
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
// Usage; | |
// | |
// tween((t) => { | |
// const i = lerp(-20, 100, ease(t)); | |
// console.log(i); | |
// }, 500); | |
function tween(callback, ticks = 500) { | |
let timer = performance.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
toString[(""+toString)[!!toString+!!toString]+(""+!toString)[+!!toString]+(+(+[!+toString+!+toString]+[!+toString+!+toString])).toString(+([!+toString+!+toString]+[!+toString+!+toString+!+toString]))+(!!toString+toString)[!+toString+!+toString+!+toString]] |