thoughts from brian samson

The Per Diem Budget

I read an interesting idea about budgeting spending money last week, and I was waiting for a new pay period to give it a try. So I started April 25th by going to the bank and withdrawing 14 tens and 14 fives ($210 total). I happened to have $39 in my wallet so we’ll see how cheap I have to be when we go out tonight :)



Updated Monday 4/27
Starting on a Saturday was tough. I put golf on the credit card and proceeded to spend all $54 at the course, dinner, and the bars after, although that’s probably less than I would have spent if not on this budget. And since I didn’t spend anything on Sunday, I helped myself to coffee and a danish from starbucks today, and I’m left with $26 in the wallet on Monday night. Not too bad.



Updated Friday 5/1
This week went pretty well. I had a few lunches out and a happy hour on Thursday, but I’m sitting here at 5:22pm on friday with $21 in my pocket. And I even loaned a buddy $20 that he’s paying back tonight, so I’ll be off to San Diego tomorrow morning with a little over $50!

Capistrano: Calling tasks from other tasks

I wrote a new capistrano task for deploying a rails app the other day that would totally reset the old deployed database and give me a fresh new one with fixtures pre-loaded. This is useful for deploying different branches to the same location on a server. However the lack of proper capistrano documentation let to some wasted time figuring out how to invoke previously defined tasks from a new task. Most of them are just simple methods you can call, but to call the task deploy:migrations is a little more complex because it’s really a task called migrations in the deploy namespace.

So for my new “super deploy” task, deploy.rb looks something like this:

task :drop_db
  run "cd #{deploy_to}; rake db:drop"
end

task :create_db
  run "cd #{deploy_to}; rake db:drop"
end

task :super_deploy
  drop_db
  namespace :deploy
      migrations
  end
  create_db
end

Pretty simple but I got hung up it for a few minutes. So there you go.