Skip to content

Instantly share code, notes, and snippets.

View marshall's full-sized avatar

Marshall Culpepper marshall

View GitHub Profile
var db = Ti.Database.open('/sdcard/test.db');
var rs = db.execute('SELECT message FROM test');
if (rs.isValidRow()) {
alert(rs.getFieldByName("message"));
}
rs.close();
db.close();
marshall@snake:~/Code/test/test_python
$ python test.py
modules = set(['Android', 'Android.Calendar', 'UI', 'UI.Android']), should be: Android, Android.Calendar, UI, UI.Android
methods = set(['UI.Android.createActivity', 'UI.createLabel']), should be: UI.createLabel, UI.Android.createActivity
@marshall
marshall / .bash_profile
Created December 1, 2010 17:52
Environment variables and functions that speed up testing and building Titanium Mobile
#!/bin/bash
# Add this to your ~/.bash_profile
for a in `ls $HOME/.bash_profile.d/*.sh`; do
source $a
done
@marshall
marshall / desktop_perf_results.txt
Created January 17, 2011 06:50
Various V8 perf test results
SunSpider tests - higher is better
Rhino (Interpreted)
-------------------
Score: 362
Richards: 425
DeltaBlue: 340
Crypto: 369
RayTrace: 535
@marshall
marshall / app.js
Created October 26, 2011 19:36
V8 1.8.0 vs Rhino 1.7.3 perf results
var win = Ti.UI.createWindow({
backgroundColor: 'blue',
top: 0, left: 0, right: 0, bottom: 0
});
var view = Ti.UI.createView();
win.add(view);
var createButton = Ti.UI.createButton({
top: 0, right: 0, height: "5%",
@marshall
marshall / mozilla_profile.sh
Created June 8, 2012 19:04
mozilla_profile.sh
bz_create_patch() {
rev=HEAD^
if [ "$1" != "" ]; then
rev=$1
fi
git format-patch -k --no-stat --no-signature $rev --stdout | git patch-to-hg-patch
}
@marshall
marshall / test_mobile_networks.js
Created June 13, 2012 15:08
test_mobile_networks.js
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// getNetworks() can take some time..
MARIONETTE_TIMEOUT = 60000;
const WHITELIST_PREF = "dom.mobileconnection.whitelist";
let uriPrePath = window.location.protocol + "//" + window.location.host;
SpecialPowers.setCharPref(WHITELIST_PREF, uriPrePath);
@marshall
marshall / networkSelectionModes.patch
Created June 18, 2012 22:41
networkSelectionModes.patch - v4
# HG changeset patch
# User Marshall Culpepper <marshall@mozilla.com>
Bug 759637: Initial implementation of MobileConnection network selection APIs. r=philikon sr=sicking
diff --git a/dom/network/interfaces/nsIDOMMobileConnection.idl b/dom/network/interfaces/nsIDOMMobileConnection.idl
index 1df7131..ef434cd 100644
--- a/dom/network/interfaces/nsIDOMMobileConnection.idl
+++ b/dom/network/interfaces/nsIDOMMobileConnection.idl
@@ -31,17 +31,52 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
@marshall
marshall / smsIndicator.js
Created June 22, 2012 23:15
WebSmsIndicator example
// This example shows the WIP API in https://bugzilla.mozilla.org/show_bug.cgi?id=736710
// Note: mozSms access requires the URL to be in the dom.sms.whitelist
// I tested with the statusbar by adding the "sms" permission category to Gaia's system app in gaia/apps/system/manifest.webapp
var sms = window.navigator.mozSms;
sms.addEventListener("indicator", function onindicator(event) {
var indicator = event.message.indicator;
if (indicator.active) {
// show indicator
}
@marshall
marshall / shell output
Created September 6, 2012 18:52
shell expansion fun
# in each case the script sees $1 as the full value (with spaces, or quotes)
$ export ABC="a b c"
$ ./test.sh "ABC=$ABC"
=ABC=a b c=
$ export ABC="\"abc\""
$ ./test.sh "ABC=$ABC"
=ABC="abc"=