Skip to content

Instantly share code, notes, and snippets.

View tpatel's full-sized avatar

Thibaut Patel tpatel

View GitHub Profile
// A person that can login to the SaaS
model User {
id String @id @unique @default(cuid())
name String?
email String?
Member Member[]
}
// A workspace of several persons, focused on one podcast
model Podcast {
@tpatel
tpatel / [slug].js
Created November 3, 2022 14:03
Example of GenerateBanners.com <=> Next.js integration for custom open graph images
import Head from "next/head";
import GenerateBanners from "@generatebanners/node-sdk";
const client = new GenerateBanners({
apiKey: process.env.GB_API_KEY,
apiSecret: process.env.GB_API_SECRET,
});
export default function Post({ post, image }) {
return (
@tpatel
tpatel / googly-eyes.js
Created January 22, 2022 22:03
p5.js implementation of googly eyes looking around (https://twitter.com/thibpat/status/1484628474002300928). Paste into https://editor.p5js.org/ to try it out!
let colors;
const colorOptions = ['green', 'darkblue', '#954535', 'black'];
function setup() {
createCanvas(400, 400);
colors = Array(10).fill(0).map(x => colorOptions[floor(random(0, colorOptions.length))]);
}
function eye(x, y, targetX, targetY, color) {
noFill();
stroke(0);
@tpatel
tpatel / faces.js
Created December 29, 2020 14:57
Draws many wobbly circles
const points = 16;
const maxNoise = 0.5;
const transparency = 0.05;
const lines = 1024;
const lineStepNoise = 0.001;
const minRadius = 10;
const maxRadius = 700;
function setup() {
createCanvas(500, 500);
background('#ffffff');
noLoop();
}
function randomLine(x, y, w, h) {
if(Math.random() < 0.5) {
line(x, y, x+w, y+h);
} else {
docker stop $(docker ps -a -q)
@tpatel
tpatel / run-node.sh
Created January 3, 2019 15:37
Run node on a setup without node \o/
docker run -p 3000:3000 -v $(pwd):/src -w /src node:10-alpine node main.js
var elems = [].slice.call(document.querySelectorAll('.js-issue.ghx-selected'));
var total = 0;
var count = 0;
elems.forEach(function(elem) {
var points = parseFloat(elem.querySelector('*[title="Story Points"]').innerText);
total += points;
count++;
})
alert(total + ' points\n' + count + ' tickets');
<!DOCTYPE>
<html>
<head>
<meta name="charset" content="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link href="//cdnjs.cloudflare.com/ajax/libs/normalize/6.0.0/normalize.min.css" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Open+Sans:400,300,700" rel="stylesheet" type="text/css">
<style>
html {
@tpatel
tpatel / readme.md
Created June 7, 2016 07:52
Convert a video to a gif
rm -rf /tmp/gif
mplayer -ao null <video file name> -vo jpeg:outdir=/tmp/gif
convert /tmp/gif/* /tmp/gif/output-temp.gif
convert /tmp/gif/output.gif -fuzz 5% -layers Optimize /tmp/gif/output-temp.gif