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
Easily check JavaScript KeyboardEvent properties (e.key, e.code, e.which, | |
e.keyCode… and more) with Key.js: | |
https://keyjs.dev | |
Key Code | Key Description | |
---------------------------- | |
0 | Unidentified key | |
1 | | |
2 | |
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 fs = require('fs'); | |
module.exports = class FileChunksReader { | |
constructor(filepaths, callback, config = {}) { | |
if (!Array.isArray(filepaths) || filepaths.length < 1 || typeof callback !== 'function') { | |
throw new Error('Constructor signature not matching actual parameters.'); | |
} | |
this.options = { | |
chunkSize: config.chunkSize || 1024, // 1 KB |
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
import { useCallback, useEffect, useRef, useState } from 'react'; | |
import { FIELD_THROTTLE_RATE } from '../../components/form/form.constants'; | |
import { getFakeChangeEvent } from '../../components/form/utils/form-events.utils'; | |
import { FormValue } from '../../data/common/types/common.types'; | |
import { useThrottledCallback } from './throttled-callback.hook'; | |
export function useInputState<V extends FormValue = FormValue>( | |
initialValue: V, |
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
import React, { useEffect, useRef } from 'react'; | |
/** | |
* Use setInterval with Hooks in a declarative way. | |
* | |
* @see https://stackoverflow.com/a/59274004/3723993 | |
* @see https://overreacted.io/making-setinterval-declarative-with-react-hooks/ | |
*/ | |
export function useInterval( | |
callback: React.EffectCallback, |
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
#!/usr/bin/python3 | |
import sys | |
import re | |
import subprocess | |
PROJECT_IDS = ['SLO'] | |
BRANCH_TYPES = ['feature', 'bug', 'hot'] |
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 users = [{ | |
name: 'Charlie', | |
ranking: 30, | |
}, { | |
name: 'Alice', | |
ranking: 10, | |
}, { | |
name: 'Eve', | |
ranking: 40, | |
}, { |
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
// requestAnimationFrame POLYFILL //////////////////////////////////////////////////////////////////// | |
// requestAnimationFrame and cancelAnimationFrame polyfill based on Erik Möller's one: https://gist.github.com/paulirish/1579671 | |
// MDN Docs: https://developer.mozilla.org/es/docs/DOM/window.requestAnimationFrame | |
// @source https://gist.github.com/Danziger/fc83f1b2f16f70655a4a | |
// @license MIT license | |
(function(strict, calculations){ | |
"use strict"; | |
var vendors = ['webkit', 'moz', 'ms', 'o']; |