Skip to content

Instantly share code, notes, and snippets.

@lbrenman
lbrenman / _readme
Last active August 29, 2015 14:06
Appcelerator Titanium tijasmine simple titanium example
tijasmine Unit Test Demo
* Have a working project
- Note that i created a utils.js file in the lib folder with my business logic methods
e.g.
exports.concatName = function(a,b) {
return a.substring(0,1).concat(b);
}
@lbrenman
lbrenman / _readme
Last active April 19, 2017 22:28
Appcelerator Titanium ti-mocha simple titanium example
Titanium has no built in Unit Test as Xcode/ObjC and Android Java have
Jasmine and Ti-mocha are the two main unit test frameworks for titanium
Jasmine runs without requiring the app to run
Ti-mocha runs while the app is running
Using T-Mocha
@lbrenman
lbrenman / _readme
Last active October 30, 2020 14:05
Appcelerator Titanium Hello Alloy Model
Hello Model
Models are useful for updating controls based on data updates. Without models when data changes you need to manually update every control that is associated with the data (e.g. label, tableVIew, …). By binding your controls to a model, you can simply update the model’s data and all the controls will be updated automatically.
Here are the steps for a basic model demo. For reference, the online docs are here:
http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Data_Binding-section-36739592_AlloyDataBinding-Model-ViewBinding
* Add model and select “properties”
@lbrenman
lbrenman / _readme
Created September 13, 2014 20:04
Appcelerator Titanium Hello Push with Rich Push
Basic Titanium Push Demo for iOS and Android
If you pass a URL in the push json payload in the htmlLink field, then the client will display the URL in a webview. This is Rich Push
@lbrenman
lbrenman / _readme
Last active August 29, 2015 14:06
Appcelerator Titanium ACS Search History
Example of implementing search history synced across a user's multiple devices (like google maps)
See blog post here:
http://www.appcelerator.com/blog/2014/08/implementing-recent-history-in-your-appcelerator-apps/
Excerpt from Blog:
Implementing Recent Search History in your Appcelerator apps
@lbrenman
lbrenman / _readme
Last active January 4, 2016 15:35
Appcelerator Titanium Search Autocomplete
Appcelerator Autocomplete Search
A server side search for customers, accounts, inventory, products, etc… in a mobile application is a very common operation. A typical UI for this operation is to allow the user to enter the search text and press a search button or the enter key on the on screen keyboard, as shown below. Then a search is performed, perhaps via a web service call to a server search API, and the retrieved results are displayed in a list for the user to select from the search results, as shown:
This is accomplished in Titanium by adding a event listener on the search TextField and listen for the return event as follows:
@lbrenman
lbrenman / config.json
Created October 4, 2014 01:36
Appcelerator Titanium Node.ACS Post Example
{
"routes": [ {
"path": "/",
"callback": "application#index"
}, {
"path": "/getData",
"method": "post",
"callback": "services#getData"
} ],
"filters": [ {
@lbrenman
lbrenman / config.json
Created October 5, 2014 22:39
Appcelerator Titanium Node.ACS REST to REST example
{
"routes": [ {
"path": "/",
"callback": "application#index"
}, {
"path": "/getMovies",
"method": "get",
"callback": "services#getMovies"
} ],
"filters": [ {
@lbrenman
lbrenman / app.tss
Created October 5, 2014 22:42
Appcelerator Titanium Alloy SQLLite Example
".container": {
backgroundColor:"white",
fullscreen: true
},
"Label": {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "#000"
},
"TextField": {
@lbrenman
lbrenman / ACS.js
Created October 5, 2014 22:45
Appcelerator Titanium ACS Photo Example
var Cloud = require('ti.cloud');
function createUserACS(u,p,o){
Ti.API.info("ACS: createUserACS(), u = "+u+", p="+p);
if(Titanium.Network.networkType == Titanium.Network.NETWORK_NONE){
alert("No Network. Please try again later.");
return;
}
//Alloy.Globals.waitCursorStart();