Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Whinnery kwhinnery

  • Twilio
  • Saint Paul / Minneapolis
View GitHub Profile
View panel.html
<div set="control[panel,theme=dark,title=Words of Wisdom,footer=Nolan Wright]"
style="width:300px">
Just say no!
</div>
View chart_example.html
<div set="control[app:iterator]" type="bar" chartMode="mode"
on="l:load.barchart then execute"
property="rows" chartTitles="titles"
title="Happiness Meter" angle="30" color="#0D52D1,#2A0CD0,#8A0CCF"
thickness="10" height="300" width="600" legend="true">
</div>
<script style="display:none;">
$MQ('l:load.barchart',
{'rows':[
{'name':'Appcelerator', 'value':'10,10,10'},
View gist:142095
<id>initial</id>
<url>index.html</url>
<backgroundColor>#000</backgroundColor>
<fullscreen>false</fullscreen>
<hideNavBar>true</hideNavBar>
<hideTabBar>true</hideTabBar>
View gist:142106
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="tiui/js/tiui.js"></script>
<link href="tiui/css/tiui.css" rel="stylesheet" type="text/css"></link>
<link href="index.css" rel="stylesheet" type="text/css"></link>
View gist:142108
<center><img src="images/logo-m.png"></img></center>
<hr/>
<div id="options">
<h4>Upload a Picture</h4>
<input id="choose" type="button" value="Choose Picture"></input>
<input id="take" type="button" value="Take A Picture"></input>
<h5>Message (Optional - 110 Characters)</h5>
<textarea id="message"></textarea>
</div>
View gist:142112
//Wire up buttons to save/recall
$("#store").click(function() {
storeLogin();
});
$("#recall").click(function() {
recallLogin();
});
//recall any saved login information and show UI
recallLogin();
View gist:142115
//Handle storing and recalling username/password
function storeLogin() {
Titanium.App.Properties.setString('username',$("#username").val());
Titanium.App.Properties.setString('password',$("#password").val());
}
function recallLogin() {
$("#username").val(Titanium.App.Properties.getString('username'));
$("#password").val(Titanium.App.Properties.getString('password'));
}
View gist:142118
//Make XHR request to post picture
function postPic(pic) {
var query = 'https://twitpic.com/api/uploadAndPost';
var xhr = Titanium.Network.createHTTPClient();
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
notify('Picture posted sucessfully!');
}
};
xhr.open('POST',query);
View gist:142129
//display a notification message
function notify(msg) {
Titanium.API.debug(msg);
var n = Titanium.UI.createNotification();
n.setMessage(msg);
n.show();
}
View gist:142133
Titanium.Media.openPhotoGallery({
success: function(image,details) {
postPic(image);
},
error: function(e) {
notify(e.message);
},
cancel: function() {
//no op
},