Archive of articles classified as' "Code"

Back home

Capture key sequences in ActionScript 3. AKA The Konami Comeback.

6/06/2009

Contra Konami
Lately the internet has had a wave of sites using the cherished Konami Cheatcode to reveal easter eggs or similar functionality in the site or app.

I wrote a (crappy but working) class to implement such functionality in ActionScript about a year ago here.

I decided to polish it up a bit for the benefit of myself and anyone else and in the process ended up creating a small utility class to work with keystrokes in the process.

You can download the (fairly self-expaining) classes and a sample project right here, or read on for a bit of explanations.

(Text) Keys.as.
(Text) Konami.as.
(Archive) Neatly zipped + example.

Read the rest of this article »

3 Comments

Migrate from Things to The Hit List

14/05/2009

Edit: I updated the app to work on Snow Leopard. Go here to get the app or source code.

Things Migrator ScreenSo this all started out with me pining for the release of the fabled iPhone version of The Hit List. I started out just wanting to create a script that would let me use Things Touch to gather tasks when I was out and about and then transfer them to The Hit List and delete them from things. Seeing how I already had a license for Things this seemed to be my best option for the time being. (Sorry Appigo Todo. It’s not you, it’s me.)

So this is all just exposition, because:
1. It’s too klugey a way of going about this to actually be useful
And 2. it’s easier to achieve almost as good a result by just syncing through iCal.

So now I’m sitting here with a heap of useless code and decided to see if I could repurpose it to do some good.
I present to you the Things Migrator. This is a small app that does one thing only. It grabs all of your to-dos from Things and migrates them over to The Hit List.

Now, not all of the same metaphors apply in The Hit List as they do in Things, so some of the data will inevitably be lost or confuddled. Below is a short summary of how the migrator will treat the different kinds of data.
Tags are transformed into /Tags or /Multi word tags/, Projects become Lists and you can map Areas into /Tags, /Area name tags/ or @contexts.

Issues that may or may not be improved upon:

  • It’ll only migrate open tasks and it’ll ignore Things’ “activation date”, “creation date”, and pretty much anything to do with “per sons”.
  • Links to local files will not be read. I can’t figure out how to decode the stupid HEX-string I get into a proper path. Instead the script will insert a note alerting you to the fact that somehting’s missing.
  • URL links will for now show up as the full HTML link, i.e. <a href="http://ctrloptcmd.com">my link</a>. I’m sure it’s easily fixable, but it’ll have to wait until I know if anyone at all wants it seeing how this string parsing in AppleScript is getting on my balls.
  • It is, as mentioned before, a one way street. There’s no syncing back to Things from THL per now, and I don’t know if there ever will.

Please note that this is experimental stuff and I take no responsibility for crap that may happen!

That said, it seems to work pretty well and you can download the application (with a nice GUI) or the full XCode project here.

Comments and feedback is always appreciated.

4 Comments

Adobe Updodger

21/04/2009

Do you use any Adobe products? Tell me if this sounds familiar: “Oh hai! I need to update some totally unrelated stuff on your machine! You know, some camera raw stuff or InDesign whatchamacallits, so I’m just going to force you to quit all your browsers, because lordy lordy who knows what might happen if you coincidentally were looking at interwebs while I was installing this shit. Woohoo!”

Yes… The old adobe installer/updater. Let me count the ways I hate you. Quite a few! So, more out of spite than anything else I started checking out what browsers might not be sniffed up by the dreaded ugly beast that is the Adobe Installer/Updater. Turns out they’ve been thorough. Fluid gets away with it, but it’s really not that great for anything but site-specific stuff (which it was made for, and indeed does very well).

So in the end I wrote my own web browser, and of course I did it in AIR (Adobe Integrated AIR Runtime… RAS!).
So let me advice you; This is NOT a good browser, and it is NOT much of a feat to have written it, but it WILL work during an Adobe installation does its thing, and it IS fucking hillarious to use Adobe technology to subvert Adobe technology.

The source is available in the app itself, and you’ll notice that I’ve used this guys styles to pretty it up a bit. Knock yourself out if it takes your fancy. If you install the app you’ll get a very basic browser. A URL field, back and forward history buttons and a search field. Impressively it seems to remember your logins from other browsers, which is not my doing at all. Clicky clicky badgy badgy to install.

Please upgrade your Flash Player This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.

No Comments

Prattle of the Pettiest

9/04/2009

Java Action Script Faceoff
Original photo by Flickr user alexerde. Bastardized thoroughly by yours truly.
These two posts by Keith Peters do a marvelous job at summarising an age-old frustration that most ActionScript developers and I’m certain developers in many other languages, have either faced or actively promulgated.
Namely the attitude that while my language is certainly a robust and decent Object-Oriented Programming language, yours is obviously the stuff of programmer playgrounds and can hardly be considered programming at all.
I’ve broadly steered clear of participating in these pissing contests, but I’m sick to death of them and wish the collective programming community would grow the hell up and quit Balkanizing 1 since we all seem to have flourishing and genuinely resourceful communities in each our camps.

The first post.
The second post that explains the first post to the hard of thinking, but is still worth a read to us really smart folks.

  1. Apologies to Aral Balkan who of course represents anything but what this term has come to mean.
No Comments

Twitter, Twitter, Twitter

22/03/2009

Update!! Yahoo did the same dick move of cockblocking Flash. :/ To remedy this the URLRequest on line 80 had to be changed. If your project used to work but doesn’t anymore; Try this. If this is your first time here; Ignore this message.

Ad infinitum, ad nauseum.
So, I saw that I’m still getting some traffic to this post where I suggested a solution to the Twitter crossdomain.xml problem.

The Yahoo pipes solution still works fine, but my code is a godawful mess and I decided I’d have to fix it up a bit. The methodology is essentially the same. We’ll be using this yahoo pipe, but it’s neatly blackboxed so that you just need to know your Twitter ID to use this class.

Read the rest of this article »

28 Comments