I learned this trick from a book. I'm sorry to say I don't remember the title of it but it systematically analyzed a collection of 15 - 20 culinary myths and scientifically proved or disproved each one. Here's the trick. It works!
Purchase avocados when they are still thoroughly green, before their skins have begun to darken. Don't squeeze them as they will be hard at this time anyway and you run the risk of bruising them. Ideally, find ones that still have the little brown stem plug. It's my understanding that this helps them ripen (though I don't know this for a fact).
Take them home and keep them out of the refrigerator in an open bowl out of direct sunlight. I've heard that, to ripen them more quickly, you can put them in a paper sack where the gasses needed for ripening will be more concentrated (though again, I don't know this for a fact).
Check in on your avos at least once a day. When they are the perfect ripeness (skin dark, slightly yielding to a gentle squeeze) put them in a sealed container in the fridge. This part is important. They must be in an airtight container or they will loose moisture in the cold, dry air. We use a Tupperware-type plastic container with a snap-on lid, big enough to accommodate 6-8 avos. Then we simply take out avos as needed. They will hold that perfect ripeness for 8-12 days...just long enough to always have one of the perfect ripeness on hand till we restock our stash on our next shopping trip.