Skip to content

Instantly share code, notes, and snippets.

View joscandreu's full-sized avatar

José Carlos Andreu joscandreu

View GitHub Profile
@joscandreu
joscandreu / android-barcode.js
Created January 31, 2013 12:29
Call tibar and titanium-barcode (barcode scanner modules for iOS & Android) in a consistent manner across multiple OS. https://github.com/joseitinerarium/titanium-barcode https://github.com/joseitinerarium/tibar
function scanCode(successFunction, errorFunction){
var titaniumBarcode = require('com.mwaysolutions.barcode');
titaniumBarcode.scan({
success:function(data) {
if(data && data.barcode) {
successFunction(data.barcode);
} else {
Ti.API.info("Error scanning barcode: " + data);
}
@joscandreu
joscandreu / app.js
Created March 13, 2012 09:00 — forked from pec1985/app.js
Titanium Vertical Label
// use this as a normal Ti.UI.Label
function VerticalLabel(_params){
// store the text in this variable
var text = _params.text || '';
// create an array of letters
var array = text.split('');
// get the length of the array (letters)
var len = array.length;
@joscandreu
joscandreu / kmlroutetomap
Created November 9, 2011 10:56
Get a kml from Google and add it to a Ti.Map view
//Credits to Vali Filip
var win=Titanium.UI.currentWindow;
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
var origin1 = Titanium.UI.createSearchBar({
barColor:'#000',
showCancel:true,
height:40,
top:0,