Jamie's Weblog

Procrastination and utter drivel since 2001!
  • Email
  • Github
  • Linkedin
  • Twitter
  • Rss
  • Home
  • About
  • Archives
  • Publications
Home» Tips & Tricks

Configuring Guard notifications with Vagrant

Posted on March 12, 2013 by Jamie Lawrence in Tips & Tricks

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 [...]

growl, guard, rails, rspec, ruby No Comments View Post

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.

Connecting Navicat to Postgresql on Vagrant

Posted on September 13, 2012 by Jamie Lawrence in Ruby on Rails, Tips & Tricks

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 [...]

navicat, postgresql, vagrant 2 Comments View Post

Speeding up Rails development

Posted on September 1, 2012 by Jamie Lawrence in Ruby on Rails, Tips & Tricks

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, [...]

asset pipeline, nginx, rails No Comments View Post

Creating association collections in FactoryGirl

Posted on September 1, 2012 by Jamie Lawrence in Ruby on Rails, Tips & Tricks

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. 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 Now, I [...]

factory_girl, rails, ruby, testing No Comments View Post

Stop typing bundle exec with rbenv

Posted on August 26, 2012 by Jamie Lawrence in Ruby on Rails, Tips & Tricks

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 [...]

bash, bundler, rails, rbenv, ruby, sublime No Comments View Post

:dependent => :destroy not firing

Posted on August 25, 2012 by Jamie Lawrence in Ruby on Rails, Tips & Tricks

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 [...]

activerecord, models, rails No Comments View Post

Contact Me

  • jamie@ideasasylum.com
  • ideasasylum
    • Twitter

Categories

  • BalanceTrackr (2)
  • C# (1)
  • dualpricing.ie (2)
  • hack (1)
  • Java (4)
  • Linux (3)
  • Measure it to change it (1)
  • Parenting (2)
  • Personal (36)
  • Photography (13)
  • Projects (7)
  • Python (3)
  • rant (17)
  • Reviews (20)
  • Ruby on Rails (16)
  • Taskmonifier (1)
  • Tech (1)
  • Tips & Tricks (7)
  • tuesdaypush (1)
  • Uncategorized (877)
  • Useful (3)
  • Weekly Picks (5)
  • Work (2)

Tags

accident barcampcork batteries bizcamp business car copyright depression diy dual pricing eneloop fowadublin fun gallstones git svn hack health ipad iphone lens life material motivation nginx Personal phd photographers photography photos pinterest podcasts quote rails rant renault scenic review rspec ruby sew shutterscouts startups swimming vagrant windows wrap

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

(c) 2012 Jamie's Weblog