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
/** | |
* Module exports. | |
*/ | |
/** | |
* Check if `obj` is an array. | |
*/ | |
function isArray(obj) { | |
return '[object Array]' == {}.toString.call(obj); |
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
// | |
// blog.clearlyionnovative.com | |
// twitter: @aaronksaunders | |
// | |
// Model file for integration Appcelerator Titanium Alloy with Wordpress JSON Plugin | |
// | |
exports.definition = { | |
config : { | |
"columns" : {}, |
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
// implements a reusable countdown timer | |
// arguments: | |
// upper : upper limit to start countdown at | |
// onStart : function to execute when the timer starts | |
// onInterval : function to execute every second, like update screen | |
// onComplete : function to execute when the timer reaches 0 | |
// onKill : function to execute when the timer is manually killed | |
function countdownTimer(upper,onStart,onInterval,onComplete,onKill){ | |
var interval; | |
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
/*! Socket.IO.js build:0.9.6, development. Copyright(c) 2011 LearnBoost <[email protected]> MIT Licensed */ | |
/** | |
* Originally Ported to titanium by Jordi Domenech <[email protected]> | |
* source: https://github.com/iamyellow/socket.io-client | |
*/ | |
this.io = {}; | |
module.exports = this.io; | |
/** |
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
# We have a function that loads some resource. It might get called multiple times by our application, for example a web server. | |
# We use a stored promise to serve as both a cache and a hook for multiple callers to get the same result | |
# JavaScript version at the bottom | |
Q = require 'q' | |
loadPromise = null | |
doLoad = -> | |
if not loadPromise | |
# get a fresh result | |
loadPromise = Q.delay(1000).then -> Date.now() | |
# after 1 second clear cache |
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
/** | |
* Handle Item Swipe | |
* @param {Object} _event | |
*/ | |
$.handleItemSwipe = function(_event) { | |
var row = _event.source; | |
var id = row.id; | |
var controls = Alloy.createController("rowControls"); | |
row.add(controls.wrapper); |
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 for opening / animating sidebar | |
*/ | |
$.openSidebar = function() { | |
if(isOpen) { | |
var animateRight = Ti.UI.createAnimation({ | |
left : 0, | |
curve : Ti.UI.ANIMATION_CURVE_EASE_OUT, | |
duration : 200 | |
}); |
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 RedLaser = require('ti.redlaser'); | |
var win = Ti.UI.createWindow({ | |
backgroundColor: "#eee" | |
}); | |
var startScanningBtn = Ti.UI.createButton({ | |
width: "50%", | |
height: 50, | |
title: "Start Scanning" |
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
Alloy.createWidget = function(id, name, args) { | |
Ti.Analytics.featureEvent("widget." + id, args); | |
return new (require("alloy/widgets/" + id + "/controllers/" + (name || "widget")))(args); | |
}; | |
Alloy.createController = function(name, args) { | |
Ti.Analytics.featureEvent("controller." + name, args); | |
return new (require("alloy/controllers/" + name))(args); | |
}; |
OlderNewer