Skip to content

Instantly share code, notes, and snippets.

Kirjava kirjavascript

Block or report user

Report or block kirjavascript

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View combineProviders.js
function combineProviders(providers) {
return class Combined extends React.Component {
render() {
return (
providers.reverse().reduce((acc, Provider) => (
<Provider>{acc}</Provider>
), this.props.children)
);
}
}
View contexthook.js
// custom hook: useStore
const ctx = createContext();
export const Store = ({ children }) => {
const [state, setState] = useState(initialState);
const mergeState = useCallback((obj) => {
setState(state => ({ ...state, ...obj }));
}, []);
View calc.rs
#[derive(Debug, Clone, PartialEq)]
enum Token {
Op(char),
Num(f64),
}
fn prec(op: char) -> usize {
match op {
'*' | '/' => 3,
'+' | '-' => 2,
View wasm.js
// 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
View thing.js
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, '\\`')}\`)`))()
});
@kirjavascript
kirjavascript / animate.js
Last active Jul 6, 2017
animation primitives
View animate.js
// Usage;
//
// tween((t) => {
// const i = lerp(-20, 100, ease(t));
// console.log(i);
// }, 500);
function tween(callback, ticks = 500) {
let timer = performance.now();
View toString.js
toString[(""+toString)[!!toString+!!toString]+(""+!toString)[+!!toString]+(+(+[!+toString+!+toString]+[!+toString+!+toString])).toString(+([!+toString+!+toString]+[!+toString+!+toString+!+toString]))+(!!toString+toString)[!+toString+!+toString+!+toString]]
@kirjavascript
kirjavascript / index.html
Last active Jan 29, 2019
d3 webGL force graph with PIXI.js
View index.html
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<title>d3 webGL force graph with PIXI.js</title>
<meta name="description" content="">
<meta name="theme-color" content="#000000">
</head>
<body>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default"></script>
View index.html
onload=(b,c=`<`+`span style="color:#`)=>{`
<script src=#></script><div> #kirjavaquine </div>
`;document.body.innerHTML=`onload=${onload}`
.split('\n').map(d=>d.match(/\W|\w*/g)
.map(d=>(c+`17bf702a2d22`.match(/.../g)[`>{%'<#/script=(;"})`.indexOf(d)%4]+`">${d+`<`}/span>`))
.join('')).join('<'+'br/>')}
View index.html
onload=(b,a='&'+'#x02005;',c=`<`+`span style="color:#`)=>document.querySelector('div').innerHTML=a+a+`
<script src=#></script><div> #kirjavaquine </div>
`.match(/\W|\w*/g).map(d=>(c+`17bf702a2d22`.match(/.../g)[`>div<#/script`.indexOf(d)%4]+`">${d+`<`}/span>`)).join('')
You can’t perform that action at this time.