Skip to content

Instantly share code, notes, and snippets.

View LeonardoJaques's full-sized avatar
:octocat:
Codding...

Leonardo Jaques LeonardoJaques

:octocat:
Codding...
View GitHub Profile
@khorramk
khorramk / cors fix
Created January 29, 2021 21:34
Client side Cors error fix
fetch(url, {
method: "get", //put your method
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest",
"Access-Control-Allow-Origin": "*"
},
mode: 'no-cors'
});
@richardtallent
richardtallent / eslint-package-json.js
Last active February 27, 2024 15:40
Example eslint config in a package.json
"prettier": {
"useTabs": true,
"semi": false,
"singleQuote": false,
"bracketSpacing": true,
"trailingComma": "es5",
"printWidth": 160
},
"eslintConfig": {
"parserOptions": {
@jkrems
jkrems / es-module-history.md
Last active March 16, 2025 13:43
History of ES modules

Modules - History & Future

History

function telefone_validation(telefone) {
//retira todos os caracteres menos os numeros
telefone = telefone.replace(/\D/g, '');
//verifica se tem a qtde de numero correto
if (!(telefone.length >= 10 && telefone.length <= 11)) return false;
//Se tiver 11 caracteres, verificar se começa com 9 o celular
if (telefone.length == 11 && parseInt(telefone.substring(2, 3)) != 9) return false;
@sergiolopes
sergiolopes / lazyload-v2.js
Last active February 11, 2024 23:54
Lazy load de imagens beeem simples
(function(){
// como vamos usar o throttle varias vezes (no scroll e no resize),
// encapsulei essa funcionalidade numa função
function throttle(fn) {
fn.jarodei = false;
return function(){
if (fn.jarodei) return;
fn.jarodei = true;