Skip to content

Instantly share code, notes, and snippets.

View davedx's full-sized avatar

Dave Clayton davedx

  • Red Sky Forge
  • The Netherlands
View GitHub Profile
let cache1 = {}, cache2 = {}
const blob = () => {
var d = []
for (var i=0; i<10; i++) {
d[i] = Math.random()
}
return d
}
@davedx
davedx / getter_perf.js
Created January 4, 2018 14:04
getter_perf
var A = {
_propA: 'fish',
_propB: `cat${this._propA}`
}
var B = {
_propA: 'fish',
_propB: 'cat',
get propA() {
return this._propA
{
"clientNumber": "061234567890",
"name": "John Doe",
"birthDate": "1994-06-07T00:00:00.000",
"telephoneNumber": "06-22609703"
}
{"hello": "world"}
<!doctype html>
<html>
<head>
<style type="text/css">
html {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow: hidden;
@davedx
davedx / gist:9929388
Created April 2, 2014 07:22
Display FPS using requestAnimationFrame
var lastCalledTime;
var fps;
function requestAnimFrame(t) {
if(!lastCalledTime) {
lastCalledTime = new Date().getTime();
fps = 0;
} else {
delta = (t - lastCalledTime)/1000;
// cycle through "myArray" in "dir" (-1 or +1), wrapping around
var nextIdx = (currentIdx + dir) % myArray.length;
if(nextIdx < 0) nextIdx = myArray.length - 1;