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 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, | |
| }), | |
| ], |