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
// 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: |
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 */ | |
// 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}', |
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
// 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; |
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
/** | |
* global describe | |
*/ | |
namespace Command { | |
export type NotAsync = String | |
} | |
/** | |
* Generic interface basead in design pattern: https://refactoring.guru/design-patterns/command |
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
❯ cat database.dump | docker exec -i server_postgres_1 psql -U postgres -W postgres -p 5432 -h 127.0.0.1 -d database |
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 { useLocation } from "react-router-dom"; | |
/** | |
* Get URL query params as object | |
* | |
* Example: | |
* | |
* ```tsx | |
* type Query = { | |
* q: 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
// Example | |
// https://www.typescriptlang.org/play?#code/MYewdgziA2CmB0w4EMBOAKAlAKG6SALgATCqzIGwBKsAZrGWMLEQLxHpm0BcRYArgFsARg0y8IBVAEswAczYA+IgAMAOgBINAby4BfFXnCSSZCrAAKaZINiVUAaVgBPNhwDWLiVNlzxRSRl5JVVuHU9nA1x8EwIQAGUARQAZNwAeABUiWAAPSjAAEwgiEGEAK1hgYnZkMGdFdAgAR2hvILkAGiIAB2tbewheDP8AbUDfLtrnEYBdGZDtbCJlojhiLgBJQty3AEYllbW+WAB3eJa3ZugD5ZjiWDAfWGL2AHlyyoJ4B6eIdF7UDY7AwIDgViRjMQ0KgrIDBC8iLNcODaCAMHdEREugA3ZDQfiweYgWjZR4yZ6YIiLcHgjEAoH2NykciUWEMhhOZzoCJgmm3SFEMhyHbsMCnIg0OQAURy3X+fWBqC6AHI5MreXyMVwGA9mEyzJQaPRGMxOHQtgVcjgbjSxWcLqLTudoPAyN1oMhTULcl1tSbYNa+ctoWz4fBuvwIAALdC4-EBm3gzbbHIAalTNr0yJWZAI-FQYERdudk1QML6EBm2Cz2Fk9lonpYoeK1JWYCBbV8NrRltQvGVAEF4gBhZVEAA+RGVABEpSPlTboNJBNICLwBCIGNXcAB6HdECJ8IFEWREWjSVAmbogCCr6TgIyEHoV3a8ZtuVvLdu2fuCZA5ZUOm7VBe37IdRyA8ElxXNciF2AAGICaz3A8XCPWwT0LD0rxvO8HzpCsACY3wrD9gNAqdwMAxdl1XXgEMgtsOynP8AKQ6IBSuNxDHBCBYDgKoiETFYACpGL5bhoNXIghxPfIIAAfW6BglOQYUbVoVAQEEISgyIAhkGEOBdJWE4ox1Ey+TAbSWHYbhv1gciGCIYRXAcohuB7LcoNo4hJN87BDEfEwyAgfhoAIXY3DiJJkjSZsGiuLp6XhXYcC1Z5woIQjooSFJ4orRKWmSojr |
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
interface Api { | |
post: <R = any, P = any>(params: P) => Promise<R> | |
} | |
/* | |
A api espera user_login, user_password | |
E response user_name, user_age, user_status | |
*/ | |
type ApiResponse = { | |
user_name: 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
interface Example { | |
first_name: string, | |
last_name: string, | |
home_town: string, | |
} | |
type CamelizeString<T extends PropertyKey> = T extends string ? string extends T ? string : | |
T extends `${infer F}_${infer R}` ? `${F}${Capitalize<CamelizeString<R>>}` : T : T; | |
type Camelize<T> = { [K in keyof T as CamelizeString<K>]: T[K] } |
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
SELECT | |
E'@Column({ name: \'' || column_name || E'\', type: \'' || data_type || E'\'})' | |
FROM | |
INFORMATION_SCHEMA.COLUMNS | |
WHERE | |
TABLE_NAME = 'yourtable' | |
AND TABLE_SCHEMA = 'your schema if necessary'; |
NewerOlder