Skip to content

Instantly share code, notes, and snippets.

@zwhitchcox
zwhitchcox / create_views.ts
Created July 22, 2023 19:31
create periodic views with typescript and prisma
import { format, zonedTimeToUtc } from "date-fns-tz";
import { Group, Period } from "./types";
import { prisma } from './db';
/*
* This was copied from http://npm.im/strip-indent
*/
export const stripIndent = (str: string) => {
const match = str.match(/^[ \t]*(?=\S)/gm)
@zwhitchcox
zwhitchcox / gather
Last active November 22, 2023 03:26
copy files to clipboard for chatgpt
#!/bin/zsh
# Function to copy content to clipboard
copy_to_clipboard() {
echo "$1" | pbcopy
}
# Function to process files and copy to clipboard
process_files() {
local content=""
Some tools I use regularly include:
- TypeScript
- Node.js
- Remix (the web framework)
- postgresql
- prisma
- Tailwind
- React
---
- Always show code when suggesting changes, preferably first.
@zwhitchcox
zwhitchcox / .gitconfig
Last active April 16, 2024 08:34
git aliases
[alias]
a = add
aa = add --all
d = diff
dc = diff --cached
pl = pull
pu = push
puf = push --force
puom = push -u origin master
s = status
type CombineTuples<T extends [[number] | number[]] | ([number] | number[])[]> =
T extends [infer A, ...infer B]
? A extends number[] | [number]
? B extends [number[] | [number]] | ([number] | number[])[]
? [...A, ...CombineTuples<B>]
: never
: never
: []
type J = CombineTuples<[[1, 2, 3], [4, 5, 6]]>
@zwhitchcox
zwhitchcox / calendar.ts
Created October 22, 2025 21:14
responsive shadcn calendar
import * as React from 'react'
import { DayPicker } from 'react-day-picker'
import { cn } from '#app/utils/misc.js'
import { buttonVariants } from './button'
import { Icon } from './icon'
export type CalendarProps = React.ComponentProps<typeof DayPicker>