View FileChunksReader.js
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 |
View input-state.hook.ts
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, |
View interval.hook.ts
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, |
View commit-msg
#!/usr/bin/python3 | |
import sys | |
import re | |
import subprocess | |
PROJECT_IDS = ['SLO'] | |
BRANCH_TYPES = ['feature', 'bug', 'hot'] |
View coding-test.js
const users = [{ | |
name: 'Charlie', | |
ranking: 30, | |
}, { | |
name: 'Alice', | |
ranking: 10, | |
}, { | |
name: 'Eve', | |
ranking: 40, | |
}, { |
View rAF.js
// 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']; |