This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function noop(){}; | |
function createKeydownListener(key: string, modifiers: string[] = [], cb: Function = noop) { | |
const shouldHaveAlt: Boolean = modifiers.includes(keymap.ALT); | |
const shouldHaveCtrl: Boolean = modifiers.includes(keymap.CTRL); | |
const shouldHaveMeta: Boolean = modifiers.includes(keymap.META); | |
const shouldHaveShift: Boolean = modifiers.includes(keymap.SHIFT); | |
return function (event: KeyboardEvent) { | |
if (event.keyCode !== key.toUpperCase().charCodeAt(0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
function noop() { } | |
; | |
function createKeydownListener(key, modifiers = [], cb = noop) { | |
const shouldHaveAlt = modifiers.includes(keymap.ALT); | |
const shouldHaveCtrl = modifiers.includes(keymap.CTRL); | |
const shouldHaveMeta = modifiers.includes(keymap.META); | |
const shouldHaveShift = modifiers.includes(keymap.SHIFT); | |
return function (event) { | |
if (event.keyCode !== key.toUpperCase().charCodeAt(0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"workbench.colorTheme": "Material Theme High Contrast", | |
"editor.multiCursorModifier": "ctrlCmd", | |
"sublimeTextKeymap.promptV3Features": true, | |
"editor.fontLigatures": true, | |
"terminal.integrated.shell.osx": "/bin/zsh", | |
"terminal.integrated.fontFamily": "Hack Nerd Font, Source Code Pro for Powerline, Meslo LG S for Powerline", | |
"editor.cursorBlinking": "smooth", | |
"editor.cursorSmoothCaretAnimation": true, | |
"editor.cursorWidth": 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DJSet() { | |
this.nodes = new Map(); // id -> Node | |
this.sets = new Map(); // id -> Node | |
} | |
function Node(id) { | |
this.id = id; | |
this.rank = 0; | |
this.parent = this; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* LinkedList Node Class | |
*/ | |
function Node(tree, value, next = null, prev = null) { | |
this.tree = tree; | |
this.value = value; | |
this.next = next; | |
this.prev = prev; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* TypeScript Type Calculations (Utility Types) | |
*/ | |
/** ================== | |
* Interface | |
==================== */ | |
/** Example */ | |
interface Person { |