Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dsumer's full-sized avatar
🙌
Hey!

Dominik Sumer dsumer

🙌
Hey!
View GitHub Profile
@dsumer
dsumer / paddle.interface.ts
Created May 18, 2022 11:13
TypeScript types for the Paddle Subscription webhook payloads
export interface PaddlePassthrough {
userId: string; // the id of the user in our supabase database
}
export enum PaddleSubscriptionStatus {
Active = 'active',
Trialing = 'trialing', // at the moment we don't support trial phases
PastDue = 'past_due', // Payment is pending, we should inform he user that he needs to update his payment method
Paused = 'paused', // at the moment we don't support pausing subscriptions
Cancelled = 'deleted',
@dsumer
dsumer / validate-paddle-webhook.ts
Created May 18, 2022 11:09
A function which validates Paddle Webhook requests
import type { NextApiRequest } from 'next';
import crypto from 'crypto';
import * as Serialize from 'php-serialize';
const allowedIpAdresses = [
// Sandbox
'34.194.127.46',
'54.234.237.108',
'3.208.120.145',
// Production
@dsumer
dsumer / Dockerfile
Last active March 14, 2022 20:37
Dockerfile playwright
FROM ubuntu:focal
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=Europe/Vienna
# === INSTALL Node.js ===
RUN apt-get update && \
# Install node16
apt-get install -y curl wget && \
@dsumer
dsumer / TaxRateModel.ts
Last active February 2, 2022 15:07
Apply the correct VAT Rate to your customer in Stripe Checkout
import { Model } from 'objection';
export default class TaxRateModel extends Model {
countryCode!: string;
stripeId!: string;
static tableName = 'tax_rate';
}
@dsumer
dsumer / AbstractModel.js
Last active December 8, 2017 01:36
linkState for mobx-state-tree
import {types, getType} from 'mobx-state-tree';
function getValueFromPath(value, valuePath) {
if (valuePath) {
const path = valuePath.split('.');
let endValue = value;
for (const pathItem of path) {
endValue = endValue[pathItem];
}
return endValue;