Skip to content

Instantly share code, notes, and snippets.

View davidcostadev's full-sized avatar
😎

David Costa davidcostadev

😎
View GitHub Profile
@davidcostadev
davidcostadev / .prettierrc
Created July 9, 2024 12:45
Project lint configs
{
"printWidth": 120,
"singleQuote": true,
"plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
"importOrder": ["^@(/.*|$)", "^[./]"],
"importOrderParserPlugins": ["typescript", "jsx", "decorators"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"tailwindFunctions": ["clsx"]
}
@davidcostadev
davidcostadev / next-js-app-folder-structure.txt
Created June 8, 2024 20:04
next js app folder structure
my-next-app/
├── src/
│ ├── app/
│ │ ├── [lang]/
│ │ │ ├── (auth)/
│ │ │ │ ├── login/
│ │ │ │ │ ├── page.tsx
│ │ │ │ └── register/
│ │ │ │ ├── page.tsx
│ │ │ ├── dashboard/
@davidcostadev
davidcostadev / createTask.test.tsx
Created November 9, 2020 23:28
Mock Apollo Mutation with Jest and typescript
import { useMutation } from "@apollo/client";
jest.mock("@apollo/client", () => {
const pkg = jest.requireActual("@apollo/client");
pkg.useMutation = jest.fn();
return pkg;
});
test("Should call the mutation as mock", async () => {
// hook/useName.js
import { useEffect, useState } from 'react';
const useName = () => {
const [name, setName] = useState('');
useEffect(() => {
setName('asdasdas')
}, [])
@davidcostadev
davidcostadev / formatAndReverseFormat.js
Created January 3, 2020 00:03
Javascript format and reverse format for currency
function format (lang, currency, number) {
return new Intl.NumberFormat(lang, { style: "currency", currency }).format(number);
}
function reverseFormat(lang, currency, money) {
const separatorDecimal = new Intl.NumberFormat(lang, {
style: "decimal"
})
.format(11.11)

TODO List Project

API spec of to handle with list of tasks

Features

  1. List
  2. Create
  3. Edit
  4. Delete
{
"Ansi 7 Color" : {
"Red Component" : 0.94901960784313721,
"Color Space" : "sRGB",
"Blue Component" : 0.94901960784313721,
"Alpha Component" : 1,
"Green Component" : 0.94901960784313721
},
"Tags" : [
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
I Pular para o começo da linha e entrar em INSERT
A Pular para o final da linha e entrar em INSERT
w Pular uma palavra para frente
b Pular uma palavra para traz
dw Excluir uma palavra
dd Exclui toda a linha
o Cria uma nova linha baixo
O Cria uma nova linha acima
docker run --rm -v $PWD:/data asciinema/asciicast2gif -s 2 https://asciinema.org/a/X82e8bpwwPAqIvTf9fHMjdjRA.json.json demo.gif