Skip to content

Instantly share code, notes, and snippets.

View jewelsjacobs's full-sized avatar
:octocat:
Working

Julia Jacobs jewelsjacobs

:octocat:
Working
View GitHub Profile
@jewelsjacobs
jewelsjacobs / server.js
Last active July 18, 2018 21:08
[Dynamic Namespace Objects Based On Directory Structure and File Names] #nodejs
http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port') + " in " + process.env.NODE_ENV + " mode.");
var emitter,
str,
iter = [],
startPath = "public/javascripts/poc",
appName = "poc",
filePath = "public/javascripts/poc/namespace.js";
@jewelsjacobs
jewelsjacobs / fixjs.sh
Last active July 18, 2018 21:07
[Fixes Closure Linter] #lint #automation
#!/bin/bash
########################################################
## Fixes closure linter ##
## (https://developers.google.com/closure/utilities/) ##
## errors in JavaScript files. Requires closure ##
## compiler ##
## (https://developers.google.com/closure/compiler/) ##
## ##
## Usage: ##
## fixjs /path/myfile.js or ##
@jewelsjacobs
jewelsjacobs / Gruntfile.js
Last active July 18, 2018 21:08
[Gruntfile from AT&T U-verse project] #grunt #nodejs #automation
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-dox');
@jewelsjacobs
jewelsjacobs / docs.sh
Last active July 18, 2018 21:05
[Run jsdoc] Super simple shell script to run jsdoc with my configuration file to be used with grunt #jsdoc #grunt
#!/bin/bash
node_modules/jsdoc-toolkit/app/run.js -c=node_modules/jsdoc-toolkit/conf/jsdoc.conf
@jewelsjacobs
jewelsjacobs / docs.bat
Last active July 18, 2018 21:04
[Batch file for running jsdoc] batch file for running jsdoc with configuration file #jsdoc
@echo off
REM This script assumes you are running it
REM in the directory jsdoc-toolkit (https://code.google.com/p/jsdoc-toolkit/downloads/list)
REM resides in.
REM Also it is refering to a configuration file in the
REM jsdoc-toolkit conf folder called jsdoc.conf. Replace this
REM with the location and name of your configuration file.
set JSDOC_BASE_DIR=%CD%\jsdoc-toolkit
java -Djsdoc.dir=%JSDOC_BASE_DIR% -jar %JSDOC_BASE_DIR%\jsrun.jar %JSDOC_BASE_DIR%\app\run.js -c=%JSDOC_BASE_DIR%\conf\jsdoc.conf %*
@jewelsjacobs
jewelsjacobs / perf.js
Last active July 18, 2018 21:19
[Protractor timing test] Perf testing with protractor. #test #nodejs
// var expect = require('chai').use(require('chai-as-promised')).expect;
var async = require('async');
var moment = require('moment');
var _ = require('lodash');
var loginPage = require('../pages/login.page');
var ptor = protractor.getInstance();
var routes = [
'/cloud/hub_cap/servers',
'/cloud/hub_cap/servers/ORD/6b2af55b-2e3a-43d7-bfe6-758ea39126c4',
'/cloud/hub_cap/servers/create',
@jewelsjacobs
jewelsjacobs / LoadConfig.js
Last active July 18, 2018 21:16
[Require Env files dynamically] Snippet to load an env file dynamically #nodejs
'use strict';
module.exports = require(`./${process.env.NODE_ENV}.js`);
@jewelsjacobs
jewelsjacobs / dbconnections.js
Last active July 18, 2018 21:13
[ETL Scripts] - DBConnections #etl #mongodb #nodejs #db
/**
* @author Julia Jacobs
* @version 1.0.0
* @description MongoDB remote and local connection singletons
* @module dbConnections
*/
var LocalClient = require('mongodb').MongoClient;
var RemoteClient = require('mongodb').MongoClient;
// local MongoDB connection
@jewelsjacobs
jewelsjacobs / operations.js
Last active July 18, 2018 21:12
[ETL Scripts - Find And Load Operations] #etl #mongodb #nodejs #db
require("babel/register");
/**
* @author Julia Jacobs
* @version 1.0.0
* @desc Mongodb operations
* @module operations
*/
var localDb = require('./dbConnections.js').localDb,
remoteDb = require('./dbConnections.js').remoteDb,
@jewelsjacobs
jewelsjacobs / sampleJobs.js
Last active July 18, 2018 21:12
[ETL Scripts - Sampe Jobs] #etl #mongodb #nodejs #db
require("babel/register");
var operations = require('./operations.js');
var async = require('async');
var localDb = require('./dbConnections.js').localDb;
var remoteDb = require('./dbConnections.js').remoteDb;
// define url connection strings
localDb.url = 'mongodb://localhost:9000';
remoteDb.url = 'mongodb://remotehost:27017/db';