Skip to content

Instantly share code, notes, and snippets.

View kwhinnery's full-sized avatar

Kevin Whinnery kwhinnery

View GitHub Profile
Titanium.Media.showCamera({
success: function(image,details) {
postPic(image);
},
error: function(e) {
notify(e.message);
},
cancel: function() {
//no op
},
$(this).find("[nodeName=namespace:tag]").text();
<html>
<head>
<script type="text/javascript" charset="utf-8">
(function() {
var intro = Titanium.Media.createSound("app://audio/FF1prelu.m4a");
intro.setLooping(true);
intro.play();
})();
</script>
</head>
// #1 - Define the master library
var TMA = {
ModuleOne: {
importantNumber: 2,
doSomething: function() {
return importantNumber+2;
}
},
ModuleTwo: {
someProperty: true,
var c = Titanium.Network.createHTTPClient();
c.onload = function() {
var f= Titanium.Filesystem.getFile("xhr.png");
f.write(this.responseData);
document.getElementById('html').innerHTML = '<img src="'+f.url+'"/>';
};
// open the client
c.open('GET','http://www.appcelerator.com/wp-content/uploads/2009/06/titanium_desk.png');
// send the data
c.send();
<script type="text/javascript" charset="utf-8">
window.location.href="http://www.appcelerator.com/company/partners";
</script>
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function() {
try {
$(doc).find("rss channel item").each(function() {
//do something with news items
});
}
catch(e) {
Titanium.API.debug(e);
var url = "https://"+un+":"+pw+"@twitter.com/statuses/update.json";
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function() {
// Handle response
};
xhr.open("POST",url);
xhr.send({ status:'My awesome tweet!' });
var ta1 = Titanium.UI.createTextArea({
id:'idOfADOMElement',
value: 'Here\'s a new #tweet @joeschmoe',
keyboardType:Titanium.UI.KEYBOARD_ASCII,
autocorrect:false,
textAlign:'left',
height:100,
width:255
});
var info = Titanium.UI.createButton({
image:'/img/info.png'
});
var infoWin = Titanium.UI.createWindow({
url:'info.html'
});
info.addEventListener('click',function() {
infoWin.open( {animated:'true'} );