Skip to content

Instantly share code, notes, and snippets.

View ipetinate's full-sized avatar
🖖
Live long and prosper!

Isac Petinate ipetinate

🖖
Live long and prosper!
View GitHub Profile
@ipetinate
ipetinate / For.tsx
Created April 10, 2023 19:27
For component implementation, to abstract data map iteration inside components
// For.tsx
import { Key } from "react";
type TypeWithKey<T> = T & { key: Key };
type ForProps<T> = {
data: TypeWithKey<T>[];
each: (x: TypeWithKey<T>, key: Key) => JSX.Element;
};
@ipetinate
ipetinate / .prettierrc
Last active January 28, 2021 18:31
My favorite Prettier and VSCode config
{
"tabWidth": 2,
"useTabs": false,
"semi": false,
"jsxBracketSameLine": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true
}
@ipetinate
ipetinate / keybindings.json
Last active August 6, 2020 17:35
My Visual Studio Code settings and keybindings (keyboards shortcuts) for Linux (to be more similar to Windows natural shortcuts)
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+shift+c",
"command": "workbench.action.terminal.openNativeConsole",
"when": "!terminalFocus"
},
{
"key": "ctrl+shift+c",
"command": "-workbench.action.terminal.openNativeConsole",
@ipetinate
ipetinate / portuguese-paginator-intl.ts
Last active November 28, 2023 00:01
Tradutor para o Componente Paginador de Tabelas do Angular Material (no momento está configurado para traduzir do inglês para portugues).
import { MatPaginatorIntl } from '@angular/material';
const portugueseRangeLabel = (page: number, pageSize: number, length: number) => {
if (length === 0 || pageSize === 0) { return `0 de ${length}`; }
length = Math.max(length, 0);
const startIndex = page * pageSize;
const endIndex = startIndex < length ?