Where have I been?
Here. I’ve been really busy (and alternately, lazy)
Tired of Wordpress
I normally post to this blog when there is something cool to post about, and I’m inspired to write about it. Wordpress was just not inspiring any longer. It does a billion things, yet, none I really need. I wanted a simple blog engine. Posts, Comments, Attachments, Textile, spam filtering, etc. I decided to roll my own using Rails.
The Media Temple Meltdown
I have hosted this domain with Media Temple for nearly two years, and their service has always been a good value. I’ve never really had an issue, but shared hosting was really starting to feel way too cramped. I’m used to having a full server at my command.
Serendipitously, the cluster that hosted this domain crashed. The website was down, as well as my email. I understand these kinds of systems pretty well, and I fully understand downtime, and the resulting bald spots that occur afterwards. The thing with this crash was that after three days, my email store was still missing.
The last leg of their restoration process was restoring on average 22 domains per hour. Now that is dreadfully show when you consider that my cluster alone had over 14,000 domains.
Time Machine saves the day
It occurred to me suddenly: Time Machine. Yes! Time Machine would save me. I enter the app and navigate back to Sunday. All of my email is gloriously intact, and restored within moments back into Mail.app. If I ever run into Apple at the bar, he is definitely getting a drink or two on me.
The Awesomeness that is Google Apps
One of the main reasons I’ve always stuck with third-party hosting of my websites is that I hate email servers. I’ll pretty much avoid running my own at all costs. If you’ve ever run your own, you understand. Enter Google Apps. Google Apps is basically free email hosting for your domain via GMail. No bullshit, it just works. I highly recommend using it. Immediately. Go.
Since my email situation was figured out, I am now free to host my own websites on my own server. No monthly fees anywhere (even the cheapest EC2 instance will run $70/month).
This site uses Phusion’s Passenger; I’ve written about it in the past, and since it has become the golden child of the Rails community. It’s super easy, fast, and largely effortless. I use it with Apache, but it now support Nginx as well.
I’m also using Sphinx full-text search (via the wonderful ThinkingSphinx gem). It’s easy to configure for your Rails app, but I’m still having issues after deploying changes to my apps — something always seems to happen to where I need to login to the server and manually futz with rake commands to get everything going again.
Tricks
One of the issues I was faced with in building this application was changing the URL format for blog posts. My old blog used a ‘/YYYY/MM/DD/Permalink’ format, and I wanted to change to the /posts/ID-Permalink’ format. Aesthetics I guess, but this breaks every external link to this site.
The trick I used was to capture the request right before it failed and pushed the permalink part of the URL to the search feature. If the original blog post wasn’t found, the site would search for you, and present the results. Pretty slick if you ask me.
Another great trick was figuring out how to upload file data via an AJAX call. Normally, this isn’t allowed as Javascript can’t touch a filesystem, but the jQuery Form Plugin wields some awesome magic to get around that. When I go to post a blog entry, I can upload any number of attachments via a simple form field element and it is immediately sent to the server for processing. I use Thoughtbot’s Paperclip for that. After the file is saved, it inserts a Textile formatted string into the Post editor text area. Two clicks and I have an image URL that I can use in a post. Slick.
This blog engine uses the wonderful Markitup jQuery text editor for the actual crafting of blog entries. It gives me a live, textile formatted preview of my post as I’m writing it, sized to my main column’s width — no more layout crushing blog entries!
I finally got around to trying out SASS. SASS is a sister of the fantastic HAML project. Both aim to remove the drudgery of writing CSS and HTML code respectively.
I’m used HAML for well over a year now and love every minute of it. SASS, on the other hand, I never really got. CSS is simple, so why add another layer? After using it on this project, I will use it on all that follow it. SASS makes sense. It strips away the BS in CSS and actually allows you to write better structured documents, as it natively allows you to namespace your elements more readily.
Here’s an example:
# CSS
.about_me{
text-align:justify
}
.about_me .recommend_me{
padding:40px 0px
}
.about_me .polaroid img{
float:left;
margin-top:4px;
margin-right:7px;
border:1px solid #DDD;
padding:2px;
padding-bottom:15px
}
# SASS
.about_me
:text-align justify
.recommend_me
:padding 40px 0px
.polaroid
img
:float left
:margin-top 4px
:margin-right 7px
:border 1px solid #DDD
:padding 2px
:padding-bottom 15px
Phew!
Man, that was long. Well, it’s been a while, and a lot has changed in the last three days. I might open source this blog engine if there is interest. If you’re interested, please drop me a lineā¦






