Skip to content

Instantly share code, notes, and snippets.

Avatar

Simon Bailey newtriks

View GitHub Profile
View PopUpCombo.as
package
{
import flash.display.DisplayObject;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.ui.Keyboard;
import mx.controls.PopUpButton;
@newtriks
newtriks / gist:1016612
Created Jun 9, 2011
Run command with rake test
View gist:1016612
task :default => :list do
%x{touch readme.txt}
end
task :list do
@dump=%x{ls}
puts "Directory contents: #{@dump}"
end
@newtriks
newtriks / FlexTestRunner.mxml
Created Jun 10, 2011
Flex ASUnit4 TestRunner
View FlexTestRunner.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
minWidth="800"
minHeight="600"
creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import asunit.core.TextCore;
@newtriks
newtriks / AllTests.as
Created Jun 10, 2011
ASUnit4 Test Suite class
View AllTests.as
package
{
[Suite]
public class AllTests
{
}
}
@newtriks
newtriks / SearchViewTest.as
Created Jun 13, 2011
SearchView Test Class using ASUnit4
View SearchViewTest.as
/** @author: Simon Bailey <simon@newtriks.com> */
package
{
import asunit.asserts.assertNotNull;
import asunit.asserts.assertSame;
import asunit.asserts.assertTrue;
import asunit.framework.IAsync;
import flash.display.Sprite;
import flash.events.Event;
@newtriks
newtriks / SearchView.mxml
Created Jun 13, 2011
SearchView MXML component used by ASUnit4 test example
View SearchView.mxml
<?xml version="1.0"?>
<s:Group xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:fx="http://ns.adobe.com/mxml/2009">
<fx:Metadata>
[Event(name='submitSearchEvent',type='flash.events.Event')]
</fx:Metadata>
<s:layout>
<s:HorizontalLayout paddingLeft="10"
paddingRight="10"
paddingBottom="10"
@newtriks
newtriks / ExampleComponentUsage.mxml
Created Jul 28, 2011
Fluent snippets example usage in a Flex project. Configuration is set via mxml params which are then used to build a strongly typed Object in a Fluent fashion.
View ExampleComponentUsage.mxml
<media:MediaContainer id="mediaContainer"
aspectRatio="{VideoBase.WIDE_SCREEN}"
verticalCenter="0"
horizontalCenter="0"
bandwidth="32768"
logHandler="{log}"
layoutHandler="{resize}"/>
@newtriks
newtriks / gist:1139788
Created Aug 11, 2011
Preparing Mockolate example in an ASUnit4 TestCase
View gist:1139788
[Inject]
public var async:IAsync;
[Before]
public function prepareMockolates():void
{
var mockolateMaker:IEventDispatcher=prepare(IModuleStore);
async.proceedOnEvent(mockolateMaker, Event.COMPLETE, 5000);
}
@newtriks
newtriks / gator.rb
Created Aug 15, 2011
Gator config file
View gator.rb
require "gator/as3/generators"
require "gator/as3/generators/test/asunit4"
require "gator/as3/robotlegs/generators"
require "gator/as3/robotlegs/generators/test/asunit4"
project Gator::Project::ProjectBase.new
project.name = "MyProject"
project.options[:authors] = ["newtriks"]
project.layout[:source,:main,:as3] = "src"
project.layout[:source,:test,:as3] = "test"
@newtriks
newtriks / gator.rb
Created Sep 1, 2011
Includes to use source instead of gem
View gator.rb
require "/Users/newtriks/Development/libs/gator-as3/lib/gator/as3/generators/"
require "/Users/newtriks/Development/libs/gator-as3/lib/gator/mxml/generators/"
require "/Users/newtriks/Development/libs/gator-as3/lib/gator/as3/generators/test/asunit4"
require "gator/as3/robotlegs/generators"
require "gator/mxml/robotlegs/generators"
require "gator/as3/robotlegs/generators/test/asunit4"