Skip to content

Instantly share code, notes, and snippets.

View vrobel's full-sized avatar

Michał Wróblewski vrobel

View GitHub Profile
package org.robotlegs.utilities.remote
{
import com.adobe.serializers.json.JSONDecoder;
import mx.collections.ArrayCollection;
public class JsonRemoteService extends RemoteServiceBase
{
public function JsonRemoteService(rootURL:String = "")
{
package {
public class PageFlipperMediator extends Mediator implements IHasStateTransition{
/**
* VIEW
*/
[Inject]
public var view:PageFlipperView;
/**
* IHasStateTransition implementation for autoremove
@vrobel
vrobel / ExampleSequenceManager.as
Created September 15, 2011 14:12
SequenceManager and example
package com.blackmoondev.sequence.example {
import com.blackmoondev.sequence.example.services.InitLoaderService;
import com.blackmoondev.sequence.example.services.core.IInitLoaderService;
import com.blackmoondev.sequence.example.signals.LoadIconsSignal;
import com.blackmoondev.sequence.example.signals.LoadMainConfigSignal;
import com.blackmoondev.sequence.example.signals.LoadUserConfigSignal;
import com.blackmoondev.sequence.example.signals.initloader.InitFlashLibSignal;
import com.blackmoondev.sequence.SequenceManager;
public class ExampleSequenceManager extends SequenceManager {
@vrobel
vrobel / BasePromiseService.as
Created September 29, 2011 00:02
Promise based service
package com.blackmoondev.services {
import flash.events.ErrorEvent;
import flash.utils.Dictionary;
import org.robotlegs.oil.async.Promise;
public class BasePromiseService {
protected var loaders:Dictionary = new Dictionary();
protected var promises:Dictionary = new Dictionary();
@vrobel
vrobel / BaseApplicationPreloader.as
Created November 10, 2011 11:00
BaseApplicationPreloader
/**
* Created by IntelliJ IDEA.
* User: wrobel221
* Date: 08.12.10
* Time: 13:07
* To change this template use File | Settings | File Templates.
*/
package com.blackmoondev.preloader {
import flash.display.DisplayObject;
import flash.display.Graphics;
@vrobel
vrobel / LibraryManager.as
Created November 24, 2011 13:18
LibraryManager.removeGroupsContaining
/**
* Removes all groups containing given string
* @param str: Search phrase for groupIds
*/
public static function removeGroupsContaining(str:String):void{
var toBeRemoved:Array = [];
for (var groupId:String in LibraryManager._groupMap) {
if(groupId.indexOf(str) != -1) {
//get group
@vrobel
vrobel / StateSystemRules.as
Created July 24, 2012 19:18
SystemEnabledRule
package com.blackmoondev.ashes.boot.vo
{
import net.richardlord.ash.core.Game;
import net.richardlord.ash.core.SystemEnabledRule;
import org.hamcrest.Matcher;
import org.hamcrest.collection.inArray;
import org.hamcrest.core.not;
import org.hamcrest.object.equalTo;
@vrobel
vrobel / SystemTests.as
Created August 10, 2012 15:01
Test case for removing and adding system with same priority causess infinite loop
[Test]
public function removeSystemAndAddItAgainDontCauseInvalidLinkedList():void {
var systemB:System = new System();
var systemC:System = new System();
game.addSystem( systemB, 0 );
game.addSystem( systemC, 0 );
game.removeSystem(systemB);
game.addSystem(systemB, 0);
// game.update( 0.1 );
assertThat( systemC.previous, nullValue() );
@vrobel
vrobel / StageReadySignal.as
Created August 16, 2012 12:57
Signal that notifies when target DisplayObject lands on stage dispatching target DisplayObject and Stage objets. Adding listener dispatches immidiately when target is already on stage.
/**
* Created with IntelliJ IDEA.
* User: wrobel221
* Date: 16.08.12
* Time: 14:35
* To change this template use File | Settings | File Templates.
*/
package com.blackmoondev.signals.native
{
import flash.display.DisplayObject;
@vrobel
vrobel / gist:3388643
Created August 18, 2012 17:38
What do you do if you find something like this
//poziom 2 //
slowa_losowanie=random(300)+1;
if (slowa_losowanie==1){
slowa="lorem";
}
else if (slowa_losowanie==2){
slowa="ipsum";
}
else if (slowa_losowanie==3){
slowa="dolor";