This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//app.js | |
Titanium.UI.setBackgroundColor('#000'); | |
//create window | |
var win = Titanium.UI.createWindow({ | |
title:'Countdown Main', | |
modal: true, | |
exitOnClose: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Simple k/v | |
//Open the db. | |
//DB is simple k/v | |
var db = Ti.Database.open('db'); | |
// db.execute('DELETE FROM DATA'); | |
// db.execute('DROP TABLE DATA'); | |
// db.execute('VACUUM'); | |
db.execute('CREATE TABLE IF NOT EXISTS DATA (KEY TEXT UNIQUE, VALUE TEXT)'); | |
// var xo = db.execute('SELECT * FROM DATA'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'socket' | |
require 'rubygems' | |
require 'json' | |
require 'listen' | |
path = '/Users/mitch/Sites/klocko' | |
Listen.to(path, :force_polling => true) do |modified, added, removed| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript"> | |
var Ti = Titanium; | |
Titanium.UI.getCurrentWindow().showInspector(true); | |
</script> | |
</head> | |
<body style="background-color:#ccc;margin:0"> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Some example code on how to make a menu item type app. | |
var tray = Ti.UI.addTray('tray.png'), | |
menu = Ti.UI.createMenu(), | |
//Add some menu items | |
menuItems = [ | |
Titanium.UI.createMenuItem('Change Icon', function() { | |
//Something's going on... let's change the icon. | |
tray.setIcon('tray-active.png'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'socket' | |
require 'rubygems' | |
require 'json' | |
require 'listen' | |
path = '/Users/mitch/Sites/klocko' | |
Listen.to(path) do |modified, added, removed| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//bug: Cannot remove child view from inside TableViewRow | |
//2 cases | |
//A: .remove() View inside TableViewRow - Crash | |
//B: .remove() View nested in View inside TableViewRow - No Crash, but no effect | |
//Tested | |
//Android: 4.1, 2.3.3 | |
//TiSDK: 2.1.2.v20120821160113, 2.1.1GA | |
var table = Ti.UI.createTableView({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function() { | |
// CREDIT: broofa http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, | |
function(c) { | |
var r = Math.random() * 16 | 0, | |
v = c == 'x' ? r: (r & 0x3 | 0x8); | |
return v.toString(16); | |
}).toUpperCase(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//navGroup Wrapper to be able to implement home. | |
//Track stack of open windows | |
var _navGroup, //Original | |
currentStack = [], | |
uuid = require('lib/util/uuid'); | |
var create = function(args) { | |
if (Ti.Platform.osname != 'android') { | |
_navGroup = Ti.UI.iPhone.createNavigationGroup(args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win1 = Titanium.UI.createWindow({ | |
backgroundColor:'#ccc', | |
exitOnClose:true, | |
title:'win1: Main Window' | |
}); | |
var label1 = Ti.UI.createLabel({ | |
top: 10, | |
backgroundColor:'black', | |
color:'white', | |
ellipsize:true, |