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
(async function() { | |
window.loadStyle = async (url) => { | |
if (Array.isArray(url)) return Promise.all(url.map(window.loadStyle)); | |
if (/\.js$/gi.test(url)) return window.loadScript(url); | |
if (document.querySelector(`link[href="${url}"]`)) return; | |
let link = document.createElement('link'); | |
link.rel = 'stylesheet'; | |
link.href = url; | |
document.head.appendChild(link); |
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
<?php | |
/** | |
* Prompts for a password on the commandline | |
* characters are not visible while the user types | |
* | |
* @param string $prompt (optional default to "Enter Password:") the text inviting the user to enter the password | |
* | |
* @return string the password entered | |
* |
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
/** | |
* This module allows to execute certain actions during scroll | |
* when a certain trigger is triggered | |
* | |
*/ | |
function init_scroll(opt) { | |
let opt_default = { | |
scroll_container: 'html, body', // the element in which we want to scroll |
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
/** | |
* waits for fn_cond() to return truthy value and then executes fn_exec() | |
*/ | |
function retry(fn_cond, fn_exec, max_retries = -5) { | |
if (max_retries == 0) return; | |
if (fn_cond()) return fn_exec(); | |
return setTimeout(_ => retry(fn_cond, fn_exec, max_retries-1), 100); | |
} |
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
import * as moment from 'moment'; | |
export const _ = { | |
sum, | |
mean, | |
traverse, | |
listMonths, | |
map2Obj, | |
sortBy, | |
values, |
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
/* ======================================================= */ | |
/* OPS SUR LES ENSEMBLES */ | |
/* ======================================================= */ | |
function xor(arr1, arr2, fn = null) { | |
let arr = [] | |
let xor1 = identity(arr1) | |
let xor2 = identity(arr2) | |
if (fn && typeof fn == 'string') { | |
xor1 = arr1.map(el => el[fn]) |
TODO : ajouter la fonction Unzip (à nettoyer depuis Inventaire.xlsm)
- getDirsize : (dirPath, optional recursive = True) renvoie la taille du dossier en octets
- getFileSize : (filePath) renvoie la taille du fichier en octets
- readFile : (filePath, optional encoding = "utf-8") renvoie le contenu du fichier
- coll2arr : transforme une collection en array
- trierArr : trie un array selon un critere
- countOccurArr : compte le nombre d'occurence d'une chaine dans un array
- arrayMerge : fusionne 2 arrays
- arrayPadding : complète un array avec une chaine pour qu'il atteigne une certaine longueur
NewerOlder