Monthly Archives: August 2010

Node Knockout – Team LazerCatz!

August 30, 2010 » Geek

This weekend I participated in Node Knockout with Jerod and Cody. It was awesome, we made a game in 48 hours (less than that of actual working time).

LazerCatz!
LazerCatz!

It was a lot of work, how much?

We had 129 total commits, 82 were mine, 35 belonged to Jerod, and 12 to Cody. That’s not 100% accurate because Cody had some git problems part way through, so I committed things for him. In those commits we had 245 file changes.

The final product had 974 total lines of code, as broken down by CLOC:

If you have a minute, give it a shot at http://www.lazercatzthegame.com/.

Fixing Kate’s Instance Behavior

August 27, 2010 » Geek

I’ve been a KDE user for a long time now, and I love all the new changes (except the Aero snap thing, you can turn that off though). One thing I love is Kate. I usually have two or three Kate sessions open at once, borrowing code across projects or changing things in different modules.

My problem is that Kate now defaults to only one instance, so if I call Kate from the command line with a file name, it gets added to a running instance, not a new one. If I use the KRunner to start a session, it loads in place of the current session in a running instance. I understand the reasoning here, but I want to use it the way I always have.

Easy fix! Just always make sure it is called with kate -n

You can do this with a BASH alias,

or more thoroughly with a wrapper script like this one from a forum post:

Easy fix!

Tags: , , ,

Thursday Quote: Jeff Atwood

August 26, 2010 » Geek

“As programmers go, I’m fairly social. Which still means I’m a borderline sociopath by normal standards.”

– Jeff Atwood
On Working Remotely

PanoramAh: Version Two

August 25, 2010 » Geek

Last week I put together a quick script to display a panorama I took in Colorado.

It was a one-off script and I didn’t think much of it until Naina Redhu left a comment asking about using it for multiple panorama’s.

Well, why not?

It didn’t take much to tweak it into a full fledged jQuery plugin. I just took the bit that made the panorama and tweaked it to use local references. While I was at it I removed the requirement for a pre-loader image in the markup. Have a look.

Using it is pretty easy too, just set up your HTML like so:

Then make a collection and call panoramah() on it:

There’s a demo available here and you can keep up with any changes at Github.

A Simple JavaScript Hooks System

August 19, 2010 » Geek

I was looking to add some more extensibility to a project this week and I couldn’t find a hook system for JavaScript. I wanted something similar to the PHP hook system in MediaWiki, but Google just wasn’t much help.

I’m sure there is something out there that does what I need, but it’s such a simple thing I went ahead and implemented it.

hook.js

Extensions can “get in line” for a hook by calling register with the hook name and callback.

Core code (or even other extensions actually) can call hooks by using the call method, with name and an argument array (think argv). If a hook returns anything other than true, processing of the hook ceases.

To do useful things you have to set up the right arguments. Since objects are passed by reference in JavaScript, you can manipulate anything in the argument array from inside of your hook (or even add to the array if you want).

Obviously this is a simplified tool. All code is implicitly trusted, argument specification is non-existent, there is no prioritization (except for insertion order) and hooks are not guaranteed to run. But it works!

You can check out some basic usage code and test it out here.

Suggestions are welcome!