This file contains 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
[].slice.call(document.querySelectorAll('.js-file-header')) | |
.filter((item) => item.dataset.path.indexOf('{file-name-part}') > -1 && !item.parentNode.classList.contains('Details--on')) | |
.map((header) => header.querySelector('.js-details-target')) | |
.forEach((item) => item.click()) |
This file contains 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
const processNumber = (data, condition, message) => data + (condition ? message : ''); | |
const hasNoRemainder = (number, divider) => number % divider === 0; | |
const rule = (value, message) => (number, data) => | |
processNumber(data, hasNoRemainder(number, value), message); | |
const rules = [ | |
rule(3, 'Fizz'), | |
rule(5, 'Buzz') |
This file contains 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
const monthsLater = (date, months) => | |
[ | |
(dateArg) => new Date(dateArg), | |
(dateObj) => dateObj.setMonth(dateObj.getMonth() + months), | |
(timestamp) => new Date(timestamp), | |
String | |
].reduce( | |
(value, fn) => fn(value), | |
date | |
); |
This file contains 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
const getRatio = (w, h) => | |
( | |
h/w > w/h | |
? [w/w, h/w] | |
: [w/h, h/h] | |
) | |
.map( | |
(number) => Number(number.toFixed(2)) | |
) | |
.join(' : '); |
This file contains 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
const px2vw = (value) => (100 * value) / 1920; |
This file contains 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
const vh2vw = (value) => value / (16 / 9); |