Skip to content

Instantly share code, notes, and snippets.

View benbahrenburg's full-sized avatar

Ben Bahrenburg benbahrenburg

View GitHub Profile
@benbahrenburg
benbahrenburg / app.js
Created June 14, 2015 21:38
Draft API for adding NSUserActivity to Titanium. This allows for the support of hand off, search, etc
var activity = Titanium.App.iOS.createUserActivity({
activityType : "com.appcelerator.handoff.example.browsing-location"
userInfo : someDictionary,
needsSave : false,
webpageUrl : "optional webpage",
title : "an example"
});
activity.addEventListener("useractivitywascontinued",function(e){
'use strict';
import View from 'view';
import Window from 'window';
// Example Usage
let win = new Window();
let view = new View({
top: 0,
@benbahrenburg
benbahrenburg / idea.js
Created July 18, 2015 18:40
WK Bridging idea
var qxCore = {
callbackWrappers : {
wrapperCounter : 0,
generateId : function(name){
qxCore.callbackWrappers.wrapperCounter++;
return name + qxCore.callbackWrappers.wrapperCounter;
}
}
};
@benbahrenburg
benbahrenburg / gist:948579
Created April 29, 2011 16:32
Login Example
// create tab group
demo.tabMainGroup = Ti.UI.createTabGroup({isOpen:false});
demo.tabLoginGroup = Ti.UI.createTabGroup({isOpen:false});
demo.wLogin = Ti.UI.createWindow({
id:'wLogin'
});
demo.tbLogin = Ti.UI.createTab({window:demo.wLogin});
@benbahrenburg
benbahrenburg / app.js
Created May 23, 2011 20:29
Ti.App issues
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
var tzt ={
testIt: function(){
alert('testIt');
},
isAndroid : function(){
return (Ti.Platform.osname == 'android');
},
@benbahrenburg
benbahrenburg / gist:1085149
Created July 15, 2011 17:47
Android XHR issue
bGet.addEventListener('click', function(){
var _url = "https://my.url.goes.here";
var username='demo';
var password='badpass';
var aToken = 'Basic ' + Ti.Utils.base64encode(username + ':' + password);
var c = Titanium.Network.createHTTPClient();
c.setTimeout(10000);
c.onload = function(e)
{
Ti.API.info("ONLOAD = "+e);
@benbahrenburg
benbahrenburg / app.js
Created July 24, 2011 23:57
Camera Callback
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Ti.UI.setBackgroundColor('#000');
Ti.UI.iPhone.statusBarStyle = Ti.UI.iPhone.StatusBar.OPAQUE_BLACK;
//Create main app namespace
var demo={};
//Create a few helpers
demo.myHelpers = {
isAndroid : function(){
return (Ti.Platform.name == 'android');
},
@benbahrenburg
benbahrenburg / gist:1103324
Created July 25, 2011 00:54
Saving XHR Results to a file
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function()
{
var results = this.responseText;
Ti.API.info('Results from xhr Lookup = ' + results );
var supportDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'my_support');
if(!supportDir.exists()){
supportDir.createDirectory();
}
@benbahrenburg
benbahrenburg / app.js
Created July 31, 2011 03:46 — forked from joemaffia/app.js
foursquare OAuth in Titanium
/**
*
*
* Copyright 2011 Aaron K. Saunders, Clearly Innovative Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
@benbahrenburg
benbahrenburg / .gitignore
Created August 6, 2011 14:20
Git ignore file for a Titanium Build Directory
tmp
android/
iphone/