Skip to content

Instantly share code, notes, and snippets.

View robertpenner's full-sized avatar

Robert Penner robertpenner

View GitHub Profile
@robertpenner
robertpenner / gist:a9bf52740308544e2973
Created November 1, 2014 09:03
Frozen's top 4 songs: behold the lyrical craftsmanship!
1. I never see you anymore / Come out the door
2. We don't have to feel it anymore! / Love is an open door!
3. The window is open, so's that door / I didn't know they did that anymore
4. Let it go, let it go! / Can't hold it back anymore.
Let it go, let it go! / Turn away and slam the door.
@robertpenner
robertpenner / gear.md
Last active August 29, 2015 14:15 — forked from joelhooks/gear.md
//MIT License
//Author: Max Irwin, 2011
//Floodfill functions
function floodfill(x,y,fillcolor,ctx,width,height,tolerance) {
var img = ctx.getImageData(0,0,width,height);
var data = img.data;
var length = data.length;
var Q = [];
var i = (x+y*width)*4;
// really more a struct/interface
class DataStore {
store: (object: any, key: string) => string;
get: (key: string) => any;
}
class JsonDataStore extends DataStore {
getRawJson: () => string;
static create(fileWriter: FileWriter): JsonDataStore {
@robertpenner
robertpenner / node.es6imports.d.ts
Last active August 29, 2015 14:21
node.d.ts with ES6 imports so TypeScript can --target ES6 without Error TS1202: Import assignment cannot be used when targeting ECMAScript 6 or higher. Used regex search: import[ ]+(\w+)[ ]+=[ ]+require\(\"(\w+)\"\) replace: import * as $1 from "$2"
// Type definitions for Node.js v0.12.0
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/borisyankov/DefinitelyTyped>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/************************************************
* *
* Node.js v0.12.0 API *
* *
************************************************/
@robertpenner
robertpenner / 3D TypeScript cubes, wireframe and shading.markdown
Created May 23, 2015 04:35
3D TypeScript cubes, wireframe and shading

3D TypeScript cubes, wireframe and shading ('-' * 42) 3D cubes with wireframe and shading in TypeScript.

I wanted to see how well this preprocessor works. The editor doesn't cope with it that well quite yet. The indentation doesn't quite work, nor does the syntax highlighting.

Also, when an error occurs, it always points to line 1. No matter what the error is.

It also is rather difficult to access external symbols from secondary script files, for example, new Stats() isn't possible, but that's just a TypeScript annoyance.

@robertpenner
robertpenner / setIntervalInternals.as
Created November 26, 2009 18:58
setInterval internals decompiled from Flash 10 playerglobal.swc
//Created by Action Script Viewer - http://www.buraks.com/asv
package flash.utils {
public function setTimeout(closure:Function, delay:Number, ... _args):uint{
return (new SetIntervalTimer(closure, delay, false, _args).id);
}
}//package flash.utils
import flash.events.*;
@robertpenner
robertpenner / EnterFrameDispatcher.as
Created November 26, 2009 19:49
EnterFrameDispatcher using timeline to avoid Event creation
package
{
import flash.display.MovieClip;
import org.osflash.signals.Signal;
/**
* This class needs to be associated with a movie clip symbol containing two blank frames on its timeline.
* Usage:
*
* var dispatcher:EnterFrameDispatcher = new EnterFrameDispatcher();
@robertpenner
robertpenner / SignalsHelloWorld.as
Created December 3, 2009 05:42
A simple example of using Signals to dispatch changes to a property.
package
{
import org.osflash.signals.Signal;
import flash.display.Sprite;
public class SignalsHelloWorld extends Sprite
{
private var radio:Radio;
private var messageListener:MessageListener;
@robertpenner
robertpenner / SignalAsMXMLTag.mxml
Created February 11, 2010 02:51
Signal as MXML tag in Flex 4
<?xml version="1.0"?>
<!--
~ RegFormRLSExample - RegView.mxml
~
~ Copyright (c) 2010. Newtriks Ltd <simon@newtriks.com>
~ Your reuse is governed by the Creative Commons Attribution 3.0 License
-->
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"