Skip to content

Instantly share code, notes, and snippets.

View mahdisoultana's full-sized avatar
🙂
Web Development Is My Passion.

Mahdi mahdisoultana

🙂
Web Development Is My Passion.
View GitHub Profile
@mahdisoultana
mahdisoultana / map.js
Created February 18, 2021 13:27 — forked from AugustMiller/map.js
Map a number in one range to a number in another.
const mapNumber = (number, in_min, in_max, out_min, out_max) => {
return (number - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
};
@mahdisoultana
mahdisoultana / 1-CalendarItem.js
Created July 16, 2022 12:11 — forked from getify/1-CalendarItem.js
a non-trivial example of newer JS class features
class CalendarItem {
static #UNSET = Symbol("unset")
static #isUnset(v) {
return v === this.#UNSET;
}
static isSameItem(item1,item2) {
if (#ID in item1 && #ID in item2) {
return item1.#ID === item2.#ID;
}
else {