Jamie's Weblog

Lessons of a startup CTO — and other things

Here I am!

Jamie Lawrence

Jamie Lawrence

I help non-technical founders start their business, build their product, get their first customers, and grow their technical team. I'm a generalist software engineer and I've worked with many different languages over the past 15 years but my current tool of choice is Ruby on Rails. I'm also an enthusiastic photographer and a novice archer

Personal Links

View Full Profile →

Tips & Tricks

March 12, 2013 0

Configuring Guard notifications with Vagrant

One problem when running everything in a headless Vagrant instance is that you lose the ability to see Guard Rspec notifications. Actually, you don’t lose it but it’s not immediately obvious how to configure Guard. Since Guard is running inside Vagrant, it can’t display the Growl notifications on the guest operating system. However, you can […]

Read More
September 26, 2012 0

Sleeping Air

There are two types of ‘Sleep’ that your MacBook Air can have: close-the-lid-sleep which will drain the battery within 24hrs; or sleep-from-the-menu-sleep which only uses about 3-5% in 24hrs. Choose wisely.

Read More
September 13, 2012 3

Connecting Navicat to Postgresql on Vagrant

I’m falling in love with Postgres as a database but it comes fairly well locked down (good for production, not so good for development). I do all my development in a Vagrant box so a) the environment matches production and b) I don’t pollute my Mac with various conflicting versions of things. Mostly I’ve been […]

Read More
September 1, 2012 0

Speeding up Rails development

A brand new Rails app is a joy to work on but over the past few weeks I’ve noticed the app getting slower in development as, in hindsight, I added more and more stylesheets and javascripts. The culprit, I quickly realised, was the asset pipeline. On each page refresh it was reloading all the assets, […]

Read More
September 1, 2012 0

Creating association collections in FactoryGirl

I’m still discovering the joys of using FactoryGirl to create test data but I particularly like this pattern for creating a collection of associated objects. [code lang=ruby] FactoryGirl.define do factory :list do name “My List” end trait :with_items do ignore do item_count 3 end after(:create) do |plan, evaluator| FactoryGirl.create_list(:item, evaluator.item_count, list: list) end end end […]

Read More
August 26, 2012 1

Stop typing bundle exec with rbenv

It can get a bit tiresome typing bundle exec in front of every Rails command. RVM seems to have this problem solved but I’m using rbenv. alias b The quick and dirty way to add this to your .bash_profile/.bashrc file: alias b='bundle exec' Now you can just type b rake instead of bundle exec rake […]

Read More
August 25, 2012 0

:dependent => :destroy not firing

I had a model which wasn’t cleaning up the dependent models, even though the :dependent => :destroy attribute was set on the association: class PerformancePlan < ActiveRecord::Base has_many :goals, dependent: :destroy validates_associated :goals end class Goal < ActiveRecord::Base belongs_to :plan, class_name: 'PerformancePlan' end Luckily, I’d written a spec to test that the goals were being cleaned […]

Read More