Skip to content

Instantly share code, notes, and snippets.

View AZagatti's full-sized avatar
🎯
Focusing in learn

André Zagatti AZagatti

🎯
Focusing in learn
View GitHub Profile
{"version":1,"resource":"file:///Users/azagatti/Downloads/Projects/candidate/src/components/atoms/input-date/dates.ts","entries":[{"id":"xUy4.ts","source":"Fix all ESLint auto-fixable problems","timestamp":1650138015651},{"id":"tVf8.ts","source":"renamed.source","timestamp":1650138061019},{"id":"XuY3.ts","source":"Fix all ESLint auto-fixable problems","timestamp":1650138681735},{"id":"HSVa.ts","source":"Fix all ESLint auto-fixable problems","timestamp":1650138711444}]}
@AZagatti
AZagatti / useForm.ts
Created October 28, 2020 02:00
useForm
import { useCallback, useState, ChangeEvent } from "react";
function useForm<T>(initialData: T) {
const [values, setValues] = useState<T>(initialData);
const setValue = useCallback((key: string | null, value: string) => {
if (!key) return;
setValues((state) => ({ ...state, [key]: value }));
}, []);
@AZagatti
AZagatti / pdf.ts
Created August 6, 2020 14:21
PDF
import PDFDocument from 'pdfkit';
import {
copyFileSync,
createWriteStream,
existsSync,
mkdirSync,
readdirSync,
readFileSync,
statSync,
watchFile,
@AZagatti
AZagatti / validators.js
Created July 29, 2020 18:31
Validation Functions
/* eslint eqeqeq: [0, "smart"] */
export const getValidTelefone = value => {
const regex = /^[1-9]{2}9?[1-9]\d{7}$/;
const telefone = value.replace(/\D/g, '');
if (regex.test(telefone)) {
return Boolean(telefone);
}
return false;
};
import React from 'react';
import {
Route as ReactDOMRoute,
RouteProps as ReactDOMRouteProps,
Redirect,
} from 'react-router-dom';
import { useAuth } from '../hooks/auth';
interface RouteProps extends ReactDOMRouteProps {
@AZagatti
AZagatti / .dockerignore
Created July 27, 2020 12:43
Server config
.git
build
node_modules
.env
docker-compose.yml
Dockerfile
./certs
@AZagatti
AZagatti / webpack.dev.ts
Created July 23, 2020 20:31
Webpack config
require('dotenv').config();
const Dotenv = require('dotenv-webpack');
import * as webpack from 'webpack';
const HtmlWebpackPlugin = require('html-webpack-plugin');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const htmlPlugin = new HtmlWebpackPlugin({
template: './public/index.html',
});
@AZagatti
AZagatti / docker
Created July 5, 2020 00:01
Docker Images Deploy
docker run -d --name postgresql -e POSTGRESQL_PASSWORD=my_password -e POSTGRESQL_USERNAME=my_user -e POSTGRESQL_DATABASE=my_db -p random_port:5432 bitnami/postgresql:latest
docker run -d --name mongodb -e MONGODB_USERNAME=my_user -e MONGODB_PASSWORD=my_password -e MONGODB_DATABASE=my_db -p random_port:27017 bitnami/mongodb:latest
docker run -d --name redis -e REDIS_PASSWORD=my_password -p random_port:6379 bitnami/redis:latest
@AZagatti
AZagatti / .eslintignore
Created June 5, 2020 03:17
Eslint e Prettier TS
**/*.js
node_modules
build
@AZagatti
AZagatti / main.c
Last active June 9, 2020 18:20
Linked List
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node *next;
};
void printList(struct Node *start) {