Skip to content

Instantly share code, notes, and snippets.

View migtibincoski's full-sized avatar
💻
Working as a freelancer...

Miguel Tibincoski migtibincoski

💻
Working as a freelancer...
View GitHub Profile
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]);
@migtibincoski
migtibincoski / setup-termux.sh
Created September 28, 2024 21:51
How to mine on any android device with CPUMiner & Termux
# 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
@migtibincoski
migtibincoski / mascaraCPF.html
Last active August 9, 2024 01:16
Máscara de CPF aplicada a um input em HTML
<!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>
@migtibincoski
migtibincoski / validaCPF.js
Created August 9, 2024 01:08
Validação de CPF com JavaScript
function validarCPF(cpf) {
cpf = cpf.replace(/[^\d]+/g, '');
if (cpf.length !== 11 || /^(\d)\1+$/.test(cpf)) {
return false;
}
let soma = 0;
let resto;
@migtibincoski
migtibincoski / CalculationsUsingTrueOrFalse.js
Created October 8, 2022 03:18
Calculations using True or False (boolean)
//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