This file contains 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
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs' | |
import { dirname, resolve } from 'path' | |
export class Store<T extends Record<any, any>> { | |
protected readonly aPath: string | |
protected readonly data: T | |
constructor(path: string) { | |
this.aPath = resolve(__dirname, path) | |
if (!existsSync(this.aPath)) { |
This file contains 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
// Javascript EventEmitter Polyfill by [Nobu](https://github.com/NobUwU) | |
export class EventEmitter { | |
constructor(max = 25) { | |
this._listeners = new Map() | |
this.max = max | |
} | |
// Override toString/name Methods | |
static get [Symbol.toStringTag]() { |
This file contains 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
type Color = [number, number, number] | |
interface Config { | |
drawTo?: HTMLCanvasElement | |
drawFrom?: HTMLImageElement | |
scale?: number | |
palette?: Color[] | |
maxHeight?: number | |
maxWidth?: number | |
} |
This file contains 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
{ | |
"apps": [{ | |
"name": "laravel-app", | |
"script": "artisan", | |
"args": ["serve", "--host=0.0.0.0", "--port=3333"], | |
"instances": "1", | |
"wait_ready": true, | |
"autorestart": false, | |
"max_restarts": 1, | |
"interpreter" : "php", |
This file contains 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
#!/bin/bash | |
# Functions ============================================== | |
# return 1 if global command line program installed, else 0 | |
# example | |
# echo "node: $(program_is_installed node)" | |
function program_is_installed { | |
# set to 1 initially | |
local return_=1 |