Skip to content

Instantly share code, notes, and snippets.

View dantailby's full-sized avatar

Daniel Tailby dantailby

  • Marks & Spencer
View GitHub Profile
@dantailby
dantailby / bash-npm-autocomple.sh
Created June 17, 2016 21:16
bash npm autocompletion
# BASH standalone npm install autocomplete. Add this to ~/.bashrc file.
_npm_install_completion () {
local words cword
if type _get_comp_words_by_ref &>/dev/null; then
_get_comp_words_by_ref -n = -n @ -w words -i cword
else
cword="$COMP_CWORD"
words=("${COMP_WORDS[@]}")
fi
@dantailby
dantailby / zsh-npm-autocomplete.sh
Last active June 20, 2016 07:59
.zsh npm autocompletion
# ZSH standalone npm install autocompletion. Add this to ~/.zshrc file.
_npm_install_completion() {
local si=$IFS
# if 'install' or 'i ' is one of the subcommands, then...
if [[ ${words} =~ 'install' ]] || [[ ${words} =~ 'i ' ]]; then
# add the result of `ls ~/.npm` (npm cache) as completion options
compadd -- $(COMP_CWORD=$((CURRENT-1)) \
COMP_LINE=$BUFFER \
var fs = require('fs'),
npm = require('npm'),
_ = require('lodash'),
madge = require('madge');
module.exports = function() {
var obj = {};
npm.load({production:true,json:true}, function(err, npm) {
@dantailby
dantailby / Copy Git History - Repo to Subdir.md
Last active May 12, 2016 13:02
This Gist contains instructions of how to preserve Git history of an existing repository as you convert that repo into a subdirectory of a larger repo.

Preface

@mintuz gist contains instructions of how to preserve history of a subdirectory between repos, for example a template or lib within morph-renderer which you are transferring into morph-modules. However this script doesn't work for a whole repository, such as something already (incorrectly) versioned or a standalone lib.

Based off of article found here: http://www.nomachetejuggling.com/2011/09/12/moving-one-git-repo-into-another-as-subdirectory

Instructions

You have two repos here. morph-modules and my-module. We will be copying 'my-module' and preserving it's history into morph-modules/my-module.`