Skip to content

Instantly share code, notes, and snippets.

@nnupoor-zz
nnupoor-zz / event-emitter.js
Created October 18, 2018 10:46 — forked from domenic/event-emitter.js
Revealing constructor pattern event-emitter
// This event emitter emits events, but reserves the right to publish events to
// for its creator. It uses a WeakMap for true encapsulation.
const eesToEventMaps = new WeakMap();
export default class EventEmitter {
constructor(publisher) {
const eventMap = Object.create(null);
eesToEventMaps.set(this, eventMap);
@nnupoor-zz
nnupoor-zz / injector.js
Created October 18, 2018 14:02 — forked from jankuca/injector.js
Injector.js
/**
* @constructor
*/
function Injector() {
/**
* @type {!Object.<string, function(Injector=): !Object>}
*/
this.factories = {};
@nnupoor-zz
nnupoor-zz / .gitconfig
Created July 16, 2019 05:39 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"