Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
/** | |
* Get current day number of the given date. | |
* | |
* @param now Target date (current date by default). | |
*/ | |
const dayNumber = (now = new Date()) => | |
Math.floor( | |
(now.getTime() - new Date(now.getFullYear(), 0, 0).getTime()) / 864e5, | |
); |
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
javascript:((d,o,m)=>{d[m]=d[m]!==o?o:"off"})(document,"on","designMode") |
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
/** | |
* Get the CSS path of a given element. | |
* | |
* @param {Element} [element] Element to get the css path to. | |
* @param {string} [path=""] Path so far (used in recursion). | |
*/ | |
export const cssPath = (element, path = "") => | |
((tag, nth) => | |
tag | |
? cssPath( |
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
/** Takes a string and returns it's upper case */ | |
export const upperCase = <const Source extends string>(source: Source) => | |
source.toLocaleUpperCase() as Uppercase<Source>; | |
/** Takes a string and returns it's lower case */ | |
export const lowerCase = <const Source extends string>(source: Source) => | |
source.toLocaleLowerCase() as Lowercase<Source>; | |
/** Takes a `from` and a `to` and returns a random integer. */ | |
export const randomNumber = (from: number) => (to: number) => |