h - move cursor left
j - move cursor down
k - move cursor up
l - move cursor right
w - jump forwards to the start of a word
import { Kysely } from "kysely"; | |
import { PlanetScaleDialect } from "kysely-planetscale"; | |
import { type z } from "zod"; | |
import * as Models from "./prisma/generated/zod/modelSchema"; | |
type RemoveSchema<S extends string> = S extends `${infer Prefix}Schema` ? Prefix : S; | |
export type Database = { | |
[K in keyof typeof Models as RemoveSchema<K>]: z.infer<(typeof Models)[K]>; | |
}; |
import type { Kysely, RawBuilder } from "kysely"; | |
import type { Account } from "next-auth"; | |
import type { | |
Adapter, | |
AdapterSession, | |
VerificationToken, | |
AdapterUser, | |
} from "next-auth/adapters"; | |
import type { DB } from "shared"; |
import { useEffect, useState } from "react"; | |
import * as swc from "@swc/wasm-web"; | |
let __initialized = false; | |
type SWC = Omit<typeof swc, "default" | "initSync">; | |
let __swc: SWC; | |
export default function useSwc() { | |
const [initialized, setInitialized] = useState(__initialized); | |
const [_swc, setSwc] = useState<SWC>(__swc); |
// npm i clsx react-aria | |
import clsx from 'clsx'; | |
import Link, { LinkProps } from 'next/link'; | |
import React, { AnchorHTMLAttributes, useRef } from 'react'; | |
import { type AriaLinkOptions, useLink } from 'react-aria'; | |
export default function LLink( | |
props: AnchorHTMLAttributes<HTMLAnchorElement> & { | |
children: React.ReactNode; | |
next?: LinkProps; |
import autosize from "autosize"; | |
import { forwardRef, useEffect, useRef } from "react"; | |
const AutosizeTextarea = forwardRef< | |
HTMLTextAreaElement, | |
React.DetailedHTMLProps< | |
React.TextareaHTMLAttributes<HTMLTextAreaElement>, | |
HTMLTextAreaElement | |
> & { | |
onResize?: (target: HTMLTextAreaElement) => void; |
// npm i usehooks-ts | |
import { useEffect } from "react"; | |
import { useDarkMode } from "usehooks-ts"; | |
export function useTheme() { | |
const theme = useDarkMode(); | |
useEffect(() => { | |
if (theme.isDarkMode) { | |
document.body.classList.add("dark"); |
import { getYjsValue, syncedStore } from "@syncedstore/core"; | |
import { | |
DocTypeDescription, | |
MappedTypeDescription, | |
} from "@syncedstore/core/types/doc"; | |
import { useSyncedStore } from "@syncedstore/react"; | |
import { createContext, useContext, useEffect, useState } from "react"; | |
import { WebsocketProvider } from "y-websocket"; | |
import * as Y from "yjs"; |
// i like trpc. i like autocomplete. i like vercel/serverless. | |
// netlify acquired quirrel. | |
// theo would shill for a type safe option. | |
// there's a gap for a type-safe scheduling/cron/queuing/realtime and i want to fill it. | |
// also, quirrel has weird syntax for | |
// framing: typescript-first bindings for what you would typically use redis for | |
const appRouter = createRouter(); |
// app/routes/api/auth/$.ts | |
import NextAuth from "~/lib/next-auth/index.server"; | |
export const { action, loader } = NextAuth({ | |
providers: [ | |
GoogleProvider({ | |
clientId: env.GOOGLE_CLIENT_ID, | |
clientSecret: env.GOOGLE_CLIENT_SECRET, | |
}), | |
], |