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 / 0_reuse_code.js
Created April 4, 2014 15:01
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@grantges
grantges / androidmanifestforpush.xml
Last active January 15, 2018 01:43
android manifest for push notification
<!--- REPLACE com.example.gcm WITH YOUR APP BUNDLE ID -->
<manifest package="com.example.gcm" ...>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
@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:
//
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@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});
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 / 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;
@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 / 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 / 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' +