- [GitHub] styfle/awesome-online-ide - A list of awesome online development environments
This file contains hidden or 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
| /* | |
| based on: | |
| https://sqlpey.com/javascript/top-5-methods-to-generate-a-hash-from-a-string-in-javascript/#generating-a-hash-method-3-using-hexadecimal-output | |
| */ | |
| export const cyrb53Hex = (str: string, seed = 0) => { | |
| let h1 = 0xdeadbeef ^ seed, | |
| h2 = 0x41c6ce57 ^ seed | |
| for (let i = 0, ch; i < str.length; i++) { |
This file contains hidden or 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
| export const toObject = <K extends string | number, V>(arr: [K, V][]) => | |
| arr.reduce((obj, [key, value]) => { | |
| obj[key] = value | |
| return obj | |
| }, {} as Record<K, V>) | |
| export default toObject( | |
| Object.entries(import.meta.glob('./icons/*.svg', { eager: true, import: 'default' })).map( | |
| ([n, m]) => [ | |
| n.replace('./icons/', '').replace('.svg', ''), |
This file contains hidden or 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
| // ref.: https://plainjs.com/javascript/manipulation/unwrap-a-dom-element-35/ | |
| /** | |
| * unwrap the content of a given HTMLElement to the parent element at the previous | |
| * position of the given element | |
| * | |
| * @param {HTMLElement} element | |
| * @param {boolean} removeElement | |
| */ | |
| export const unwrap = (element: HTMLElement, removeElement = true) => { |
-
WebGL in Chrome - How to Enable, Disable and Troubleshoot | oTechWorld
-
[GitHub] add-qwq/WebGL-GPU-Detector - Check if the browser is enabled/supports WebGL GPU acceleration (JS component)
- gpu-detector.js - line 36
What Is Daylight Savings Time (DST)? - About 40% of countries use Daylight Saving Time. Learn how it works, what makes it controversial, and why it’s not actually saving any daylight.
This file contains hidden or 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
| /* | |
| Day.js - format | |
| https://day.js.org/docs/en/display/format | |
| */ | |
| const getLastSundaysOfYear = (year = new Date().getFullYear()) => { | |
| const currentYear = dayjs().year(year); | |
| const lastSundaysOfYearMap = new Map(); | |
| for(let i = 0; i < 12; i++) { | |
| const lastSundayOfMonth = currentYear.month(i).endOf('month').day(0); |
This file contains hidden or 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
| /* | |
| dynamic sorting an object array | |
| https://dev.to/fpaghar/donesort-an-array-of-objects-ways-in-javascript-48hl | |
| */ | |
| const SortDirection = { | |
| Asc: 1, | |
| Desc: -1 | |
| } as const; |
NewerOlder