Skip to content

Instantly share code, notes, and snippets.

View Falciighol's full-sized avatar
📷
Say JS!

Juampa Falciighol

📷
Say JS!
View GitHub Profile
@Falciighol
Falciighol / pagoFunc.js
Last active August 4, 2022 07:14
[Excel PAGO Func] Función PAGO de Excel en Javascript #js #bp
// Basado en la formula de matemática financiera:
// https://luismasanchezmaestre.files.wordpress.com/2014/08/calculo-anualidad.jpg
var a = 0;
// Monto
var co = 5700;
// Años
var n = 13;
// Pagos Anuales
var m = 12;
// Tasa Interes
@Falciighol
Falciighol / numberToLetters.js
Created October 15, 2019 17:04
[Number to Letters] Change a number (Integer/Double) value to letters #js #bp
var numeroALetras = (function() {
// Código basado en el comentario de @sapienman
// Código basado en https://gist.github.com/alfchee/e563340276f89b22042a
function Unidades(num) {
switch (num) {
case 1:
return 'UN';
case 2:
return 'DOS';
@Falciighol
Falciighol / countriesList.json
Last active October 20, 2022 02:49
[Countries list] Countries list (in spanish) #json #list #bp
[
{
"CODPAIS": 93,
"DESPAIS": "AFGANISTAN"
},
{
"CODPAIS": 355,
"DESPAIS": "ALBANIA"
},
{
@Falciighol
Falciighol / svDepartments.json
Created October 30, 2019 15:42
[El Salvador Departments] El Salvador departments list #json #list #bp
[
{
"DESDEPTO": "AHUACHAPAN",
"CODDEPTO": 1
},
{
"DESDEPTO": "SANTA ANA",
"CODDEPTO": 2
},
{
@Falciighol
Falciighol / svMunicipalities.json
Created October 30, 2019 15:47
[El Salvador Municipalities] El Salvador municipalities list #json #list #bp
[
{
"DESCIUDAD": "AHUACHAPAN",
"CODDEPTO": 1,
"CODCIUDAD": 1
},
{
"DESCIUDAD": "APANECA",
"CODDEPTO": 1,
"CODCIUDAD": 2
@Falciighol
Falciighol / professions.json
Created October 30, 2019 19:25
[Professions List] Professions list in spanish #json #bp #list
[
{
"CODPROFESI": 1,
"DESPROFESI": "ABOGADO"
},
{
"CODPROFESI": 2,
"DESPROFESI": "AEROTECNICO"
},
{
@Falciighol
Falciighol / consoleScriptCall.js
Created November 12, 2019 21:45
[Console Script Call] Call an external or local script from console #js #bp
document.head.appendChild(Object.assign(
document.createElement('script'),
{ src: 'https://momentjs.com/downloads/moment-with-locales.js' }
));
// Example
console.log(moment("2011-10-31", "YYYY-MM-DD").format('DD/MM/YYYY'));
@Falciighol
Falciighol / ageCalc.js
Created January 13, 2020 22:17
[Age Calculator] Javascipt age calculator script #js
var run = () => {
var birth = new Date("1999-3-22");
var curr = new Date();
var diff = curr.getTime() - birth.getTime();
console.log("Edad: " + Math.floor(diff / (1000 * 60 * 60 * 24 * 365.25)));
}
run();
@Falciighol
Falciighol / timerDate.groovy
Created January 14, 2020 22:02
[Timer Date] Set and return the timer date in Bonita #groovy #bp #bonita
import java.time.LocalDate;
// New calendar instance
Calendar calendar = GregorianCalendar.getInstance();
LocalDate dt = LocalDate.parse("2020-01-15");
Integer day = 0, month = 0, year = 0;
year = dt.getYear();
@Falciighol
Falciighol / csvCreator.js
Created March 10, 2020 04:01
[CSV from Array]
const rows = [
["name1", "city1", "some other info"],
["name2", "city2", "more info"]
];
let csvContent = "data:text/csv;charset=utf-8," + rows.map(e => e.join(",")).join("\n");
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);