Skip to content

Instantly share code, notes, and snippets.

@dazld
dazld / index.js
Last active February 9, 2017 05:56
const ma = require('moving-average')(10000);
const log = (a)=>{ console.log(a); return a}
let run = true;
log(process.version)
function count(){
const now = Date.now();
return new Promise(function(res, rej){
const vals = Array(9e4).fill('').map(_ => Math.random());
vals.reduce((t,v) => {return t + v}, 0);
let skip = 5;
let img = 502;
const canvas = document.querySelector('#thing');
const ctx = canvas.getContext('2d')
const h = window.innerHeight;
const w = window.innerWidth;
canvas.setAttribute('width', w);
canvas.setAttribute('height', h);
const dns = require('dns');
console.log(dns.getServers());
function getAddress(uri) {
return new Promise(function(res, rej) {
dns.resolve4(uri, function(err, address) {
if (err) {
rej(err);

el.getBoundingClientRect()

http://output.jsbin.com/rasaso

desktop: 1000 ops = 3-5ms mobile: 1000 ops = 30ms (busts 60fps limit)

1,000,000 ops = 1573ms (desktop) 17000+ms (mobile)

ie should put a warning about calling this too much on mobile, but it's pretty solid for desktop.

function findMultiplesOf(...nums){
const max = 1000,
matches = new Set();
for (let i = 0; i < max; i++) {
nums.forEach((num) => {
if (i % num === 0) {
matches.add(i);
};
});
(ns tsl.circles
(:require [quil.core :as q]
[tsl.funcs :as f]
[quil.middleware :as m]))
(def WIDTH 512)
(def HEIGHT WIDTH)
(def random-pos
(f/make-randomizer 0 WIDTH))
# Default application configuration that all configurations inherit from.
scss_files: "**/*.scss"
linters:
BangFormat:
enabled: true
space_before_bang: true
space_after_bang: false
@dazld
dazld / component.txt
Last active June 20, 2021 16:37
AEM Sightly JS globals, currentPage investigations
accessible
adaptTo
analyzable
cellName
childEditConfig
class
componentGroup
container
declaredChildEditConfig
declaredEditConfig
# Default application configuration that all configurations inherit from.
scss_files: "**/*.scss"
linters:
BangFormat:
enabled: true
space_before_bang: true
space_after_bang: false
@dazld
dazld / index.js
Created June 2, 2015 15:24
requirebin sketch
var mori = require('mori');
var rgb1 = mori.vector(128,128,128);
var rgb2 = mori.vector(128,128,128);
var s = mori.set(rgb1,rgb2,rgb1,rgb1);
console.log(mori.count(s))