Skip to content

Instantly share code, notes, and snippets.

View stwgabriel's full-sized avatar
🚀
constantly improving

Gabriel Silva stwgabriel

🚀
constantly improving
View GitHub Profile

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@stwgabriel
stwgabriel / Context.tsx
Created September 28, 2022 14:00
useContext base
import {
createContext,
useMemo,
useState,
} from 'react';
const Context = createContext({});
function Provider({ children }) {
@stwgabriel
stwgabriel / useClickOutside.ts
Last active September 15, 2022 15:20
click outside to close hook
import { useEffect, useRef } from 'react';
function useClickOutside(handler: () => void, additionalTriggerElement?: Element) {
const domNodeRef = useRef(null);
useEffect(() => {
function outsideHandler(event: Event) {
const lowercase = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
const uppercase = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
const numbers = [0,1,2,3,4,5,6,7,8,9];
const symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', ']', '^', '_', '{', '|', '}', '~'];
@stwgabriel
stwgabriel / Arrays com os meses e dias da semana javascript pt-BR
Last active April 6, 2021 21:36
Arrays com os meses do ano e os dias da semana em javascript | pt-BR
//meses
const months = [
'Janeiro',
'Fevereiro',
'Março',
'Abril',
'Maio',
'Junho',
///////////// settings.json
{
"editor.fontFamily": "fira code",
"editor.fontSize": 17,
"editor.fontWeight": "normal",
"editor.tabSize": 3,
"editor.renderWhitespace": "none",
"editor.minimap.enabled": false,
"editor.fontLigatures": true,
"editor.renderLineHighlight": "gutter",