- Debian/Ubuntu Server is assumed
- Designed to run on Docker Host Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/* | |
Browserify Example: | |
var bsHelp = require('./bootstrap-helpers'); | |
bsHelp.modal({ | |
content: [element|html], | |
title: 'Hello World', | |
success: [fn], | |
cancel: [fn] | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
# ^^^^^^^ PRODUCTION SERVER SETUP ^^^^^^^ | |
export NODE_ENV=production | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var inherits = require('inherits'), | |
EventEmitter = require('events').EventEmitter; | |
function BaseController($scope, $http, $location) { | |
if (!(this instanceof BaseController)) { return new BaseController.apply(null, [].slice(arguments)); } | |
$scope.load = this.load; | |
this.$scope = $scope; | |
this.$location = $location; | |
this.$http = $http; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extend(obj, src) { | |
Object.getOwnPropertyNames(src) | |
.forEach( (propName) => Object.defineProperty(obj, propName, Object.getOwnPropertyDescriptor(src, propName)) ); | |
return obj; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
BACKUP_PATH=/data/backups | |
# IMPORTANT: SET BACKUP PASSWORD, $USER IS A PLACEHOLDER | |
PASSWORD=$(USER) | |
# Add database name, or set to $1 to use command line parameters | |
DATABASE_NAME=$1 | |
BACKUP_TAG="mongodb-"$(DATABASE_NAME)"-"$(date +%F) | |
mongodump -d $(DATABASE_NAME) -o $(BACKUP_PATH)/$(BACKUP_TAG) | |
7z a -r -mx=1 -p$(PASSWORD) $(BACKUP_PATH)/$(BACKUP_TAG).7z $(BACKUP_PATH)/$(BACKUP_TAG)/$(COLLECTION)/*.*son |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
$DETECTED_DOMAIN=$(dnsdomainname) | |
for CID in `docker ps -q`; do | |
IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CID) | |
NAME=$(docker inspect --format '{{ .Config.Hostname }}' $CID) | |
echo "$IP $NAME $NAME.$DETECTED_DOMAIN" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(numArray) { | |
var args = [].slice.call(arguments); | |
if ( args.length < 2 ) { throw new Error('Invalid parameters'); } | |
if ( !Array.isArray(numArray) ) { throw new Error('Invalid Input, Must be Array'); } | |
var findSums = args.slice(1, args.length); | |
// unpack sums if array, or use arguments[1:] | |
findSums = Array.isArray(findSums[0]) ? findSums[0] : findSums; | |
return numArray.some(checkSums, findSums); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credit/Reference: http://www.lowendguide.com/3/webservers/http-status-codes-cheat-sheet/ | |
var HTTP_STATUS_DICT = module.exports = { | |
/*## HTTP Successful Codes (2xx)*/ | |
"200": "OK", | |
"201": "Created", | |
"202": "Accepted", | |
"203": "Non-Authoritative Information 1.1", | |
"204": "No Content", | |
"205": "Reset Content", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var API_KEY = '';// <<-- '<__YOUR_KEY__HERE__>'; | |
module.exports = function _geocode(address, callback) { | |
require('request') | |
.get('https://maps.googleapis.com/maps/api/geocode/json?region=us&address=' + encodeURIComponent(address) + '&key=' + encodeURIComponent(API_KEY)) | |
.on('response', function(response) { | |
callback(null, response); | |
}).on('error', function(err) { | |
callback(err); | |
}); |