This file contains hidden or 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 dijkstra(graph, start) { | |
const queue = [[0, start]]; | |
const shortestPaths = {}; | |
for (const vertex in graph) { | |
shortestPaths[vertex] = Infinity; | |
} | |
shortestPaths[start] = 0; | |
while (queue.length > 0) { | |
queue.sort((a, b) => a[0] - b[0]); |
This file contains hidden or 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
# You will need Termux from f-droid: https://f-droid.org/en/packages/com.termux/ | |
termux-setup-storage | |
pkg update && apt-get update | |
pkg upgrade -y && apt-get upgrade -y | |
pkg install wget openssl-tool proot -y | |
hash -r | |
wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Ubuntu/ubuntu.sh | |
bash ubuntu.sh | |
clear && ./start-ubuntu.sh |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="pt-BR"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Máscara de CPF</title> | |
</head> | |
<body> | |
<form> | |
<label for="cpf">CPF:</label> |
This file contains hidden or 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 validarCPF(cpf) { | |
cpf = cpf.replace(/[^\d]+/g, ''); | |
if (cpf.length !== 11 || /^(\d)\1+$/.test(cpf)) { | |
return false; | |
} | |
let soma = 0; | |
let resto; |
This file contains hidden or 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
//Confirma que "true" e "false" são do tipo boolean | |
console.log(typeof true) //Output: "boolean" | |
console.log(typeof false) //Output: "boolean" | |
//Se tentar fazer parseInt em true e false, retorna "Not a Number" (NaN) | |
console.log(parseInt(true)) //Output: NaN | |
console.log(parseInt(false)) //Output: NaN | |
//Mas nesses casos true vale como 1 e false, como 0 | |
console.log(true + 2) //Output: 3 |