Skip to content

Instantly share code, notes, and snippets.

@adamjcooper
adamjcooper / Setup
Created February 4, 2022 22:17
Setup git slog (short log)
git config --global alias.slog 'log --pretty=oneline --abbrev-commit'
# Automatically call `nvm use`/`nvm install` after `cd` or `git checkout` to use
# the version of Node.js defined in .nvmrc (or the default Node.js version if
# there is no .nvmrc and you are in a directory with a package.json file).
# This first `nvm_after_cd` function is based on the function recommended in the
# official documentation at
# https://github.com/nvm-sh/nvm/tree/2c0c34f10e6f415d1c6f60c54fcbf53a7670dec6#bash,
# but avoids calling `nvm` when there is no package.json present so that `cd` is
# not so slow all the time.
@adamjcooper
adamjcooper / git-delete-merged-branches.sh
Last active August 22, 2019 16:14
Bash function to delete local git branches which have been merged to master
# Thanks https://stevenharman.net/git-clean-delete-already-merged-branches
function git-delete-merged-branches {
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d
}
@adamjcooper
adamjcooper / npm-module-aliases.sh
Last active January 9, 2017 15:44
npm module aliases
# --- npm module aliases ---
alias gulp='./node_modules/gulp/bin/gulp.js'
alias mocha='./node_modules/mocha/bin/mocha'
alias bunyan='./node_modules/bunyan/bin/bunyan'
alias istanbul='./node_modules/istanbul/lib/cli.js'
alias eslint='./node_modules/eslint/bin/eslint.js'
alias tslint='./node_modules/tslint/bin/tslint'
alias tsc='./node_modules/typescript/bin/tsc'
@adamjcooper
adamjcooper / useful-mac-apps.md
Created January 7, 2017 12:53
Useful mac apps
@adamjcooper
adamjcooper / private.xml
Last active January 7, 2017 12:43
Karabiner private.xml
<?xml version="1.0"?>
<root>
<appdef>
<appname>WEBSTORM</appname>
<equal>com.jetbrains.WebStorm</equal>
</appdef>
<appdef>
<appname>ONENOTE</appname>
<equal>com.microsoft.onenote.mac</equal>
</appdef>
@adamjcooper
adamjcooper / keybindings.json
Last active January 7, 2017 11:56
vs code keybindings
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "cmd+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "cmd+alt+shift+r",
"command": "editor.action.rename",
"when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
@adamjcooper
adamjcooper / git-prompt.sh
Last active January 12, 2022 16:20
git prompt setup for mac ~/.bash_profile, with active python virtualenv
export BASH_SILENCE_DEPRECATION_WARNING=1
eval "$(/opt/homebrew/bin/brew shellenv)"
# --- git command prompt ---
# Pre-requisites:
# brew install bash-completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi