Wednesday, April 25, 2012 Monday, April 16, 2012 Wednesday, February 15, 2012

Size Matters

Want the TL;DR version? Here you go: I don’t want a bigger cell phone. If I can serve breakfast in bed on it, it’s too damn large. If it won’t fit in my pocket or I can’t bend my leg when I put it there, it’s too damn large. If anyone feels compelled to ask whether I’m happy to see them because my phone’s in my pocket, it’s too damn large.

You know what? Let’s make that the long version as well. I think I’ve articulated my thoughts on the matter about as well as they’re going to be articulated. Anything else would be superfluous.

With that in mind, I link to this review of a Jurassic-sized “mobile” phone because it includes one of the best lines I’ve heard in a very, very long time:

The Galaxy Note’s tagline asks if the device is a tablet or a smartphone, but like a girl in Spanx, it’s so much more.

Ah, yes.

(Source: thetechblock.com)

Friday, January 27, 2012

Control Pulsar with Alfred

The Pulsar Alfred Extension in action

Wherein you:

  1. Are a Sirius subscriber, and
  2. Listen to Sirius on your Mac via Rogue Amoeba’s awesome Pulsar application, and
  3. Heart the hell out of the productivity provided by Alfred, and
  4. Have the Alfred Powerpack installed, then

You might be wishing you could use Alfred to control Pulsar so you didn’t have to activate the app every time you wanted to pause a great song by Starland Vocal Band. I was too. Eventually, I decided to do something about it.

Pulsar’s script API isn’t very extensive, but it does cover pause/play as well as a few other useful bits. The Pulsar extension supports:

  • xm play
  • xm pause
  • xm show (display the channel, artist, track and album now being played)
  • xm next (changes the channel to the next Favorite channel)
  • xm prev (changes the channel to the previous Favorite channel)

I chose the xm keyword because it’s short and reasonably descriptive since I’m playing a Sirius_XM_ channel, but that’s easy to change once the extension is installed. If you have Growl installed, the xm show command will display a Growl notification. If not, it will degrade to an ugly, but functional alert dialog.

Growl notification

Hint: Any command other than play, pause, next and prev will behave as show. Give it a try.

Download the Alfred Pulsar Extension

Tuesday, October 25, 2011 Monday, October 24, 2011

Anonymous asked: This Auditable Behavior sounds great! But the links are dead.. is the code still available? /post/867819035/an-auditable-behavior-for-cakephp

Sorry about the dead links. You can find the code on Github.

Thursday, October 28, 2010 Monday, October 25, 2010
Photoblog - Bridge to somewhere:

Remarkable feats of engineering like the Hoover Dam and now the bridge over the dam are endlessly fascinating to me. I was there just under a year ago and it’s hard to believe that the bridge is now complete.

Photoblog - Bridge to somewhere:

Remarkable feats of engineering like the Hoover Dam and now the bridge over the dam are endlessly fascinating to me. I was there just under a year ago and it’s hard to believe that the bridge is now complete.

Thursday, October 14, 2010 Thursday, September 16, 2010

Compass, SASS, CakePHP

I’ve learned to loathe CSS. As a developer with a lot of OOP experience, I love the intent, but I can’t endorse the implementation. Then, about a year ago, I found Compass and my grey skies became blue again or, at the very least, they became a whole lot less grey.

The point of this post isn’t to dive deep into either my hostility towards CSS, my newlywed love affair with Compass and SASS or even to spend a lot of time discussing the latter two. Rather, the point is to document how I configure a Ruby tool to play nice in a PHP code base, specifically a CakePHP code base. Since we’re making introductions, though, it’s worth touching on the highlights of the ecosystem. If CSS frustrates you on a regular basis, I’ll leave it to you to read on.

SASS (Syntactically Awesome Style Sheets)

Sass makes CSS fun again. Sass is an extension of CSS3, adding nested rules, variables, mixins, selector inheritance, and more. It’s translated to well-formatted, standard CSS using the command line tool or a web-framework plugin.

As the acronym hints, SASS is essentially just an (awesome) alternate syntax that takes advantage of a “compilation” process to translate the alternate syntax into standard CSS. Baked into that compilation process, though, is a lot of power. Variables and mixins (think functions) right a lot of CSS wrongs.

Compass

Compass is a stylesheet authoring framework that makes your stylesheets and markup easier to build and maintain.

I can’t improve on something as clear and concise as that so I won’t try. Compass includes an executable that provides some handy command line tools and offers a lot of plugins that port many of the popular CSS frameworks (e.g. Blueprint, 960gs, Susy, etc.) to SASS syntax.

As a quick example, rather than littering markup with non-semantic span-[number] classes in a site built on the Blueprint CSS framework, you can drop those classes and reference a mixin that creates the same effect. For a sidebar div that might get a class of span-4, drop the class and update your main definition instead:

#sidebar
  +column( 4 )

Cleaner markup, improved semantics. Win-win.

Ruby

Since Compass and SASS have deep roots in the Ruby community, they may be easily overlooked by other developers. They shouldn’t be. While it’s true that Compass is written in Ruby and old-school SASS looks a bit like Ruby (the old syntax is still supported—I even prefer it—but the most recent syntax is more CSS-like), it compiles down to plain, old, ordinary CSS without all of the headaches of writing (or maintaining) it as CSS.

Because it compiles down to CSS, it can be used in any project written in any language that I can think of. I’ve used it in small, standalone PHP projects as well as framework-based projects using Symfony and CakePHP.

Compass and Cake

Since I prefer CakePHP, I’ll use that as the model, but the instructions should be easily extrapolated for any other language, structure or framework.

Before getting into Compass itself, here’s how the relevant directories of my CakePHP project directory are laid out:

<project root>
+ app
   + webroot
      + css
      + img
      + js

So let’s get started with Compass. If Compass isn’t already installed, just install it via its gem: gem install compass. That’s it. We’re going to deviate slightly from the instructions on the Compass homepage, so for the project creation & configuration, I’m going to ask you not to RTFM until we’re through here.

First, in your Terminal:

$ cd <project_root>
$ mkdir sass
$ cd sass
$ touch config.rb

This creates the top level directory for this project’s Compass framework files and an empty config file that will soon tell Compass how to do what it does. Here’s what my config.rb file contains for a CakePHP project:

http_path = "/"  
sass_dir = 'src'                    
css_dir = '../app/webroot/css'
images_dir = '../app/webroot/img'
javascripts_dir = '../app/webroot/js'
http_stylesheets_path = 'css'
http_javascripts_path = 'js'
http_images_path = 'images'
environment = :development
output_style = :compressed

The config file tells Compass where everything belongs once the project is initialized. In short, I’m telling Compass to install the supporting SASS files in a child directory named src and also how to access CakePHP’s asset directories from the SASS root (e.g. <project_root>/sass).

The *_path variables tell Compass how to reference these assets via HTTP. An image, for example, would be referenced as /img/my_image.png.

The last two variables tell Compass something about the operating environment and how the compiled stylesheet should look. A “compressed” stylesheet contains the entire declaration for each selector on a single line. I’d never create CSS that way because I find it miserable to maintain, but since I won’t be maintaining any CSS, this is a nice space saver. Complete documentation of the config file is available on the Compass site.

All that’s left is to initialize the Compass project. You should already be in your sass/ directory, so:

$ compass install blueprint/semantic

Now you’re ready to go. You can compile your stylesheets manually whenever you’re ready to test in a browser, but it’s much less hassle to let Compass do all of that work for you. It will “watch” your project and compile each time you save a .sass (or .scss) file in that directory.

$ cd ..
$ compass watch sass

Start editing—and saving—your SASS files and you’ll see the terminal come alive with activity. Your plain old CSS files are being compiled and stored right where CakePHP expects them to be. Your days of writing and maintaining CSS are over.