San Francisco is a wealthy tech haven today - but not long ago it was an apocalyptic madhouse