This file contains hidden or 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 win1 = Titanium.UI.createWindow({ | |
title:'Window 1', | |
backgroundColor:'#fff' | |
}); | |
var label1 = Titanium.UI.createLabel({ | |
color:'#999', | |
text:'Window 1\nClick anywhere for opening Window 2', | |
textAlign:'center', |
This file contains hidden or 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 win1 = Titanium.UI.createWindow({ | |
title:'Tab 1', | |
backgroundColor:'#fff', | |
layout: 'vertical' | |
}); | |
var bt1 = Ti.UI.createButton({title: 'send message (method 1)', top: 200}); | |
bt1.addEventListener('click', function(e) |
This file contains hidden or 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 text = '576520776f756c64206c6f766520746f2073656520796f757220636f646520696e7374656164206f6620736f6d65207061706572732c20776520646f6e27742077616e74204954206d616e61676572732c2077652077616e74207265616c206861636b6572732e20576527726520666f6375736564206f6e206368616e67696e67207468652077617920736572766963657320616e6420646174612061726520646973747269627574656420616e6420636f6e73756d65642e20496620796f752077616e7420746f207075742074686520776f726c642075707369646520646f776e2c20616e6420796f7520647265616d732061726520636f64656420696e204a41564120616e64206261736564206f6e206d6f6e676f44422c2073686f757420697420686572653a206861636b657273406d6173686170652e636f6d20496620796f75277265206b69636b2d61737320646576656c6f706572207765276c6c2066696e6420796f752e204265206172726f67616e742e'; | |
var decode = function(txt) { | |
var decoded = ''; | |
for (var i = 0; i < txt.length; i += 2) { | |
var b = '' + txt.charAt(i) + txt.charAt(i+1); | |
var c = parseInt(b, 16); | |
decoded += String.fromCharCode(c); | |
} |
This file contains hidden or 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 CustomSwitch = function(onText, offText, value) { | |
// the custom view | |
var view = Ti.UI.createView(); | |
var label = Ti.UI.createLabel(); | |
var sw = Ti.UI.createSwitch(); | |
view.add(label); | |
view.add(sw); |
This file contains hidden or 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
#define MODULE_ID @"your.module.id" | |
- (NSURL *)getAssetURL:(NSString*)resFile | |
{ | |
NSString * filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"modules/%@/%@",MODULE_ID, resFile]]; | |
return [NSURL fileURLWithPath:filePath]; | |
} |
This file contains hidden or 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
+ (NSData*) resolveAppAsset:(NSString*)path; | |
{ | |
NSString *ServerAddr = SERVER_ADDRESS; | |
NSString *ServerPort = SERVER_PORT; | |
NSString *path_url = [NSString stringWithFormat:@"http://%@:%@/%@",ServerAddr, ServerPort, path]; | |
NSURL *url = [NSURL URLWithString:path_url]; | |
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; | |
[request startSynchronous]; | |
if ([request responseStatusCode] != 200) |
This file contains hidden or 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
ip_addr = "localhost" | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
try: | |
s.connect(("gmail.com",80)) | |
ip_addr = s.getsockname()[0] | |
except socket.error, msg: | |
s.close() | |
s = None |
This file contains hidden or 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
+ (NSData*) resolveAppAsset:(NSString*)path; | |
{ | |
static NSMutableDictionary *map; | |
if (map==nil) | |
{ | |
map = [[NSMutableDictionary alloc] init]; | |
//here the entry for app.js is created | |
//(I filled the hex string with garbage - it's only an example) | |
[map setObject:dataWithHexString @"DEADBEEF…" forKey:@"app_js"]; | |
} |
This file contains hidden or 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
-(void)setShadow_:(id)args | |
{ | |
if(args != nil) | |
{ | |
self.layer.masksToBounds = NO; | |
if ([args objectForKey:@"shadowOffset"] != nil) { | |
CGPoint p = [TiUtils pointValue: [args objectForKey:@"shadowOffset"]]; | |
CGSize shadowOffset = {p.x,p.y}; |
This file contains hidden or 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.include('included.js'); | |
function launch_test1() { | |
test1(); | |
} |
OlderNewer