Skip to content

Instantly share code, notes, and snippets.

View brentonhouse's full-sized avatar
🚀
Busy being awesome!

Brenton House brentonhouse

🚀
Busy being awesome!
View GitHub Profile
@dawsontoth
dawsontoth / app.js
Created February 4, 2011 23:21
CSS Injection on External Websites using Appcelerator Titanium
// create our web view
var win = Ti.UI.createWindow({ backgroundColor: "#fff" });
var web = Ti.UI.createWebView({ url: "http://chicago.craigslist.org/" });
// inject our css when the web view finishes loading (because we need to inject into the head element)
web.addEventListener('load', function () {
// first, specify the CSS file that we should load
var cssFileName = 'styles.css';
// read in the contents
var cssFromFile = Ti.Filesystem.getFile(cssFileName);
@dawsontoth
dawsontoth / verticalScrollableView.js
Created February 22, 2011 19:34
Vertical Scrollable View
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var rotate = Ti.UI.create2DMatrix().rotate(90);
var counterRotate = rotate.rotate(-180);
var scrollView = Titanium.UI.createScrollableView({
views:[
Titanium.UI.createImageView({ image:'default_app_logo.png', transform: counterRotate }),
Titanium.UI.createImageView({ image:'KS_nav_ui.png', transform: counterRotate }),
Titanium.UI.createImageView({ image:'KS_nav_views.png', transform: counterRotate })
@kosso
kosso / background_demo.js
Created March 12, 2011 17:55
Background Service notification for Titanium
/* Kosso : March 12th 2011
This the only way I managed to do this without the app crashing on resume.
Done slightly differently to the KS example, since they unregister the service and
do not use a setInterval timer.
*/
//############ in app.js :
// test for iOS 4+
@mcongrove
mcongrove / TiDrop.js
Created April 1, 2011 22:13
A quick and simple example of how to do drag+drop in Titanium
var TiDrop = {
touching: false,
position: {
elementYStart: 0,
elementXStart: 0,
yStart: 0,
xStart: 0,
yCurrent: 0,
xCurrent: 0
},
@mcongrove
mcongrove / TiLoad.js
Created April 6, 2011 17:12
A loading screen that can be shown and hidden from anywhere within an application
var TiLoad = {
visible: false,
init: function(_properties) {
var options;
if(_properties && _properties.rotate) {
options = {
orientationModes: [
Titanium.UI.LANDSCAPE_LEFT,
Titanium.UI.LANDSCAPE_RIGHT,
@pec1985
pec1985 / TableViewIndex.js
Last active September 25, 2015 11:08
Get the right column of letters on a table view
/* Ever wondered how to get the nice column of letters in the right side
* of the table view?
*
* Here is an example:
* 1. We take a list of names from a json file
* 2. We need to sort them by either first name or last name
* 3. We need to create a row header once in a while, when the first letter changes
* 4. We need to create a table index
*
*/
@rileydutton
rileydutton / collabsablerows.js
Created April 28, 2011 16:03
Collapsable/Expandable Table View Rows in Titanium Mobile
var container = Ti.UI.createView({backgroundColor: "white", layout: "vertical"});
var layout = [
{
title: "Parent 1",
isparent: true,
opened: false,
sub: [
{
@dawsontoth
dawsontoth / app.js
Created May 10, 2011 14:05
Loading images in @appcelerator #Titanium
/* The images for this example can be downloaded from http://j.mp/loadingimagesforti */
var win = Ti.UI.createWindow({ backgroundColor: '#f00'});
var loading = Ti.UI.createImageView({
images: [
'images/loading/00.png', 'images/loading/01.png', 'images/loading/02.png',
'images/loading/03.png', 'images/loading/04.png', 'images/loading/05.png',
'images/loading/06.png', 'images/loading/08.png', 'images/loading/09.png',
'images/loading/10.png', 'images/loading/11.png'
],
width: 33, height: 33
@adampax
adampax / titanium-array-form-next-key.js
Created October 20, 2011 17:59
Simple Titanium form saved in an array with return key eventlistener moving to the next field
Ti.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({
title : 'test'
});
var arrayLength = 5
var fields = new Array(arrayLength);
for( i = 0; i < arrayLength; i++) {
@pec1985
pec1985 / app.js
Created February 13, 2012 20:13
Lock Screen for iOS apps - Titanium
function PassCode(_params){
_params = _params || {};
// @PARAMS:{
// boxSize: (Number) size of the passcode character boxes
// backgroundColor: (String) background color of the mainview
// backgroundImage: (String) background image of the mainview
// panicColor: (String) background color of the view when panic() is called - when wrong password
// titleText: (String) the text of the title view, above the pass code boxes by default,
// mainView: (Object) params for the main view that hold the passcode boxes