Skip to content

Instantly share code, notes, and snippets.

@mschmulen
mschmulen / animate annotation
Created January 3, 2011 21:44
animate an annotation on a mapview
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
var win = Ti.UI.createWindow({
title: "Window Title",
exitOnClose: true
});
win.open();
// CREATE MAP VIEW
@mschmulen
mschmulen / myLocationOnAMap
Created January 4, 2011 06:36
show my location on a map
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
Ti.Geolocation.purpose = "FUN";
var win = Ti.UI.createWindow({
exitOnClose: true,
backgroundColor:'#336699',
title: 'Main Window',
navBarHidden: false
});
@mschmulen
mschmulen / AppcPerfomanceTips.md
Created January 5, 2011 22:13
Appc performance tips

Appc Performance tips

  • More efficient for repeating timers to use setInterval that repeating a setTimer. You'll get better efficiency and scheduling and less overhead.
  • Cancel your timers. Calling setInterval which will return a timer handle. to cancel a timer clearTimeout or clearInterval and pass the handle returned by either setTimeout or setInterval.
  • Use JSON.parse instead of eval.
  • Don't re-use XHR Objects. It's not safe and they're not meant to be re-usable.
@mschmulen
mschmulen / TableViewNeverending.js
Created February 1, 2011 02:07
Titanium tableView with a continuous amount of data.
//
// in this demo, we simply show how you could dynamically scroll
// with a continuous amount of data in the tableview by detecting
// when the user's scroll position gets near the end of the table
// and start a background fetch of new data and seamlessly append
// the new data to the table automatically
//
var win = Ti.UI.createWindow();
@mschmulen
mschmulen / bootstrap.js
Created February 7, 2011 16:28 — forked from rblalock/bootstrap.js
with closure
// Include framework files
Ti.include('system/core.js');
// Set app preferences
var App = new TiGantry(
'0.1', // App version
'Zergling', // App version name
'tweetrdone', // Name of app
'app', // Location of app directory
'controllers', // Location of controllers directory
/**
* We're going to create an infinite scrollable list. In this case, we're going to show a date. When you swipe left,
* you'll see yesterday. Then the day before yesterday, and so on. Swiping right shows you tomorrow, and so on.
*/
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var isAndroid = Ti.Platform.osname === 'android';
/**
* Track where we are in the infinite scrollable views, and define how large of a step goes between each view.
*/
var currentDate = new Date(), msIntervalBetweenViews = 1000/*ms*/ * 60/*s*/ * 60/*m*/ * 24/*h*/;
#!/bin/sh
#
# Copyright (c) 2010 Warren Merrifield
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
// inspired on http://www.joelpeterson.com/clock/
// and most of the code taken from there as well
var win = Ti.UI.createWindow({
orientationModes: [3, 4]
});
var clock_bg = Ti.UI.createView({
backgroundColor: '#444444',
top: 20,
left: 20,
@mschmulen
mschmulen / #{fileName}
Created July 22, 2011 19:57
This is a test description
friday
friday
friday
@mschmulen
mschmulen / #{fileName}
Created July 27, 2011 16:55
This is a test description
forTheDemo