Skip to content

Instantly share code, notes, and snippets.

View feliche93's full-sized avatar

Felix Vemmer feliche93

View GitHub Profile
@feliche93
feliche93 / zod-lemon-squeezy-subscription.ts
Created June 26, 2023 09:00
Models to parse Lemon Squeezy Webhook Request
import { z } from 'zod';
import camelcaseKeys from 'camelcase-keys'
const camelize = <T extends readonly unknown[] | Record<string, unknown>>(
val: T,
) => camelcaseKeys(val)
const Urls = z.object({
update_payment_method: z.string(),
}).transform(camelize);
@feliche93
feliche93 / pricing.tsx
Last active June 26, 2023 08:30
Pricing Table with Lemon Squeezy Data Fetching
import { currentUser } from '@clerk/nextjs'
import { User } from '@clerk/nextjs/dist/types/server'
import { CheckIcon } from '@heroicons/react/20/solid'
import { getProductVariants } from '@lib/lemon-squeezy'
import { cn } from '@lib/utils'
import { JSDOM } from 'jsdom'
import { CheckoutButton } from './checkout-button'
import { Badge } from './ui/badge'
export default async function Pricing({
@feliche93
feliche93 / zod-lemon-squeezy.ts
Created June 26, 2023 08:27
Zod Models for Lemon Squeezy Fetching Products Request
import { z } from 'zod';
const SPagination = z.object({
currentPage: z.number(),
from: z.number(),
lastPage: z.number(),
perPage: z.number(),
to: z.number(),
total: z.number(),
});
@feliche93
feliche93 / lemon-squeezy.ts
Created June 26, 2023 08:23
Fetch Lemon Squeezy Products
"use server"
import { revalidatePath } from "next/cache";
import { SLemonSqueezyRequest, TLemonSqueezyRequest } from "./zod-lemon-squeezy";
const lemonSqueezyBaseUrl = 'https://api.lemonsqueezy.com/v1';
const lemonSqueezyApiKey = process.env.LEMON_SQUEEZY_API_KEY;
if (!lemonSqueezyApiKey) throw new Error("No LEMON_SQUEEZY_API_KEY environment variable set");
@feliche93
feliche93 / attestation.txt
Created April 11, 2022 22:30
Attestation
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: semaphore17
Contributor # 293
Hash: undefined
Circuit: semaphore16
Contributor # 297
Hash: 553aec2e 09336e08 75a1639b c81d87b7
151430b2 d1e6f37c e08a0abc 17208418