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
Array.prototype.remove = function(itemToRemove) { | |
var i = 0; | |
while (i < this.length) { | |
if (this[i] == itemToRemove) { | |
this.splice(i,1) | |
} else { | |
i++; | |
} | |
} | |
return this; |
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 params = { | |
'name' : name, | |
'direction' : 'inbound' | |
}; | |
connection = Twilio.Device.connect( params ); | |
console.log(connection.parameters); | |
connection.error(function(error){ | |
console.log("connection error!"); |
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
function getUrlVars(path) { | |
var vars = {}; | |
var parts = path.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { | |
vars[key] = value; | |
}); | |
return vars; | |
} |
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
exports.charge = function(req, res){ | |
var pkg = req.body; | |
var token = pkg.token; | |
console.log("POST BODY"); | |
console.log(req.body); | |
var charge = rk.stripe.charges.create({ | |
amount: 3999, // amount in cents, again | |
currency: "usd", | |
card: token.id, |
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
exports.charge = function(req, res){ | |
var pkg = req.body; | |
var token = pkg.token; | |
console.log("POST BODY"); | |
console.log(req.body); | |
var charge = rk.stripe.charges.create({ | |
amount: 3999, // amount in cents, again | |
currency: "usd", | |
card: token.id, |
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
<script> | |
var handler = StripeCheckout.configure({ | |
key: '*****', | |
//image: '/square-image.png', | |
token: function(token, args) { | |
// Use the token to create the charge with a server-side script. | |
// You can access the token ID with `token.id` | |
console.log(token); | |
console.log(args); | |
var pkg = {'token':token, 'args':args}; |
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
brew doctor | |
Warning: /usr/local/etc isn't writable. | |
This can happen if you "sudo make install" software that isn't managed by | |
by Homebrew. If a brew tries to write a file to this directory, the | |
install will fail during the link step. | |
You should probably `chown` /usr/local/etc | |
Warning: /usr/local/share isn't writable. | |
This can happen if you "sudo make install" software that isn't managed by |
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
// Setup default behavior (in some init script probably) | |
$(document).ajaxError(function( event, jqxhr, settings, thrownError ) { | |
console.log('Ajax Error: ' + thrownError); | |
console.log('Ajax Error jqXHR: ' + jqxhr); | |
console.log('Ajax settings: ' + settings); | |
}); | |
$.ajaxSetup({ | |
dataType: json, |
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 serializedArray = [ | |
{name: 'location', value:'Location one'}, | |
{name: 'location', value:'Location two'} | |
] | |
// in practice | |
// var serializedArray = $(form).serializeArray(); | |
var mappedObject = serializedArray.map(function(location){ | |
return { location: location.value }; |
OlderNewer