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
// interweave two arrays with stretching; i.e. if one is shorter than the other, its elements are | |
// distributed to cover most of the final array | |
const interweave = (A, B) => { | |
// create [0..1] index of each item | |
const map = array => array.map((val, i) => ({ | |
array, | |
val, | |
index: array.length === 1 ? 0.5 : i / (array.length - 1) | |
})); |
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
/* | |
* Copyright 2016, Matthieu Dumas | |
* This work is licensed under the Creative Commons Attribution 4.0 International License. | |
* To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ | |
*/ | |
/* Identify rules in a given stylesheet and change them on the fly. | |
* var ss = StyleChanger("my_custom_identifier"); // stylesheet must have a dummy identifying rule like .my_custom_identifier{color:black;} | |
* ss.change("darkolivegreen", "blue"); // change all values with a given original value | |
* ss.change("darkolivegreen", "green"); // ...can be applied many times (original values are saved) |
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
/* | |
* Copyright 2016, Matthieu Dumas | |
* This work is licensed under the Creative Commons Attribution 4.0 International License. | |
* To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ | |
*/ | |
/* Usage : | |
* var log = Logger.get("myModule") // .level(Logger.ALL) implicit | |
* log.info("always a string as first argument", then, other, stuff) | |
* log.level(Logger.WARN) // or ALL, DEBUG, INFO, WARN, ERROR, OFF |