Prefixed pluralize
I’d like the view to be smart and say something like “There are 3 plans available” or “There is 1 plan available” based on the number of plans.
Icky:
%p There #{( current_gym.membership_plans.count == 1 ) ? "is" : "are"} #{pluralize(current_gym.membership_plans.count, "membership plan")}.
Better:
%p There #{prefixed_pluralize(current_gym.membership_plans.count, "is", "are", "membership plan")}.
Here’s the little helper method:
def prefixed_pluralize(count, singular_prefix, plural_prefix, singular_suffix, plural_suffix = nil)
prefix = (count == 1) ? singular_prefix : plural_prefix
"#{prefix} #{pluralize(count, singular_suffix, plural_suffix)}"
end
And the test:
test "prefixed_pluralize" do
assert_equal "are 7 dogs", prefixed_pluralize(7, "is", "are", "dog")
assert_equal "is 1 dog", prefixed_pluralize(1, "is", "are", "dog")
assert_equal "are 0 animals", prefixed_pluralize(0, "is", "are", "animals")
assert_equal "are 5 users", prefixed_pluralize(5, "is", "are", "person", "users")
assert_equal "are now 2 penguins", prefixed_pluralize(2, "is now", "are now", "penguin")
end
Helpful?
Time Freedom
I met a dad in the pediatric intensive care unit whose child had been in the neonatal area of the hospital for 3 months. I asked him how things went with work and how he and his wife were able to spend so much time at the hospital. He replied that he’s a business owner and that his work wasn’t too affected by the long hospital stay.
Creating assets that provide value to people is important. Producing more than we consume is important. Figuring out how to live in a way such that your income is not solely based on the time you spend working is important.
Ready for real customers?
You’re creating a website that you’d like to release to the general public. One of the questions that needs answering is, which features do you need to make it to that first release?
I’ve been enjoying creating sites that I personally use like Spreedly and No Kahuna. When I’m an actual user of the site I’m making, it makes the decision about what to implement a bit easier.
The goal is to get to market and have the site being used by real customers as quickly as possible. For No Kahuna, that happened in 2 days. Spreedly took many weeks of effort before a real customer started using it. To release to a real customer, we’re only trying to make something that’s slightly better than what’s out there. We’re only trying to provide some value to the customer, not all of the value we’re ever going to provide. Does the site in its current state improve the lives of our customers?
When you’re your own customer, this becomes fun because you’re only working on the features that you’re quite sure would improve your life. If you’re at all unsure whether a feature provides value, defer it. Only do the stuff you’re confident about. This is fine because you’ll be released soon, and then customers will start giving you real feedback which is much more valuable than your guesses about what’s important.
Once you’re released, then you need to be judicious about which features to implement and be willing to say no to many requests from customers. In Getting Real, the 37 Signals guys said this:
And one more thing: it’s not just about the sheer number of requests (we don’t recommend adding something just because X# of people requested it), it’s about customers planting a seed in your mind. If they keep reminding you of something, it forces you to think about it. Maybe it is a good idea. Maybe it isn’t. But at least it’s important enough to consider if so many people keep asking for it.
Command history meme
Why not? Everyone else seems to be.
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
125 git
66 gs
64 rake
56 cd
45 cap
33 ls
18 g
16 ./script/server
9 mv
8 svn
g is an alias for `git`. gs is an alias for `git status`. I like Chu’s alias of ss for `script/server`. I think I’ll do that.
cap deploy:pending
Running `cap deploy:pending` displays the commits since your last deploy. I wanted it’s output to be a bit different primarily so I could send a message to the others on the team about what’s just been deployed.
Specifically, I wanted the output to look something like this:
Deployment revision 49c45b7
I deployed the latest. It includes:
* Added avatar support (Duff)
* Cleaned up the project switcher (Alex)
To do that, I added the following capistrano recipe:
namespace :deploy do
namespace :pending do
desc <<-DESC
Show the commits since the last deploy
DESC
task :default, :except => { :no_release => true } do
deployed_already = current_revision
to_be_deployed = `git rev-parse --short "HEAD"`
puts "\n\nDeployment revision #{to_be_deployed}"
puts "I deployed the latest. It includes:"
puts
system(%Q{git log --no-merges --pretty=format:"* %s %b (%cn)" #{deployed_already}.. | replace '<unknown>' ''})
puts "\n\n\n"
end
end
end
Then I added a hook in my deploy.rb to run this automatically whenever someone deploys:
before "deploy:update_code", "deploy:pending:default"
The next piece of automation I’d like is to have it automatically post a message to basecamp.
No Kahuna
My friend Alex and I spent 2 full days last week creating No Kahuna. It was an intense and quite enjoyable 48 hour burst of design and development. We can’t wait to see what the world thinks of it.
Of course, we used Spreedly to handle our subscriptions and payments. Without Spreedly or something like it, going live in that time frame with a subscription-based web site capable of collecting real money would be pretty difficult if not impossible.
I hope you can give it a try.
Nathaniel Talbott’s first Spreedly interview
Some exciting things have been happening in Spreedly land. More invites have been sent and Nathaniel’s been interviewed.
The Art of Innovation
I found this excellent talk by Guy Kawasaki to be quite motivational:
Spreedly
I’ve spent the last few months working on Spreedly with 3 friends. It’s been a wonderful experience working together to create a business.
Rails plugin - svn_messages (updated)
I created a rails plugin to help me keep clients up to date on the status of projects. This post is an update to the original svn_messages plugin.
The plugin now uses capistrano 2 (Multistage). I use it in 2 instances - whenever I deploy a site, and whenever I send a weekly status report. For a deployment, this is what I type at the command line:
cap staging svn:deployment_report
This gives me the following output:
Deployment to staging (Revision 34)
I deployed the latest. It includes:
* Started adding user registration system. (domelia)
* Now translating validation errors and their attribute names. (bjones)
* Reorganized views a bit. (domelia)
* Now sending activation email when user signs up. (fsmith)
* Added support for "remember me" when logging in. (domelia)
I could have also typed:
cap production svn:deployment_report
For a weekly status report, I type the following:
cap svn:messages r=70 u=domelia
70 is the oldest subversion revision I care about. domelia is me. I specify this because I only care about the svn commits that I personally made. This gives me the following output:
* Started adding user registration system.
* Reorganized views a bit.
* Added support for "remember me" when logging in.
I like the plugin because I can keep clients up to date and spend very little time doing it.
To install:
svn export https://terralien.devguard.com/svn/projects/plugins/svn_messages vendor/plugins/svn_messages
If you’d like this deployment report to happen every time you deploy, you can add the folllowing to your deploy.rb:
before "deploy:update_code", "svn:deployment_report"
