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
// | |
// Create main view | |
// | |
A2B.createView = function() { | |
// create map view | |
A2B.mapview = Titanium.Map.createView({ | |
mapType: Titanium.Map.STANDARD_TYPE, | |
animate:true, | |
regionFit:true, | |
region:{latitude:33.74511, longitude:-84.38993, latitudeDelta:0.5, longitudeDelta:0.5}, |
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 function initializes the library | |
exports.initialize = function (wha) { | |
console.log("initialized " + wha); | |
}; | |
//This is super complex - watch out for it! | |
//Serious bro | |
exports.coolprop = "hi"; | |
//This function kills a process |
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
### | |
http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
requestAnimationFrame polyfill by Erik Möller | |
fixes from Paul Irish and Tino Zijdel | |
Coffeescript and AMD by Blaine Bublitz | |
### |
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
makeUUID = -> | |
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace /[xy]/g, (a, b) -> | |
b = Math.random() * 16 | |
return (if a is "y" then b & 3 | 8 else b | 0).toString 16 |
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
@['__bind'] = (fn, scope) -> | |
nu = -> | |
fn.apply scope, arguments | |
(nu._scope?=[]).push scope | |
return nu |
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
map = (obj, cb) -> | |
out = {} | |
todo = Object.keys(obj).length | |
check = -> cb out if --todo is 0 | |
for key, val of obj | |
if typeof val is 'function' | |
do (key) -> | |
t = val (res) -> | |
out[key] = res |
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
# DOM ready | |
window.ready ?= (fn) -> | |
fire = -> | |
unless window.ready.fired | |
window.ready.fired = true | |
fn() | |
return fire() if document.readyState is "complete" | |
# Mozilla, Opera, WebKit |
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
cookie = (name, value) -> | |
if name and value | |
document.cookie = "#{name}=#{value};" | |
return value | |
else | |
out = {} | |
for cookie in document.cookie.split ";" | |
pair = cookie.split "=" | |
out[pair[0]] = pair[1] | |
return (if name? then out[name] else out) |
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
# Most throttles are actually just delays | |
# This will only call the function if it hasn't been triggered in (delay)ms | |
throttle = (fn, delay) -> | |
return fn if delay is 0 | |
timer = false | |
return -> | |
return if timer | |
timer = true | |
setTimeout (-> timer = false), delay unless delay is -1 | |
fn 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
parseLocation = -> | |
out = {} | |
for key in window.location.search.substring(1).split "&" | |
pair = key.split "=" | |
out[pair[0]] = pair[1] | |
return out |
OlderNewer