Skip to content

Instantly share code, notes, and snippets.

View aaronksaunders's full-sized avatar

Aaron K Saunders aaronksaunders

View GitHub Profile
@aaronksaunders
aaronksaunders / test.js
Created August 16, 2011 18:25
question to map annotations and callbacks using appcelerator
function getmappoints(Lat,Long,_callback){
// you need to get the zip information, this is asynchronous also!! so
// inside of callback, we will then make the httpRequest
Ti.Geolocation.reverseGeocoder(Lat,Long,function(e){
var address = e.places;
var zip;
zip = address[0].zipcode;
// now we have zip, make httprequest
@aaronksaunders
aaronksaunders / app.js
Created August 18, 2011 06:11
Group table view sections by table data?
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
@aaronksaunders
aaronksaunders / app.js
Created August 23, 2011 19:55
Titanium Quickie: Facebook Album Covers Part 1
(function() {
var mainWindow, tableview;
function setupWindow() {
mainWindow = Titanium.UI.createWindow({
title : 'Tab 1',
backgroundColor : '#fff'
});
@aaronksaunders
aaronksaunders / app.js
Created August 27, 2011 02:27
Appcelerator Titanium iPad FileDownload Example
/**
* htp://blog.clearlyinnovative.com
*
* more appcelerator examples
*/
var c = Titanium.Network.createHTTPClient();
c.setTimeout(10000);
c.onload = function() {
Ti.API.info('IN ONLOAD ');
@aaronksaunders
aaronksaunders / ComClearlyinnovativeUtilsModule.m
Created August 29, 2011 15:17
Titanium Appcelerator Quickie: base64encode iOS Module
/**
*
* Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
* and licensed under the Apache Public License (version 2)
*/
#import "ComClearlyinnovativeUtilsModule.h"
#import "TiBase.h"
#import "TiHost.h"
#import "TiUtils.h"
#import "Base64Transcoder.h"
@aaronksaunders
aaronksaunders / app.js
Created August 29, 2011 15:29
test harness for Titanium Appcelerator Quickie: base64encode iOS Module
// This is a test harness for your module
// You should do something interesting in this harness
// to test out the module and to provide instructions
// to users on how to use it by example.
// open a single window
var window = Ti.UI.createWindow({
backgroundColor:'white'
});
//
// aaronksaunders
// blog.clearlyinnovative.com
//
var mainWindow = Titanium.UI.createWindow({
title : 'Main'
});
var dataItems = [];
var dataArray = [{
@aaronksaunders
aaronksaunders / app.js
Created September 3, 2011 08:03
Why does this fail on Android but work fine on iOS
var XHR = Ti.Network.createHTTPClient();
XHR.open("POST", "http://www.clearlyinnovative.com");
// on success, grab the request token
XHR.onload = function() {
Ti.API.debug("XHR.onload " + XHR.responseText);
};
// on error, show message
XHR.onerror = function(e) {
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
@aaronksaunders
aaronksaunders / app.js
Created September 10, 2011 16:54
Publish a Facebook checkin using Graph API in Appcelerator
Titanium.Facebook.appid = "YOUR APP ID";
Titanium.Facebook.permissions = ['publish_stream', 'read_stream', "user_checkins", "publish_checkins"];
function doFacebookCheckin(_callback) {
var getInfo = function(localCallback) {
// GOTCHA - You need to stringify the coordinates or the
// the API call will fail, this was a PITA to find
var data = {