Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@realrasengan
Created July 25, 2012 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realrasengan/3178816 to your computer and use it in GitHub Desktop.
Save realrasengan/3178816 to your computer and use it in GitHub Desktop.
Bitcoin Balance 3
var Barcode = require("ti.barcode");
Barcode.addEventListener('success', function (e) {
// Ti.Platform.openURL("http://blockexplorer.com/address/"+unescape(e.result).match(/([^\?]*)/)[1].replace("bitcoin:",""));
//
// "If using regex, then why not just use regex to snip out the first contiguous group of say 28-34 characters starting with '1'
// and the rest matching the base58 alphabet? This would make it highly universal without adding any complexity." -- casascius
var btcAddress = unescape(e.result).match(/([1][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{27,34})/)
if(btcAddress!=null)
Ti.Platform.openURL("http://blockexplorer.com/address/"+btcAddress[1]);
self.close();
var activity = Titanium.Android.currentActivity;
activity.finish();
});
Barcode.capture({
animate: false,
showCancel: false,
showRectangle: true,
keepOpen: false,
acceptedFormats: [
Barcode.FORMAT_QR_CODE
]
});
var self = Ti.UI.createWindow({
backgroundColor:'#000000',
exitOnClose:true
});
self.addEventListener('android:back', function(e){
self.close();
var activity = Titanium.Android.currentActivity;
activity.finish();
});
self.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment