andymatuschak.org: archive

You are at the archive for the November, 2007

Jonas Brothers ringtonesThe Fratellis ringtones

An Amusing Story

I was standing in my Hovse’s courtyard the other day, when the following interchange took place:

Guy in a Microsoft shirt: Hey, guys.
Guy in a Debian shirt: We must kung-fu fight!
Another student: Wait, wait, you’ve got to get Andy, too!
Me: Huh? I’m not wearing Apple clothes!
Him: Oh, yes you are!

I was really confused. Then I looked down and realized I was the only student in sight wearing a fitted shirt and designer jeans.

You know, I didn’t care about my clothes until a couple years ago. And I didn’t switch to the Mac until a couple years ago. Coincidence?

At least it wasn’t a black turtleneck.

  • RubyCocoa + Scripting Bridge = :)

    require ‘osx/cocoa’
    include OSX
    require_framework ‘ScriptingBridge’
    iTunes = SBApplication.applicationWithBundleIdentifier:
    	‘com.apple.iTunes’
    iTunes.playpause
    puts "Now playing: #{iTunes.currentTrack.name}"
    (3)

RubyCocoa + IRB for Testing!

Sometimes, I find myself wondering how a Cocoa method will behave if I do a certain thing. Can I pass nil for this argument? What keys does this return?

Often, I’ll build little test apps to solve these kinds of problems. That requires make a new Xcode project, which has its own directory, then, in many cases, adding some kind of class to instantiate in IB, then calling some methods when applicationDidFinishLaunching:.

Way too much work.

Now, next time I’m wondering which formats NSImage supports, I can just open up IRB in the Terminal and type things like:

require 'osx/cocoa'
OSX::NSImage.imageFileTypes

Well, that was my first try, anyway. That just spits out:

#<OSX::NSCFArray:0x2e09dc class='NSCFArray' id=0x1a73040>

Now, if we passed this NSArray to any Ruby method requiring a Ruby array, it’d be converted automatically:

OSX::NSImage.imageFileTypes.collect { |type| type.reverse }

But if we want to just convert it, we can use the handy to_ruby method:

>> OSX::NSImage.imageFileTypes.to_ruby
=> ["'PDF '", "PDF", "pdf", "'PICT'", "PIC", "pic", "PCT", "pct",
"PICT", "pict", "'EPSF'", "PS", "ps", "EPSI", "epsi", "EPSF", "epsf",
"EPI", "epi", "EPS", "eps", "XBM", "xbm", "HDR", "hdr", "EXR", "exr",
"CR2", "cr2", "DCR", "dcr", "DNG", "dng", "SRF", "srf", "NEF", "nef",
"CRW", "crw", "RAF", "raf", "ORF", "orf", "MRW", "mrw", "ICNS",
"icns", "'jp2 '", "JP2", "jp2", "'qtif'", "QTI", "qti", "QTIF",
"qtif", "'TPIC'", "TGA", "tga", "TARGA", "targa", "'.SGI'", "RGB",
"rgb", "SGI", "sgi", "'8BPS'", "PSD", "psd", "'PNTG'", "MAC", "mac",
"PNT", "pnt", "PNTG", "pntg", "'FPix'", "FPIX", "fpix", "FPX", "fpx",
"'PNGf'", "PNG", "png", "'GIFf'", "GIF", "gif", "'JPEG'", "JPG", "jpg",
"JPEG", "jpeg", "CUR", "cur", "'ICO '", "ICO", "ico", "'BMPf'", "BMP",
"bmp", "'TIFF'", "FAX", "fax", "TIF", "tif", "TIFF", "tiff"]

This technique is really useful for spiking things out without having to make a whole new project.

6 in 2!

So I realized on Sunday that due to a confluence of Thanksgiving scheduling changes, six assignments were all due on Wednesday. Normally, one to do per night eats almost all of the evening.

As you might expect, it’s been an interesting couple of days.

I’m actually not sure how I managed to finish everything on time. Things have kind of been a blur. But now that I’m out, through the other side of the veil, everything’s clear and beautiful. Nothing’s due until Monday. I have four truly free evenings! This has never happened in my time here at Tech.

Is this what it’s like to be a normal college student?

It’s a very freeing feeling. I think I might actually prefer the oh-god-everything-in-two-days scheduling tact: now I have enough time to actually switch mental gears and to code. To enjoy myself!

I’m thinking of trying to arrange my weeks like this more often in the future, but it’s difficult to do sets very early, since collaboration is essentially mandatory, and everyone else is on the one-per-night schedule. Hm.

In other delightful news, I only have one assignment left in each of my classes. It’s been a ridiculous term, but it’s finally drawing to a close. And better yet, it looks like with my current schedule for the next few months, I may actually get some free time.

Here’s to hope!

  • Panic’s released CandyBar 3 with some absolutely gorgeous web design. Check it out for some great UI, both in and out of the app.

    As a side note, it seems to use some kind of in-house update mechanism that isn’t Sparkle.

    (1)

If you're looking for something specific then give the search form below a try:

RSS Wordpress Grady (theme) Valid XHTML Return to the Top ↑