Skip to content

Instantly share code, notes, and snippets.

@rborn
rborn / app.js
Created September 29, 2011 19:01 — forked from jonalter/app.js
iOS/Android: read the bytes of a file
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
win.open();
var button = Ti.UI.createButton({
title : "Click me!",
height : 50,
width : 200,
top : 100
@rborn
rborn / PagingControl.js
Created April 19, 2012 07:36 — forked from raulriera/PagingControl.js
Custom paging control for scrollableViews for Titanium Appcelerator
// I was unhappy about there was close to no control over the "pageControl"
// in scrollableViews, so I hacked my own
// -----
var pages = [];
var page;
var numberOfPages = 0;
// Configuration
var pageColor = "#c99ed5";
@rborn
rborn / AndroidManifest.xml
Created April 20, 2012 12:33 — forked from iskugor/AndroidManifest.xml
Android hardware accelerator & tabs width
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.adriatic.test" android:versionCode="1"
android:versionName="1">
<uses-sdk android:minSdkVersion="11" />
<!-- TI_MANIFEST -->
<application android:icon="@drawable/appicon"
android:label="Test Application" android:name="TestApplication"
@rborn
rborn / app.js
Created May 24, 2012 16:34
now.js for Titanium mobile
// put now.js and socket.io.js inside a 'lib' dir inside Resources dir
// (obviously you can change this, only remember to change the require inside now.js line #1)
// just socket.io:
/*
var io = require('/lib/socket.io');
var socket = io.connect('http://192.168.1.129:6120'); // using LAN IP instead of localhost
socket.on('news', function (data) {
Ti.API.log(data);
socket.emit('my other event', { my: 'data' });
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
//
// the regular expression composed & commented
// could be easily tweaked for RFC compliance,
// it was expressly modified to fit & satisfy
// these test for an URL shortener:
@rborn
rborn / pull-to-refresh(android).js
Created June 19, 2012 09:10 — forked from jpurcell/pull-to-refresh(android).js
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({
@rborn
rborn / TiUITextAreaProxy.m
Created June 28, 2012 07:44 — forked from pec1985/TiUITextAreaProxy.m
contentWidth and contentHeight in Ti.UI.TextArea
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#ifdef USE_TI_UITEXTAREA
@rborn
rborn / app.js
Created July 5, 2012 15:34 — forked from dawsontoth/app.js
Customize the look of the tab bar in iOS Appcelerator Titanium
Ti.include('overrideTabs.js');
/*
This is a typical new project -- a tab group with three tabs.
*/
var tabGroup = Ti.UI.createTabGroup();
/*
Tab 1.
@rborn
rborn / ti.js
Created July 7, 2012 10:16 — forked from kwhinnery/ti.js
/*
* Mixin properties of n objects into the given object - pass in as many objects to mix in as you like.
* Can perform a shallow or deep copy (shallow is default for performance reasons).
*
* Usage:
* mixin([Boolean deepCopy,] objectToExtend, objectToMixIn [, as many other objects as needed])
*
* Examples:
*
* var o1 = {
@rborn
rborn / app.js
Created July 11, 2012 07:29
titanium tiws module example
// ****************************************************************************************************************
// ****************************************************************************************************************
// test value can be 'raw' | 'socket.io' | 'nowjs'
var test = 'raw',
// ****************************************************************************************************************
// ****************************************************************************************************************
// REMEMBER to change this with your data