Modern JavaScript
let
&const
- prefer const- Arrow functions >
function
// gross
function greet(greeting) {
return greeting
DOMAIN=$(git remote -v | head -1 | awk 'BEGIN{FS="@"} {print $2}' | sed -e 's/:.*//g') | |
REPO=$(git remote -v | grep 'origin' | head -1 | awk 'BEGIN{FS=":"} {print $2}' | sed -e 's/.git.*//g') | |
echo "Go to repo: https://$DOMAIN/$REPO" |
" -*- mode: vimrc -*- | |
"vim: ft=vim | |
" dotspaceneovim/auto-install {{{ | |
"Automatic installation of spaceneovim. | |
if has('nvim') | |
let s:config_dir = $HOME . '/.config/nvim' | |
else | |
let s:config_dir = $HOME . '/.vim' | |
endif |
async / await
, Promises, Higher-Order Functions & "Composition over Inheritance"Command - Tab / Command - Shift - Tab # Cycle active window forwards / backwards
Command - 1 / 2 / 3 ... 9 # select first tab, second tab third tab, or last tab (Chrome and Atom)
Command - R # Reload (Chrome)
Command - Space # Spotlight search (you should almost never have to use finder to open an application)
Command - S # Save (Atom, Word, almost any GUI application really)
/* | |
* Reusable Helpers (á la Professor Frisby): | |
* Note that in a real project, these would live in a separate file | |
* (e.g. `src/constants/helpers.js`) | |
*/ | |
function split(string, onChar) { | |
return string.split(onChar); | |
} | |
/* Designate filtered stems for concatenating to the result */ | |
const stems = { |
"use strict"; | |
function lookSay (number) { | |
/* Setup: | |
* Stringify the number, split it, | |
* then coerce each string to an integer | |
*/ | |
let split = `${number}`.split("").map(n => +n); | |
let acc = {}; | |
// '.reduce()' would be nice but it's not as efficient |
/* | |
* Performance Test at | |
* https://jsperf.com/interpolate-search/1 | |
*/ | |
"use strict"; | |
function interpolateSearch(array, target) { | |
var high = array.length - 1; | |
var low = 0; // lowest possible index of an array is 0 |
'use strict'; | |
var seq = [1, 4, 6, 3, 1, 4, 6, 3, 25, 593, 0, 53, 24, 352, 53905, 234]; | |
function merge(array) { | |
if (array.length < 2) { | |
console.log('returns ' + array); | |
return array; | |
} | |
var mid = array.length / 2; |