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 Utils = { | |
RemoteImage: function(a){ | |
a = a || {}; | |
var md5; | |
var needsToSave = false; | |
var savedFile; | |
if(a.image){ | |
md5 = Ti.Utils.md5HexDigest(a.image)+'.jpg'; | |
savedFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,md5); | |
if(savedFile.exists()){ |
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
HTTPRequest({ | |
ur:'http://example.com/somefile.json', | |
type:'GET', | |
success: function(a){ | |
var json = JSON.parse(a); | |
// do something else | |
}, | |
error: function(response, message){ | |
// handle error | |
} |
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 Navigation = require('navigation'); | |
var rootWindow = Ti.UI.createWindow({ | |
backgroundColor: 'green' | |
}); | |
var btn = Ti.UI.createButton({ | |
title: 'next' | |
}); |
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 = Titanium.UI.createWindow({ | |
backgroundColor:'#fff' | |
}); | |
var webView = Ti.UI.createWebView({ url:'http://www.appcelerator.com', scalesPageToFit:true,setZoomScale:2, top:0, left:0}); | |
win.add(webView); | |
var firstTime = true; | |
var htmlHack = ''; | |
htmlHack += 'var element = document.createElement("meta");'; | |
htmlHack += 'element.name = "viewport";'; |
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 Pe(){}; | |
var len = 1000000; | |
var half = len / 2; | |
var array = []; | |
var last = new Pe(); | |
while(len--) { | |
array.push(new Pe()); | |
} | |
array.push(last); |
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 memLeakArray = []; | |
function FirstWindow() { | |
var win = Ti.UI.createWindow({ | |
backgroundColor: '#ccc' | |
}); | |
var btn = Ti.UI.createButton({ | |
title: 'open next', | |
width: Ti.UI.SIZE, |
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 list 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
package com.pec1985.tigolf; | |
import org.appcelerator.titanium.util.TiRHelper; | |
import org.appcelerator.titanium.util.TiRHelper.ResourceNotFoundException; | |
public class RHelper { | |
public static int getString(String str){ | |
try { | |
return TiRHelper.getApplicationResource("string."+str); |
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 json = {"HasMore":false,"FuelStations":[{"StationId":"POIID-2011Q1_32035298","FuelPrice":[{"FuelType":1,"CapacityPrice":{"Value":4.139,"Units":"GAL","Currency":"USD"},"PriceTimestampLocal":"2013-05-10T12:17:00.000+0000","PriceTimestampGMT":"2013-05-10T19:17:34.000+0000"},{"FuelType":4,"CapacityPrice":{"Value":4.259,"Units":"GAL","Currency":"USD"},"PriceTimestampLocal":"2013-05-13T17:03:00.000+0000","PriceTimestampGMT":"2013-05-14T00:03:30.000+0000"},{"FuelType":3,"CapacityPrice":{"Value":4.159,"Units":"GAL","Currency":"USD"},"PriceTimestampLocal":"2013-05-13T17:03:00.000+0000","PriceTimestampGMT":"2013-05-14T00:03:30.000+0000"},{"FuelType":2,"CapacityPrice":{"Value":4.099,"Units":"GAL","Currency":"USD"},"PriceTimestampLocal":"2013-05-14T14:25:00.000+0000","PriceTimestampGMT":"2013-05-14T21:25:45.000+0000"}],"Brand":"76","LastUpdateTimestamp":"2013-05-16T04:06:26.000+0000","Routing":{"href":"http://fuel.si.public.devbln.europe.nokia.com/1.0/routing/calculateroute?waypoint=37.332332611083984,-122.0312194824 |
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 Slider = require('slider'); | |
var win = Ti.UI.createWindow(); | |
var slider = Slider({ | |
left: 10, | |
right: 10, | |
height: 40 | |
}); |
NewerOlder