This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isValidCPF(number) { | |
var sum; | |
var rest; | |
sum = 0; | |
if (number == "00000000000") return false; | |
for (i=1; i<=9; i++) sum = sum + parseInt(number.substring(i-1, i)) * (11 - i); | |
rest = (sum * 10) % 11; | |
if ((rest == 10) || (rest == 11)) rest = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Hoje iremos MUDAR a vida da pessoa que não te responde no whatsappp... | |
Que tal enviar mensagens pra ela até obter uma resposta?! | |
Sensacional não acha?! Mas, somos devs, correto?! Então vamos automatizar esse paranauê! | |
Para utilizar: | |
- Abra o web.whatsapp.com; | |
- Selecione a conversa que você quer; | |
- Abra o console e cole o código que está no gist; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const groupBy = (xs, key) => xs.reduce((rv, x) => { | |
(rv[x[key]] = rv[x[key]] || []).push(x); | |
return rv; | |
}, {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arrObj = [ | |
//Primeiro element | |
[{ | |
"name": "Distri Equipamente Cirurgicos", | |
"data": 18 | |
}, | |
{ | |
"name": "DNAPet", | |
"data": 70 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pairwise = (arr, arg) => | |
/* | |
Primeiro laço (reduce) com os numeros recebidos no array | |
Inicio o reduce com um array contendo 2 posições, um número inteiro que vai armazenar as somas dos indices e um | |
objeto que vai armazenar os indices já usados no processo | |
*/ | |
arr.reduce((acc, cur, indexR, arr) => { | |
/* | |
Segundo laço (forEach) para testar o valor recebido do reduce com cada valor do array com a finalizade de | |
satisfazer a condição do desafio |