Skip to content

Instantly share code, notes, and snippets.

View alanleard's full-sized avatar

Alan Leard alanleard

View GitHub Profile
@alanleard
alanleard / app.js
Last active July 19, 2016 13:21
Understanding how backgroundLeftCap and backgroundTopCap work in Titanium
//This is a demo to show how backgroundLeftCap and backgroundTopCap work on the Tianium platform by Appcelerator
//Paste this code in app.js (tested on iOS)
//Screenshot: http://screencast.com/t/txWQD3l2UBN
///////////////////////////////////////////////////////////////////////////////
//Just modify these variables to see how backgroundLeftCap and topCap will work
var topCap = 20;
var leftCap = 35;
var originalImageSize = {height:100, width:100}
@alanleard
alanleard / app.js
Created December 6, 2012 19:50
Infinite Remote ImageView Scrollable
/*
Recognized parameters:
imageListURL - string (URL to JSON array of image names, if not available, imageList will be used)
imageList - array (array of image names to be added to imageURL, not used if imageListURL present)
imageURL - string (base url of images)
defaultImage - string (preventDefaultImage set if not used)
scrollable - object (pass in your own scrollableView)
scrollProps - object (pass in your own scrollable properties)
Sample Usage:
@alanleard
alanleard / gist:7778819
Created December 3, 2013 22:33
Font Size Manipulation
var args = arguments[0] || {};
var changeFontSize = null;
$.sectionTitle.text = args.title;
function setTitles(callback){
if(args.criteria) {
var cLength = args.criteria.length;
for(var i=0; i<cLength; i++){
var title = Ti.UI.createLabel({
@alanleard
alanleard / app
Last active December 24, 2015 01:09
Android tableView pull to refresh and no results alert
var win = Ti.UI.currentWindow;
var alertDialog = Titanium.UI.createAlertDialog({
title: 'System Message',
buttonNames: ['OK']
});
var data = [
{title:"Refresh",color:'#000',height:50},
{title:"Row 1",color:'#000',height:50},
@alanleard
alanleard / app.js
Created March 7, 2013 23:00
Sizing sample
var container = Ti.UI.createView({
height : Ti.UI.SIZE
});
var dashboardTileHolder = Ti.UI.createView({
top : 0,
layout : "vertical",
height : Ti.UI.SIZE
});
@alanleard
alanleard / app.js
Created March 7, 2013 20:41
Dynamic height
var win = Ti.UI.createWindow();
var leftTileView = Ti.UI.createView({
backgroundColor:"red",
height:(Math.random()*200),
width:"59%",
left:0
});
var tileContainer = Ti.UI.createView({
@alanleard
alanleard / index.js
Last active December 14, 2015 13:58
Alloy table open tabs example
$.index.open();
function tableClick(e){
$.index.setActiveTab(e.rowData.tab);
}
@alanleard
alanleard / app.js
Created March 1, 2013 16:28
Custom slider
var win = Ti.UI.createWindow();
var slider = Ti.UI.createView({
height:28,
width:358,
backgroundImage:'slider.png',
top:0
});
var button = Ti.UI.createView({
@alanleard
alanleard / app.js
Last active December 14, 2015 01:59
Geolocation returning County
Ti.Geolocation.purpose = "Locate your current county";
Ti.Geolocation.getCurrentPosition(function(e){
if(Ti.Geolocation.locationServicesAuthorization != 2){
var lat = e.coords.latitude;
var lng = e.coords.longitude;
getCounty({county:"County", url:"http://labs.silverbiology.com/countylookup/lookup.php?cmd=findCounty&DecimalLatitude="+lat+"&DecimalLongitude="+lng});
@alanleard
alanleard / gist:4964354
Created February 15, 2013 23:11
Test AppCSolution Gist
Testing