Skip to content

Instantly share code, notes, and snippets.

View brunobertolini's full-sized avatar
🎯
Focusing

Bruno Bertolini brunobertolini

🎯
Focusing
View GitHub Profile

Link da tarefa no Trello

Descrição

Descreva brevemente do que se trata essa PR, se é uma correção de bug, adição de nova funcionalidade, etc.

Qual era o comportamento antigo?

Descreva como funcionava o projeto sem essa adição.

@brunobertolini
brunobertolini / use-storage.js
Created January 15, 2024 13:48
A react useState with localStorage persistence
import { useEffect, useState } from 'react'
export const useStorage = (key, defaultValue) => {
const [value, setValue] = useState(() => {
const storedValue = typeof window !== 'undefined' && window?.localStorage.getItem(key)
return (storedValue && JSON.parse(storedValue)[key]) || defaultValue
})
useEffect(() => {
const valueToStore = { [key]: value }
[
{
"gameTime": "2022-11-20T16:00:00Z",
"homeTeam": "cat",
"awayTeam": "equ"
},
{
"gameTime": "2022-11-21T13:00:00Z",
"homeTeam": "ing",
"awayTeam": "ira"
@brunobertolini
brunobertolini / safari-flex-gap-polyfill.css
Created December 8, 2021 14:30
A Flex Gap polyfill to old Safari versions using Tailwind
@supports (-webkit-touch-callout: none) {
.gap-2.flex:not(.flex-col):not(.flex-wrap) > *:not(:last-child) {
margin-right: 0.5rem;
}
.gap-3.flex:not(.flex-col):not(.flex-wrap) > *:not(:last-child) {
margin-right: 0.75rem;
}
.gap-4.flex:not(.flex-col):not(.flex-wrap) > *:not(:last-child) {
{
"editor.suggestSelection": "first",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"github.copilot.enable": {
"yaml": false,
"*": true,
"plaintext": true,
"markdown": false
SPACESHIP_PROMPT_ORDER=(
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
exec_time # Execution time
line_sep # Line break
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
@brunobertolini
brunobertolini / vscode.keybindings.json
Last active February 27, 2021 13:34
vscode-terminal
// Empty
[
{
"key": "cmd+k cmd+o",
"command": "workbench.action.addRootFolder"
},
{
"key": "cmd+j",
"command": "workbench.action.toggleMaximizedPanel",
"when": "!terminalFocus"
[alias]
k = !gitk --all &
dismiss = reset HEAD --hard
rollback = reset --soft HEAD~1
unstage = reset HEAD --
undo = checkout --
redo = commit --amend --no-edit
sane = remote prune origin
send = push origin $(git rev-parse --abbrev-ref HEAD)
l = log --graph --pretty=format:'%C(yellow)%h%Creset %Cgreen%cr %C(bold blue)%an%Creset - %s%C(red)%d%Creset' --abbrev-commit --max-count=30
import * as R from 'ramda'
export const between = (num: number, min: number, max: number) =>
R.max(min, R.min(num, max))
export const paginate = (
records: number,
limit: number = 10,
current: number = 1,
delta: number = 1,
@brunobertolini
brunobertolini / .env
Last active August 7, 2018 19:44
Instance setup scripts
#!/bin/bash