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 Win = Ti.UI.createWindow({ | |
title: "My Message", | |
}); | |
var ScrollView = Ti.UI.createScrollView({ | |
height: Ti.UI.FILL, | |
width: Ti.UI.FILL, | |
contentHeight: "100%", | |
contentWidth: "100%", | |
}); |
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
/** | |
* Caching functions class | |
* @class Cache | |
*/ | |
var Moment = require("alloy/moment"); | |
var directory; | |
exports.valid = function (_url) { | |
var fileName = _url.replace(/[^\w\d]/g, ""); |
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
/** | |
* Structure of an alloy controller | |
**/ | |
function Controller() { | |
var $ = this; | |
} | |
module.exports = Controller; | |
/** |
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
$.recordCount.value = 99 |
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 TiBind = require("ti.bind"); | |
var data = [ | |
{ someTitle: "Hello World" } | |
]; | |
TiBind($, data); |
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
/* Ever wondered how to get the nice column of letters in the right side | |
* of the table view? | |
* | |
* Here is an example: | |
* 1. We take a list of names from a json file | |
* 2. We need to sort them by either first name or last name | |
* 3. We need to create a row header once in a while, when the first letter changes | |
* 4. We need to create a table index | |
* | |
*/ |
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
Ti.UI.setBackgroundColor('#000'); | |
var win = Titanium.UI.createWindow({ | |
title : 'test' | |
}); | |
var arrayLength = 5 | |
var fields = new Array(arrayLength); | |
for( i = 0; i < arrayLength; i++) { |
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 PassCode(_params){ | |
_params = _params || {}; | |
// @PARAMS:{ | |
// boxSize: (Number) size of the passcode character boxes | |
// backgroundColor: (String) background color of the mainview | |
// backgroundImage: (String) background image of the mainview | |
// panicColor: (String) background color of the view when panic() is called - when wrong password | |
// titleText: (String) the text of the title view, above the pass code boxes by default, | |
// mainView: (Object) params for the main view that hold the passcode boxes |
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 log = require("/api/Log"); | |
var os = Ti.Platform.osname; | |
// The TiShadow build of the Titanium SDK does not cache CommonJS modules loaded | |
// from the applicationDataDirectory. This is so that if an update to the app is | |
// deployed, i.e. a file in the applicationDataDirectory is modified, the changes | |
// while be loaded. That said loading a CommonJS module every time that it is loaded | |
// make the deployed bundle run slowly. So we will manage the caching of those | |
// modules here in the code. |
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 cancelableRequest = function (url) { | |
var xhr = new XMLHttpRequest(); | |
var deferred = Q.defer(); | |
function onload() { | |
if (xhr.status === 200 || xhr.status === 0 && xhr.responseText) { | |
deferred.resolve(xhr.responseText); | |
} else { | |
onerror(); | |
} |
OlderNewer