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 { z, ZodObject, ZodTuple } from 'https://deno.land/x/zod/mod.ts' | |
export type ToZod<T> = T extends string | |
? z.ZodString | |
: T extends number | |
? z.ZodNumber | |
: T extends boolean | |
? z.ZodBoolean | |
: T extends null | |
? z.ZodNull |
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 { ComponentProps, FC } from 'react' | |
export const Ticks: FC< | |
Omit< | |
ComponentProps<'circle'>, | |
'strokeWidth' | 'pathLength' | 'strokeDasharray' | 'strokeDashoffset' | 'r' | |
> & { | |
r: number | |
count: number | |
length: 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
import { ComponentProps, ComponentRef, forwardRef } from "react" | |
import { Slot } from "@radix-ui/react-slot" | |
import { cn } from "@/lib/util" | |
const variants = { | |
light: "rgba(255,255,255, 0.3)", | |
dark: "rgba(0,0,0, 0.2)", | |
} as const |
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
from __future__ import annotations | |
from dataclasses import dataclass | |
from pathlib import Path | |
from typing import Any, Generic, Optional, TypeVar, cast, overload | |
from dotenv import dotenv_values # type: ignore | |
from typing_extensions import LiteralString | |
KI = TypeVar("KI", bound=LiteralString) |
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
from __future__ import annotations | |
from asyncio import Task, create_task | |
from dataclasses import dataclass | |
from typing import ( | |
Any, | |
AsyncIterable, | |
AsyncIterator, | |
Awaitable, | |
Callable, |
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
from __future__ import annotations | |
from dataclasses import dataclass | |
from typing import Any, ClassVar, Generic, Literal, NoReturn, Type, TypeAlias, TypeVar | |
from typing_extensions import LiteralString | |
K = TypeVar("K", bound=LiteralString) | |
V = TypeVar("V", covariant=True) | |
AnyPair: TypeAlias = tuple[LiteralString, Any] |
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
from __future__ import annotations | |
from typing import ( | |
Any, | |
Awaitable, | |
Callable, | |
Iterable, | |
Literal, | |
Mapping, | |
ParamSpec, |
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
// Iterator approach, seems to be good up until ~850 | |
type Result = Take<100, FizzBuzzIterator[1]> | |
// ["1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz", ...] | |
export type FizzBuzzIterator< | |
S extends Record<any, any> = { 3: []; 5: []; i: [] }, | |
R extends string = `${S[3]["length"] extends 3 ? "Fizz" : ""}${S[5]["length"] extends 5 ? "Buzz" : ""}` | |
> = [ | |
R extends "" ? `${S["i"]["length"]}` : R, | |
FizzBuzzIterator<{ |
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
export type Msg = { GotText: Http.Result<Error, string> } | |
export type Model = { Failure: [] } | { Loading: [] } | { Success: string } | |
// copy of https://guide.elm-lang.org/effects/http.html | |
export const main = ( | |
<ElmElement<Model, Msg> | |
init={() => [ | |
{ Loading: [] }, | |
Http.get({ | |
url: 'https://elm-lang.org/assets/public-opinion.txt', |
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 { readFileSync } from 'fs' | |
import { resolve } from 'path' | |
import ts from 'typescript' | |
import * as prettier from 'prettier' | |
/** | |
* reveal all top level `type` declarations from a file | |
*/ | |
export const reveal = (sourcePath: string) => { | |
const program = ts.createProgram([sourcePath], getConfig()) |
NewerOlder