Skip to content

Instantly share code, notes, and snippets.

View anthonychung's full-sized avatar

Anthony Chung anthonychung

View GitHub Profile
@anthonychung
anthonychung / android-ti6-modules.md
Last active January 23, 2017 03:57
Reference list of titanium android native modules that have been recompiled for Titanium 6.0+sdk.
@anthonychung
anthonychung / collectionResetBind
Last active December 18, 2015 03:39
#tiAlloy shuffle and update collection with view-binding. Need to use reset.
function callback(){
//Alloy.Collections.collectionName.shuffle();
// just using suffle wont update the binding, I have to reset, then call trigger change.
Alloy.Collections.collectionName.reset(Alloy.Collections.collectionName.shuffle());
Alloy.Collections.collectionName.trigger('change');
$.myTable.height=Ti.UI.SIZE;
}
<TableView id="myTable" dataCollection="Alloy.Collections.collectionName">
@anthonychung
anthonychung / gist:5610577
Last active December 17, 2015 12:29
#tiAlloy gist use RGBA (rgb with alpha) for color gradient shadow with transparency for overlays.
'.gradientShadow':{
backgroundColor: 'transparent',
backgroundGradient:{
type:'linear',
colors:['rgba(0,0,0,0.4)','rgba(0,0,0,0.0)'], // top gradient color, bottom gradient color
startPoint:{x:0,y:0},
endPoint:{x:0,y: Ti.UI.FILL},
backFillStart:false
}
}
@anthonychung
anthonychung / gist:5572908
Created May 14, 2013 01:20
Offending code caches function in a variable so the TextField.value never update the model.
updateUserModel = function(){
// this is bad because it caches the function in the variable,
// so the Textfield.value won't get the latest value
// but only the original cached.
// This bad practice can happen if being lazy after getting rid of the exports prefix of a commonjs exports.functionname.
// it will still work for most cases but cause nasty caching bugs for when textfield values need to be updated
var currentUser ={
firstname: $.firstName.value, // these are textfields
surname: $.surname.value,
@anthonychung
anthonychung / app.tss
Last active November 13, 2017 07:27
Titanium Alloy Custom Tab Controller for specifying selected and deselected image to get around iOS native tabController limitation.
/* Window and View Styling */
'.container': {
height: Ti.UI.FILL,
width: Ti.UI.FILL,
backgroundColor: 'white'
}
/* TabGroup styling */
'#tabGroup':{
@anthonychung
anthonychung / listView.js
Last active September 7, 2018 22:21
# Lazy loading parts of a collection bound to an table view > Titanium alloy example. Look at readme.md
var common = require('common');
var pullToRefresh, scrollCtrl;
var numberTableRowsDisplayed = 10;
var postsCollection = Alloy.Collections.post;
function filterFunction(collection) {
return collection.first(numberTableRowsDisplayed);
}