Skip to content

Instantly share code, notes, and snippets.

View joshualambert's full-sized avatar
🎧

Josh Lambert joshualambert

🎧
View GitHub Profile
function dump(arr,level) {
var dumped_text = "";
if(!level) level = 0;
//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += " ";
if(typeof(arr) == 'object') { //Array/Hashes/Objects
for(var item in arr) {
var mainWindow = Ti.UI.createWindow();
var myView = Ti.UI.createView({
width:500,
height:500,
left:-500,
backgroundColor:blue
});
mainWindow.add(myView);
@joshualambert
joshualambert / gist:4347159
Created December 20, 2012 17:47
time_since() - Time comparison function for PHP.
/*
* Originally written by: billythekid.
* https://twitter.com/billythekid
*
* Modified by: Joshua Lambert.
* https://twitter.com/zettageek
*
* Changelog:
* - Added array output.
* - Added ability to pass in custom end timestamp.
@joshualambert
joshualambert / gist:4273022
Created December 13, 2012 00:32
Storekit Purchase Issue
--------------------------------------------------
Code
--------------------------------------------------
AppContext.Storekit.requestProducts(['com.testproduct.lite.pm1'], function (evt) {
displayLog(JSON.stringify(evt));
if (!evt.success) {
alert('ERROR: We failed to talk to Apple!');
}
else if (evt.invalid) {
@joshualambert
joshualambert / gist:4270844
Created December 12, 2012 19:35
Ti.storekit Verification Issue
[INFO] One moment, building ...
[INFO] Detected third-party module: ti.storekit/1.6.1
[INFO] Detected third-party module: ti.storekit/1.6.1
[INFO] Titanium SDK version: 2.1.3 (10/02/12 16:16 15997d0)
[INFO] iPhone Device family: iphone
[INFO] iPhone SDK version: 5.0
[INFO] iPhone simulated device: iphone
[INFO] Performing full rebuild. This will take a little bit. Hold tight...
[INFO] Minimum iOS version: 4.0 Linked iOS Version 5.0
[INFO] Performing clean build
@joshualambert
joshualambert / gist:4128161
Created November 21, 2012 22:03
Switch loop
followMeSwtichCheckbox.eventOverride = false;
followMeSwtichCheckbox.addEventListener('change', function(e) {
if (followMeSwtichCheckbox.eventOverride == false) {
if (checkSOSactive() == false) {
alert('SOS inactive.');
} else {
followMeSwtichCheckbox.eventOverride = true;
if (followMeSwtichCheckbox.value == true) {
followMeSwtichCheckbox.value = false;
@joshualambert
joshualambert / gist:4073548
Created November 14, 2012 17:34 — forked from RaVbaker/gist:2967695
[HOWTO] Ubuntu 12.04 Ruby on Rails Development Environment

Ubuntu 12.04 Ruby on Rails Development Environment

I haven't set up an install guide for the latest ubuntu release, largely because the last set of instructions worked pretty closely with the latest and greatest Ubuntu, 12.04 Precise Pangolin, however when installing today, I found that there were enough differences in the way that I configure my setup to justify an update, so here it goes. Yes, I'm late to the party, but a quick google search didn't find anything that I felt was as complete for my requirements as my previous install guides, so here I go.

As always with my install guides, I have included here is just about everything you'll need (and then some) to get started with ruby on rails development with Ubuntu 12.04 as a platform. These are my settings and preferences, and this is certainly not the only way of doing things, so keep that in mind.

Step 1: Get the repos ready and run updates.

sudo apt-get update && sudo apt-get upgrade
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(33.219105,-87.046053),
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
@joshualambert
joshualambert / hold.js
Created October 15, 2012 16:39
Used to delete a row.
var row = Titanium.UI.createTableViewRow({
height:'50dp',
width:'100%',
layout:'absolute'
});
var rowView = Ti.UI.createView({
left:'0dp',
top:'0dp',
width:'230dp',
var isAndroid = false;
if(Titanium.Platform.name == 'android') {
isAndroid = true;
}
Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
Ti.Geolocation.distanceFilter = 0;
Ti.Geolocation.purpose = "Save your last known position.";