Skip to content

Instantly share code, notes, and snippets.

<ios>
<min-ios-ver>4.3</min-ios-ver>
<plist>
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
@iotashan
iotashan / MyModule.js
Created September 12, 2012 17:00
commonJS as a singleton lib
var MyModule = {};
// auth info
MyModule.somevariable = 'http://www.google.com/';
MyModule.someFunction = function(...) {
...
}
module.exports = MyModule;
@iotashan
iotashan / app.js
Created September 2, 2012 06:44
Here's a snippet from my app.js file
//
// include our reusable component
//
var BeerRow = require('BeerRow');
//
// create our rows
//
for (var i in beers) {
var newRow = new BeerRow(beers[i]);
/**
* @author Shannon Hicks
*/
// detect screen density once because Ti.Platform.displayCaps calls are expensive
var retina = Ti.Platform.displayCaps.density == 'high';
var BeerRow = function(beer) {
// create a container object
var row = {};
@iotashan
iotashan / app.js
Created September 2, 2012 05:59
Example of using javascript loop labels with Titanium
outerloop:
for (var i=0;i<10;i++) {
Ti.API.debug('outerloop: '+i);
innerloop:
for (var x=0;x<10;x++) {
Ti.API.debug('innerloop: '+x);
if (x === i) {
break innerloop;
}
}
var MyCustomWindow = function(navController,title,number,points) {
var win = Ti.UI.createWindow({custom stuff here});
return win;
};
module.exports = MyCustomWindow;
@iotashan
iotashan / NewWin.js
Created December 15, 2011 02:45
Creating a CommonJS singleton with Titanium
var secondCall = require('TestSingleton');
var NewWindow = function() {
var win = Titanium.UI.createWindow({
title:'Win 2',
backgroundColor:'#c00'
});
var label1 = Titanium.UI.createLabel({
color:'#999',
function Common(input) {
this.phrase = input;
};
Common.prototype.doIt = function() {
return this.phrase;
};
module.exports = Common;
test gist