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 forEach = function(list, callback) { | |
return Array.prototype.forEach.call(list, callback); | |
}; |
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
// HELPER: #key_value | |
// | |
// Usage: {{#key_value obj}} Key: {{key}} // Value: {{value}} {{/key_value}} | |
// | |
// Iterate over an object, setting 'key' and 'value' for each property in | |
// the object. | |
Handlebars.registerHelper("key_value", function(obj, options) { | |
var buffer = "", | |
key; |
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 is the line from the stack-trace that's causing the error: | |
//backbone.js L39 | |
if (!_ && (typeof require !== 'undefined')) _ = require('underscore'); |
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
// TemplateJS v3.1.1 MIT/GPL2 @jon_neal | |
(function (global) { | |
function escapeJS (str) { | |
return str.replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r'); | |
} | |
function TemplateWalk (instance, str) { | |
// check for the opening and closer strings | |
var indexOpener = str.indexOf(instance.chars.open); | |
var indexCloser = str.indexOf(instance.chars.close); |
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
// Define whatever global space vars you might need. | |
var mbta = { | |
// application configuration parameters | |
app : { | |
server : "http://backbonetraining.bocoup.com:8000" | |
}, | |
// application data | |
data : { | |
// station collection | |
lines : null |
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
// Initially zero. When decremented to zero, fires callback | |
function semaphore( callback ) { | |
var fn = callback, | |
count = 0; | |
return { | |
increment: function() { | |
count++; | |
}, | |
decrement: function() { | |
if( count > 0 ) { |
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 () { | |
// export the API, but also create a global called "foo" | |
foo = module.exports = function (s) { | |
console.log('foo1 (global): ' + s); | |
}; | |
})(); |
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
if request.method == 'GET': | |
id = request.GET['id'] | |
tagging = Images.objects.get(id=id) | |
tags = Tag.objects.usage_for_model(tagging, counts=True) | |
usageNum = [{"tag": tagfreq.name, "count": tagfreq.count} for tagfreq in tags] | |
dump = simplejson.dumps(usageNum) | |
message = dump | |
$.getJSON('/tags/', | |
{ |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Detect Credit Card Type</title> | |
<style type="text/css"> | |
#cards, #statuses { | |
padding-left: 5px; |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Detect Credit Card Type</title> | |
</head> | |
<body> |
NewerOlder