This file contains hidden or 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
Ti.Geolocation.getCurrentPosition(function(evt) { | |
var origin = String(evt.coords.latitude + ',' + evt.coords.longitude), | |
travelMode = 'walking', | |
destination = String(yourLatitude + ',' + yourLongitude), | |
url = "http://maps.google.com/maps/api/directions/xml?mode=" | |
+ travelMode + "&origin=" | |
+ origin + "&destination=" | |
+ destination +"&sensor=false"; | |
xhr = Titanium.Network.createHTTPClient(); | |
xhr.open('GET',url); |
This file contains hidden or 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
function decodeLine(encoded) { | |
var len = encoded.length; | |
var index = 0; | |
var array = []; | |
var lat = 0; | |
var lng = 0; | |
while (index < len) { | |
var b; | |
var shift = 0; |
This file contains hidden or 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
function RateMe(ios_url, goog_url, usecount) { | |
if(!Ti.App.Properties.hasProperty('RemindToRate')) { | |
Ti.App.Properties.setString('RemindToRate', 0); | |
} | |
var remindCountAsInt = parseInt(Ti.App.Properties.getString('RemindToRate'), 10); | |
var newRemindCount = remindCountAsInt + 1; | |
if(remindCountAsInt === -1) { | |
// the user has either rated the app already, or has opted to never be | |
// reminded again. |
This file contains hidden or 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
/** | |
* The following snippet will ask the user to rate your app the second time they launch it. | |
* It lets the user rate it now, "Remind Me Later" or never rate the app. | |
*/ | |
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
win.addEventListener('open', checkReminderToRate); | |
win.add(Ti.UI.createLabel({ text: 'This is a simple app that will remind you to rate it.' })); | |
win.open(); | |
function checkReminderToRate() { |
This file contains hidden or 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 win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
var rotate = Ti.UI.create2DMatrix().rotate(90); | |
var counterRotate = rotate.rotate(-180); | |
var scrollView = Titanium.UI.createScrollableView({ | |
views:[ | |
Titanium.UI.createImageView({ image:'default_app_logo.png', transform: counterRotate }), | |
Titanium.UI.createImageView({ image:'KS_nav_ui.png', transform: counterRotate }), | |
Titanium.UI.createImageView({ image:'KS_nav_views.png', transform: counterRotate }) |
This file contains hidden or 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
/*** | |
* Connects the blue box to the red box with touch and finger slide. | |
* The window's backgroundColor and the label's text give feedback to the user. | |
* ... the blue box is not going to move anywhere | |
* | |
* @Copyleft 2013 Patrick De Marta | |
* @License GNU GPL | |
*/ | |
/** |
This file contains hidden or 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
/*** | |
* Connects the blue box to the red box with touch and finger slide. | |
* The window's backgroundColor and the label's text give feedback to the user. | |
* ... the blue box is not going to move anywhere | |
* | |
* @Copyleft 2013 Patrick De Marta | |
* @License GNU GPL | |
*/ | |
/** |
This file contains hidden or 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
//AUTOCOMPLETE TABLE | |
var table_data = []; | |
var last_search = null; | |
var timers = []; | |
// NOTE: iOS and Android keys will be different! | |
var IOS_API_KEY = 'xxx__APIKEY___xxx'; | |
var ANDROID_API_KEY = ''; |
This file contains hidden or 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
/** | |
* Calculates the physical display size for android devices | |
* e.g 4,95 for Nexus 5 or 7,02 for Nexus 7 | |
* | |
* IMPORTANT: this requires https://github.com/dbankier/HasMenu | |
* | |
* @return {Number} size as inches | |
*/ | |
function getPhysicalSize(){ | |
// some infos we need |
This file contains hidden or 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
<?php | |
// API access key from Google API's Console | |
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); | |
$registrationIds = array( $_GET['id'] ); | |
// prep the bundle | |
$msg = array |
OlderNewer