Skip to content

Instantly share code, notes, and snippets.

@merthanmerter
merthanmerter / actions.ts
Last active June 16, 2026 03:34
Next Safe Actions & React Hook Form - Reusable form component
// actions.ts
export const addUpdateProject = privateActionClient
.metadata({ actionName: 'addUpdateProject', description: 'Add or update a project.' })
.schema(projectsInsertSchema)
.action(
async ({ parsedInput, ctx }) => {
const { id, ...rest } = parsedInput
const [{ insertId }] = await ctx.db
.insert(projects)
@mattstobbs
mattstobbs / month-picker.tsx
Created July 26, 2023 22:15
A simple month picker that matches the style of shadcn/ui
import {
add,
eachMonthOfInterval,
endOfYear,
format,
isEqual,
isFuture,
parse,
startOfMonth,
startOfToday,