This file contains 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 paginate(array, page_size, page_number) { | |
// human-readable page numbers usually start with 1, so we reduce 1 in the first argument | |
return array.slice((page_number - 1) * page_size, page_number * page_size); | |
} | |
console.log(paginate([1, 2, 3, 4, 5, 6], 2, 2)); | |
console.log(paginate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], 4, 1)); |
This file contains 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
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')); |
This file contains 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
[ | |
{ | |
"CODPROFESI": 1, | |
"DESPROFESI": "ABOGADO" | |
}, | |
{ | |
"CODPROFESI": 2, | |
"DESPROFESI": "AEROTECNICO" | |
}, | |
{ |
This file contains 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
[ | |
{ | |
"DESCIUDAD": "AHUACHAPAN", | |
"CODDEPTO": 1, | |
"CODCIUDAD": 1 | |
}, | |
{ | |
"DESCIUDAD": "APANECA", | |
"CODDEPTO": 1, | |
"CODCIUDAD": 2 |
This file contains 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
[ | |
{ | |
"CODPAIS": 93, | |
"DESPAIS": "AFGANISTAN" | |
}, | |
{ | |
"CODPAIS": 355, | |
"DESPAIS": "ALBANIA" | |
}, | |
{ |
This file contains 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
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'; |
This file contains 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
// 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 |
This file contains 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
/*************************************************************/ | |
// NumeroALetras | |
// The MIT License (MIT) | |
// | |
// Copyright (c) 2015 Luis Alfredo Chee | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights |