Author Archives: Zevan

Proxy - (object always defined)

This uses a proxy to make sure all keys/props of an object are always defined.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
let spec = {
get: (o, key) => {
return o[key] != null ? o[key] : o[key] = O();
},
set: (o, key, v) => {
o[key] = v;
}
};
 
let O [...]

Posted in Object, dynamic, es6, functions, javascript | Tagged , | Leave a comment

es6 concat trick

let a = [1], b = [2], c = [3],
d = […a, …b, …c];
console.log(d);
// outputs: [1, 2, 3]

Posted in arrays, es6, javascript | Tagged | Leave a comment

Zeta Pictograms

I have a set of ~100 pictograms that I use for personal notation. When I was actively working on Zeta. I created a few of these with equations:
See the Pen Zeta Pictograms by Zevan Rosser (@ZevanRosser) on CodePen.

You can read more about Zeta in this post.
I spam my facebook with images from my sketchbooks [...]

Posted in Graphics, graphics algorithms, html5, javascript | Tagged , | Leave a comment

Dictionary with ES6 Symbol

Creating a dictionary type object with ES6 Symbols is easy. Yes we have Maps and WeakMaps but this is still interesting for a variety of reasons… Being able to use objects as keys in another object (dictionary) has many great uses…. So how do you use Symbols like this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
let a = { id: Symbol(’key’) },
[...]

Posted in Dictionary, arrays, associative arrays, es6, html5, javascript | Tagged , , , | Leave a comment