Skip to content

Instantly share code, notes, and snippets.

@timkim
timkim / gist:1368596
Created November 15, 2011 22:35
Quick fix for scope
// Try setting var self = this in the init and using self.mouseX/self.mouseY in onMouseMove
GAME.Input = function ( parent ) {
this.game = parent;
this.oldMouseX = 0;
this.oldMouseY = 0;
this.mouseX = 0;
this.mouseY = 0;
@timkim
timkim / blackberry-webworks.md
Created February 28, 2012 23:45 — forked from mwbrooks/blackberry-webworks.md
Overview of PhoneGap BlackBerry WebWork - original revision by filmaj

BlackBerry WebWorks & PhoneGap

WebWorks is a BlackBerry SDK that leverages Web technologies to create applications for BlackBerry 5.0, 6.0, and QNX. An application that is built with WebWorks uses HTML, CSS, and JavaScript and is called a Web widget. The structure of the application is similar to a thick-client JavaScript Web application, where JavaScript manages the model, view, and logic.

WebWorks enhances the JavaScript API to allow any Web widget application to access any Blackberry Java API. RIM includes a small WebWorks JavaScript API that allows access to some BlackBerry device features, such as invoking third-party applications. However, more importantly, WebWorks allows developers to create an Java extension that binds JavaScript and Java. This means any Java API can be accessible to JavaScript.

The WebWorks SDK uses a command-line tool called bbwp.exe (Windows-only) to create a BlackBerry-compatible application binary (.cod). Since a WebWorks application is pa

@timkim
timkim / PGCamera_Canvas
Created May 15, 2012 19:44
Short example of how to get photo from PhoneGap Camera to canvas
// Note: have not tested this - but I think it should work!
function cameraWin(picture){
var theCanvas = document.getElementById('theCanvas');
var ctx = theCanvas.getContext('2d');
var theImage = new Image();
theImage.src = "data:image/jpeg;base64,"+picture;
ctx.drawImage(theImage, 0, 0);
@timkim
timkim / Blackberry PhoneGap Sample
Created July 31, 2012 21:21
Blackberry PhoneGap Sample
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" id="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no">
<script src="json2.js" type="text/javascript"></script>
<script src="cordova-1.6.1.js" type="text/javascript"></script>
<script type="text/javascript">
//---------------------------------------------------------------------
@timkim
timkim / gist:3694742
Created September 10, 2012 23:24
Cordova Android Git Url
https://git-wip-us.apache.org/repos/asf/incubator-cordova-android
it('should receive the correct request', function(){
var mySpy = spyOn(http, 'get');
// need this to get around the 'on' function callback beind undefined in plugins.js
mySpy.on = function(){};
plugins.getPluginInfo('ChildBrowser', function(error, plugin) {
});
expect(mySpy).toHaveBeenCalledWith('https://github.com/imhotep/ChildBrowser');
});
Failures:
1) common platform handler deleteJava should delete empty directories after removing source code in a java src path heirarchy
Message:
Error: EPERM, operation not permitted '/var/folders/k5/p44x4yn122s_gk2s0p0c7rm00000gn/T/test_plugman/project/dest'
Stacktrace:
Error: EPERM, operation not permitted '/var/folders/k5/p44x4yn122s_gk2s0p0c7rm00000gn/T/test_plugman/project/dest'
at Object.fs.unlinkSync (fs.js:582:18)
at Object.module.exports.deleteJava (/Users/timkim/repo/plugman/src/platforms/common.js:32:12)
at null.<anonymous> (/Users/timkim/repo/plugman/spec/platforms/common.spec.js:105:20)
@timkim
timkim / gist:8855177
Created February 7, 2014 00:14
Kill ME
timki_000@PHONEGAP-SF ~/repo/connect-phonegap (master)
$ npm test
> connect-phonegap@0.8.1 test c:\Users\timki_000\repo\connect-phonegap
> jasmine-node --color spec
..............F...F...................................................
Failures:
@timkim
timkim / gist:10313756
Created April 9, 2014 20:50
Windows Phone 8 Build Log
1>------ Build started: Project: PhoneGap, Configuration: Debug Any CPU ------
1>C:\Users\timki_000\repo\phonegap-app\platforms\wp8\Plugins\org.apache.cordova.media\AudioPlayer.cs(168,13,168,106): warning CS0612: 'WPCordovaClassLib.Cordova.Commands.BaseCommand.InvokeCustomScript(WPCordovaClassLib.Cordova.ScriptCallback, bool)' is obsolete
1> PhoneGap -> C:\Users\timki_000\repo\phonegap-app\platforms\wp8\Bin\Debug\com.phonegap.app.dll
1> Begin application manifest generation
1> Application manifest generation completed successfully
1> Begin Xap packaging
1>MSBUILD : error : Xap packaging failed. Failed to package file 'C:\Users\timki_000\repo\phonegap-app\platforms\wp8\www\css\index.css'. Unable to find the specified file.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
@timkim
timkim / gist:79638dee231da0c67c8e
Created May 9, 2014 22:49
WP8 fails on: phonegap test wp8 --test
$ phonegap run wp8 --test
[phonegap] detecting Windows Phone 8 SDK environment...
[phonegap] using the local environment
[phonegap] compiling Windows Phone 8...
fs.js:543
return binding.rename(pathModule._makeLong(oldPath),
^
Error: EPERM, operation not permitted 'c:\Users\timki_000\repo\phonegap-app\www-
backup'