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 / 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 / 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 / uploadPhoto.js
Created November 26, 2012 22:18
Quick function to upload photos taken from your camera to the cloud
function uploadPhoto( _source, _callback) {
var onSuccess = function(e){
if(e.media){
Cloud.Photos.create({
photo: e.media
}, function (e) {
if (e.success) {
var photo = e.photos[0];
alert('Success:\\n' +
@grantges
grantges / alloy.js
Last active December 12, 2015 07:48
Quick code snippets to easily set up a background task to poll geolocation information on iOS on a 10 second interval
// Setup Geoloaction Background Tasks for the app
Ti.Geolocation.purpose = "This app would like to use your location.";
Ti.App.iOS.registerBackgroundService({url: "geoBackgroundTask.js"});
/**
* Note: If you are programming in a standard project for Titanium,
* this snippet would probably go in your app.js file
* /
@grantges
grantges / WildText.js
Last active December 14, 2015 11:18
CommonJS Module for Titanium that allows you to create gradient filled Labels (note: iOS only) Updated to include updates from Todd Lindner - as noted here : https://gist.github.com/toddlindner/5093536
/*
WildText CommonJS module for Appcelerator Titanium
Create dynamic gradient filled text in your iOS Applications using this simple module.
@params : text - String. The text for your label
font - Font. Specify the font attributes for the label (defaults to standard size, weight and family),
backgroundGradient - BackgroundGradient. Specify your backgroundGradient object (defaults to White to Black linear gradient),
Top - Integer. Top property for your label,
Left - Integer. Left Property for your Label,
@grantges
grantges / nodeacs_stocks.js
Last active December 14, 2015 16:48
Node.ACS service for pulling a stock list from ACS and using MarketOnDemand to capture the stock information
var ACS = require('acs').ACS;
var logger = require('acs').logger;
var EventEmitter = require('events').EventEmitter;
var https = require('http');
var sessionID = null;
var stocks, results=[];
function getStockQuotes(req, res) {
var evt_count=0;
var A = require("alloy/animation");
var _args = arguments[0] || {};
var panelView = null;
_args.controller = _args.controller || null;
_args.parent = _args.parent || null;
/**
* PANEL ANIMATIONS
*/
@grantges
grantges / openInMenu.js
Created May 30, 2013 12:47
Generating an Open In Menu from a custom button in Appcelerator Titanium
var win = Ti.UI.createWindow();
var menuView = Ti.UI.createView({width: Ti.UI.SIZE, height: TI.UI.SIZE});
win.add(menuView);
win.open();
Ti.UI.iOS.createDocumentViewer({url:'pathToYourFile.pdf'}).show({view: menuView});
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@grantges
grantges / alloy.js
Created August 9, 2013 18:44
Simple navigation for Titanium
// The contents of this file will be executed before any of
// your view controllers are ever executed, including the index.
// You have access to all functionality on the `Alloy` namespace.
//
// This is a great place to do any initialization for your app
// or create any global variables/functions that you'd like to
// make available throughout your app. You can easily make things
// accessible globally by attaching them to the `Alloy.Globals`
// object. For example:
//