Skip to content

Instantly share code, notes, and snippets.

var git = require('gulp-git');
var inject = require('inject-string');
// This successfully returns my git hash
gulp.task('hash', function() {
git.revParse({args:'--short HEAD'}, function (err, hash) {
return hash;
});)
})

Keybase proof

I hereby claim:

  • I am mcranston18 on github.
  • I am mcranston18 (https://keybase.io/mcranston18) on keybase.
  • I have a public key whose fingerprint is 91FF E601 E006 4CAF B916 DFAF 107E F6B4 3C9F 9F5E

To claim this, I am signing this object:

const Sequelize = require('sequelize');
const sequelize = new Sequelize('dummy_db', 'postgres', '', {
host: 'localhost',
dialect: 'postgres',
logging: false
});
const User = sequelize.define('users', {
id: {
### Keybase proof
I hereby claim:
* I am mcranston18 on github.
* I am mcranston18 (https://keybase.io/mcranston18) on keybase.
* I have a public key ASDuy0tvtWmb9ZdaZYljUD6mi8Fb57GQfvzNpjiDJvMjxAo
To claim this, I am signing this object:
@mcranston18
mcranston18 / testing.js
Created September 28, 2017 16:12
Component testing
describe('myComponent', function() {
var $ctrl;
var $rootScope;
var $scope;
beforeEach(module('theNameOfMyAngularApp'));
beforeEach(inject(function(_$rootScope_, _$componentController_) {
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
{
"name": "root",
"children": [
{
"name": "Bacteria",
"children": [
{
"name": "Acidobacteria",
"children": [
{
@mcranston18
mcranston18 / config.js
Created September 16, 2016 15:27
ES6 babel/webpack build
'use strict';
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var browserSync = require('browser-sync');
var webpack = require('webpack-stream');
var $ = require('gulp-load-plugins')();
var assert = require('assert'),
fs = require('fs');
var webdriver = require('browserstack-webdriver'),
test = require('browserstack-webdriver/testing');
var browserNameList = ['ie', 'firefox', 'opera'];
for(i = 0; i < browserNameList.length; i++) {
test.describe('Google Search', function() {
var webdriver = require('browserstack-webdriver');
var browserNameList : ['firefox', 'chrome', 'opera'];
for(i = 0; i < browserList; i++) {
// Input capabilities
var capabilities = {
'browserName' : browserNameList[i],
'browserstack.user' : 'xxx',
@mcranston18
mcranston18 / directive_verticalAlign
Created October 30, 2013 15:20
Directive to vertically align in CSS
app.directive('verticalAlign', function () {
return {
restrict: 'A',
link: function (scope, elm, attrs) {
var childHeight = elm[0].clientHeight;
var parentHeight = elm[0].parentElement.clientHeight;
var offset = (parentHeight - childHeight) / 2;
elm[0].style.paddingTop = offset + 'px';
}
}