Skip to content

Instantly share code, notes, and snippets.

View max10rogerio's full-sized avatar
🎯
Focusing

Max Rogério max10rogerio

🎯
Focusing
  • Maringá, Paraná - Brasil
View GitHub Profile
@max10rogerio
max10rogerio / useQuery.ts
Created August 31, 2021 01:52
useQuery Hook - React with react-router-dom - TS
import { useLocation } from "react-router-dom";
/**
* Get URL query params as object
*
* Example:
*
* ```tsx
* type Query = {
* q: string
@max10rogerio
max10rogerio / command.sh
Created September 6, 2021 17:59
POSTGRES - DOCKER - Restore database
❯ cat database.dump | docker exec -i server_postgres_1 psql -U postgres -W postgres -p 5432 -h 127.0.0.1 -d database
@max10rogerio
max10rogerio / example.ts
Last active November 24, 2021 17:35
Typescript spy mock pattern example
/**
* global describe
*/
namespace Command {
export type NotAsync = String
}
/**
* Generic interface basead in design pattern: https://refactoring.guru/design-patterns/command
@max10rogerio
max10rogerio / yup.locale.pt-br.js
Last active August 23, 2023 17:43
Translation of the main messages from the Yup library into the Pt-Br language.
/* eslint-disable */
// For more infos, see: https://github.com/jquense/yup/blob/master/src/locale.js
import { setLocale } from 'yup'
const translation = {
mixed: {
default: '${path} é inválido',
required: '${path} é um campo obrigatório',
oneOf: '${path} deve ser um dos seguintes valores: ${values}',
notOneOf: '${path} não pode ser um dos seguintes valores: ${values}',
@max10rogerio
max10rogerio / clipboard.ts
Last active November 22, 2023 00:13
Example Copy to Clipboard with Typescript
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard
/**
* Interface CopyToClipboard params
*/
interface ICopyToClipboard {
/** HTML reference identifier ```<div id="foo"></div>``` */
target?: string;
/** String value */
value?: string;
@max10rogerio
max10rogerio / slugify.ts
Last active March 21, 2024 20:18
Typescript slug function
// MIT License
// Copyright (c) 2023 Max Rogério
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: