Skip to content

Instantly share code, notes, and snippets.

View amosbastian's full-sized avatar
🚀

Amos Bastian amosbastian

🚀
View GitHub Profile
{
"about-us.amos-description": "Amos description",
"about-us.amos-title": "Code slave",
"about-us.heading": "About us",
"about-us.kristina-description": "Kristina description",
"about-us.kristina-title": "Napoleon",
"about-us.natalia-description": "Natalia description",
"about-us.natalia-title": "The brains",
"about-us.subtitle": "Description of the about us section",
"account-settings-form.country-label": "Country",
@amosbastian
amosbastian / route.ts
Last active August 6, 2024 20:08
Lemon Squeezy webhook using the new route handler in Next.js 13
import crypto from "crypto";
import { listAllSubscriptions } from "lemonsqueezy.ts";
import { NextRequest } from "next/server";
// Put this in your billing lib and just import the type instead
type LemonsqueezySubscription = Awaited<ReturnType<typeof listAllSubscriptions>>["data"][number];
const isError = (error: unknown): error is Error => {
return error instanceof Error;
};
@amosbastian
amosbastian / index.ts
Created June 13, 2023 15:27
Mailing.run + Resend.com
import { openPreview, render } from "mailing-core";
import { Resend } from "resend";
import type { CreateEmailOptions, CreateEmailRequestOptions } from "resend/build/src/emails/interfaces";
const BRAND_NAME = "Template";
const BASE_URL = "https://example.com";
const resend = new Resend(process.env["RESEND_API_KEY"]);
function extractHostname(url: string): string {
@amosbastian
amosbastian / sst-auth.ts
Last active June 20, 2024 20:58
SST code adapter auth
// auth function
import { CodeAdapter } from "sst/auth/adapter";
import { auth } from "sst/aws/auth";
import { createSessionBuilder } from "sst/auth";
// This can be whatever you want
export const session = createSessionBuilder<{
account: {
accountId: string;
email: string;