This file contains hidden or 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
((store, render)=>{ | |
function memoize(f, cache){ | |
return function(k){ | |
if (k === null) return undefined; | |
if (cache[k]) return cache[k]; | |
return cache[k] = f(k); | |
} | |
} |
This file contains hidden or 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
((name)=>{ | |
const container = | |
document.getElementById(name) || | |
document.createElement("div"); | |
container.id = name; | |
var htm = ` | |
<div class="-container">${content()}</div> | |
<style> | |
#${name} .-container { | |
padding: 2vw 32vw; |
This file contains hidden or 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
((assert, it)=>{ | |
function func(){ | |
return true; | |
} | |
it("<better decription here>", function() { | |
return assert( | |
func(), | |
true | |
); |
This file contains hidden or 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
((assert, it)=>{ | |
it("1 equals 1", function() { | |
return assert(1, 1); | |
}); | |
})( | |
(value, expected)=>{ //assert | |
return value === expected; | |
}, | |
(describe, test)=>{ //it |
This file contains hidden or 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
((app)=>{ | |
var elapse = 0, | |
intv; | |
app.props.onEvent = app.debounce(app.run, app.props.DEBOUNCE_DEFER); | |
intv = setInterval(()=>{ | |
app.props.onEvent({ | |
app: app | |
}); |
This file contains hidden or 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
((target)=>{ | |
function getPos(el){ | |
for (var lx=0, ly=0; | |
el != null; | |
lx += el.offsetLeft, ly += el.offsetTop, el = el.offsetParent); | |
return {x: lx,y: ly}; | |
} | |
function getScrollAmount(){ | |
const doc = document.documentElement; |
This file contains hidden or 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 getScrollAmount(){ | |
const doc = document.documentElement; | |
return { | |
left: (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), | |
top: (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0) | |
}; | |
} |
This file contains hidden or 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 getScrollAmount(){ | |
const doc = document.documentElement; | |
return { | |
left: (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), | |
top: (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0) | |
}; | |
} |
This file contains hidden or 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 getScrollAmount(){ | |
const doc = document.documentElement; | |
return { | |
left: (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), | |
top: (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0) | |
}; | |
} |
This file contains hidden or 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 getScrollAmount(){ | |
const doc = document.documentElement; | |
return { | |
left: (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), | |
top: (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0) | |
}; | |
} |