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 ts = new Date().getTime() | |
url = ''; | |
// adding cache busting to url | |
url += ( /\?/.test( url ) ? "&" : "?" ) + "_=" + ts : "" |
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 name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<style type="text/css"> | |
html { height: 100% } | |
body { height: 100%; margin: 0; padding: 0 } | |
#map_canvas { height: 100% } | |
</style> | |
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></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
if (typeof window.console === "undefined") { | |
var noOpFunc = function() { }; | |
window.console = { | |
assert: noOpFunc, | |
log: noOpFunc, | |
warn: noOpFunc, | |
debug: noOpFunc, | |
info: noOpFunc, | |
time: noOpFunc, |
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(scope) { | |
// Code | |
var index; | |
function log(){ | |
console.log(index); | |
}; | |
function iterate(){ | |
log(); |
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 $w = function(string) { return string.split(' '); }; | |
var asInts = function(arr) { | |
var results=[]; | |
for(var i=0, m=arr.length; i<m; i++) results.push(parseInt(arr[i], 10)); | |
return results; | |
}; | |
Array.prototype.map = function(func) { |
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 Car = function(make, color){ | |
this.make = make; | |
this.color = color; | |
this.log = function(){ | |
console.log('I am a '+ this.color +' '+ this.make); | |
}; | |
} | |
// Example call for OO version: |
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
// 1. Write a class to support the following code: | |
var Person = function(name) { | |
this.name = name; | |
} | |
var thomas = new Person('Thomas'); | |
var amy = new Person('Amy'); | |
thomas.name // --> "Thomas" |
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
<p>1. Change the addEventListener calls so that the events occur in the following order.<br/> | |
the_div! the_item! the_list!</p> | |
<div id="the_div"> | |
<ul id="the_list"> | |
<li id="the_item">Click me! 1</li> | |
</ul> | |
</div> | |
<p>2. Change the addEventListener calls so that the events occur in the following order.<br/> | |
the_item! the_list! the_div!</p> | |
<div id="the_div2"> |
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.prototype.curry = function () { | |
var method = this, args = Array.prototype.slice.call(arguments); | |
return function () { | |
return method.apply(this, args.concat(Array.prototype.slice.call(arguments))); | |
}; | |
}; |
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
ko.bindingHandlers.autoNumeric = function ($) { | |
function getElementValue(el) { | |
return parseFloat(el.autoNumericGet(), 10); | |
} | |
function getModelValue(accessor) { | |
return parseFloat(ko.utils.unwrapObservable(accessor()), 10); | |
} |
OlderNewer