Skip to content

Instantly share code, notes, and snippets.

View mikaelhadler's full-sized avatar
🌻
Make your reality

Mikael Hadler mikaelhadler

🌻
Make your reality
View GitHub Profile

Guia de Implementação Completo: Context API vs Redux Performance Demo

1. Setup Inicial

1.1. Criar o projeto

npx create-react-app performance-demo --template typescript
cd performance-demo
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();
});
{
"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",

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

#!/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
@mikaelhadler
mikaelhadler / index.js
Last active July 16, 2020 13:27
Nuxt.js problems mailchimp
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 () => {
#!/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
#!/usr/bin/env bash
# screenshots stuff
# TODO: docs
function help_and_exit {
if [ -n "${1}" ]; then
echo "${1}"
fi
cat <<-EOF
const handleOpenPdf = url => {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
" 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