Skip to content

Instantly share code, notes, and snippets.

View JakobTischler's full-sized avatar

Jakob Tischler JakobTischler

  • Berlin, Germany
View GitHub Profile
@JakobTischler
JakobTischler / normalize-in-range.js
Created August 11, 2021 09:55
Normalizes a `value` between `min` and `max` and then casts it onto a range between `rangeMin` (defaults to 0) and `rangeMax` (defaults to 1). The initial normalization can be clamped between 0 and 1 (`clamp`, defaults true). The return value describes where `value` would lay if `min` and `max` were represented by the `rangeMin` and `rangeMax` r…
/**
* Normalizes a `value` between `min` and `max` and then casts it onto a range between `rangeMin`
* (defaults to 0) and `rangeMax` (defaults to 1). The initial normalization can be clamped between
* 0 and 1 (`clamp`, defaults true). The return value describes where `value` would lay if `min`
* and `max` were represented by the `rangeMin` and `rangeMax` range.
*
* Read as: "value is to min and max as result is to rangeMin and rangeMax"
*
* @param {number} value The value to cast.
* @param {number} min The lower value of the normalization set. `min < max` must be true.
@JakobTischler
JakobTischler / TVMaze-Set-Episode-Status.js
Created August 11, 2021 10:08
Goes through defined seasons and sets their episodes' status to the wanted status.
/**
* Delays the script execution for a specified amount of time. Returns a promise that gets resolved after `amount` ms. Must be called in an `async` function with `await`.
* @param {Number} amount The length in ms. Default: `1000`.
* @returns {Promise} The promise.
*/
function sleep(amount = 1000) {
return new Promise((resolve) => {
setTimeout(resolve, amount);
});
}
@JakobTischler
JakobTischler / Frank Herbert - Dune #1 - Dune.cue
Created August 27, 2021 13:02
Dune series Audiobook .cue files
FILE ""
TRACK 1 AUDIO
TITLE "Book One: Dune — Chapter 1"
INDEX 01 0:0:00
TRACK 2 AUDIO
TITLE "Chapter 2"
INDEX 01 35:22:46
TRACK 3 AUDIO
TITLE "Chapter 3"
INDEX 01 62:48:28