Stroll along Market Street in San Francisco's historic Tenderloin district and you find yourself wandering through a futuristic Internet enclave.
In the offices adjacent to the nearby Warfield Theater, where artists ranging from Louis Armstrong to the Grateful Dead performed, venture capital firms Benchmark and Artis Ventures have opened shop as have Spotify and a productivity start-up called Quip.
And then there's Twitter's 295,000-square-foot global headquarters in a 1937 art deco building.
Welcome to Mid-Market, home to a new technology gold rush.
For this is no upscale community, but an area that for decades was deprived of anything corporate or at all luxurious. Where there was once an abundance of art, a half-century of decline produced abandoned buildings, homelessness, drugs and prostitution.
Even many locals don't feel safe after dark.
"Tech companies are coming in, putting what I call their cathedrals on Market Street," said Del Seymour, who founded and runs the Tenderloin Walking Tour, a close-up view of the neighborhood's grit and glory. "The faces are really changing down here."
Read MoreTech community laughs at itself
All this just a few blocks from SoMa (South of Market), where high-priced software developers have spent the past seven years cramming into old warehouses, lifting real estate prices near record levels and inspiring chatter of a new tech bubble.
The facelift for the long-neglected Tenderloin began in 2011. With Twitter considering a move south to Silicon Valley, Ed Lee, San Francisco's tech-friendly mayor, established a plan to keep the microblogging site in town and at the same time revive a lengthy stretch of Market Street that featured boarded-up buildings and a storefront vacancy rate of 30 percent.
Any company with annual payroll expenses of at least $1 million that agreed to open on Market between Sixth and 11th streets (certain buildings were excluded) and some surrounding blocks would not have to pay tax on added payroll for six years. That's real savings for fast-growing tech companies, potentially amounting to $56 million just for Twitter.