Skip to content

Instantly share code, notes, and snippets.

// run in console on a https page
stream = await navigator.mediaDevices.getUserMedia({ video: true, audio:true })
video = document.createElement("video");
video.muted = true;
video.srcObject = stream;
await video.play();
canvas = document.createElement("canvas")
ctx = canvas.getContext("2d")
ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
imageData = ctx.getImageData(0,0,video.videoWidth, video.videoHeight)
@dagingaa
dagingaa / backdateStripeSubscription.js
Created February 5, 2020 08:42
Backdates a Stripe subscription without triggering proration. Probably the easiest way to undo a mistake if you ended up screwing something up royally and need to reset.
const stripe = require("stripe")("api_key");
const CUSTOMER = "";
const PLAN = "";
const quantity = 1;
const startTimeInSecondsSinceEpoch = 0;
const billingCycleAnchorInSecondsSinceEpoch = 0;
async function foo() {
const subscription = await stripe.subscriptions.create({