Skip to content

Instantly share code, notes, and snippets.

View squeedee's full-sized avatar
🚛
Supply Chain Specialist

Rasheed Abdul-Aziz squeedee

🚛
Supply Chain Specialist
View GitHub Profile
@squeedee
squeedee / NumberRange.as
Created December 19, 2010 19:07
Not tested. just like the idea
package {
/**
* Simple 'Range' dsl. May or may not suit.. but I like it.
*/
public class NumberRange {
public function NumberRange(from:Number = NaN, to:Number = NaN) {
this.from = from;
this.to = to;
}
@squeedee
squeedee / AbstractSequencer.as
Created January 17, 2011 18:51
Robotlegs Sequencer Actor
package com.visfleet.robotlegs.bootstrap {
import org.robotlegs.core.ICommandMap;
import org.robotlegs.core.IReflector;
import org.robotlegs.mvcs.Actor;
public class AbstractSequencer extends Actor {
private var steps:Array = new Array();
[Inject]
public var reflector:IReflector;
@squeedee
squeedee / FlyoutPresenter.as
Created March 1, 2011 23:09
Presenter for launching popups or generally having early access to flex events. FlyoutPresenter is an example that builds popups (so it uses the contextView as the parent to the popup) To prepare it, I either inject it in the context OR in Bootstrap as s
package com.visfleet.vWork.modules.map.view.flyoutPresenter {
import com.visfleet.robotlegs.presenter.Presenter;
import com.visfleet.util.topLevel.isNotNull;
import com.visfleet.util.topLevel.isNull;
import com.visfleet.vWork.modules.map.model.activeFlyout.ActiveFlyoutModel;
import com.visfleet.vWork.modules.map.model.activeFlyout.ActiveFlyoutModelChangedEvent;
import mx.core.IFlexDisplayObject;
import mx.managers.PopUpManager;
@squeedee
squeedee / farm.rb
Created March 22, 2011 22:51
BiScoped DSL
class Farm
attr_accessor :animals
def initialize(&block)
@animals = []
block.arity == 1 ? yield(self) : self.instance_eval(&block)
end
@squeedee
squeedee / gist:912891
Created April 11, 2011 00:20
Yucky find_by_sql
user system total real
Sequel 13.810000 4.800000 18.610000 ( 27.503995)
Sequel Eager Loaded 2.170000 2.370000 4.540000 ( 4.960289)
AR 12.470000 4.440000 16.910000 ( 24.182770)
AR Eager Loaded 5.520000 0.000000 5.520000 ( 5.556822)
Sequel No-Models 2.090000 3.720000 5.810000 ( 6.506667)
AR Find By SQL 26.000000 6.690000 32.690000 ( 55.647988)
AR Direct SQL 0.520000 0.020000 0.540000 ( 0.684972)
lib/buildr/as3/compiler
base.rb
module Buildr
module As3
module Compiler
class Base < Buildr::Compiler::Base
end
end
end
<testsuite errors="0" failures="0" name="Worker Selection" tests="0" time="0.049817"> </testsuite>
package com.visfleet.vWork.modules.map.controller.configuration.commands {
public class ConfigureHoverModelCommands extends Command {
[Inject]
public var event:SequenceStepEvent;
override public function execute():void {
commandMap.mapEvent(OpenFlyoutForVOEvent.SET, OpenFlyoutForVOCommand, OpenFlyoutForVOEvent);
commandMap.mapEvent(CloseFlyoutForVOEvent.CLEAR, CloseFlyoutForVOCommand, CloseFlyoutForVOEvent);
@squeedee
squeedee / Modelling.markdown
Created July 4, 2011 20:51
Skeleton of a RL chap

Modelling your application

The reason MVC came into existence, was to seperate view logic and domain modelling. When you model your application domain, you naturally are aware of how poeple may use your application, however if you can distinguish between the display of information, accepting user input, and the actual logic/state that binds your application together, then you do not have to change large amounts of one to satisfy changes to the other.

[Further reading: Fowler history of MVC]

Robotlegs simplifies the seperation of view and domain modelling.

public function add(handlerType:Class):InstanceHandlerCollection {
var handler:* = instanceClass(handlerType);
var added:Boolean;
added = addBeforeHandler(handler);
added ||= addAfterHandler(handler);
if (!added)
throw new NotAnInstanceHandlerError(handlerType);