Skip to content

Instantly share code, notes, and snippets.

@vindriaoc
vindriaoc / kopi_namespaces.js
Created April 29, 2011 23:11
Kopi NameSpaces
var Ki={}; //Root of Kopi.TIME NameSpaces
var Kopi=Ki; //Root of Kopi.TIME NameSpaces
Kopi.app='App' //"Curr App", Application w/ share implementation (Ex: Kopi.Viewer)
Kopi.<App>={}; //"Some App" (Change <App> with your app name see Ex: Auth)
Kopi.<App>.f={}; //"Some App" must declare function in this namespaces!
Kopi.<App>.<Ns>={}; //"Some App" have NameSpace or copy of instance object
Kopi.Tab={}; //Tab Module
Kopi.Tab.Group. //Instance of tabGroup use in this application
@vindriaoc
vindriaoc / t.sh
Created April 27, 2011 08:28 — forked from dawsontoth/t.sh
Bash script to quickly simulate / emulate / deploy Appcelerator Titanium Mobile apps
##
# Use this script in one of several ways:
# To launch the Android package manager, ./t a
# To deploy to Android ./t /Code/PathToYourProject da
# To run the iOS Simulator ./t /Code/PathToYourProject si
# To run the Android Emulator ./t /Code/PathToYourProject sa
# Future feature: add support for deploying to iOS with the "di" flag
##
##
@vindriaoc
vindriaoc / app.js
Created April 23, 2011 23:00 — forked from jonalter/app.js
TableView With DB and tap and hold
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var tableView = Ti.UI.createTableView();
var setupDB = function() {
var db = Ti.Database.open('mydb.db');
db.execute('CREATE TABLE IF NOT EXISTS DATABASETEST (ID INTEGER, NAME TEXT)');
db.execute('DELETE FROM DATABASETEST');
@vindriaoc
vindriaoc / android_prefs
Created April 23, 2011 22:55 — forked from IGx89/android_prefs
Emulates the standard Android preferences grid
// the following code is both the logic and examples of using it
var win = Titanium.UI.currentWindow;
// I've set anyDensity to true in my app and this function enables the UI to properly scale
// you can safely delete this function and all references to it if you'd like
var adj = function(pixels) {
if(Titanium.Platform.name == 'iPhone OS') {
return pixels;
} else {
@vindriaoc
vindriaoc / ti-tools.sh
Created April 23, 2011 22:33 — forked from lamberta/ti-tools.sh
Command line interface for creating and building Titanium Mobile Android projects.
#!/usr/bin/env bash
## Command line interface for creating and building Titanium Mobile Android projects.
TI_SRC="$HOME/local/src/titanium_mobile"
TI_SDK="$TI_SRC/dist/mobilesdk/linux/1.7.0"
TI_VERSION_TAG="1_7_0_preview"
ANDROID_HOME=${ANDROID_HOME:-"$HOME/local/lib/android-sdk"}
JAVA_HOME=${JAVA_HOME:-"/usr/lib/jvm/java-6-sun"} #sun-java6-sdk
PROJECT_HOME="$HOME/projects/ti"
@vindriaoc
vindriaoc / AndroidMenuNavigation.js
Created April 23, 2011 22:20 — forked from dawsontoth/AndroidMenuNavigation.js
Menu based navigation in Appcelerator Titanium that supports the use of the "Back" button to go back a view.
// this is your app.js
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// define our main window and open it. it will be an activity (navBarHidden: true), and will control our child window views
Titanium.UI.createWindow({
navBarHidden: true,
backgroundColor: '#fff',
url: 'mainwindow.js',
exitOnClose: true
@vindriaoc
vindriaoc / activity1.js
Created April 23, 2011 09:24 — forked from marshall/activity1.js
Native Titanium + Android example code
var activity = Ti.Android.currentActivity;
var win = Ti.UI.currentWindow;
activity.addEventListener("create", function(e) {
var button = Ti.UI.createButton({title: "Hello world"});
button.addEventListener("click", function(e) {
activity.finish();
});
win.add(button);
});
@vindriaoc
vindriaoc / app.js
Created April 23, 2011 09:20 — forked from dawsontoth/app.js
Launch Custom Android Application from Android Browser with Titanium Mobile
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.add(Ti.UI.createLabel({ text: 'Type appcelerator.com in a browser, and this app will get launched. Try it!' }));
win.open();
@vindriaoc
vindriaoc / notificationsInAndroid.js
Created April 23, 2011 09:17 — forked from dawsontoth/notificationsInAndroid.js
Notifications in Android using Titanium Appcelerator Mobile
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.add(Ti.UI.createLabel({ text: 'Look for the notification! It should be there now.' }));
win.open();
Titanium.Android.NotificationManager.notify(
0, // <-- this is an ID that we can use to clear the notification later
Ti.Android.createNotification({
contentTitle: 'Cheese, Gromit!',
contentText: 'Swiss',
tickerText: 'Our app made a notification!',
@vindriaoc
vindriaoc / emacs titanium dictionary
Created April 23, 2011 04:19 — forked from mogya/emacs titanium dictionary
emacs titanium dictionary
Titanium
Titanium.addEventListener
Titanium.fireEvent
Titanium.include
Titanium.removeEventListener
Titanium.userAgent
Titanium.version
Titanium.API
Titanium.API.addEventListener
Titanium.API.debug