Matthew Hanagan worked for Yahoo back in 2006, out of a satellite office in San Francisco, doing search-engine marketing in the company’s entertainment group. After a round of layoffs, the floor he worked on was “half empty.