Skip to content

Instantly share code, notes, and snippets.

@codeboxed
codeboxed / index.html
Created March 5, 2011 17:27
Download remote files async with Titanium
<html>
<head></head>
<body style="background-color:#1c1c1c;margin:0">
<div style="border-top:1px solid #404040">
<div style="color:#fff;;padding:10px">Welcome to Titanium</div>
</div>
<script type="text/javascript">
localFile = Titanium.Filesystem.getDesktopDirectory().toString() +
Titanium.Filesystem.getSeparator() +
@codeboxed
codeboxed / index.html
Created March 5, 2011 17:29
Download script using Titanium API
<html>
<head></head>
<body style="background-color:#1c1c1c;margin:0">
<div style="border-top:1px solid #404040">
<div style="color:#fff;;padding:10px">Welcome to Titanium</div>
</div>
<script type="text/javascript">
var url = 'http://www.codeboxed.com';
// Initialize the HTTPClient object
@codeboxed
codeboxed / database.js
Created March 5, 2011 18:55
Connect with Titanium to your databases
/**
* Class name: database.js
* Author: Codeboxed
* URL: http://www.codeboxed.com
* Date: March 5, 2011
* Platform: Titanium
*/
var database = function(dbName, table){
@codeboxed
codeboxed / FileUtils.js
Created March 5, 2011 19:34
Copy files from a source to a target using Titanium as a platform
/**
* Class name: FileUtils.js
* Author: Codeboxed
* URL: http://www.codeboxed.com
* Date: March 5, 2011
* Platform: Titanium
*/
var FileUtils = function (){
@codeboxed
codeboxed / example.js
Created March 5, 2011 20:13
Example on how to set the file path for embedding videos on Mac OS X and Windows with Titanium
var filesPath = Titanium.API.application.dataPath +
Titanium.Filesystem.getSeparator();
var currentFile = 'file.mp4';
var filePath = null;
switch(Titanium.getPlatform()) {
// Apple
case 'osx':
filePath = "file:///" + filesPath + currentFile;
break;
@codeboxed
codeboxed / Preferences.js
Created March 5, 2011 20:57
Preferences class for storing/retrieving Titanium.App.Properties
/**
* Class name: Preferences.js
* Author: Codeboxed
* URL: http://www.codeboxed.com
* Date: March 7, 2011
* Platform: Titanium
*/
var Preferences = function() {
// Private
@codeboxed
codeboxed / index.html
Created March 26, 2011 15:50
Titanium Desktop event listeners
<html>
<head></head>
<body style="background-color:#1c1c1c;margin:0">
<div style="border-top:1px solid #404040">
<div style="color:#fff;;padding:10px">Welcome to Titanium</div>
</div>
<script type="text/javascript">
var eventName = 'randomEvent';
@codeboxed
codeboxed / call.js
Created March 26, 2011 16:14
Send requests to a server using Titanium API
/**
* Filename: Call.js
* Author: Codeboxed
* URL: http://www.codeboxed.com
* Date: March 26, 2011
* Platform: Titanium
*/
/**
* Call
@codeboxed
codeboxed / youtube_videos_example.js
Created May 4, 2011 16:33
Show YouTube videos with Titanium mobile
var win = Ti.UI.currentWindow;
// Set the window orientation modes for the video to rotate with the device
win.orientationModes = [ Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_LEFT,
Ti.UI.LANDSCAPE_RIGHT ];
// Build the movie URL. 'fs' and 'autoplay' parameters are optional.
var movieId = "d0llSyfgwEE";
var movieUrl = "http://www.youtube.com/embed/" + movieId+ "?fs=1&autoplay=1";
@codeboxed
codeboxed / plist-to-json.js
Created June 1, 2011 09:34
PlistToJson class
/**
* Class name: PlistToJson
* Author: Codeboxed
* URL: http://www.codeboxed.com
* Date: May 10, 2011
* Platform: Titanium
*/
var PlistToJson = function() {
/**