Skip to content

Instantly share code, notes, and snippets.

View MichaelFedora's full-sized avatar
🍱
Always Tinkering

Michael C. MichaelFedora

🍱
Always Tinkering
  • East Coast, USA
View GitHub Profile
@MichaelFedora
MichaelFedora / express-router-util.ts
Last active June 13, 2023 21:30
Parse router layers into something usable
/**
* Parse Express Router Layers into something usable, with
* formatted paths, parameters lists, and ancestry tracking.
*/
/**
* A "reduced layer", the output of `reduceStack`. Has
* simplified information in it.
*/
export interface ReducedLayer {
@MichaelFedora
MichaelFedora / wrapped-storage.ts
Last active February 4, 2022 15:48
Wrap a web storage with a prefix
/**
* Wrap a web storage with a prefix.
* @author Michael Fedora
* @link https://gist.github.com/MichaelFedora/031e1ec7a3df736b2b004d6b437e526e
*/
export class WrappedStorage implements Storage {
#store: Storage;
#prefix: string;
#key(k: string): string { return `${this.#prefix}_${k}`; }
@MichaelFedora
MichaelFedora / api-types.ts
Created January 27, 2022 18:26
Another tiny express-like http router thing
export interface TinyRequest {
// CORE (std)
url: string;
method: string;
headers: Headers;
json<T = unknown>(): Promise<T>;
text(): Promise<string>;
@MichaelFedora
MichaelFedora / playcanvas-stable.d.ts
Last active December 29, 2017 14:20
PlayCanvas Engine Typings (wip). Use it by downloading and placing both this and `playcanvas-stable.js` in the same directory.
/**
* PlayCanvas Engine Typings
*
* Use it by downloading and placing both this and `playcanvas-stable.js` in the same directory.
*
* (c) 2017 Michael Fedora (michaelfedora.github.io)
* Licensed under MIT.
*/
type DomKeyboardEvent = KeyboardEvent;