Skip to content

Instantly share code, notes, and snippets.

Avatar

Simon Bailey newtriks

View GitHub Profile
@newtriks
newtriks / NetConnectionServiceTest.as
Created Sep 2, 2011
NetConnection service Class UnitTest example
View NetConnectionServiceTest.as
package
{
import asunit.framework.TestCase;
import com.newtriks.restricted.modules.streamingservicemodule.api.signals.NetConnectionSuccessful;
import com.newtriks.restricted.shell.api.signals.RecorderError;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
@newtriks
newtriks / gist:1297937
Created Oct 19, 2011
PMVC Nested View Registration
View gist:1297937
public class ProfileDisplayMediatorsCommand extends SimpleCommand implements ICommand
{
override public function execute( note:INotification ):void
{
var profileDisplay:ProfileDisplay = note.getBody() as ProfileDisplay;
facade.registerMediator( new ProfileDisplayMediator( profileDisplay ) );
facade.registerMediator( new BalanceDisplayMediator( profileDisplay.balanceComponent ) );
}
View RemoteDelegate.as
/*
RemoteDelegate Class
Copyright (c) 2009 Simon Bailey <simon@newtriks.com>
Your reuse is governed by the Creative Commons Attribution 3.0 License
*/
package
{
import mx.rpc.AsyncToken;
import mx.rpc.IResponder;
import mx.rpc.remoting.RemoteObject;
View build.properties
######################################
## PROJECT INFORMATION
######################################
## Developer info
AUTHOR = Simon Bailey
PROJECT.OWNER = Newtriks
PROJECT.OWNER.URL = http://www.newtriks.com
PROJECT.FULLNAME = Flex Ant Tasks Example
PROJECT.VERSION = 1.0.0 alpha
View build.xml
<?xml version="1.0"?>
<!-- ======================================================================
Flex ANT Build Script
- Deletes build and template directory
- Creates build, assets and templates directories
- Compiles release and debug swf's
- Connects to svn (Adobe Flex Opensource)
- Svn checkout of latest Flex SDK > templates > SWFObject
- Creates html wrappers for release and debug using SWFObject template
View CustomList.as
package
{
import flash.display.DisplayObject;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import mx.controls.List;
import mx.controls.listClasses.ListRowInfo;
import mx.core.mx_internal;
View ListExtraRowExample.mxml
<?xml version="1.0"?>
<!-- Simple example to demonstrate the List Control -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#ffffff" backgroundGradientColors="[#ffffff,#ffffff]" xmlns:local="*" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var selectedItem:Object;
@newtriks
newtriks / actionscript.sublime-build
Created Jul 17, 2012
SublimeText2 MXMLC compile and run buildfile
View actionscript.sublime-build
{
"cmd": ["/Users/newtriks/Library/Plugins/sdks/flex_sdk_4.6.0.23201B/bin/mxmlc",
"$file",
"-static-link-runtime-shared-libraries=true"],
"file_regex": "(.*)[(](\\d+)[)]:(?: col: (?:\\d+))? *Error: (.*)",
"selector": "source.actionscript",
"variants": [
{ "cmd": ["open ${file_path}/${file_base_name}.swf"],
"shell": true,
"name": "Run"
@newtriks
newtriks / version.sh
Created Oct 18, 2012
Versioning a Rails app with Git and Heroku
View version.sh
#!/bin/bash
REVISION=$(heroku config:get REVISION)
echo " info: heroku REVISION: $REVISION"
function version_release
{
echo -e " info: writing: '\$tagged_release_version = \"$1\"' to version_helper.rb"
echo -e "\$tagged_release_version = \"$1\"" > config/initializers/version_helper.rb
git add config/initializers/version_helper.rb
git commit -am "Updating version_helper with latest tagged version $1"
echo " info: deployed version $REVISION is not yet tagged; tagging now as $1"
@newtriks
newtriks / JavaScript.sublime-build
Created Nov 5, 2012
Sublime Build File for JavaScript using (OS X) JSC
View JavaScript.sublime-build
{
"cmd": ["/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc","$file"],
"selector": "source.js"
}