Worst possible approach:
- Run plugins all in the same vm context on server side Bad approach:
- Run plugins in the same vm context on browser side
Ish:
- Run plugins in browser side web workers
/** | |
* Generate a fragile object that will throw error at any operation. | |
*/ | |
export function createErrorObj<T = any>(error: string): T { | |
return new Proxy( | |
{}, | |
{ | |
get(target, prop, receiver: unknown) { | |
throw new Error( |
#SingleInstance Force | |
; Debugging | |
; https://www.autohotkey.com/scite4ahk/pages/debugger.htm | |
; Map Capslock to control (macOS is Capslock as Command, so most keybindings feel similar) | |
CapsLock::RControl | |
; Left Ctrl Tab -> Left Alt Tab | |
<^Tab::>!Tab |
/** Memory-volatile multi-key cache with a root weak key */ | |
export class WeakCache { | |
private wm = new WeakMap<object, Map<string | number, unknown>>(); | |
/** It's very important to not call this with the same keys and expect a different result. */ | |
getOrPut<R>(weakKey: object, keys: CacheKeys, fn: () => R): R { | |
let found = this.wm.get(weakKey); | |
const innerKey = typeof keys === "object" ? JSON.stringify(keys) : keys; | |
if (!found) { | |
const computed = fn(); | |
found = new Map([[innerKey, computed]]); |
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |
type $IntentionalAny = any; | |
/** | |
* This special type can help generate pattern matchers for you! | |
* Just use it as so: | |
* // enum-ts | |
* type Result<Ok, Err> = Enum<{ | |
* Ok: Ok, | |
* Err: Err, |
import { createTRPCProxyClient, httpLink } from "@trpc/client"; | |
import { AnyRouter, initTRPC, MaybePromise, Router } from "@trpc/server"; | |
import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; | |
import type { ParserWithInputOutput, ParserWithoutInput } from "@trpc/server/dist/core/parser"; | |
import type { AnyRouterDef } from "@trpc/server/dist/core/router"; | |
import type { ResponseMetaFn } from "@trpc/server/dist/http/internals/types"; | |
import { getParseFn } from "./getParseFn"; | |
export type TrpcDurableObjectRouter<Router extends AnyRouter> = { | |
router: Router, |
# -*- coding: utf-8 -*- | |
# | |
# Slack file downloader from export archive | |
# | |
# Requirements: | |
# Python 2 (or Python3 if you can use six) | |
# | |
# How to use: | |
# 1. Log in as admin, export your chat logs, and download archive. | |
# 2. Unarchive archive to directory (ex. TeamName export Apr 24 2016) |
type PropType<Domain extends string, Tag extends string, T> = Record<Tag, T> & { | |
type: `${Domain}.${Tag}`; | |
}; | |
type EnumType<Enum extends string, Variants extends Record<string, any>> = { | |
[P in keyof Variants]: P extends string | |
? Record<P, Variants[P]> & { | |
type: `${Enum}#${P}`; | |
} | |
: never; | |
}[keyof Variants]; |
// Place your key bindings in this file to override the defaultsauto[] | |
[ | |
{ | |
"key": "ctrl+right", | |
"command": "-cursorWordEndRight", | |
"when": "textInputFocus" | |
}, | |
{ | |
"key": "ctrl+shift+right", | |
"command": "-cursorWordEndRightSelect", |
#!/usr/bin/env bash | |
set -euxo pipefail | |
database_url="${1}" | |
dump_path="${2:-schema}" | |
schemas=("app_public" "app_hidden" "app_private" "public") | |
find "$dump_path" -name '*.sql' -delete |