Skip to content

Instantly share code, notes, and snippets.

View thisavoropaev's full-sized avatar

Andrei Varapayeu thisavoropaev

View GitHub Profile
@krutoo
krutoo / parseMultiple.js
Last active January 26, 2022 19:31
date-fns parse multiple formats
import { default as parse } from 'date-fns/parse';
import { default as isValid } from 'date-fns/isValid';
// like parse but second argument must array of strings
// returns date
export const parseMultiple = (
dateString,
formatString,
referenceDate,
options
@terkel
terkel / _decimal.scss
Last active June 17, 2024 14:07
Rounding decimals in Sass
// _decimal.scss | MIT License | gist.github.com/terkel/4373420
// Round a number to specified digits.
//
// @param {Number} $number A number to round
// @param {Number} [$digits:0] Digits to output
// @param {String} [$mode:round] (round|ceil|floor) How to round a number
// @return {Number} A rounded number
// @example
// decimal-round(0.333) => 0