Archive for January, 2008

Auto Comment Block In TextMate

Monday, January 21st, 2008

If you haven’t heard of TextMate go check it out it’s sweet. It allows a helluva lot of automation and is damn near the only thing you need for development of any language [minus compilers]. I’m about ready to throw away my Flash CS3 IDE I got for free from my day job and shell out the 39 pounds to buy it [those of you who know me personally know I don't ever buy software].

So, here’s a little command I wrote in the form of a bash script [I think all textmate commands are bash scripts or cocoadialog thangs]. The script takes selected input and pads it with “/* */” if it isn’t already, effectively commenting the text or it strips the comment block. I don’t write shell scripts often, so I like it when I get one that’s really useful.

#!/bin/bash

#-------------------------------------------------------------------------
# Make comment / Undo comment
# by Schell Scivally
# @ efnx.com
#-------------------------------------------------------------------------

opening=`echo "$TM_SELECTED_TEXT" | awk 'BEGIN {nlines=0} /\/\*/ {nlines++} END {print nlines}'`
if [[ "$opening" == 0 ]];
    then
        echo -n "/*$TM_SELECTED_TEXT*/"
    else
        output=`echo "$TM_SELECTED_TEXT" | sed 's/\*\///g' | sed 's/\/\*//g'`
        echo -n "$output"
fi

AS3 Classes and Interfaces Quicktip

Saturday, January 19th, 2008

Interfaces in AS3 are super useful for requiring classes to support a set of public methods, enabling other classes to communicate through the interface thereby abstracting the class itself. AS3 doesn’t natively support abstract classes so using Interfaces is a good replacement in some cases, but if you’ve never used an Interface before you probably wouldn’t know how to implement it. The docs help a little, showing you how to instantiate a class using an interface with the “implements” keyword, but doesn’t go much further:

public class myClass implements myInterface{
}

But what if you’d like to implement a class while extending another? Well, it’s simple once you know the syntax…

public class myClass extends baseClass implements myInterface {
}

This is a very quick and simple tip that took me a while to find online due to the fact Adobe doesn’t mention it. Such a simple thing should be in the help docs, but I guess adobe thinks that anyone trying to use Interfaces would already know the syntax! Well now you do.

Joa Ebert SpeedCodes a Particle Explosionater [Explodinating the Countryside]

Tuesday, January 15th, 2008

I just like posting vidyos when I’m too lazy to code or write about code.

Rad Video

Thursday, January 10th, 2008

This guy and Paul Roberts would be my dream team to work on a platformer with.


Follow me on GitHub
Follow me on Google+
Follow me on Twitter