Skip to content

Instantly share code, notes, and snippets.

@stereoket
stereoket / Geolocation Method (Titanium)
Created February 16, 2011 14:12
Trying to understand why event listener does not close down
Ti.Geolocation.getCurrentPosition(function(e)
{
if (!e.success || e.error)
{
Ti.API.debug('error ' + JSON.stringify(e.error));
return;
}
Ti.Geolocation.addEventListener('location',function(e)
{
if (!e.success || e.error)
@stereoket
stereoket / destroyAuthorizeUI() method
Created February 20, 2011 17:40
Error message form Titanium Editor when using new oauth-adapter file
[DEBUG] destroyAuthorizeUI
[DEBUG] destroyAuthorizeUI:webView.removeEventListener
2011-02-20 17:35:00.938 PurpleAndroid[20379:b003] -[NSNull context]: unrecognized selector sent to instance 0x220adc8
[ERROR] The application has crashed with an unhandled exception. Stack trace:
0 CoreFoundation 0x0219cbcc __exceptionPreprocess + 156
1 libobjc.A.dylib 0x022f15c2 objc_exception_throw + 47
2 CoreFoundation 0x0219e6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0210e366 ___forwarding___ + 966
4 CoreFoundation 0x0210df22 _CF_forwarding_prep_0 + 50
5 PurpleAndroid 0x00089cc1 -[TiProxy removeEventListener:] + 531
@stereoket
stereoket / tabgroup Ti Bug
Created March 17, 2011 17:01
tabgroup titanium buggy example
// Create intial Window Group for use in the tab groups
var win1 = Ti.UI.createWindow({title: 'Page1', titleid: 'page1', backgroundColor: '#fff'});
var win2 = Ti.UI.createWindow({title: 'Page2', titleid: 'page2', backgroundColor: '#fff'});
// Create New tab group before adding individual tabs
var tabGroup1 = Ti.UI.createTabGroup({id: 'firstTabGroup', bottom: 0,height: 40, barColor: 'green'});
// Create the individual tabs with titles and icons
var tab1 = Ti.UI.createTab({
window:win1,
@stereoket
stereoket / android.Ti.geo-test
Created March 18, 2011 21:33
A titanium app built to test geo capabilities on Android (currently buggy on nadroid, fine for iOS)
var GeoTest = {
init: function(){
Ti.API.debug('Using an '+Ti.Platform.osname+' device');
GeoTest.win2 = Ti.UI.createWindow({
backgroundColor:"#d4fdfd",
title: 'GPS Android Test'
});
GeoTest.win2.open();
var gpsTestLabel = Titanium.UI.createLabel({
text:'GPS Test started',
@stereoket
stereoket / oauth-test.js
Created May 19, 2011 20:18
ouath-adapter test
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
@stereoket
stereoket / gpstest.js
Created June 4, 2011 21:45
GPS Lookup demo
var GO = {
init: function(){
// Delete the property data
Ti.API.debug('Removing properties');
Ti.App.Properties.removeProperty("latitude");
Ti.App.Properties.removeProperty("longitude");
Ti.App.Properties.removeProperty("geoAccuracy");
Ti.App.Properties.removeProperty("geoTimestamp");
var propTimestamp = Ti.App.Properties.getString("geoTimestamp");
@stereoket
stereoket / example.jss
Created August 5, 2011 11:19
example JSS snippet
#styleID {
width: 250;
height: 82;
backgroundImage: 'none';
backgroundSelectedColor: '#e2ffee';
borderColor: '#0000ff';
borderWidth: 1;
borderRadius:5;
}
@stereoket
stereoket / androidmanifest1.xml
Created August 14, 2011 07:58
Android Manifest XML Orientation snippets
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dsfsdgsfdg" android:versionCode="1"
android:versionName="1">
<uses-sdk android:minSdkVersion="7" />
<!-- TI_MANIFEST -->
<application android:icon="@drawable/appicon"
@stereoket
stereoket / stack-debug-1.0.4.txt
Created August 17, 2011 16:30
stack trace debugger in studio 1.0.4
[ERROR] The application has crashed with an unhandled exception. Stack trace:
0 CoreFoundation 0x0238658c __exceptionPreprocess + 156
1 libobjc.A.dylib 0x024da313 objc_exception_throw + 44
2 CoreFoundation 0x023880bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x022f7966 ___forwarding___ + 966
4 CoreFoundation 0x022f7522 _CF_forwarding_prep_0 + 50
5 Festival App 0x0033008b -[TiDebugger log:level:] + 134
6 Festival App 0x00331b10 TiDebuggerLogMessage + 69
7 Festival App 0x00143656 -[APIModule logMessage:severity:] + 486
@stereoket
stereoket / codeSnippet-crash.js
Created August 22, 2011 22:41
Crashing iOS emulator
fa.device = {
density: Ti.Platform.displayCaps.density,
platformHeight: Ti.Platform.displayCaps.platformHeight,
platformWidth: Ti.Platform.displayCaps.platformWidth,
dpi: Ti.Platform.displayCaps.dpi
};