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
node_modules/ |
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
/** | |
* An enhanced version of localStorage. It's returns typed values for each key. | |
* One function it does not perform is the enumerating of all the values in | |
* localStorage and does not provide keys. You can use the localStorage for that | |
*/ | |
const ls = {}; | |
/** | |
* @param {string} key - the key of the item to remove from localstorage |
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
// inspired by https://github.com/pauldijou/redux-act | |
// TODO: talk about motivations, boilerplate, no action conflicts | |
// TODO: README | |
const ActionTypes = new Set(); | |
function actionCreater(type) { | |
if (ActionTypes.has(type)) { | |
throw new Error('action type already created '+ type); | |
} |
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
// use husky to add a precommit hook to your package.json like this | |
// npm install husky --save | |
// then in package.json do this under scripts | |
// "precommit": "node scripts/lint-staged.js", | |
// this file is soooo much less code and requires way less dependencies than lint-staged | |
// ideas taken from here https://github.com/okonet/lint-staged | |
const getStagedGitFiles = require('staged-git-files'); | |
const { CLIEngine } = require('eslint'); |
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
Show hidden characters
{ | |
"presets": ["@babel/preset-env"] | |
} |
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
{ | |
"name": "poller", | |
"version": "1.0.0", | |
"description": "", | |
"main": "poller.js", | |
"dependencies": {}, | |
"devDependencies": { | |
"chai": "^4.1.2", | |
"mocha": "^5.1.1" | |
}, |
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
const os = require("os"); | |
const ifaces = os.networkInterfaces(); | |
const ips = []; | |
for (let ifname in ifaces) { | |
ifaces[ifname].forEach(function(iface) { | |
if ("IPv4" !== iface.family || iface.internal) { | |
return; | |
} | |
ips.push({ |
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
A simple utility for running tasks. To run the test just install jest | |
npm install jest | |
jest taskRunner.js |
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
/** | |
* A simple throttle utility function. Usefull for expensive methods that | |
* might be called very rapidly in succession | |
* @param {number} delay - delay in millis to throttle the function callback | |
* @param {function} fn - the callback to invoke when throttled | |
* @return {function} a method to invoke many times during a period that you would like to throttle | |
*/ | |
module.exports = function throttler(delay, fn) { | |
if (typeof delay !== 'number') { | |
throw new Error('you must pass in a number'); |