Skip to content

Instantly share code, notes, and snippets.

View LeandroGazoli's full-sized avatar
🏠
Working from home

Leandro Gazoli LeandroGazoli

🏠
Working from home
View GitHub Profile
function handleLoading() {
const time = 2000;
return new Promise((resolve) => setTimeout(resolve, time));
}
@LeandroGazoli
LeandroGazoli / AWS-ES2-NODE-EXPRESS
Created June 29, 2023 19:39
AWS ES2 NODE EXPRESS
Configurando AWS ES2 FREE TIER PARA API NODE EXPRESS
##confirgurando primeiros passos
1- acesse aws
2- Serviços ES2
3- Executar instancia / nova intancia
4- Criar chave SSH,
5- Salve a chave SSH em um ambiente seguro
6- Nas suas i
@LeandroGazoli
LeandroGazoli / Validacao regex.txt
Created May 19, 2023 17:48
validação numero de telefone Brasileiro com todas as entradas
^\s*\(?(\d{2})\)?[-. ]?(\d{1})?[-. ]?(\d{4})[-. ]?(\d{4})[-. ]?\s*
aceita os seguintes formatos:
11 12341234,
11 1234-1234,
11 1234 1234,
(11) 12341234,
(11) 1234-1234,
(11) 1234 1234,
11 912341234,
@LeandroGazoli
LeandroGazoli / TypographyBehind.css
Created May 17, 2023 18:51
Text Typography Behind
h1 {
display: grid;
grid-template-columns: 1fr max-content 1fr;
align-items: center;
gap: 0.5rem;
}
h1:before,
h1:after {
content: '';
@LeandroGazoli
LeandroGazoli / validation hex color regex .ts
Last active May 19, 2023 17:49
Regex for validation Hex color code
// Regex: /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/
// Example:
const hexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
if (!hexRegex.test(color)) {
throw new Error('Invalid hex color');
}
@LeandroGazoli
LeandroGazoli / Regex for brazilian numbers.js
Last active August 24, 2022 20:07
Regex for brazilian numbers
export function validateNumberBrazillian(phoneNumber){
phoneNumber = phoneNumber.replace(/[^\d]/g, ""); //remove all non digits
return phoneNumber.replace(/(\d{2})(\d{1})(\d{4})(\d{4})/, "($1) $2 $3-$4");
}
@LeandroGazoli
LeandroGazoli / option-group::PDO.php
Created March 30, 2021 14:10
option group / optgroup em php Brasil
//faz as chamadas da classe event
//dentro da classe event criamos a função de conectar com o banco de dados
//e criamos algumas funções que fazem algumas requisições de busca
//Obs da para melhorar usando metodo POST e fazendo um case tudo dentro de uma unica função (Atualização em Breve)
//Nesse caso inner right e left não irão funcionar
if ($eventContarLoja > 0){
$categoriaEvent = $event->getCategorias(); //Busca no bando de dados as categorias do sistema salvas no banco de dados e validam se esta ativo e disponivel ao usuario final
foreach ($categoriaEvent as $rowCategoria) {
$clausula1 = $rowCategoria['CategoriasLojas']; // salva as informações em uma variavel de clausulas para facilitar a leitura do codigo
@LeandroGazoli
LeandroGazoli / openweathermap.js
Last active February 24, 2021 12:47
api import JSON openweathermap
function previsaoDoTempo (cidade, api){
var gjson
var cidade
var api
cidade = document.getElementById('cidade').value
cidadeLimpo = cidade.trim()
console.log(cidadeLimpo)
gjson = getJSON('api.openweathermap.org/data/2.5/weather?q='+ cidadeLimpo +'&appid='+ api +')
gparse = []
gparse = JSON.parse(gjson)
@LeandroGazoli
LeandroGazoli / gist:b26d26649e7624069efe10e2255f865b
Created February 22, 2021 15:14
celsius para fahrenheit tempo real
function cal(tipo) {
if (tipo === 'c') {
var c = eval(document.getElementById('c').value)
var soma = (c*9/5) + 32
document.getElementById('f').value = soma
console.log(soma)
}
if (tipo === 'f') {
var f = eval(document.getElementById('f').value)
console.log(f)
@LeandroGazoli
LeandroGazoli / gist:14a318cce8b3286979ca8e504ee040ea
Last active February 24, 2021 12:46
celsius para fahrenheit tempo real
<input onkeyup="cal('c')" id="c" type="number" name="c" placeholder="insirir valor de c" value="0">
<input onkeyup="cal('f')" id="f" type="number" name="f" placeholder="insirir valor de f" value="0">
<script>
function cal(tipo) {
if (tipo === 'c') {
var c = eval(document.getElementById('c').value)
var soma = (c*9/5) + 32
document.getElementById('f').value = soma