Skip to content

Instantly share code, notes, and snippets.

View QGao's full-sized avatar

Qing Gao QGao

  • Mountain View, CA
View GitHub Profile
@QGao
QGao / md5
Created December 7, 2011 02:04
TiSDK MD5 sample
var win = Ti.UI.createWindow({ backgroundColor: 'red' });
var md5 = Ti.Utils.md5HexDigest(win.toImage());
var label = Ti.UI.createLabel({
text:md5
});
win.add(label);
win.open();
@QGao
QGao / "DO NOT BACKUP" flag for iCloud
Created December 6, 2011 01:07
A sample shows how to set the "DO NOT BACKUP" flag in TiSDK
var newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mydir');
Ti.API.info("Created mydir: " + newDir.createDirectory());
Ti.API.info('newdir ' + newDir);
var newFile = Titanium.Filesystem.getFile(newDir.nativePath,'backup.txt');
if(newFile.exists()){
newFile.write("I should be backed up!");
newFile.remoteBackup = true;
//or we can set the whole folder to be iCloudable
//newDir.remoteBackup = true;
}
@QGao
QGao / app.js
Created December 2, 2011 23:08
A sample of using convertPointToView
var win = Ti.UI.createWindow(
{ backgroundColor: 'black' }
);
var center1 = {'x': 100, 'y':100};
var center2 = {'x': 100, 'y':250};
var lastIndex = 1;
var background = Ti.UI.createView({ backgroundColor:"#444444", });
var view = Ti.UI.createView({ backgroundColor:'red', center:center1, width:100, height:100, zIndex:lastIndex++, });
var view2 = Ti.UI.createView({ backgroundColor:'green', center:center2, width:100, height:100, zIndex:lastIndex, });
background.addEventListener('touchstart', function(e){