Skip to content

Instantly share code, notes, and snippets.

@leegrey
leegrey / inherit.js
Last active October 12, 2015 21:47
inherit.js - a minimal prototype inheritance utility
/*
Inherit copyright 2012 by Lee Grey
license: MIT
http://creativecommons.org/licenses/MIT/
http://opensource.org/licenses/mit-license.php
The goal of the Interit class is to allow for a prototype based inheritance that
does not create a deep prototype chain. Inherited fields are known to be slow,
so methods and fields are simply copied onto the prototype of the target,
keeping only a single depth.
@leegrey
leegrey / SignalHub.as
Created September 15, 2012 07:48
SignalHub.as is a Signal manager for AS3
/*
SignalHub:
Created on Sat 15th Sep, 2012
by Lee Grey
SignalHub solves the problem of object-creation order by using lazy initialisation - whoever
makes the first request for a Signal with a given key will bring about it's creation.
@leegrey
leegrey / SeededRandomNumberGenerator.js
Created August 3, 2012 13:32
Seeded random in Javascript, translated from Michael Baczynski's AS2 ( http://www.polygonal.de )
/*
* Copyright (c) 2009 Michael Baczynski, http://www.polygonal.de
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@leegrey
leegrey / Vector2D.as
Created June 22, 2011 08:43
LGVector2D.as - A 2D Vector Class in AS3
//CLASS: com.lgrey.vectors.LGVector2D
//created by Lee Grey
package com.lgrey.vectors {
import flash.geom.Point;
public class LGVector2D {
public var x:Number = 0;
public var y:Number = 0;