Skip to content

Instantly share code, notes, and snippets.

View bob-sims's full-sized avatar

Bob Sims bob-sims

View GitHub Profile
@pec1985
pec1985 / app.js
Created November 17, 2011 19:19
Android system images
var win = Ti.UI.createWindow({
fullscreen:false
});
var table = Ti.UI.createTableView();
var row;
var data = [];
for(var i = 17301504; i < 17302359; i ++){
try{
@oroce
oroce / _for iOS users
Created November 2, 2011 18:20
Appcelerator share to native facebook, twitter
This gist is only for Android.
If you would like launch native apps
on iPhone, iPad, you can find information about it in Appcelerator Docs:
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.canOpenURL-method.html
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.openURL-method.html
More info about iOS URL Schemes: http://handleopenurl.com/
@pec1985
pec1985 / app.js
Created October 23, 2011 05:30
Android quick dashboard view
var win = Ti.UI.createWindow({});
win.open();
var height = Ti.Platform.displayCaps.platformHeight-40;
var width = Ti.Platform.displayCaps.platformWidth;
var viewsArray = [];
@Mindelusions
Mindelusions / app.js
Created October 18, 2011 23:01
Sample Titanium App Built Using Sensis Developer API
// Include a small sensis helper library
var mind = {};
Ti.include('sensis.js');
// Custom activity indicator
var indWin = null;
var actInd = null;
function showIndicator()
{
@dawsontoth
dawsontoth / app.js
Created September 7, 2011 14:08
QR Codes in Titanium Mobile
/**
* Creates an image view using Google's QR Code generator.
* @param text The text to be encoded in the QR code
* @param size The size of the QR code; Possible Sizes: 100x100, 150x150, 200x200, 250x250, 300x300, 350x350, 400x400, 500x500
*/
function createQRCodeImageView(text, size) {
var url = 'http://chart.apis.google.com/chart?cht=qr&chs=' + size + '&chl=' + encodeURI(text) + '&chld=H|0';
var width = size.split('x')[0], height = size.split('x')[1];
if (Ti.Android) {
width += 'dp';
@skypanther
skypanther / app.js
Created September 1, 2011 21:48
Draw gridlines in a Titanium window
// implement like this:
var window = Ti.UI.createWindow({
backgroundColor:'#fff'
});
// draw the gridlines first so your other elements stack on top of them
// without requiring you to set the z-index property of each
var grid = require('gridlines');
grid.drawgrid(10,window);
var win = Titanium.UI.createWindow();
win.backgroundColor = '#fff';
Ti.Geolocation.preferredProvider = "gps";
Ti.Geolocation.purpose = "GPS demo";
function translateErrorCode(code) {
if (code == null) {
return null;
}
@pec1985
pec1985 / app.js
Created August 1, 2011 20:41
XHR function with callback
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
}
var os = require('os').os;
//branch logic based on platform - saves you an if statement
os(function() {
alert('do this on android');
}, function() {
alert('do this on iOS');
});
var platformSpecificValue = os('android string','ios string');
@powmedia
powmedia / gist:1081802
Created July 14, 2011 01:58
Backbone.sync for Titanium
//Customise Backbone.sync to work with Titanium rather than jQuery
Backbone.sync = (function() {
var methodMap = {
'create': 'POST',
'read' : 'GET',
'update': 'PUT',
'delete': 'DELETE'
};
var xhr = Ti.Network.createHTTPClient({ timeout: 5000 });