Skip to content

Instantly share code, notes, and snippets.

View idettman's full-sized avatar

Isaac A. Dettman idettman

View GitHub Profile

Zip excluding specific directories

Exclude .git file and node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*

Exclude .git file and files in node_modules directory, but keep node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*

Zip excluding specific directories

Exclude .git file and node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*

Exclude .git file and files in node_modules directory, but keep node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*
@idettman
idettman / gist:ab4806df4385d97e8597e220cb832437
Created November 29, 2017 03:08 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@idettman
idettman / node-and-npm-in-30-seconds.sh
Created February 23, 2018 19:27 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@idettman
idettman / h.js
Created February 23, 2018 19:33 — forked from isaacs/h.js
'use strict'
const test = require('tap').test
const server = {
inject: options => new Promise(r => r({ statusCode: 200, payload: 'Hello world' }))
}
test('Home entry', async t => {
const options = {
method: 'GET',
url: '/'
@idettman
idettman / smodule.js
Created February 23, 2018 19:34 — forked from isaacs/smodule.js
const s = require('http').createServer((q, s) => {
console.error(q.method, q.url)
switch (q.url) {
case '/':
return html(s)
case '/app.js':
return js(s)
@idettman
idettman / gist:e4686e78afac15987485a2e5f4de309a
Created February 23, 2018 19:40 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*