If you work in tech and a short commute is important to you, you can make it happen anywhere in the Bay.
I had a 2 mile commute when I was working at Google - it was 5 minutes by car, and about 12 minutes by bike. I've got a 30 foot commute now - I work from home. I've put about 30k miles on my 10 year old car.
Many of my friends are the same - live in Mountain View, work at the Googleplex, ~10 minute commute. Well, at least back when I was still commuting. I've heard traffic over the 101 bridges has gotten stupendously bad such that it can take 30 minutes to drive 100 yards, but that's easily averted by walking or biking. (Apparently it now takes less time to walk from most of North Mountain View to the Googleplex than to drive, during rush hour.)
You do pay for the privilege, and you sacrifice in other ways (eg. there's not much in the way of night life in the South Bay). But most of the folks with the 1-2 hour commutes in the Bay are a.) not in tech, and therefore screwed in many ways b.) consider living in the city to be non-negotiable, and therefore willing to put up with all sorts of literal shit to maintain that lifestyle or c.) consider living in the mountains to be non-negotiable, and so are willing to put up with a long but beautiful commute to maintain that lifestyle.