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
geocoder.geocode( { 'address': unitOfWork}, function(results, status) { | |
if (status == google.maps.GeocoderStatus.OK) { | |
var result = {}; | |
result.address = unitOfWork.replace(/\+/g,' '); | |
result.location = results[0].geometry.location.b + ',' + results[0].geometry.location.c; | |
displayMarkerStack.push(results[0].geometry.location); | |
finishedStack.push(result); | |
$("body").trigger('addressComplete'); |
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
define([ | |
// notice the text! prefix | |
// this tells require.js to | |
// use the text plugin to | |
// retrieve the template | |
'text!./myTemplate.htm' | |
], function(myTemplate){ | |
// use your template here | |
}); |
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
Backbone.View.extend({ | |
template: 'my-view-template', | |
render: function () { | |
var deferred = new $.Deferred(), | |
promise = deferred.promise(), | |
that = this; | |
require('/templates/' + this.template + '.html', function (tmpl) { | |
deferred.resolve(that.$el.html(tmpl)); |
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 user = { | |
validateCredentials: function (username, password) { | |
return ( | |
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
: (!/^([a-z0-9-_]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
: false | |
); |
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 signForm = $.ajax({ | |
type: "POST", | |
url: "/some/form", | |
dataType: "JSON", | |
data: myData | |
}); | |
signForm.done(function(response){ | |
// handle success here | |
}); |
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
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 2K bytes over 1 Gbps network 20,000 ns | |
Read 1 MB sequentially from memory 250,000 ns | |
Round trip within same datacenter 500,000 ns | |
Disk seek 10,000,000 ns |
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 date = new Date(); | |
date.toLocaleDateString().split(',')[1].trim().split(' ')[0]; |
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
├───src | |
│ ├───client | |
│ │ ├───apps | |
│ │ │ ├───balance | |
│ │ │ │ └───tests | |
│ │ │ │ └───mocha | |
└────BalanceViewModel_spec.js | |
│ │ │ │ └───BalanceViewModel.js | |
└───tools | |
├───requirejs |
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
require.config({ | |
config: { | |
i18n: { | |
locale: myLocale | |
} | |
} | |
}); |
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
define(['core', './topics'], function (core, topics) { | |
var valueFilter = /\D/g, | |
widthClasses = [], i, | |
jsLintLintDoesNotLikeLiteralsHere = true, | |
updateQueue = [], | |
pubsub = core.pubsub, | |
updatingInstances = {}; | |
pubsub.subscribe(topics.pause, function (ev, instanceId) { | |
// delete to keep the object small, and keep the lookup time short. |