Skip to content

Instantly share code, notes, and snippets.

View stephenfeather's full-sized avatar

Stephen Feather stephenfeather

View GitHub Profile
@jpurcell
jpurcell / pull-to-refresh(android).js
Created April 5, 2011 15:58
Tweetie-like pull to refresh and pull to load more. Note that it requries set heights for everything.
// This is the Android version of the Tweetie-like pull to refresh table:
// http://developer.appcelerator.com/blog/2010/05/how-to-create-a-tweetie-like-pull-to-refresh-table.html
var win = Ti.UI.currentWindow;
var alertDialog = Titanium.UI.createAlertDialog({
title: 'System Message',
buttonNames: ['OK']
});
var scrollView = Ti.UI.createScrollView({
@powmedia
powmedia / gist:1081802
Created July 14, 2011 01:58
Backbone.sync for Titanium
//Customise Backbone.sync to work with Titanium rather than jQuery
Backbone.sync = (function() {
var methodMap = {
'create': 'POST',
'read' : 'GET',
'update': 'PUT',
'delete': 'DELETE'
};
var xhr = Ti.Network.createHTTPClient({ timeout: 5000 });
@oroce
oroce / _for iOS users
Created November 2, 2011 18:20
Appcelerator share to native facebook, twitter
This gist is only for Android.
If you would like launch native apps
on iPhone, iPad, you can find information about it in Appcelerator Docs:
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.canOpenURL-method.html
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.openURL-method.html
More info about iOS URL Schemes: http://handleopenurl.com/
@pec1985
pec1985 / app.js
Created February 28, 2012 03:55
Titanium Vertical Label
// use this as a normal Ti.UI.Label
function VerticalLabel(_params){
// store the text in this variable
var text = _params.text || '';
// create an array of letters
var array = text.split('');
// get the length of the array (letters)
var len = array.length;
@psyked
psyked / RateMe.js
Created March 7, 2012 10:08 — forked from dawsontoth/app.js
"Rate my app in Appcelerator Titanium Mobile" as a commonJS module.
function RateMe(ios_url, goog_url, usecount) {
if(!Ti.App.Properties.hasProperty('RemindToRate')) {
Ti.App.Properties.setString('RemindToRate', 0);
}
var remindCountAsInt = parseInt(Ti.App.Properties.getString('RemindToRate'), 10);
var newRemindCount = remindCountAsInt += 1;
if(remindCountAsInt === -1) {
// the user has either rated the app already, or has opted to never be
// reminded again.
/**
* @preserve
* Titanium Cloud Module
*
* This module is used across three distinct platforms (iOS, Android, and Mobile Web), each with their own architectural
* demands upon it.
*
* Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
* and licensed under the Apache Public License (version 2)
*/
@pec1985
pec1985 / app.js
Created May 20, 2012 06:55
DashboardView JS module
var Dashboard = require('dashboard');
var win = Ti.UI.createWindow({
backgroundColor:'lightgray'
});
var view = new Dashboard.View();
var data = [];
for(var i = 0; i < 20; i++){
@pec1985
pec1985 / test1.js
Created June 25, 2012 15:37
Optimizing Appcelerator's Titanium
/**
* Test #1
* Adding 10,000 Ti.UI.TableViewRows to a Ti.UI.TableView
* The rows have the Ti.UI.iPhone.TableViewCellSelectionStyle.BLUE constant in them
*
* Total time in my Mac: 1228ms
*/
var win = Ti.UI.createWindow({
backgroundColor: '#ccc'
@pec1985
pec1985 / app.js
Last active October 12, 2015 21:48
Login utility to save to file for titanium
/**
* To be used this way
*/
var Log = require('log');
Log.Info('This is an info log');
Log.Error('This is an error log');
Log.Debug('This is a debug log');
// ==UserScript==
// @name Ingress Player Locations
// @description Shows player locations on the Ingress Intel Map
// @version 1.2
// @match http://www.ingress.com/intel
// @run-at document-start
// ==/UserScript==
function override() {