Skip to content

Instantly share code, notes, and snippets.

View neilmanuell's full-sized avatar

neil manuell neilmanuell

View GitHub Profile
@neilmanuell
neilmanuell / vectors.as
Last active April 25, 2016 12:28
do these have the same memory optimisations.
//create dynamic vector and fix
private var _items:Vector.<uint> = new <uint>[];
_items.push(1);
_items.push(2);
_items.push(3);
_items.push(4);
_items.push(5);
_items.fixed = true;
//create static vector
@neilmanuell
neilmanuell / main.py
Last active February 29, 2016 16:18
immutable int problem
import pyglet
def update_image(dt):
img = pyglet.image.load(image_paths[count])
#... do other stuff
count += 1 #cant do this cause its immutable
.container-center {
position: absolute;
margin: 0 auto;
width: 100%;
height: 100%;
}
.element-center {
position: absolute;
top:50%;
@neilmanuell
neilmanuell / ApplicationContext.as
Last active December 29, 2015 06:08
RL1.5 ConfigurableModules
public class ApplicationContext extends ConfigurableContext
{
public function PreloaderContext( contextView:DisplayObjectContainer )
{
super( contextView );
}
override public function startup():void
{
controllers.CanvasCtrl = function ( $scope, $timeout, CanvasService ) {
$scope.onStart = function () {
$scope.pageNumber = $scope.data.pageNumber;
$scope.velocity = 0;
$scope.damping = 0.002;
$scope.repeat = false;
}
$scope.onDrag = function () {
@neilmanuell
neilmanuell / TickProviderTests.js
Last active December 16, 2015 21:39
Mocha BDD test with nodeJS fail
var should = require('should');
var TickProvider = require('../scripts/tick/tick_provider');
describe('TickProvider', function() {
it('should instantiate', function() {
var tick = new TickProvider()
});
});
@neilmanuell
neilmanuell / mocha test runner
Created May 1, 2013 08:58
Mocha test runner for use with NodeJS.
var Mocha = require('mocha'),
path = require('path'),
fs = require('fs');
var mocha = new Mocha({
reporter: 'dot',
ui: 'bdd',
timeout: 999999
});
@neilmanuell
neilmanuell / mapCmdsToCompleteEvent
Created July 21, 2012 21:11
Mapping separate commands with Guards and Hooks to same Event type
commandmap
.map( Event.COMPLETE, Event )
.toCommand( DispatchProcessEvent )
.withHooks( InjectMakeAbsoluteProcess )
.withGuards( OnlyIfReasonNotAbsolute );
commandmap
.map( Event.COMPLETE, Event )
.toCommand( DispatchProcessEvent )
.withHooks( InjectMakeEvenProcess )
@neilmanuell
neilmanuell / configuringProcesses.as
Created June 12, 2012 11:35
FSM for a latchable door
private function configProcesses():void
{
// LOCK Process
fsmConfig.configureProcess( LOCK )
.ifCurrentState( CLOSED )
.transitionTo( LOCK );
fsmConfig.configureProcess( LOCK )
.ifCurrentState( OPENED )
.transitionTo( CLOSED, LOCK );
@neilmanuell
neilmanuell / WithEnumbs.as
Created June 11, 2012 11:06
FSM Declaration with Strings vs enmubs
// state names
public static const LOADING:StateName = new StateName("loading");
public static const DECODING:StateName = new StateName("decoding");
public static const DISPLAYING:StateName = new StateName ("displaying");
// process names
public static const IN:ProcessName = new ProcessName("in");
// state declaration
fsmConfig.configureState( LOADING )