Skip to content

Instantly share code, notes, and snippets.

@phuesler
phuesler / cocos2swipedetection.m
Created November 8, 2012 14:37
cocos2d swipe detection
#import "cocos2d.h"
#import "MyLayer.h"
// register those in MyLayer.h
//CGPoint startLocation;
// CGPoint endLocation;
@implementation MyLayer
@phuesler
phuesler / erb2haml.sh
Created September 30, 2012 14:23 — forked from stigi/erb2haml.sh
erb2haml.sh
#! /usr/bin/env sh
DEPS_MISSING=0
check_gem() {
if ! gem list -i $1 >/dev/null; then
echo "Please install $1 with 'gem install $1'"
DEPS_MISSING=1
fi
}

Engineering Diamond Dash

Building software is probably the discipline people are most afraid of calling "engineering". In my career as a programmer, I have seen many people making decisions out of hype or unsupported claims. To be honest, I have done that over, and over again!

When we start a software project, we always start by making decisions. Each of those decisions will have an impact on how easy the program is to maintain, scale and extend. How can we make sure the decisions we make are going to shape the program the way we really want?

@phuesler
phuesler / proposal.md
Created November 30, 2011 19:33
talk proposal

Of Remote Islands, Trolls, and Polyglot Knights

Dive deep into the mystical waters surrounding ye' olde mobile browser game development. Swim to this fantastical island ravaged by a foreboding HTML5 creature protectively hovering over her shy, industrious cubs: Kanvas and Css3. Scramble past forest and fawn to match riddles with the Polyglot Order, speaking their prescient lyrical language of JavaScript, Ruby, or Erlang. Come closer and listen to these stories of woe, of trials and tests in these Magic Lands.

@phuesler
phuesler / learnyousomeerlang_offline
Created November 21, 2011 18:40
learnyousomeerlang.com in offline mode
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains learnyousomeerlang.com \
--no-parent \
http://learnyousomeerlang.com
var socket;
var host = "ws://localhost:8080";
var socket = new WebSocket(host);
socket.onopen = function(){
console.log('open');
}
socket.onmessage = function(msg){
console.log(msg.data);
EM.run {
channel = EM::Channel.new
# define your websocket server here
# start udp server
  host = "127.0.0.1"
  port = "3000"
# pass in the channel to the data handler
  EM::open_datagram_socket(host, port, Handler, channel)
class Handler < EM::Connection
def initialize(*args)
   @channel = args[0]
@counter = 0
super *args
end
def receive_data(data)
   if data && data.size > 0
@counter += 1
require 'em-websocket'
EM.run do
channel = EM::Channel.new
options = {:host => "0.0.0.0", :port => 8080}
EM::WebSocket.start(options) do |ws|
ws.onopen do
sid = channel.subscribe{|msg| ws.send msg}
end
require 'eventmachine'
class Handler < EM::Connection
def receive_data(data)
  log_line = Syslog.parse(data)
puts log_line.messge
end
end
EM.run {