http://stackoverflow.com/questions/14290113/git-pushing-code-to-two-remotes
git remote set-url --add --push origin GIT_REPO_URL
// Requires either "underscore" or "lodash" | |
function difference(source, compare) { | |
var ret = {}, dateStr; | |
for (var name in compare) { | |
if (name in source) { | |
if (_.isDate(compare[name])) { | |
dateStr = _.isDate(source[name]) ? source[name].toISOString() : source[name]; | |
if (compare[name].toISOString() !== dateStr) { | |
ret[name] = compare[name]; | |
} |
var JsonUtil = (function (exports) { | |
exports = exports || {}; | |
var reserved = 'userId name'.split(' '); | |
var dates = 'updateLastRequestOn'.split(' '); | |
var incs = 'newSession'.split(' '); | |
var e; | |
var isObject; |
// This represents an external JS file | |
var example = (function(exports){ | |
'use strict'; | |
exports = exports || {}; | |
var frameworks = {}; | |
function getInstance(name) { |
function forEach(list, fn, done, options) { | |
if (typeof fn !== 'function') { | |
throw new Error('Second param expected type "function"'); | |
} | |
var fnDesc = fn.toString(); | |
var next; | |
var len = list.length; | |
var index = 0; |
/** | |
* supplant() does variable substitution on the string. It scans through the string looking for | |
* expressions enclosed in { } braces. If an expression is found, use it as a key on the object, | |
* and if the key has a string value or number value, it is substituted for the bracket expression | |
* and it repeats. | |
* | |
* Updated by Rob Taylor | |
* http://roboncode.com | |
* | |
* Originally written by Douglas Crockford |
http://stackoverflow.com/questions/14290113/git-pushing-code-to-two-remotes
git remote set-url --add --push origin GIT_REPO_URL
// http://stackoverflow.com/questions/26246601/wildcard-string-comparison-in-javascript | |
// Short code | |
function matchRuleShort(str, rule) { | |
return new RegExp("^" + rule.split("*").join(".*") + "$").test(str); | |
} | |
// Explanation code | |
function matchRuleExpl(str, rule) { | |
// "." => Find a single character, except newline or line terminator |
// usage example | |
var wf = waterfall({count: 0}) | |
wf([ | |
function(data) { | |
data.count++; | |
}, | |
function(data) { | |
data.count++; | |
// to stop the cascade, return anything | |
// return 'Stop cascade'; |
function Permissions() { | |
} | |
Permissions.createRules = function(options) { | |
var permissions = {}; | |
var num = 1; | |
var len = options.length; | |
for(var i=0;i<len;i++) { | |
if(i === 0) { | |
permissions[options[i]] = num; |
var rules = Permissions.createRules(['view', 'modify', 'create', 'delete']); | |
var permissions = Permissions.createPermissions([rules.modify, rules.delete]); | |
console.log('#view', Permissions.checkForPermission(permissions, rules.view)); // false | |
console.log('#modify', Permissions.checkForPermission(permissions, rules.modify)); // true | |
console.log('#create', Permissions.checkForPermission(permissions, rules.create)); // false | |
console.log('#delete', Permissions.checkForPermission(permissions, rules.delete)); // true |