npx create-react-app performance-demo --template typescript
cd performance-demo
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 firstRequest = () => | |
fetch("https://api.github.com/users/mikaelhadler").then((res) => { | |
console.log("First request completed"); | |
if (!res.ok) { | |
return res.json().then((errorData) => { | |
throw new Error(`Failed at firstRequest: ${errorData.message}`); | |
}); | |
} | |
return res.json(); | |
}); |
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
{ | |
"scripts": { | |
// ... | |
"db:migrate:up": "bun run -r dotenv/config ./src/lib/db/migrate latest", | |
"db:migrate:down": "bun run -r dotenv/config ./src/lib/db/migrate down", | |
"db:migrate:create": "bun run -r dotenv/config ./src/lib/db/migrate create initial", | |
"db:generate:types": "bunx kysely-codegen --out-file=src/lib/db/schema/Database.ts", | |
}, | |
"dependencies": { | |
"kysely": "^0.27.3", |
As configured in my dotfiles.
start new:
tmux
start new with session name:
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 | |
# bash script that can setup environment with common linting and testing tools | |
yes="${@}" | |
function yes_or_no { | |
if [[ $yes == "-y" ]]; then | |
echo "🛑👍🛑 !!! skipping question !!! 🛑👍🛑" | |
else |
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 Head from 'next/head' | |
import { useState } from 'react'; | |
const Home = (props) => { | |
let [email, setEmail] = useState(''); | |
const handleChange = (event, set) => set(event.value) | |
const addSubscribe = async () => { | |
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 | |
unsplash_user=$1 | |
if ! [ -x "$(command -v feh)" ]; then | |
echo 'Error: feh is not installed.' >&2 | |
exit 1 | |
fi | |
if ! [ -x "$(command -v wget)" ]; then | |
echo 'Error: wget is not installed.' >&2 |
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
#!/usr/bin/env bash | |
# screenshots stuff | |
# TODO: docs | |
function help_and_exit { | |
if [ -n "${1}" ]; then | |
echo "${1}" | |
fi | |
cat <<-EOF |
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 handleOpenPdf = url => { | |
const link = document.createElement('a') | |
link.href = url | |
link.target = '_blank' | |
document.body.appendChild(link) | |
link.click() | |
document.body.removeChild(link) | |
} |
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
" vim-bootstrap | |
"***************************************************************************** | |
"" Vim-PLug core | |
"***************************************************************************** | |
let vimplug_exists=expand('~/.vim/autoload/plug.vim') | |
let g:vim_bootstrap_langs = "html,javascript,python" | |
let g:vim_bootstrap_editor = "vim" " nvim or vim |
NewerOlder