Skip to content

Instantly share code, notes, and snippets.

View alumican's full-sized avatar

Yukiya Okuda alumican

View GitHub Profile
@alumican
alumican / EventDispatcher.coffee
Created October 4, 2012 09:25
AS3 like EventDispatcher
class EventDispatcher
constructor: () ->
@_listeners = {}
addEventListener: (type, listener) ->
return unless typeof listener == 'function'
@_listeners[type] ?= []
for l in @_listeners[type]
return if l == listener
@_listeners[type].push(listener)
@alumican
alumican / MathUtil.as
Created May 21, 2012 16:28
MathUtil.map
package net.alumican.as3.utils
{
public class MathUtil
{
static public function map(value:Number, srcMin:Number, srcMax:Number, dstMin:Number, dstMax:Number):Number
{
value = value < srcMin ? srcMin : value > srcMax ? srcMax : value;
return dstMin + (dstMax - dstMin) * (value - srcMin) / (srcMax - srcMin);
}
}
@alumican
alumican / testApp.cpp
Created January 14, 2012 15:32
openFrameworksとZinniaで手書き文字認識
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup()
{
ofSetDataPathRoot("data/");
ofBackground(0);
//setup recognizer
recognizer = zinnia::Recognizer::create();