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 in javascript that performs a withdrawal based on the balance and an array of banknotes available, for example, I need to withdraw 5 reais, and there are notes of 5 notes of 10, 4 notes of 20, 3 of 50, 5 of 100, so it would not have value of 5 reais, and if I withdraw 550 I discount it on the bills and I always do it in the best way possible | |
function cashWithdrawal(value, availableNotes) { | |
let notes = []; | |
let availableNotesOriginal = structuredClone(availableNotes); | |
// array com os valores de todas as notas disponíveis | |
const allNotesValues = Object.keys(availableNotes).map((note) => Number(note)).sort((a, b) => b - a); | |
for (const subsetNotes of subsets(allNotesValues, 0, 2)) { | |
let remainingValue = value; | |
for (const noteValue of subsetNotes) { | |
// quantas notas desse valor eu preciso? |
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
import express from "express"; | |
import httpProxy from "http-proxy"; | |
const proxy = httpProxy.createProxyServer({ | |
changeOrigin: true, | |
}); | |
const app = express(); | |
function buildAuthHeader(user, pass) { | |
return "Basic " + Buffer.from(user + ":" + pass).toString("base64"); |
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="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<input name="laInicioMapa" id="laInicioMapa" value="-23.526217"> |