Skip to content

Instantly share code, notes, and snippets.

View Mango3403's full-sized avatar

Haoming Ren Mango3403

View GitHub Profile
@Mango3403
Mango3403 / my-promise.js
Created September 13, 2021 12:47
JavaScript Promise
class MyPromise {
callbacks = []
state = 'pending'
value = null
constructor(fn) {
fn(this._resolve.bind(this))
}
then(onFulfilled) {
return new Promise(resolve => {
this._handle({
@Mango3403
Mango3403 / queue.ts
Last active July 19, 2021 22:22
js-queue-stack
function Queue<T>() {
let data: Record<string, T> = {}
let head = 0
let tail = 0
this.enqueue = function(item: T): void {
data[tail] = item;
tail++;
}
@Mango3403
Mango3403 / useful-npx-commands.md
Created May 10, 2021 17:44 — forked from gokulkrishh/useful-npx-commands.md
List of useful npx (Node Package Runner) commands (https://git.io/useful-npx-commands)

NPX (NPM Package Runner) Commands

List of useful npx (NPM Package Runner) commands.

What is NPX?

Using NPX we can execute/run node binaries without the need to install it locally or globally.

Commands