This file contains hidden or 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
// https://www.typescriptlang.org/docs/handbook/advanced-types.html | |
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html | |
/** | |
* Enlève les clés K de T (plus précis que le Omit natif). | |
*/ | |
type OmitStrict<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> | |
/** | |
* Récupère la version promisifiée d'une fonction. |
This file contains hidden or 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
/** | |
* Use with await to have synchrone delay | |
*/ | |
const delay = (ms: number) => new Promise<void>(resolve => setTimeout(resolve, ms)) | |
/** | |
* Retry a promise a number of times if it failed | |
*/ | |
async function retry<T>(promise: Promise<T>, maxRetries: number, delayBetweenRetriesMs: number = 0) { | |
let res: T |
This file contains hidden or 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
// Generate class helpers for size properties such as margin, padding, font-size | |
// Usage : | |
// @include marginer(5, 60, 5) | |
// .mt5 will then add margin-top:5px to the element, | |
// and so on for each side, from 5px to 60px with a 5px step. | |
@mixin marginer($min, $max, $step) { | |
.mt#{$min} {margin-top: $min*1px} | |
.mb#{$min} {margin-bottom: $min*1px} | |
.ml#{$min} {margin-left: $min*1px} |
NewerOlder