Instantly share code, notes, and snippets.

View iTerm2.md

iTerm2 Shortcuts

Tab navigation

  • open new tab: Cmd + t
  • next tab: Cmd + Shift + ]
  • previous tab: Cmd + Shift + [

Pane navigation

View js-micro.js
// Array literal (= []) is faster than Array constructor (new Array())
// http://jsperf.com/new-array-vs-literal/15
var array = [];
// Object literal (={}) is faster than Object constructor (new Object())
// http://jsperf.com/new-array-vs-literal/26
var obj = {};
// property === undefined is faster than hasOwnProperty(property)
// Note: don't use this in cases where 'undefined' is a possible value for your properties
View MacOS_iTerm2_shortcuts.md

MacOS + iTerm2 shotcuts

Some custom useful shortcuts when I use MacOS + iTerm2.

iTerm2

iTerm2 useful shortcuts * Configure your shortcuts as screenshot above.

Shortcuts:

View RxJS_6_changes.md
View arrow_factorial.js
const factorial = n => n > 1 ? n * factorial(n - 1) : 1
factorial(6)
// 720
// function factorial (n) {
// var total = 1
// for (i = 1; i <= n; i++) {
View .gitignore
*.~
**/*.gz
**/*.tar
**/*.tgz
**/*.log
**/*.env
**/*.zip
**/*.map
**/*cache
**/.DS_Store
View for-vs-map.js
var Benchmark = require('benchmark');
var expect = require('expect');
var suite = new Benchmark.Suite;
var testArray = [1,2,3,4,5,6,7,8,9,10,11,12,13];
var resultat = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26];
suite
.add('forHoley', () => forHoley(testArray))
.add('forPush', () => forPush(testArray))
View env_validator.js
const env = (key) => process.env[key] || null
const debug = (obj) => console.dir(obj, { colors: true })
const validator = (vlist = []) => {
const errors = []
vlist.forEach(v => {
if (!env(v)) errors.push(`No '${v}' supplied!`, v)
})
View to_boolean.js
/**
* Convert a mixed value into a boolean
*
* @param {string|number|object} value
* @returns {boolean}
*/
function toBoolean (value) {
if (!value) return false
if (typeof value === 'boolean') return value