Skip to content

Instantly share code, notes, and snippets.

View jhyland87's full-sized avatar

J jhyland87

View GitHub Profile
@jhyland87
jhyland87 / foo.js
Last active February 9, 2016 00:21
Example of a mongoose model
'use strict'
module.exports = Mongoose => {
const Schema = Mongoose.Schema
const fooSchema = new Schema({
name: {
type: Schema.Types.String,
trim: true,
select: true,
'use strict'
const _ = require( '../' )
const Code = require('code')
const Lab = require('lab')
const lab = exports.lab = Lab.script()
const suite = lab.suite
const it = lab.test
const before = lab.before
@jhyland87
jhyland87 / index.js
Created February 26, 2016 17:42
Loading Mongoose model files
'use strict'
import path from 'path'
import fs from 'fs'
import _ from 'moar-lodash'
import * as appRoot from 'app-root-path'
const log = appRoot.require('./dist/lib/utils/logger')({ model: 'Index (loader)' })
module.exports = ( Mongoose ) => {
@jhyland87
jhyland87 / hapi_plugin.js
Last active March 13, 2016 16:32
HapiJS Custom plugin error
// File: real-plugin-src.js
module.exports = ( plugin, options, next ) => {
// Do stuff...
next()
}
module.exports.attributes = {
pkg: {
name: "test-plugin",
@jhyland87
jhyland87 / logger.js
Created March 17, 2016 16:43
Logging library using winston
'use strict'
import _ from 'moar-lodash'
import path from 'path'
import * as appRoot from 'app-root-path'
import * as Winston from 'winston-color'
const config = appRoot.require('./dist/lib/config').logs
const _internals = {}
'use strict'
// Tools
const _ = require( 'lodash' )
const appRoot = require( 'app-root-path' )
const Util = require( 'util' )
// Unit test related
const Code = require( 'code' )
const Lab = require( 'lab' )
'use strict'
// Tools
const _ = require( 'lodash' )
const appRoot = require( 'app-root-path' )
const Util = require( 'util' )
// Unit test related
const Code = require( 'code' )
const Lab = require( 'lab' )
@jhyland87
jhyland87 / create_my-cnf.sh
Created May 11, 2016 18:45
Bash script to create /etc/my.cnf for mysql master replicator
cp /etc/my.cnf{,.orig} && \
echo "#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
@jhyland87
jhyland87 / system-summary.sh
Created May 13, 2016 20:25
System Summary Script
#!/bin/bash
# Summary: Script to quickly show a summary of the servers stats, showing any possible issues (mainly regarding to resource utilization)
# Author: Justin Hyland
# Created: 05/11/16
# Screenshot: http://d.pr/i/2nTm
# Settings and thresholds
# These are set at odd limits just for testing
disk_thresh=10 # Percent
cpu_thresh='0.02'
@jhyland87
jhyland87 / jenkins.js
Created June 1, 2016 18:03
Custom jQuery code to introduce new functionality to the Jenkins UI
/**
* Jenkins Custom JavaScript/jQuery Code
* Author: Justin Hyland
* Created: 06/01/16
* This file is loaded by Jenkins via the Simple Theme Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Simple+Theme+Plugin)
* in combination with the jQuery Plugin (https://wiki.jenkins-ci.org/display/JENKINS/jQuery+Plugin), and is used to introduce any
* customized functionality for the UI, such as setting parameter values based on other parameter values or the job name, etc.
*
* Logic: The controller.init gets executed on document.ready, and attempts to deduce the viewers username (via the profile link
* in the upper right), and details about the job (via the URL). Since all jobs are separated into the appropriate folder named