Skip to content

Instantly share code, notes, and snippets.

View grantges's full-sized avatar

Bert Grantges grantges

  • Austin, Tx - United States
View GitHub Profile
@grantges
grantges / gist:3778919
Created September 24, 2012 22:47
animation test
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#fff');
var win = Ti.UI.createWindow();
var webView = Ti.UI.createWebView({
url: 'http://www.google.com',
height: 400,
top: 0,
width: Ti.API.FILL
@grantges
grantges / acs.js
Last active October 10, 2015 08:07
Appcelerator ACS Wrapper Module
/**
* Appcelerator Cloud Services (ACS) Helper Module
*/
var Cloud = require('ti.cloud');
var $P = Ti.App.Properties;
/**
* Users Helpers
@grantges
grantges / utils.js
Created September 6, 2012 19:42
Titanium Utilities Library
//Shortcuts
var $P = Ti.App.Properties;
var $F = Ti.Filesystem;
// PLATFORM RELATED Functions
exports.osname = Ti.Platform.osname;
exports.iOS = function() { return (Ti.Platform.osname === 'ipad' || Ti.Platform.osname ==='iphone')};
exports.android = function() { return Ti.Platform.osname === 'android' }
@grantges
grantges / AcsPushNotify.js
Created August 31, 2012 15:20
Registering for Push Notifications in Titanium and subscribing to an Appcelerator ACS Push Notification Channel
var Cloud = require('ti.cloud');
Cloud.debug = true;
Cloud.PushNotifications.notify({
channel: 'car-checkout',
payload: {alert:'Pending Car Checkout Request', badge:1, car_id: e.rowData.car_id}, // car_id is custom prop
to_ids: '123456,78910'
}, function (e) {
if (e.success) {
alert('Your Request has been sent');
@grantges
grantges / CloudImage.js
Created August 31, 2012 10:22
Class for handling remote Images in Titanium from the Appcelerator Cloud Service.
/**
* Dependencies
*/
var ACS = require('ti.cloud');
/**
* CloudImage Definition
*/
var CloudImage = function(_args) {
@grantges
grantges / utils.js
Created August 14, 2012 19:34
Utility Library for Appcelerator Titanium
//Shortcuts
var $P = Ti.App.Properties;
var $F = Ti.Filesystem;
// PLATFORM RELATED Functions
exports.osname = Ti.Platform.osname;
exports.iOS = function() { return (Ti.Platform.osname === 'ipad' || Ti.Platform.osname ==='iphone')};
exports.android = function() { return Ti.Platform.osname === 'android' }
@grantges
grantges / gist:3132716
Created July 17, 2012 22:58
TextField - Focus on Window Open Event
var win = Ti.UI.createWindow({layout: 'vertical', backgroundColor:'#fff'});
var textField = Ti.UI.createTextField({
height: Ti.UI.SIZE,
width: '90%',
font: {fontSize: 20},
softKeyboardOnFocus: Ti.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS
});
win.add(textField);
@grantges
grantges / gist:3132706
Created July 17, 2012 22:57
TableView - Rows and Border Radius
var win = Ti.UI.createWindow({layout: 'vertical', backgroundColor:'#fff'});
var data = [];
for(var i=0; i<20; i++){
var row = Ti.UI.createTableViewRow({
height: 40,
width: Ti.UI.FILL
});
row.title = 'Item '+i;
@grantges
grantges / gist:3132699
Created July 17, 2012 22:55
TextField - Max Length and Event Handling
var win = Ti.UI.createWindow({layout: 'vertical', backgroundColor:'#fff'});
var textField = Ti.UI.createTextField({
height: Ti.UI.SIZE,
width: '90%',
font: {fontSize: 20},
softKeyboardOnFocus: Ti.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS
});
@grantges
grantges / SliderTabGroup.js
Created July 6, 2012 17:16
SliderTabGroup for Appcelerator Titanium
$U = {};
$U.deviceType = (Ti.Platform.osname === 'ipad') ? 'tablet' : 'phone';
var SliderTabGroupButton = function(_args) {
_args = _args || {};
var borderLeft, borderRight, label;
var API = Ti.UI.createView({