Skip to content

Instantly share code, notes, and snippets.

@kruyvanna
kruyvanna / method_profile
Last active October 9, 2015 12:58
Android Method Profiling
// start tracing to "/sdcard/calc.trace"
Debug.startMethodTracing("calc");
// stop tracing
Debug.stopMethodTracing();
//copy to host
adb pull /sdcard/calc.trace /tmp
//view
@kruyvanna
kruyvanna / javascript_trace_method_call.js
Last active December 11, 2015 11:18
Trace the method call stack
/* source:
Martin Jespersen
http://stackoverflow.com/questions/4671031/print-function-log-stack-trace-for-entire-program-using-firebug
*/
function logStackTrace(levels) {
var callstack = [];
var isCallstackPopulated = false;
try {
i.dont.exist += 0; //doesn't exist- that's the point
@kruyvanna
kruyvanna / index.html
Last active December 20, 2015 05:18
game_controller
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script src="plugins/plugin-loader.js"></script>
<link rel="stylesheet" href="plugins/plugin-loader.css">
<script>
var PORT = 3000;
var ROOT_DIRECTORY = "client/"
@kruyvanna
kruyvanna / app1.js
Created July 25, 2013 03:31
Game Controller
Application = function(){};
Application.prototype = new EventDispatcher();
window.App = new Application();
window.App.httpServer = {};
var PORT = 3000;
var ROOT_DIRECTORY = "client/"
var httpServer = new monaca.HttpServer(ROOT_DIRECTORY, PORT);
App.httpServer.start = function(){
httpServer.start(function(response){
App.trigger('httpServer:started', response);
window.App.webSocketServer = {};
var PORT = 3001;
var socketServer = new monaca.WebSocketServer(PORT);
socketServer.onClientConnected = function(client){
App.trigger('client:connected', client);
};
socketServer.onClientDisconnected = function(client){
var host = window.location.hostname;
var port = 3001;
var serverAddress = host + ":" + port;
console.log('serverAddress:' + serverAddress);
var websocket = new WebSocket("ws:" + serverAddress);
websocket.onmessage = function(message){
console.log('onmessage: ', message);
if(message.data === "jump"){
<my-widget>
<p>This is my paragraph text.</p>
</my-widget>
var app = angular.module("MyApp", []);
app.directive("myWidget", function() {
return {
restrict: "E",
transclude: true,
template: "<h3>Heading</h3>"
@kruyvanna
kruyvanna / disable same origin in chrome
Last active December 26, 2015 09:59
Disable access allow origin security in Chrome
open -a Google\ Chrome --args --disable-web-security
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
var emitter;
function preload() {
game.load.image('diamond', 'assets/sprites/diamond.png');
}