P2 Hovercards

A couple weeks ago I worked on a project that we called P2 Hovercards. We released the code on Github last week for anyone else that might find them useful. The idea is that you can see additional information about certain links without clicking on them, therefore keeping you on the P2 and not diverting your attention unnecessarily.

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.


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' "$*";

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 🙂

Laravel Tutorials

I’ve wanted to start learning MVC for quite some time now and have decided to learn Laravel at the same time. I already have experience with MVC on a few projects, but I’m still at the point where any practice helps.

This is a forum post on the Laravel site that lists some awesome tutorials on using Laravel. I’ve never used a PHP framework, but Laravel is awesome. I’ve read through the first few posts listed there and am really liking it so far.

As a somewhat obscure side note, this is what I wanted to build when I realized I wouldn’t finish Dsgn365 last summer. For an intro project I’m building to teach myself how to use Laravel, I added the Laravel Github repo as a remote and did a fetch to get the latest copy. Then I pushed to my own repo. Now I can build on top of the latest build of Laravel and when he releases a new version, I can rebase and keep everything up-to-date.