Skip to content

Instantly share code, notes, and snippets.

View boeserwolf's full-sized avatar

Bastian boeserwolf

  • Germany
  • 23:14 (UTC +02:00)
View GitHub Profile
@boeserwolf
boeserwolf / console-proxy.js
Last active September 11, 2017 08:51
ES6 Proxy Demo - Prepending a timestamp to console output
let pad = val => String(val).padStart(2, '0');
let getTimestamp = () => {
let opts = ['day', 'month', 'year', 'hour', 'minute', 'second']
.reduce((res, key) => (res[key] = '2-digit') && res, { hour12: false });
return new Date().toLocaleString(undefined, opts);
};
let prependTimestamp = (fn) => ({
apply(target, arg, args) {
@boeserwolf
boeserwolf / release-zalgo.js
Created April 12, 2017 09:22
Demonstration of how to RELEASE ZALGO
/**
* Demonstration of how to RELEASE ZALGO
* @author Bastian Masanek (2017)
*/
let cache;
function releaseZalgo(cb) {
if (cache) {
// This is synchronous and execucted immediately.