View proxy.js
const proxy = (target, handler) => {
handler = typeof handler === 'object' ?
Object.create(handler) : new handler;
return (handler.proxy = new Proxy(target, handler));
};
View Promise.listeners.js
(function (wm) {'use strict';
// original proposal via Oliver Dunk @oliverdunk_ via ES ML
// (c) Andrea Giammarchi - (ISC)
Object.defineProperties(
Promise.prototype,
{
addListeners: {
configurable: true,
value: function addListeners(resolve, reject) {
var once = wm.get(this);
View proto-classic.js
const bench = {
stress: 10e2,
times: 5,
classical(copy, overwrite) {
this._prototype = false;
this._bootstrap(copy, overwrite);
},
prototypal(copy, overwrite) {
this._prototype = true;
this._bootstrap(copy, overwrite);
View esx-in-browsers.md

A list of screen shots for browsers capabilities

View custom-elements-shenanigans.html
<!doctype html>
<html>
<head>
<script>
class Logger extends HTMLElement {
connectedCallback() {
console.log(`<${
this.nodeName.toLowerCase()
}> has ${
View mix.js
// now an npm package qith 100% code coverage:
// https://github.com/WebReflection/endow#endow---
// (c) Andrea Giammarchi, @WebReflection (ISC)
const mix = Super => ({
with: (...mixins) =>
mixins.reduce(
(Class, Mixin) => {
Class = Mixin(Class);
if (!Mixin.hasOwnProperty(Symbol.hasInstance)) {
View fsb.js
#!/usr/bin/env gjs
// (c) Andrea Giammarchi - ISC
// define the Gtk version to use
imports.gi.versions.Gtk = '3.0';
((Gtk, Gdk, WebKit2) => {
Gtk.init(null);
View hyper-lit.md

The history of hyperHTML followed by lit-html

While many remember the epic hyperHTML: A Virtual DOM Alternative post I've published the 5th of March 2017, the first official implementation of the library was working as hyperHTML.bind(node) function for tagged literals the day before, and it's been in my experiments folder already for a little while.

The hilarious reaction from the skeptical community

At first glance people couldn't believe performance of the DBMonster demo shown in that article,

View JSON.js
if(JSON.stringify('\u2028').length<4)JSON.stringify=function(s,r,f){return function() {return s.apply(null,arguments).replace(r,f)}}(JSON.stringify,/\u2028|\u2029/g,function(c){return'\u2028'==c?'\\u2028':'\\u2029'});
View irc.js
#!/usr/bin/env node
require('fs').readFile(process.argv[2], (err, data) => {
if (err) return;
const content = data.toString().trim();
const re = /^\[(.+?)\]\s+<(.+?)>\s(.*)$/gm;
const chat = [];
let current = {};
while (match = re.exec(content)) {
if (match[2] !== current.name) {