Archive

Author Archive

Announcing Spinakr.com

August 30th, 2009

This afternoon, in my own mini version of the Rails Rumble, I gave myself 2 hours to design, develop, and deploy a site from scratch.

Spinakr is a simple app that merely tells you the current wind speed and direction in a given location. The idea came to me while sailing last summer and I’ve been sitting on it ever since. It may or may not be useful to anyone, but it was definitely a worthwhile exercise for a Sunday afternoon.

spinakr.com

Uncategorized

Extreme named_scope?

March 14th, 2009

By now, we all know that named_scope is one of the most useful Rails features ever. It’s the kind of thing that makes me wonder how I ever lived without it. I’m currently refactoring some old code and finding that using named_scope can make for some really long chains sometimes. They almost seem…too long.

For instance, I have an Update model which contains both news items (short blurbs) and articles (longer updates). Some articles are also for internal eyes only (via admin pages). When someone is viewing a news item, the 5 latest updates appear in the sidebar, but I can’t be listing the one they’re currently viewing!

In the tradition of small view / huge model, I’ve attempted to move all the logic into the model.

Model / update.rb

1
2
3
4
5
  named_scope :public, :conditions => "internal_only = 0", :order => 'updated_at desc'
  named_scope :news, :conditions => "update_type = 'news'"
  named_scope :articles, :conditions => "update_type = 'article'"
  named_scope :limit_to, lambda { |l| { :limit => l } }
  named_scope :except, lambda { |i| { :conditions => [ "id != ?", i ] } }

In a view or helper method (object = currently displayed item)

1
2
  news = Update.public.news.limit_to(5).except(object.id)
  articles = Update.public.articles.limit_to(5).except(object.id)

Now, this works great, but that’s getting to be a mighty long scoping chain. So, the burning question - can this chain ever get too long?

Rails, Ruby

New Mini Site Released

February 25th, 2009

Every year, COTN does a local Food Packaging event which generates 285,000 meals in 10 hours. This year, they’re doing two. I’ve spent the last few days putting the finishing touches on the design and UI stuff and just launched the new registration pages yesterday. If you’re in the Seattle area, you should check it out!

285K Meal Marathon Website

285K Meal Marathon Website

Portfolio

Freelancing from Home (Part One) - Creating A Life Schedule

February 8th, 2009

In this series I’m going to share a few tips of mine for being productive at home, plus my observations as a brand new freelancer and how I’m learning to be my own boss.

Some Background

Tomorrow will be the start of my second week of full-time freelancing from home. I’m a web developer and previously worked at home from 2005 to 2007, but this is my first foray into working for myself. I’m now 100% responsible for how much I earn in a given month. As I’m discovering, that’s what makes freelancing so appealing and exciting, but also a little scary.

If you’ve done it, you know that working from home presents its own sort of challenges. Gone are the office distractions, the politics, and the commute. In their place, however, comes a new sort of freedom that can be severely debilitating if you’re not careful. I’m definitely still learning what it means to be a successful freelancer, but I already know what it takes to successfully work from home.

Creating A Life Schedule

First and foremost, you need to start with the basics and create a daily life schedule that works well for you. When working from home, you’ll either be tempted to work too much or to work too little. A simple schedule can get you into a routine that allows for balance in all areas of your life.

I’m not a morning person, but I find that I can accomplish more when I don’t sleep in. For me, that means getting up at 8am, having a good breakfast, and starting my work day by 9. The battle for getting up in the morning is often fought the night before, so I have a consistent bedtime on weeknights - midnight. This allows for 8 hours of sleep and has me feeling refreshed and alert when I start the day.

I’ve gone so far as to create a daily checklist that includes some of my basic activities:

  • awake by 8am
  • in bed by 12am
  • eat breakfast
  • eat lunch
  • eat dinner

This may seem a bit extreme, but I find that it keeps me focused and allows me to look back on how I’ve done. If I see that I’ve missed lunch for the past 3 days, then I probably need to make some changes.

Perhaps the most important item on my daily schedule/checklist is to “get out of the house”. I need to remind myself that I’m living in the real world and not only in the one that exists in my apartment. Often, this is accomplished through evening outings with friends, but working at the local coffee shop for a few hours is also a great way to get out and interact with people.

When working from home (especially as a freelancer), you have insane amounts of flexibility. You can essentially do the work you want to do, whenever you want to do it. This can make procrastination very attractive. It’s easy to put work off in favor of TV, playing the guitar, going to the gym, etc., but as with most forms of procrastination, it only hurts you in the long run. I set these things aside for after hours.

I also reserve cleaning, laundry, and other chores for evenings or weekends. I break this rule every once in a while, but I find that things like this can too easily blur the line between work and home. When that line becomes too blurry, it becomes impossible to be healthy in either area.

To maintain a healthy balance, it’s important to schedule clear work times and clear play times. Even though I can work whatever hours I want, I try to work as if I’m in a regular office.

Monday through Friday, 9am - 5:30pm with 30 minutes for lunch.

I take advantage of the flexibility from time to time, but overall, I find that a good routine provides the necessary boundaries that lead to a productive and healthy life.

Resources:

See Think Simple Now’s How to Design Your Ideal Life for some exercises to help you figure out if things in your life are out of balance.

My Daily Checklist ( DOC | DOCX | PDF ), split into daily and weekly tasks. This obviously doesn’t include everything I do on a given day, but it’s a good set of milestones to keep me focused and productive. I print a new one each week and leave it on my desk as I work. Use this as a template or make your own.

I’m not really an MS guy, but I do like their Calibri font for making crisp looking documents - Calibri font for Mac

Coming Up NEXT:

PART TWO: Creating A Work-Friendly Space
Building an environment that exudes productivity

PART THREE: Creating A Work Schedule
Getting the most out of your time behind the desk

PART FOUR: Tracking Your Time
Using your time wisely and holding yourself accountable

PART FIVE: Landing Clients
Learning from those who’ve gone before you

General, Productivity

Efficient TextMate Project Panels

January 23rd, 2009

I ran into an issue with TextMate recently: the Find in Project function (command-shift-F) was taking over a minute to run and consuming huge amounts of memory in the process.

Before you scold me, know that I’m already using the time-honored tradition of excluding bloated directories like vendor/rails, log, doc, etc. using a bash alias.

This time, the culprit turned out to be my public/uploads folder which apparently included some documents that TextMate didn’t like to search.

Solution
Exclude the entire public directory from my alias and only include the javascripts and stylesheets directories. This has the added benefit of making my TextMate project panel easier to work with. After a little more thought, I decided I could do without the apps directory as well. The new look:

My TextMate Project Panel

My TextMate Project Panel

The alias:
alias rtm=’mate app/controllers app/helpers app/models app/views config lib db public/javascripts public/stylesheets spec stories vendor/plugins &’

And, when I want to have access to the excluded directories:
alias rtma=’mate . &’

TextMate colored labels provided by the ProjectPlus plugin.

Rails, TextMate

Stashing Git

January 21st, 2009

With any application, it’s tempting to learn only the commands you need for your daily tasks. The danger is that oftentimes, you miss one. You end up going the long way around a problem when there’s been a shortcut in existence all along.

I just learned a new git command (thank you, Michael Ivey) - git stash.

Some Background
On my primary Rails project, I’m the sole developer. Most times, I work from the master branch, but occasionally I’m working on a large feature that might take a week or more to complete. During those times, I want to maintain access to the master branch in case any bugs arise. So typically, I create a branch for the new feature and merge it in when the feature is complete.

Stashing
Stashing allows you to essentially put your most recent, uncommitted changes on hold while you make a small fix.

$ git stash => saves current changes for a later date
Make small fixes, commit, push, deploy, etc.
$ git stash apply => restore changes from saved state

Who knows if I’ll use this feature for anything more than the occasional quick fix, but it’s a good one to know about. Creating a branch for larger features still makes sense…mostly because I will do several commits to that branch before merging it back.

I don’t know how I would feel about doing EVERYTHING in the master branch, but this is a neat trick to have in my back pocket.

Git

Welcome

January 18th, 2009

Welcome to the original home (and the very first post) of the Atmospheric Labs blog.

At this point, Atmospheric Labs is a one-man web development shop that specializes in Ruby on Rails development. We (I) have also done projects in PHP, Python, Java, and some truly antiquated languages like Perl and Cold Fusion. There’s nothing wrong with those languages, but I’m a Ruby guy now and I’m looking to keep it that way - until, a cooler, more enjoyable language comes along. But for now, that’s a hard thing to imagine.

Over time, this site will grow and evolve, but I plan to keep my focus the same - developing easy-to-use web applications that don’t suck. Who’s to say what categories this blog will cover, but I’m on a UI kick right now so, we’ll probably start there. One thing is for sure, it’s going to be fairly technical. If you’re looking to follow my personal life, there’s always Facebook, email, or some good, old-fashioned face time.

Onwards!

General