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
/* | |
* https://locutus.io/php/strings/number_format/ | |
* _number_format(number:number, decimals:number, decPoint:string, thousandsSep:string):string | |
* Returns a string which represents the number formatted | |
*/ | |
const _number_format = (number, decimals, decPoint, thousandsSep) => { | |
// eslint-disable-line camelcase | |
number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); | |
var n = !isFinite(+number) ? 0 : +number; |
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
/* | |
* The aim of this file is get the correct video url from a youtube playlist to automatize the audio download with youtube-dl | |
*/ | |
const fs = require('fs'); | |
const filename = './videos.txt'; | |
const lines = require('fs').readFileSync(filename, 'utf-8') | |
.split('\n') | |
.filter(Boolean); |
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
/* | |
* Returns an array with the new interest rate when two companies (A and B) swap their interest rate on an arbitrage operation. | |
* [New cost for company A, new cost for company B] | |
* fixedA<number>: The fixed interest rate of a loan for the company A. | |
* variableA<number>: The variable interest rate of a loan for the company A. | |
* fixedB<number>: The fixed interest rate of a loan for the company B. | |
* variableB<number>: The variable interest rate of a loan for the company B. | |
* winA<number>: Part (between 0 and 1) of the arbitrage benefits company A will get. | |
* winB<number>: Part (between 0 and 1) of the arbitrage benefits company B will get. | |
* aIsFixed<boolean>: If true, the initial interest rate of A is fixed and the new interest rate is variable and viceversa. |