Skip to content

Instantly share code, notes, and snippets.

@nnance
nnance / del_node_modules.sh
Created October 6, 2019 23:52 — forked from gordlea/del_node_modules.sh
delete node_modules recursively
#!/bin/bash
# taken from https://coderwall.com/p/guqrca/remove-all-node_module-folders-recursively
find . -name "node_modules" -exec rm -rf '{}' +
@nnance
nnance / homebridge
Last active November 19, 2018 16:11 — forked from johannrichard/homebridge
Systemd Service for homebridge (http://github.com/nfarina/homebridge)
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*
@nnance
nnance / static_server.js
Created February 24, 2016 06:25 — forked from respectTheCode/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
mime = require("mime")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
@nnance
nnance / backbone.fetch.js
Created November 29, 2015 14:55 — forked from akre54/backbone.fetch.js
Backbone.ajax with window.fetch
var defaults = function(obj, source) {
for (var prop in source) {
if (obj[prop] === undefined) obj[prop] = source[prop];
}
return obj;
}
var stringifyGETParams = function(url, data) {
var query = '';
for (var key in data) {
var _ = require('underscore');
var Backbone = require('backbone');
var cheerio = require('cheerio');
var request = require('request');
Backbone.ajax = function(options) {
options.json = true;
return request(options, function(error, result) {
if (error) {
@nnance
nnance / aggregate.js
Last active September 20, 2015 00:09
Aggregate data from MongoDB with Node.js and mongoose
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
//Database connection
var uristring = 'mongodb://localhost/test';
var mongoOptions = { };
mongoose.connect(uristring, mongoOptions, function (err, res) {
if (err) {
console.log('Error when connecting to: ' + uristring + '. ' + err);
@nnance
nnance / gulpfile.js
Last active September 11, 2015 04:04 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
var gulp = require('gulp'),
express = require('express'),
sass = require('gulp-sass'),
spawn = require('child_process').spawn,
livereload = require('gulp-livereload');
var EXPRESS_PORT = 4000;
var EXPRESS_ROOT = '_site/'
Create separate SSH key for your personal account and your company. Named them with different extensions in your .ssh folder. Upload them to your github account and finally create a config file for your SSH
Create a config file in ~/.ssh/
vim config:
# PERSONAL ACCOUNT Github
Host github.com-COOL
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_COOL