Recent Projects

KZAK: an open source web-based jukebox

I’m happy to announce that I’ve made my latest side-project open source. It’s called KZAK. It’s a simple web-based jukebox that you can use to share and listen to music with your friends.

The feature set is pretty limited right, but I hope to continue to improve things over time. I’m already encouraged by how quickly some of my friends have taken to the app, and I think you’ll enjoy it – even in this early form.

So far you can:

  • Invite people to use the site via email
  • Upload mp3, mp4, and m4a (iTunes) tracks with an upload queue and progress
  • Listen to the uploaded music as a playlist, even in an inactive browser tab

Like I said, it’s pretty basic (invite, upload, listen) but surprisingly functional. Plus, I’m using all kinds of interesting stuff behind the scenes, which is why I really wanted to share the code ;)

To begin with, we’ve got a Rails app that’s using the latest and greatest in user authentication technology: Devise. If you’re using something like restful_authentication or Authlogic, I implore you to take a look at Devise. It’s a phenomenal improvement from these other two popular options, and it’s being actively supported by José Valim, the latest Rails committer. Essentially, it’s a Rails Engine that sits on top of Warden – a generalized Rack authentication framework. This combination is extraordinarily flexible and easy to use. It’s opinionated (in a good way) while simultaneously doing a good job of staying out of the way. It introduces very little code into your application, and the source is well documented, well tested, and easy to follow. A++ highly recommended.

To handle the file uploads, I’ve switched from Paperclip to CarrierWave. While Paperclip has (and continues) to serve me well in many applications I work with, I really appreciate the modular approach that CarrierWave takes. It’s agnostic as to which of the popular S3 clients you use, supporting both aws/s3 and right_aws. It’s also ORM agnostic and not tightly coupled to Active Record. The tight coupling of Paperclip has caused us some grief at work, and I’m also confused about the state of Paperclip’s support for aws/s3 and right_aws. So, I was happy to find this new project, and the maintainer Jonas Nicklas seems to be an extremely responsive and helpful dude, which is always good thing. The code looks great, and I’ve had an easy time working with this library so far.

In concert with CarrierWave, I’m also using the venerable SWFUpload to support upload queues and progress meters. I’m absolutely baffled as to why this kind of thing isn’t easy/possible to support without Flash, but here we are. Of course, I have a fallback “regular upload form” that still uses some ajax to make things a little easier. There are a few blog posts and tutorial applications around on GitHub that helped me get SWFUpload working with Rails and jQuery, and I’m happy to put back out an example application that other people can refer to if they’re interested in supporting upload queues and/or upload progress meters.

Next, to support audio playback while I work on supporting html5 properly, I’m using the extremely awesome SoundManager 2. Unfortunately, this is another part of the infrastructure using Flash, but the features and functionality of SoundManager are really something special. I’ve only scratched the surface of what this library can do, but I’m already enjoying it quite a bit. If you’re working with jQuery and SoundManager, you may find the KZAK source code worth perusing. You might also take a look at Adrien Gibrat’s plugin, which is a cool jQuery plugin that packs a lot of functionality.

Also running in the background of KZAK is a Twitter-style following/unfollowing system that I haven’t exposed much of yet. It’s basically the same system that’s powering Flowcoder. You can check out this example app I made if you’re interested in seeing that on its own. Currently, all users in the system follow (and are followed by) all of the other users. I plan to allow for “unfollowing” users some time soon, which will allow for some healthy splintering of the community in the case that you’re not interested in everything that everyone is uploading.

Finally – and perhaps best of all – KZAK is fully compatible with and easy to install on Heroku. All you need is an S3 account and you’re ready to get started with a web-based jukebox for you and your friends for free.

http://github.com/trevorturk/kzak

Anyway, please feel free to dig around the source code if you’re interested in any of this. I think there’s a lot of good stuff in there, especially considering that the Ruby portion of the app is clocking in at under ~250 LOC right now. Thanks, open source community ;)

Cloudfront: no-brainer CDN support for S3

Amazon’s CloudFront is a phenomenal addition to their S3 file-hosting service.

Amazon CloudFront is a web service for content delivery. It integrates with other Amazon Web Services to give developers and businesses an easy way to distribute content to end users with low latency, high data transfer speeds, and no commitments.

Amazon CloudFront delivers your static and streaming content using a global network of edge locations. Requests for your objects are automatically routed to the nearest edge location, so content is delivered with the best possible performance. Amazon CloudFront works seamlessly with Amazon Simple Storage Service (Amazon S3) which durably stores the original, definitive versions of your files. Like other Amazon Web Services, there are no contracts or monthly commitments for using Amazon CloudFront – you pay only for as much or as little content as you actually deliver through the service.

If you’re using S3 and you’re not using CloudFront, you should take a moment to check it out. You’ll be surprised at how little work it takes to set up, how much it speeds up your assets serving, and how little it costs.

CloudFront is a part of the Amazon Console now, so it’s very easy to set up. All you need to do is to create a distribution, which means enabling CloudFront for a specific S3 bucket and choosing a CNAME that you’ll serve your assets from. Then, you need to set up the CNAME in your DNS configuration on GoDaddy and you’re done.

The following two screenshots illustrate the process.

Step one is to creating the distribution in Amazon’s Console:

Note the Domain Name and CNAMEs sections in the lower half of the screen. I’ve chosen the CNAME of “s3.kzak.org” because I want my S3 bucket to be aliased such that URLs will look like this:

http://s3.kzak.org/example.jpg

CloudFront has provided me with the domain name that I need to provide to GoDaddy. Since I’m using their “Total DNS” option, all I have to do is add the CNAME like so:

Notice that the CNAME of “s3″ is set to the domain name that CloudFront provided me.

These changes seem to take about 30 minutes to percolate through the internets, but that’s all it takes to get started with CloudFront.

For bonus points, you may want to read up about using multiple asset hosts in Rails and apply this technique in your applications for additional throughput.

Flowcoder: Share, refactor, and tweet code snippets

I just realized that I never posts about our entry into the Rails Rumble last year.

Flowcoder: An Evolution of the Code Snippet Site

Coded and designed by @gbuesing, @scottymac, and @trevorturk for @railsrumble in 2009.

Flowcoder has what you would expect from a code snippet side: multiple language support, raw code view, and support for embedding on other sites.

What was missing for us and what we really wanted was a site that featured not just the code, but the people creating the code. Just as we glean interesting tidbits about people’s lives from Twitter, we wanted to learn from our favorite coders by being able to follow the kind of code snippets they create. We wanted to share our own code snippets and have others refactoring them: to fix, optimize, and make them better, and learn in the process. And we wanted to be kept informed: when your code is refactored on Flowcoder, you’ll see an @reply from @flowcoderbot with some information and a link. This closes the loop in a casual, low bandwidth fashion and highlights the advantage of using Twitter as both an identity and notification system.

Weekly Digest, 2-1-10

If you enjoy these links, you should follow me on GitHub here.

iPhone / iPad icon PSD template

I’ve decided to work with my good friend, Sean Patrick O‘Brien to create a PSD based off the exact overlays, outlines, and masks the iPhone and iPad OS use to mask icons.

visionmedia’s express

Sinatra-like JavaScript node.js web development framework — insanely fast, insanely sexy

Commit 8ae25 to rails

Introduce class_attribute to declare inheritable class attributes. Writing an attribute on a subclass behaves just like overriding the superclass reader method. Unifies and replaces most usage of cattr_accessor, class_inheritable_attribute, superclass_delegating_attribute, and extlib_inheritable_attribute.

jed’s fab

(fab) is a lightweight (~2KB minified and gzipped) toolkit that makes it easy to build asynchronous web apps. It takes advantage of the flexibility of javascript to create a concise DSL without pre-compilation or magic scope hackery.

Static websites with Heroku

I recently moved off of Dreamhost in favor of Heroku. I have a few static sites I needed to move over and here’s how I did it…

Future Shock

If the iPad and its successor devices free these people to focus on what they do best, it will dramatically change people’s perceptions of computing from something to fear to something to engage enthusiastically with. I find it hard to believe that the loss of background processing isn’t a price worth paying to have a computer that isn’t frightening anymore.

Hacker News | Tinkerer’s Sunset

The iPad has really brought out a lot of old, crochety “well in my day” engineers that are now to the point where its embarassing. The iPad will draw more people towards software engineering, because for the first time we will have a general purpose computer that doesn’t suck horribly for normal people.

Joe Hewitt: iPad

iPad is an incredible opportunity for developers to re-imagine every single category of desktop and web software there is. Seriously, if you’re a developer and you’re not thinking about how your app could work better on the iPad and its descendants, you deserve to get left behind.

JSLint

The JavaScript Code Quality Tool

jeffkreeftmeijer’s navvy at master – GitHub

Simple Ruby background job processor inspired by delayed_job, but aiming for database agnosticism.

iPad: an Apple for Mom

Most people have a computer at home. For some (like my mom), it’s an ancient Dell laptop they bought years ago. Others have bought into the netbook trend and invested a small amount of money into a machine that, for most people, can only be irritating to use (slow, small, ugly, and burns your lap – not a recipe for success). A few have actually paid good money for what was supposed to be a modern machine, and actually turned out to be yet another annoying slow, painful-to-use, Windows-based machine infested with trial software, spyware, and sometimes viruses.

documentcloud’s underscore

Functional Programming Aid for Javascript. Works well with jQuery.

neerajdotname’s admin_data

Browse and Manage your data using browser

In praise of git’s index

The key to understanding it is how it interacts with git diff. Once you add something to the index (also referred to as staging it), it disappears off the diff. You can pass –cached to see what changes you have staged, but by default, it doesn’t show you the changes that you have asserted are ready for commit.

jnicklas’s capybara

webrat alternative which aims to support all browser simulators

thoughtbot’s pacecar

Generated scopes for ActiveRecord classes

quirkey’s sammy

Sammy is a tiny javascript framework built on top of jQuery, It’s RESTful Evented Javascript.

New ActionMailer API in Rails 3.0

Action Mailer has long been the black sheep of the Rails family. Somehow, through many arguments, you get it doing exactly what you want. But it takes work! Well, we just fixed that. Action Mailer now has a new API.

Stanford’s Entrepreneurship Corner: David Heinemeier Hansson, 37signals – Unlearn Your MBA

David Heineimeier Hansson, the creator of Ruby on Rails and partner at 37signals in Chicago, says that planning is guessing, and for a start-up, the focus must be on today and not on tomorrow. He argues that constraints–fiscal, temporal, or otherwise–drive innovation and effective problem-solving. The most important thing, Hansson believes, is to make a dent in the universe with your company.

Bumps ahead as Vimeo, YouTube respond to HTML5 video demand

Although there are still a number of important problems to solve before open video can displace Flash-based video playback on the Web, it seems likely that we will see more progress now that the major players are all on board and the users are enthusiastically calling for better standards support.

Discovering Rails 3 generators

This weekend during Rails Bugmash I stumbled across some nice posts about Rails 3 generators which motivated me to share them and add some comments!

Active Record Query Interface 3.0

I’ve been working on revamping the Active Record query interface for the last few weeks ( while taking some time off in India from consulting work, before joining 37signals ), building on top of Emilio’s GSOC project of integrating ARel and ActiveRecord. So here’s an overview of how things are going to work in Rails 3.

Show and Sell: The Secret to Apple’s Magic

Flash an exotic prototype, then—Presto!—get people to buy your more boring stuff. That kind of thinking still rules at most electronics companies. Apple under Steve Jobs only shows off actual products. The difference? Apple’s arcane secret to success.

omgbloglol Rails 3 Introduction

This post is kicking off a series that I’m doing about moving your skills and migrating your code to Rails 3. I’ll be sharing some practical insights and covering some pretty in-depth topics as we go along (I’ve got some notes for entries about upgrading plugins, taking advantage of new features like the agnosticism, migrating applications, and so on), but before I go into a lot of specifics, I thought it might be useful to go over some of the high-level philosophical and architectural changes that have gone on in the Rails code between versions 2 and 3.

How A Spare Computer Became Twitpic

In 2008, Noah Everett wanted to share photos on Twitter. Since there was no way to do it, he grabbed an old server and created Twitpic as a side project… A $1.5+ Million A Year Twitter Success Story…

API_Cheatsheet – Couchdb Wiki

Server, database, and document level.

chartbeat

The web doesn’t work with a 24-hour lag and neither should your analytics. Chartbeat gives you real-time analytics so that you know what’s happening when it’s happening. Control the story, track a product launch, exploit an opportunity from the moment they happen.

The Concept *is* the Execution

You cannot design a great service without an obsessional focus on the details.

Graffiti Analysis

Graffiti Analysis is an extensive ongoing study in the motion of graffiti. Custom software designed for graffiti writers creates visualizations of the often unseen motion involved in the creation of a tag.

How I solved email overload using gmail

It’s simple. Every single email that arrives in my in-box is immediately put in a filter.