Skip to content

Instantly share code, notes, and snippets.

View ArjanJ's full-sized avatar
🍫

Arjan Jassal ArjanJ

🍫
View GitHub Profile
@ArjanJ
ArjanJ / EventEmitter.js
Last active July 19, 2019 04:46
Event Emitter Class in JavaScript
/*
* Create an event emitter that goes like this
* emitter = new Emitter();
*
* Allows you to subscribe to some event
* sub1 = emitter.subscribe('function_name', callback1);
* (you can have multiple callbacks to the same event)
* sub2 = emitter.subscribe('function_name', callback2);
*
* You can emit the event you want with this api
@ArjanJ
ArjanJ / MurmurHash.re
Created June 29, 2018 03:04
Bucklescript binding for MurmurHash algorithm
type t;
/**
* MurmurHash
* bs binding of https://www.npmjs.com/package/murmurhash
*
* Must `npm install murmurhash` first.
*
* Usage:
* let foo = MurmurHash.v3("thestringyouwannahash");