This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Client } = require('pg') | |
const fs = require('fs'); | |
const relations= [] | |
async function main() { | |
const client = new Client({ | |
connectionString: '', // e.g. postgres://user:password@host:5432/database | |
}) | |
await client.connect() | |
const res = await client.query(` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Yup from 'yup' | |
import { ObjectShape } from 'yup/lib/object' | |
declare module 'yup' { | |
interface ObjectSchema<TShape extends ObjectShape> { | |
unique(uniqueKey: string, message: string): ObjectSchema<TShape>; | |
} | |
} | |
Yup.addMethod(Yup.object, 'unique', function (uniqueKey: string, errorMessage: string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable jsx-a11y/anchor-is-valid */ | |
/* eslint-disable jsx-a11y/anchor-has-content */ | |
import { Trans } from "react-i18next" | |
const ALLOWED_TAGS = { | |
"a": <a />, | |
"b": <b />, | |
"i": <i />, | |
"u": <u />, | |
"s": <s />, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @UP | |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
-- Migration | |
-- This table will keep a list of migrations that have been run on this database. | |
-- | |
CREATE TABLE migration ( | |
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), | |
file TEXT NOT NULL, | |
hash TEXT NOT NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This script *tries* to find unused tranlations. :) | |
Do not expect 100% perfect detection, but it should give good enough results. | |
This script can detect: | |
``` | |
t('some_translation_key') // can be detected | |
let x: TranslationKey = "some_translation_key" // can be detected, because of the use of `t()` | |
let x = "some_translation_key" as TranslationKey // can be detected, because of the use of TranslationKey | |
<Trans i18nKey="some_translation_key"` /> can be detected, because of the use of prop i18nKey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inspired by | |
// https://hiddedevries.nl/en/blog/2017-01-29-using-javascript-to-trap-focus-in-an-element | |
import { ReactNode, useEffect, useRef } from "react" | |
type FocusableHTMLElement = HTMLButtonElement | |
type Props = { | |
children: ReactNode | |
} | |
export function FocusTrap({ children }: Props) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# INSTALL | |
# 1) clone to a folder (I have a ~/software one) | |
# 2) Add the following to your ~/.bashrc | |
# alias byzanz-record-window='/home/todd/software/byzanz-record-window' | |
# Delay before starting | |
DELAY=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert transparent.png -fuzz 5% -fill none -draw "matte 0,0 floodfill" -channel alpha -blur 0x1 -level 50x100% +channel -background transparent -flatten result.png |