This file contains 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
// GIT Merge | |
// Use this feature to push an local branch 'over' a remote branch. | |
// This is useful when mushing a local release branch into the staging | |
// environment. | |
git push origin localBranch:remoteBranch | |
or | |
This file contains 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
Seems that parse.com has either neutered a portion of the their stripe.com integration, just decided it is not needed. The docs seem to point to the Stripe.Customers.update(id, token) as the way to add a card (using a token) to a customers account. This works, but only allows a single card. This overwrites the initial card with the new card. Not great. | |
// This should work, but only allows a single card. | |
Stripe.Customers.update(customer, { card: found.get('token') }, | |
function(err, token) { | |
console.log('got here for token'); | |
console.log(token); | |
}); | |
// This works, and seems to point to the need for parse.com to add some work to their backlog. Looks |
This file contains 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
'.source.js': | |
'Form Input': | |
'prefix': 'input' | |
'body': ' | |
<div class="form-group">\n | |
<label class="col-md-3 control-label">$1</label>\n | |
<div class="col-md-6">\n | |
<input type="text" class="form-control col-xs-3" name="$2" value="{{model.$2}}" placeholder="" >\n | |
<span class="error help-block hide">Please enter a $1</span>\n | |
</div>\n |
This file contains 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
// Working model of how to use the Backbone.Paginator Plugin. | |
var defaults = { | |
queryParams: { | |
pageSize: '_limit', | |
currentPage: '_page', | |
totalPages: null, | |
totalRecords: null, | |
}, | |
state: { |
This file contains 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
find . -maxdepth 1 -type d -mtime +14 -exec rm -r {} \; |
This file contains 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
/* | |
This script is part of a pattern that allows mocha to test | |
a REST API (Swagger.js + Expressjs) on a CI provider, codeship.io, | |
travis-ci etc. This makes the express app accessible to script | |
that starts the server and runs the tests. | |
Also see: https://gist.github.com/d1b1/7949308 (Programmable Mocha script) | |
*/ |
This file contains 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
/* | |
Programmatic Mocha code - This is used by a codeship | |
test to both start an expressjs app, setup routes and | |
run a suite of mocha tests. | |
Hint: Place this in the root of the project. Call from | |
test package.js or setup with > node mocha.js | |
Also see: https://gist.github.com/d1b1/7949456 (Expressjs + Swagger App) |
This file contains 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
forever stopall | |
ROOT='/var/www/myapp' | |
forever start \ | |
-l ${ROOT}/logs/manage-all.log \ | |
-o ${ROOT}/logs/manage-out.log \ | |
-e ${ROOT}/logs/manage-err.log \ | |
-a \ | |
--sourceDir ${ROOT}/manager/ \ |
This file contains 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 Validator = require('validator').Validator; | |
Validator.prototype.isObjectID = function() { | |
var regex = new RegExp("^[0-9a-fA-F]{24}$"); | |
if (!regex.test(this.str)) { | |
this.error(this.msg + ', Requires a String of 12 bytes or a string of 24 hex characters.'); | |
} |
This file contains 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
/* | |
Used the url module to parse and place the parameters into req.urlparams. | |
Follows the same pattern used for swagger API path variables that load | |
into the req.params scope. | |
*/ | |
app.use(function(req, res, next) { | |
var url = require('url'); | |
var queryURL = url.parse(req.url, true); | |
req.urlparams = queryURL.query; |