Skip to content

Instantly share code, notes, and snippets.

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

Juan Pablo Hernandez Falciighol

📷
Say JS!
  • El Salvador
View GitHub Profile
@Falciighol
Falciighol / arrayPagination.js
Created March 13, 2020 22:15
[Array pagination] Slice an array with the page size and page number params #javascript #js
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));
@Falciighol
Falciighol / dragElement.js
Created March 16, 2020 22:59
[Draggable Element] Draggable HTML element script. #js #javascript
dragElement(document.getElementsByClassName("btn-group")[0]);
function dragElement(elmnt) {
var pos1 = 0,
pos2 = 0,
pos3 = 0,
pos4 = 0;
if (document.getElementsByClassName(elmnt.className + "-header")[0]) {
// if present, the header is where you move the DIV from:
document.getElementsByClassName(elmnt.className + "-header")[0].onmousedown = dragMouseDown;
@Falciighol
Falciighol / style.css
Last active July 29, 2021 21:16
[Sis. Contable Style] Default style #bonita #siscontable
:root {
--main-color: #233DF9;
--primary-color: #233df9;
--primary-font-color: #FFF;
--primary-border-color: #b5bdf9;
--primary-light-color: #F2F3FF;
--primary-transparent-color: #233df90F;
--seconday-color: #000000;
@Falciighol
Falciighol / Accounts.json
Last active June 14, 2021 22:48
[Cuentas] Listado de cuentas sistema contable #bonita #siscontable
[{
"cod": 1,
"name": "ACTIVO",
"level": 0,
"parent_id": null,
"type": 1,
"load_as": 1
},
{
"cod": 11,