Skip to content

Instantly share code, notes, and snippets.

View lionelB's full-sized avatar
🪂
Working from home

Lionel lionelB

🪂
Working from home
View GitHub Profile
async function batchPromise(items, handler, batchSize) {
const array = items.slice();
let results = [];
let i = 0;
while (array.length) {
const res = await Promise.all(array.splice(0, batchSize).map(handler));
console.log(`Performed operation for batch ${++i}.`);
results = results.concat(res);
}
return results;
function range(start, end, size = 1) {
return Array.from(
{ length: Math.ceil((end - start) / size) },
(_, i) => start + i * size
);
}
function batch(items, size) {
return range(0, items.length, size).map(val => {
return items.slice(val, val + size);
import Router from "next/router";
import { request } from "./request";
import { parse, serialize } from "cookie";
import { setRefreshTokenCookie } from "./setRefreshTokenCookie";
let token = null;
function getToken() {
return token ? token.jwt_token : null;
}
@lionelB
lionelB / .jmeter.env
Last active June 1, 2021 02:28
Install jmeter on Ubuntu
export JMETER_HOME=$HOME/apache-jmeter-5.2.1
export PATH=$PATH:$JMETER_HOME/bin/
@lionelB
lionelB / extensions
Last active October 14, 2019 07:26
vs code extensions
dbaeumer.vscode-eslint-1.9.1
editorconfig.editorconfig-0.13.0
equinusocio.vsc-material-theme-30.0.0
esbenp.prettier-vscode-2.3.0
jpoissonnier.vscode-styled-components-0.0.26
leizongmin.node-module-intellisense-1.5.0
mechatroner.rainbow-csv-1.3.1
ms-python.python-2019.10.41019
ms-vscode.vscode-typescript-tslint-plugin-1.2.2
ms-vsliveshare.vsliveshare-1.0.950
@lionelB
lionelB / diff.js
Created August 21, 2019 12:40
diff array of object
function diff(col1, col2, predicateFn = a => a) {
const contains = collection => value =>
collection.find(item => predicateFn(item) === value);
const col1Contains = contains(col1);
const col2Contains = contains(col2);
return {
col1: col1.filter(item => !col2Contains(predicateFn(item))),
col2: col2.filter(item => !col1Contains(predicateFn(item)))
};
}
@lionelB
lionelB / db.env
Last active November 18, 2019 11:18
launch matomo in a dev container, available at localhost:8080. once the install completed (db host is "db") , you will need to add vim using apt-get to edit the config.ini.php to allow host localhost:8080.
MYSQL_PASSWORD=matomo
MYSQL_DATABASE=matomo
MYSQL_USER=matomo

248 fiches Q/R particuliers

  • F100 Relations individuelles et collectives de travail » représentation du personnel dans l'entreprise»quels sont les moyens d'action du comité d'entreprise (ce) ?
  • F10008 Retraite » retraite des salariés du secteur privé»assuré polypensionné : quelles démarches effectuer pour demander sa retraite ?
  • F10030 Formation » formation des salariés du secteur privé»un salarié en formation garde-t-il ses droits à congés payés et à l'ancienneté ?
  • F1016 Congés » dans le secteur privé»fermeture de l'entreprise pour congés annuels : le salarié est-il indemnisé ?
  • F10431 Congés » dans le secteur privé»comment bénéficier d'un congé sans solde ?
  • [F1054](https://www.service-publ
soyons
eut
étais
serions
m
ont
été
était
serai
depuis
@lionelB
lionelB / sticky-focus.js
Created June 19, 2018 15:22 — forked from enwin/sticky-focus.js
Detect and change the scroll position when a focused element is under a sticky element
// sticky element
var stickyHeader = document.querySelector( '.intro-banner' );
function handleFocus( e ){
// don't try to change the scroll if the focused element is in the sticky element
if( stickyHeader.contains( e.target )){
return;
}
// quick & dirty client height on each focus