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
// |
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
export type merge<O> = { [K in keyof O]: O[K] } & {}; | |
type Type = "number" | "string"; | |
type concatStrings<arr extends any[], acc extends string = ""> = arr extends [] | |
? acc | |
: arr extends [infer x extends string] | |
? concatStrings<[], `${acc}${x}`> | |
: arr extends [infer x extends string, ...infer xs extends string[]] | |
? concatStrings<xs, `${acc}${x}`> |
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
vim.opt.termguicolors = false | |
vim.env.TERM = "xterm-256color" | |
vim.cmd("colorscheme default") | |
vim.cmd("highlight Normal ctermbg=NONE guibg=NONE") | |
vim.cmd("highlight NonText ctermbg=NONE guibg=NONE") | |
vim.cmd("highlight SignColumn ctermbg=NONE guibg=NONE") | |
vim.cmd("highlight VertSplit ctermbg=NONE guibg=NONE") |
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
export type Either<R, L> = Left<L, R> | Right<R, L> | |
export class Left<L, R = never> { | |
readonly _tag = "Left" | |
constructor(public readonly left: L) {} | |
*[Symbol.iterator](): Generator<Either<R, L>, R, any> { | |
return yield 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
// this is incredibly hacky, but it works great for me | |
// for this to work, i have a file called json-types.ts that contains a bunch of exported interfaces, one for each of | |
// the tables i have that have any JSON fields. json-types.ts should only have Effect Schema imports, like so: | |
// import { Schema1 } from '../../somewhere' | |
// import ... | |
// % | |
// ^ that is essential lol. that tells the script that the imports section is over |
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
export type Fn = (...x: never[]) => unknown | |
export declare const _: unique symbol | |
export type _ = typeof _ | |
export declare abstract class Kind<F extends Fn = Fn> { | |
abstract readonly [_]: unknown | |
f: F | |
} |
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
import ts from "typescript"; | |
import { | |
Parser, | |
alphabet, | |
char, | |
digit, | |
many0, | |
many1, | |
optional, | |
or, |
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
type buildTuple<L extends number, T extends any[] = []> = T["length"] extends L | |
? T | |
: buildTuple<L, [...T, unknown]>; | |
type addTuple<A extends unknown[], B extends unknown[]> = [ | |
...A, | |
...B, | |
]["length"] & | |
number; | |
type subTuple<A extends unknown[], B extends unknown[]> = A extends [ |
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
type buildTuple< | |
n extends number, | |
acc extends any[] = [], | |
> = acc["length"] extends n ? acc : buildTuple<n, [...acc, 0]>; | |
type add<a extends number, b extends number> = [ | |
...buildTuple<a>, | |
...buildTuple<b>, | |
]["length"] & | |
number; |
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
let activeEffect: (() => void) | null = null; | |
export function signal<T>(initialValue: T) { | |
let value = initialValue; | |
const subscribers = new Set<() => void>(); | |
return { | |
get(): T { | |
if (activeEffect) { | |
subscribers.add(activeEffect); |