Skip to content

Instantly share code, notes, and snippets.

View robertpenner's full-sized avatar

Robert Penner robertpenner

View GitHub Profile
@robertpenner
robertpenner / URLLoader.as
Created March 9, 2010 18:32
flash.net.URLLoader class decompiled from Flash 10 playerglobal.swc
//Created by Action Script Viewer - http://www.buraks.com/asv
package flash.net {
import flash.events.*;
import flash.utils.*;
public class URLLoader extends EventDispatcher {
private var stream:URLStream;
public var dataFormat:String;// = "text"
public var data;
@robertpenner
robertpenner / VectorClassesFP10
Created April 13, 2010 20:42
Vector classes decompiled from Flash 10 playerglobal.swc
package {
dynamic final class Vector$object {
function Vector$object(length:uint=0, fixed:Boolean=false){
super();
this.length = length;
this.fixed = fixed;
}
private function _shift(){
if (this.fixed){
@robertpenner
robertpenner / applyClassToInstance.as
Created April 29, 2010 18:19
Inheritance chain hacking in AS2
/**
* Makes an object inherit from a class.
* Modifies the inheritance chain and calls the class constructor.
* Commonly used to make a movie clip such as the root timeline
* inherit from a custom class, e.g.
* // on main timeline
* applyClassToInstance(MyDocumentClass, this);
* Works for AVM1 only, i.e. AS1 and AS2.
* @param theClass
* @param theInstance
@robertpenner
robertpenner / signal-cake.as
Created June 4, 2011 15:44 — forked from alecmce/signal-cake.as
Can I have my signal cake and eat it too?
class NoCake
{
private var _clicked:Signal;
private var _data:Object;
public function NoCake(mc:MovieClip, data:Object)
{
_clicked = new Signal(Object);
_data = data;
mc.addEventListener(MouseEvent.CLICK, onClick);
@robertpenner
robertpenner / All the Singletons.txt
Created October 20, 2011 04:17
All the Singletons
All the Singletons, all the Singletons
All the Singletons, all the Singletons
All the Singletons, all the Singletons
All the Singletons, all the Singletons
If you liked it then you shoulda put an instance on it
If you liked it then you shoulda made it global static
Don't be mad once you see you can't unit test it
If you liked it then you shoulda made a Singleton
@robertpenner
robertpenner / gist:1319052
Created October 27, 2011 08:24
trying to get function signature
protected function listenerValid(listener:Function):Boolean
{
var scope:Array = getLexicalScopes(listener);
var scopeXML:XML = flash.utils.describeType(scope[0]);
// No clue on how to get the "name" of the function passed. I had to use a hard coded string of "hearSignal" for this test
var functionDescriptionXML:XML = scopeXML.factory.method.(@name == "hearSignal")[0];
var params:XMLList = functionDescriptionXML..parameter;
}
@robertpenner
robertpenner / SaveFlowRobert.as
Created October 31, 2011 14:15
Command Flow DSL Comparison
const saveFlow:Flow = new Flow(
{
saveSeq : new Sequence(
[
new Attempt(ValidateChanges).guard(NotQuitting).fail(ShowError),
new Attempt(ConfirmWithUser),
new Execute(BlockQuitting),
new Attempt(SaveData).fail(saveDataErrorSeq),
new Execute(StoreSavedData),
new Execute(UnblockQuitting)
@robertpenner
robertpenner / Rectangle.as
Created February 15, 2012 02:13
flash.geom.Rectangle decompiled from playerglobal.swc (11.1)
package flash.geom{
[native(cls="RectangleClass", gc="exact", instance="RectangleObject", methods="auto")]
public class Rectangle {
public var x:Number;
public var y:Number;
public var width:Number;
public var height:Number;
public function Rectangle(x:Number=0, y:Number=0, width:Number=0, height:Number=0){
@robertpenner
robertpenner / describeType.as
Created February 15, 2012 02:49
describeType() decompiled from playerglobal.swc (11.1)
//Created by Action Script Viewer - http://www.buraks.com/asv
package avmplus{
public function describeType(value, flags:uint):XML{
var e:XML;
var o:Object = describeTypeJSON(value, flags);
var x:XML = typeXml.copy();
x.@name = o.name;
if (o.traits.bases.length){
x.@base = o.traits.bases[0];
};
@robertpenner
robertpenner / Letter to India Embassy in Nepal - Disruption of Medical Supplies.MD
Last active November 19, 2015 06:27
Letters regarding Madhes protests 2015. Feel free to copy/paste and send these under your own name.

To: picwing@eoiktm.org - Press Information Wing, India Embassy

To: ecwing@eoiktm.org - Economic Cooperation Wing, India Embassy

To: economic@eoiktm.org - Economic Wing, India Embassy

Namaste,

I am concerned about the disruption of essential medical supplies to Nepal's medical community. Can you tell me what India is doing to coordinate with the Nepal government to ensure that medicine and other equipment will reach the people whose lives depend on it?