Spotify Widget

I wrote a little WordPress widget over the weekend that will add a Spotify play button to your website. The options you get are similar to the options you would see on the Spotify Developer site. It essentially just adds an iframe based on the parameters you set. Nothing too complicated here, but it’s nice to have as a widget that you can move around with the WordPress drag-n-drop interface.

ack shortcuts

I just watched Daniel Bachhuber’s “The Zen of WordPress Coding” talk from #wcphx in February.1 There’s some really good stuff so I definitely recommend it if you’re a WordPress developer. He used a tool that I had never heard of called ack. Ack is “designed for programmers with large heterogeneous trees of source code…” — it’s faster than grep.

Daniel talks about some useful options for ack that make it especially useful for WordPress in a command like ack --before-context=10 --ignore-dir=wp-admin 'function esc_'. Find all the function definitions that start with “esc_”, ignore the wp-admin directory, and print the 10 lines before the function definition because that’s where the documentation is — genius. As soon as I saw this I knew it’d be something I could use all the time, so I opened the dotfiles.

a()

First, a shortcut function called a that runs a similar command and automatically wraps double quotes around the entire arguments string.

function a() {
  if [[ $ARGC -eq 0 ]]
  then ack
  else ack --before-context=10 --pager='less -FRX' "$*";
  fi
}

It checks that there were actually arguments specified and then runs ack with --before-context=10 to show the 10 lines before every result, --pager='less -FRX' so the results are paged and the formatting is kept (it also automatically quits if the results aren’t longer than one page), and "$*" which takes all the arguments and wraps them in double quotes. Now I can do something like a function esc_.

af esc_

Then I realized that it would probably be useful to have a shortcut since looking up functions is probably the most useful part of this in the first place. So, I created af.

alias af='a function $*'

This one is even more straight forward. Essentially, it turns what would have been ack --before-context=10 --pager='less -FRX' 'function esc_', or a function esc_, into af esc_.


  1. The slides for Daniel’s talk are available on his website. 

Jetpack Comments

I’ve talked about it before: I like running my own web server. WordPress.com is awesome (seriously, go sign up for a blog), but I’m a nerd and I like configuring nginx and Apache and deploying with git. Lots of other people do too. It’s why Jetpack exists in the first place.

There have always been a few things about WordPress.com that I’ve been jelous of. That list got smaller this week with the release of Jetpack comments though. I’ve been searching for the right comment solution for a long time. WordPress comments are cool because you can style them with the rest of your site — I always saw the comment form as a barrier though. So I tried things like intensedebate and disqus — those things are cool because they make the process of submitting a comment and identifying yourself with a site you’re already logged in to very simple. The problem with disqus and intensedebate is that they’re not all that customizeable. But Jetpack comments fixes this.

Jetpack comments replaces the standard WordPress comment form with one similar to what you see on WordPress.com blogs. You can identify with WordPress.com, Twitter, or Facebook. Comments are submitted to your site just like they are with the normal comment form. I’ve already switched from disqus here.

One thing to note, your site must use the comment_form() function to generate the form. Some themes create the comment form manually which doesn’t give the plugin anything to hook into.

Now I just need to work on the comment styling here 🙂

Ultrabooks aren’t MacBook Air Clones?

Melanie Pinola:

Sleek silver Ultrabooks arriving from major PC manufacturers aren’t just Apple Macbook Air clones. Some of them even have options that Apple’s laptop doesn’t offer.

She goes on to point out the most minute details that make Ultrabooks different from a MacBook Air. Then, somehow we come to the assertion that Ultrabooks have to run Windows.

Even though some laptops do look exactly like the MacBook Air, often there are significant differences inside. Besides running Windows, using Intel processors, and meeting the thinness requirement, laptop makers are free to adapt Intel’s specifications for Ultrabooks as they see fit.

I was curious about that so I did a quick search on Wikipedia and found the requirements. It doesn’t appear as though Windows is required. As for adapting the specs how they see fit, I put together a comparison on the Verge. Other than the fact that we’re in the middle of a transition from Sandy Bridge to Ivy Bridge, none of them really stand out from a MacBook Air.

Hypersonic

Introducing Hypersonic, an open source iOS Subsonic client. We built Hypersonic for class, but have decided to leave it open source on github. It is also available in the app store at the following short link: bit.ly/hypersonicmp.

Below are slides and a video demo. We had to re-dub the audio on the video because it was loud in the lab that day.

http://www.youtube.com/watch?v=IOgn5wz1atU