Skip to content

Instantly share code, notes, and snippets.

/**
* The MIT License
* -------------------------------------------------------------
* Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:

PhoneGap Training Day

 9:30 - 10:30 ... intro thing (setting up, compiling, git, emulators, debugging, testing, security)
    Brian
10:30 - 10:45 ... break
10:45 - 12:30 ... tutorial thing
    Fil. Run through building tutorial app on desktop (firefox/chrome/firebug/webinspector). Deploy to Android emulator, then device. Run through porting to BlackBerry - what needs to be done, what to watch out for.
    Brian. Deploy to iPhone sim / iPad.

12:30 - 1:30 ... lunch

@filmaj
filmaj / gist:574501
Created September 10, 2010 22:36
Poor man's JavaScript scrolling helper for mobile devices
function PoorMansGloveBox(element) {
this.element = element;
this.parentHeight = this.element.parentNode.clientHeight;
this.element.style.position = 'relative';
this.element.style.top = '0px';
this.lastPos = 0;
this.currentPos = 0;
var self = this;
this.element.addEventListener('touchstart', function(e){
self.lastPos = e.touches[0].pageY;
@filmaj
filmaj / QUnit.chain
Created October 31, 2010 09:05
Tiny QUnit async test helper, eliminates pyramid code in async tests with multiple assertions, each requiring its own delay.
var chain = function(tests, delay) {
if (typeof tests == 'object') {
if (tests.length > 0) {
if (typeof delay != 'undefined') {
setTimeout(function() {
tests.shift()();
chain(tests, delay);
}, delay);
} else {
return function() {
@filmaj
filmaj / gist:859523
Created March 7, 2011 23:38
A tiny templating technique by extending the String prototype in JavaScript
String.prototype.format = function(){
var args = arguments;
obj = (args.length == 1 && (typeof args[0] == 'object')) ? args[0] : args;
return this.replace(/\{(\w+)\}/g, function(m, i){
return obj[i];
});
}
// Example usage:
@filmaj
filmaj / index.html
Created July 1, 2011 01:14
Rotation of elements in PhoneGap using CSS transform and PhoneGap Compass API
<html>
<head>
<title>Compass Test</title>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, target-densityDpi=device-dpi" />
<script type="text/javascript" src="phonegap.0.9.6.1.js"></script>
<script type="text/javascript">
var d = -45,
e = null,
w = null;
function win(h) {
@filmaj
filmaj / error.log
Created January 18, 2012 18:51
nodejitsu error log
Fil-Majs-MacBook-Pro:blazd filmaj$ jitsu apps deploy
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command apps deploy
info: Authenticated as filmaj
info: Analyzing your application dependencies in app.js
warn: Local version appears to be old.
warn: Your package.json version will be incremented for you automatically.
warn: About to write /Users/filmaj/src/blazd/package.json
data:
@filmaj
filmaj / index.html
Created June 26, 2012 15:52
cordova bench web assets
<!DOCTYPE html>
<html>
<head>
<meta name=viewport content=width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no>
</head>
<body>
<h1>Cordova how fast are you?</h1>
<script src="cordova-1.9.0rc1.js"></script>
@filmaj
filmaj / gist:3031791
Created July 2, 2012 08:05
global scope hurray
<html>
<head>
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="mysqliteplugin.js"></script>
<script type="text/javascript">
var db; // this is now globally-scoped
document.addEventListener('deviceready', function() {
db = new sqliteplugin(); // assigns to the db variable above
});
</script>
@filmaj
filmaj / error.log
Created July 18, 2012 18:32
backbutton index - cordova, phonegap
07-18 14:21:39.333: WARN/System.err(1256): java.net.SocketException: Permission denied
07-18 14:21:39.333: WARN/System.err(1256): at org.apache.harmony.luni.platform.OSNetworkSystem.createServerStreamSocketImpl(Native Method)
07-18 14:21:39.353: WARN/System.err(1256): at org.apache.harmony.luni.platform.OSNetworkSystem.createServerStreamSocket(OSNetworkSystem.java:170)
07-18 14:21:39.353: WARN/System.err(1256): at org.apache.harmony.luni.net.PlainServerSocketImpl.create(PlainServerSocketImpl.java:45)
07-18 14:21:39.363: WARN/System.err(1256): at java.net.ServerSocket.<init>(ServerSocket.java:135)
07-18 14:21:39.363: WARN/System.err(1256): at java.net.ServerSocket.<init>(ServerSocket.java:89)
07-18 14:21:39.363: WARN/System.err(1256): at org.apache.cordova.CallbackServer.run(CallbackServer.java:205)
07-18 14:21:39.363: WARN/System.err(1256): at java.lang.Thread.run(Thread.java:1096)