Skip to content

Instantly share code, notes, and snippets.


Ben Bahrenburg benbahrenburg

View GitHub Profile
viezel /
Last active Aug 29, 2015
Build and copy android module
## Build an Appcelerator Android Module
## Then copy it to the default module directory
## (c) Napp ApS
## Mads Møller
mattapperson / Instructions
Last active Aug 29, 2015
CommonJS Controllers for alloy
View Instructions
In your Alloy project, add the alloy.jmk file to the app folder and create a directory called template, in the template directory, add the component.js file. Then simply start building your alloy apps with commonjs style controller.
Want to require in another controller? simply access it like this:
var otherController = require('otherController').class;
Events are now namespaced to the `C` variable for views.
jonalter / app.js
Created May 3, 2011
Creating Reusable Factories and Using Ti.App with a Namespace
View app.js
// Please note that this is a dirty solution.
// It does work, but Appcelerator does not support it (adding things to the Ti namespace).
// There is a very good chance that it will not be possible in future releases.
var ui = {};
var labels = {};
MorningZ / helpful_prototypes.js
Created May 6, 2011
Helpful JavaScript prototypes!
View helpful_prototypes.js
/* Prototypes that work against primitives */
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };
String.prototype.contains = function(t) { return this.indexOf(t) >= 0 ? true : false; };
String.prototype.beginsWith = function(t, i) { if (i == false) { return (t == this.substring(0, t.length)); } else { return (t.toLowerCase() == this.substring(0, t.length).toLowerCase()); } };
String.prototype.endsWith = function(t, i) { if (i == false) { return (t == this.substring(this.length - t.length)); } else { return (t.toLowerCase() == this.substring(this.length - t.length).toLowerCase()); } };
Object.prototype.merge = (function (ob) {var o = this;var i = 0;for (var z in ob) {if (ob.hasOwnProperty(z)) {o[z] = ob[z];}}return o;});
/* Examples:
pec1985 / deleterow.js
Created Jun 10, 2011
delete a row in a table view in android
View deleterow.js
var win = Ti.UI.createWindow({
// create the table view
var tableView = Ti.UI.createTableView({});
// create an empty array
var data = [];
// this is the alert message + deleting the row from the array
function confirmDel(rowId,rowName) {
pec1985 / app.js
Created Jun 13, 2011
Simple Single-Context app
View app.js
// namespace for the windows
var W = {};
// namespace for custom UI
var UI = {};
// store the tabs in this array for later use
var tabs = [];
// include the necessary files to run the app
pec1985 / app.js
Created Jul 22, 2011
Scroll to position - iOS - Appcelerator
View app.js
var win = Ti.UI.createWindow({
title:'Row #50'
var buttonBar = Ti.UI.createButtonBar({
win.rightNavButton = buttonBar;
kwhinnery /
Created Aug 11, 2011
Secure Web API Flow

A Rough Flow for a simple, secure web API

  • Step One: Third party app developer (hereafter "the app") registers an application with the service provider (called here and afterwards "the service provider"), like Twitter or Gimme Bar. The app receives an API key, where it is made explicitly clear that storing username/password combinations is not necessary and is a violation of the terms of service for the API.

  • Step Two: Over SSL/TLS, the app exchanges a username/password combination given to them by the end user, and provides it to the service provider, along with their API key in exchange for an access token.

####But wait, isn't that insecure? Why is the user giving you their password? oAuth prevents this!!!!

If the app is a malicious mobile or desktop application, the app can very easily steal your password if desired - the app can redirect you to a "web browser", which it controls, and steal your username and password if the app is a dick. This is only one avenue of several a malicious app

bob-sims / 00-readme.txt
Created Nov 28, 2011
CommonJS module to pull XML response from from (undocumented) Google Weather API, for use with Titanium Mobile
View 00-readme.txt
// console dump of sample returned object
I/TiAPI ( 244): (kroll$4: app://app.js) [797,3312] Object
I/TiAPI ( 244): {
I/TiAPI ( 244): weatherData => Object
I/TiAPI ( 244): {
I/TiAPI ( 244): forecastInfo => Object
I/TiAPI ( 244): {
I/TiAPI ( 244): city => 'Bydgoszcz, Kuyavian-Pomeranian Voivodeship',
pec1985 / app.js
Created Dec 30, 2011
LinkedIn effect - Titanium
View app.js
// right navigation button
var btn = Ti.UI.createButton({
// window
var win = Ti.UI.createWindow({