This file contains hidden or 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 | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} | |
check_run package.json "npm install" |
This file contains hidden or 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'; | |
process.env.NODE_ENV = 'test'; | |
var chai = require('chai'); | |
var chaiHttp = require('chai-http'); | |
var server = require('../server.js'); | |
var should = chai.should(); | |
var UserModel = require('../schemas/user-schema.js'); | |
var users = require('./mock-data.js').users; |
This file contains hidden or 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
/* Implementation */ | |
var stream = require('stream'); | |
// Create the custom stream | |
function Num(options) { | |
// Inherit properties | |
stream.Readable.call(this, options); | |
this._start = 0; | |
this._end = 100; |
This file contains hidden or 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 promisify = require('promisify-node'); | |
var myObj = { | |
myMethod: function(a, b, cb) { | |
cb(a, b); | |
} | |
}; | |
// No need to return anything as the methods will be replaced on the object. | |
promisify(myObj); |
This file contains hidden or 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'; | |
angular.module('moduleName') | |
.directive('directiveName', function () { | |
return function($scope, $element, $attrs) { | |
//make the search using element | |
}); | |
}); |
This file contains hidden or 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
angular.module('ngWaitstaffApp', ['ngRoute']) | |
// globals | |
.constant('DEFAULT_TAX_RATE', 9.50) | |
.value('earnings', []) | |
.config(function($routeProvider) { | |
$routeProvider.when('/', { | |
templateUrl : 'partials/home.html' | |
}).when('/new-meal', { |
This file contains hidden or 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 express = require('express'); | |
var bodyParser = require('body-parser'); | |
var jsonParser = bodyParser.json(); | |
var Storage = function() { | |
this.items = []; | |
this.id = 0; | |
}; | |
Storage.prototype.add = function(name) { |
This file contains hidden or 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
const mkdirp = require('mkdirp'); | |
const path = require('path'); | |
mkdirp(path.join(__dirname, 'foo/bar'), err => { | |
if (err) throw err; | |
}); |
This file contains hidden or 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
div(class="movie-card", id="oceans-11") | |
h1(class="movie-title") Ocean's 11 | |
img(src="/img/oceans-11.png", class="movie-poster") | |
ul(class="genre-list") | |
li Comedy | |
li Thriller |
This file contains hidden or 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
exports.save = function(name, callback){ | |
Item.create({name: name},function(error, item){ | |
if(error){ | |
callback(error); | |
return; | |
} | |
callback(null, item); | |
}); | |
}; |