Skip to content

Instantly share code, notes, and snippets.

View bricejulia's full-sized avatar

Brice Julia bricejulia

View GitHub Profile
@disintegrator
disintegrator / https-during-dev.macos.sh
Last active June 18, 2024 13:40
Use Caddy, mkcert and dnsmasq to expose your development server over HTTPS
brew install caddy mkcert nss dnsmasq
mkcert -install
mkcert '*.app.test' '*.cdn.test'
# rename the certs and move them under /usr/local/etc/caddy/certs
cat <<EOF > /usr/local/etc/caddy/Caddyfile
*.app.test:443, *.cdn.test:443 {
@hypeJunction
hypeJunction / refund.php
Last active June 26, 2023 02:58
Stripe Subscription Cancellation and Prorated Refund
<?php
class StripeSubscriptionHandler {
/**
* Cancel a Stripe subscription, optionally prorating and refunding the unused amount
*
* @param string $id Stripe Subscription ID
* @param bool $at_period_end Type of cancellation
* If set to true, will cancel the subscription at its end