Skip to content

Instantly share code, notes, and snippets.

View aaronksaunders's full-sized avatar

Aaron K Saunders aaronksaunders

View GitHub Profile
@aaronksaunders
aaronksaunders / app.js
Created September 10, 2011 17:03
WRONG
var data = {
"place" : "117464364938130",
"coordinates" : {
'latitude' : 40.7798027,
'longitude' : -73.9481371,
},
"access_token" : Ti.Facebook.accessToken
};
@aaronksaunders
aaronksaunders / app.js
Created September 10, 2011 17:08
correct params for checkin
var data = {
"place" : "117464364938130",
"coordinates" : JSON.stringify({
'latitude' : 40.7798027,
'longitude' : -73.9481371,
}),
"access_token" : Ti.Facebook.accessToken
};
@aaronksaunders
aaronksaunders / app.js
Created September 22, 2011 07:16
works on android with appcelerator
BH = new BirdHouse({
service : 'twitter',
consumer_key: "xxxxxxxxxxxx",
consumer_secret: "xxxxxxxxxxxxxxxxxxxxxxx"
});
BH.short_tweet("hello motto")
@aaronksaunders
aaronksaunders / app.js
Created September 27, 2011 02:42
Code For Parsing RSS Feed from YouTube used in Appcelerator Application
var processRSS = function(_feedURL, _tableView) {
// create table view data object
var data = [];
Ti.API.info(" "+_feedURL);
var xhr = Ti.Network.createHTTPClient();
xhr.open("GET",_feedURL.replace(/\"/g,""));
xhr.setRequestHeader('Accept', 'application/json');
xhr.onerror = function(e) {
@aaronksaunders
aaronksaunders / app.js
Created October 2, 2011 21:33
it works
var defaultColor = "#035385";
var window = Titanium.UI.createWindow({
backgroundColor:'#999'
});
var weatherData = [
{ title:"Mountain View (North America) - Cloudy", color:defaultColor},
{ title:"Washington, DC (North America) - Mostly Cloudy", color:defaultColor },
{ title:"Brasilia (South America) - Thunderstorm", color:defaultColor },
{ title:"Buenos Aires (South America) - Clear", color:defaultColor },
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.distanceFilter = .25;
Ti.Geolocation.purpose = "Callbacks Are Your Friend";
// make the API call
Ti.Geolocation.getCurrentPosition(function(e) {
// do this stuff when you have a position, OR an error
if (e.error) {
Ti.API.error('geo - current position' + e.error);
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.distanceFilter = .25;
Ti.Geolocation.purpose = "Callbacks Are Your Friend";
// global to hold the coords from the callback
var global_var_coords;
// make the API call
Ti.Geolocation.getCurrentPosition(function(e) {
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.distanceFilter = .25;
Ti.Geolocation.purpose = "Callbacks Are Your Friend";
// GLOBAL LISTENER
Ti.App.addEventListener('location.updated',function(coords){
Ti.API.debug(JSON.stringify(coords));
}
// make the API call
//
// file_with_location.js
//
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.distanceFilter = .25;
Ti.Geolocation.purpose = "Callbacks Are Your Friend";
/**
* @param {Object} _callback call on completion of location query
*/
function currentLocation(_callback) {
Ti.include('file_with_location.js');
// open a single window
var window = Ti.UI.createWindow({
backgroundColor:'white'
});
var coordsLbl = Titanium.UI.createLabel({
text:"NO LOCATION",
left: 10,