Skip to content

Instantly share code, notes, and snippets.

@ecwyne
ecwyne / TypesafePusher.ts
Created July 14, 2022 15:53
Typesafe Pusher (validated with Zod)
import PusherServer from 'pusher';
import { z, ZodSchema } from 'zod';
import PusherClient from 'pusher-js';
const client = new PusherClient('...', { cluster: '...' });
const server = new PusherServer({
appId: '...',
key: '...',
secret: '...',
cluster: '...',
@ecwyne
ecwyne / by_office_metro.sql
Created April 3, 2024 20:27
Queries to get you started
SELECT
offices.id AS office_id,
offices.abbr AS metro_area,
substr (payments.date, 1, 7) AS mnth,
SUM(payments.amount) AS amount
FROM
payments
INNER JOIN transactions ON transactions.id = payments.transaction_id
INNER JOIN customers ON customers.id = transactions.customer_id
INNER JOIN offices ON offices.id = customers.office_id