Skip to content

Instantly share code, notes, and snippets.

View fubar's full-sized avatar

Phil Gebauer fubar

View GitHub Profile
1111!!!
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install -y nodejs yarn

If the Node project requires node-gyp:

@fubar
fubar / random-int.js
Created October 10, 2019 23:30
JS random integer in range (inclusive)
const randomInt = (min, max) => {
const diff = max - min;
const random = Math.floor(Math.random() * (diff + 1));
return min + random;
};
const distribution = {};
[...Array(10000)].forEach(() => {
const random = randomInt(1, 10);
const current = distribution[random] || 0;
@fubar
fubar / restify-errors.js
Created March 5, 2018 22:07
Adds type-hinting for the restify-errors library
const errors = require('restify-errors');
/**
* The purpose of this list is to add type-hinting for the restify-errors library.
* See https://github.com/restify/errors
*
* @type {Object}
*/
module.exports = Object.freeze({
@fubar
fubar / Request.js
Created March 5, 2018 22:05
restify: Adds type-hinting for unresolved properties and functions of restify's RestifyRequest class
const RestifyRequest = require('restify/lib/request');
/**
* The purpose of this class is to add type-hinting for unresolved properties and functions.
*
* restify's Request class is an extension of Node's http.IncomingMessage
*
* @class Request
*/

Shell

  [483] ./~/object.entries/index.js 316 bytes {0} [built]
  [484] ./~/object.entries/implementation.js 430 bytes {0} [built]
  [485] ./~/object.entries/polyfill.js 191 bytes {0} [built]
  [486] ./~/object.entries/shim.js 300 bytes {0} [built]

WARNING in ./~/highlight.js/lib/languages/autoit.js
Module parse failed: /Users/phil/dev/geek-tennis/node_modules/highlight.js/lib/languages/autoit.js Maximum call stack size exceeded
You may need an appropriate loader to handle this file type.
var promises = ['foo', 'bar'].map(id => {
return new Promise(resolve => {
couchDb.get(
id,
function (error, data) {
// error handling
return resolve(data);
}
)
});
@fubar
fubar / cheatsheet.md
Last active May 9, 2022 23:44
git cheat sheet

Branches

list branches
git branch [-a to include remote branches]

create branch [from master]
git checkout -b HS-1234 [master]

update master, rebase and push
git checkout master\