New Fav Book: The Visual Miscellaneum

If you are a fan of infographics, graphic design, or need a fun book for a coffee table — this is the book for you. Frankly if I saw this in the store and flipped through it I probably would have bought it right then and there based solely on the bright and fun colours inside.

The Visual Miscellaneum

The Visual Miscellaneum

There are a few instances where gutters appear to have been ignored, so you end up with illegible text or a graphic might be harder to read. This is a fairly minor issue in an otherwise fantastic book.

I give it five arbitrary stars!

More at http://www.informationisbeautiful.net/

Creating Instances from the Library with Strings

Problem: while working on an AS3 document you uncover an unusual situation in which you have a string class name that corresponds to something in the library. How does one do it?

I’ve come across this a number of times and found myself dropboxing this snippet so I would always have it with me …

import flash.utils.*;

/**
 * Takes a string classname, returns an instance of that class, if it exists.
 */

private function newInstanceFromString(className:String):*{
    try{
        var classRef:Class = getDefinitionByName(className) as Class;
        return new classRef();
    } catch( e:ReferenceError ){
        trace('Error: there was a problem creating an instance of the "'+className+'" class. Check your library and linkage to ensure it\'s there.');
        trace(e+"\n");
    }
}

See the AS3 livedocs for more information about getDefinitionByName, the super helpful method that makes it all work.

Unleashing SecretSantaBot

About two years ago the occasion arose for a Secret Santa with people who, for whatever reason, couldn’t find themselves in the same room to draw names from a hat. Determined, I soldiered on and wrote a script to email all parties with a randomly selected name. It worked, it drives a slow trickle of traffic to the site every December.

I decided to give it a bit of an OOP makeover this year and go ALL-OUT and get in on the git action, too. What I have ended up with is bizarrely tacked-on front-end to an otherwise super straightforward SecretSantaBot class.

I’m going to set up a site in the future to forgo the need to have a web server in order to use the script. That’s not as fun, eh? For now, it’s targeted at the developer.

Source @ Github | Demo

Oh, I should mention that before you ream me — this is the first PHP class I’ve written, and I’m sure it’s not the most optimally written thing out there. That’s what forking is for! Forking and reaming in the same sentence …