(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| (eval-and-compile | |
| (customize-set-variable | |
| 'package-archives '(("org" . "https://orgmode.org/elpa/") | |
| ("melpa" . "https://melpa.org/packages/") | |
| ("gnu" . "https://elpa.gnu.org/packages/"))) | |
| (package-initialize) | |
| (unless (package-installed-p 'use-package) | |
| (package-refresh-contents) | |
| (package-install 'use-package))) |
| /** | |
| * USB HID Keyboard scan codes as per USB spec 1.11 | |
| * plus some additional codes | |
| * | |
| * Created by MightyPork, 2016 | |
| * Public domain | |
| * | |
| * Adapted from: | |
| * https://source.android.com/devices/input/keyboard-devices.html | |
| */ |
| function logClass(target: any) { | |
| // save a reference to the original constructor | |
| var original = target; | |
| // a utility function to generate instances of a class | |
| function construct(constructor, args) { | |
| var c : any = function () { | |
| return constructor.apply(this, args); | |
| } |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| /* Polyfill indexOf. */ | |
| var indexOf; | |
| if (typeof Array.prototype.indexOf === 'function') { | |
| indexOf = function (haystack, needle) { | |
| return haystack.indexOf(needle); | |
| }; | |
| } else { | |
| indexOf = function (haystack, needle) { | |
| var i = 0, length = haystack.length, idx = -1, found = false; |
| function inherit (child, parent) { | |
| function proxy () {}; | |
| proxy.prototype = parent.prototype; | |
| child.prototype = new proxy(); | |
| }; | |
| function Parent () {} | |
| function Child () {} | |
| inherit(Child, Parent); |
| function makeMembrane(){ | |
| var revokableWrappingHandler = new Proxy.revokable({}, { | |
| get: function(target, name){ | |
| return Reflect.call.bind(wrap(Reflect[name])); | |
| } | |
| }); | |
| var revoke = revokableWrappingHandler.revoke; | |
| var wrappingHandler = revokableWrappingHandler.proxy; | |
| var un2wrapped = new WeakMap(); |