Like its hilly streets full of rattling trams, this week was full of ups and downs for your average San Franciscan.
There was joy for the Giants baseball team which, after more than 50 years' trying, brought a World Series trophy home to California's left coast; and despair for a political movement beloved of four in five residents, when Barack Obama's Democrats suffered huge losses in Tuesday's elections.
In sporting victory, locals danced to the beat of their own drum. The rest of the nation toasts baseball triumph with hot dogs and watery beer, but Giants fans add one of the region's finest agricultural exports into their celebratory mix. "I could smell weed in the outfield. It was crazy!" said Josh Hamilton, star slugger for their opponents, the Texas Rangers, said of the ambience at their stadium.
In political defeat, "Frisco" also did things its own way. The US midterms were a sobering rejection of what Republicans like to call the "Nancy Pelosi San Francisco Democrats". But the city's legislative machine responded to the nation's lurch rightwards with a classic piece of Pelosi-style left-wingery: banning McDonald's Happy Meals from its restaurants.
The innovative law, passed by civic leaders on Tuesday, prevents fast-food corporations giving away free toys to children in local restaurants, unless their meals contain fruit, vegetables, healthy drinks, and less than 600 calories. It's aimed at reducing childhood obesity in the fattest nation on Earth, but naturally Middle America spluttered into its quarter-pounders and the law sparked debate about the excesses of the nanny state.
That controversy, along with uncertainty over whether Ms Pelosi, the multimillionaire Queen Bee of Bay Area politics, will remain Democratic leader in the House of Representatives, has only enhanced the city's proudly-held reputation as America's foremost bastion of woolly liberalism; a place idealistic young people love, but conservatives love to hate.
"Don't get me wrong, San Francisco one of the most beautiful cities in the country," says Christopher Ruddy, who runs the right-leaning news outlet Newsmax. "But people there seem to have lost their political minds. They represent everything about Democratic politics that is liberal, elitist, and out of touch, that has a wealthy political class trying to control ordinary people's lives. California is careering towards bankruptcy, and here they are saying not to eat French fries!"
The Happy Meal ban represents a new Great Leap Forward for a city cynical observers call the People's Republic of San Francisco. Over the years, its social liberalism has nurtured the beat poets, given birth to the Summer of Love, and – according to right-wing stereotype – filled its picturesque residential districts with 800,000 trendy lefties who waste their disposable incomes on Merlot, recreational drugs, and new models of the ubiquitous Toyota "Pious."
Generations of civic leaders have meanwhile pursued progressive, European-style political social policies. Locals get universal healthcare, and heavily-subsidised public transport. Plastic shopping bags are banned. Same sex couples were allowed to join one of the nation's first domestic partnership registers in the 1980s.
"San Francisco is a superb place to live. It has excellent restaurants and a laissez-faire environment with regards to lifestyle," says David Wolff, part-owner of the Giants. "That made it a great place to do business. Sneer at the creative class if you want, but they are attracted to the city and crucial to America's economic future."
As the film The Social Network, which chronicles the rise of Facebook, demonstrates, the can-do attitude of the city and its most privileged residents has become the magnet that helps firms like Google and Apple, the powerhouses of the century, maintain their excellence.
Liberalism hasn't created a fuzzy utopia. For all the green affluence, San Francisco's permissiveness has come at a cost. Walk through the city centre at night, and you'll see rampant drug abuse, prostitution, and petty crime. In the shadow of the magnificent Golden Gate Bridge people are sleeping on the streets. "There's this standing army of homeless," adds Mr Ruddy. "It's the old problem of liberalism: it doesn't solve a problem, it grows the problem. And all their wacky laws just make things worse.
"It seems that you can smoke much pot as you like, and walk the streets carrying a crack pipe, and no-one will care. But you're not allowed to feed your kids a McDonald's, or if you don't recycle your garbage they throw the book at you."
The liberal tradition is as old as San Francisco, and has its roots in the city's rise during the gold rush which began in 1849, bringing a free-spirited, open-minded wave of journeymen out West to seek their fortunes.
Geography made it a melting pot, adding energetic Chinese and Japanese immigrants to the Irish and Italian communities who helped found the city, and then rebuilt it after the devastating 1906 earthquake.
Though its unconventional ambiance always made the city a magnet for young people seeking to "discover" themselves, the city's left-wing demographic was for years counterbalanced by a thriving business community, which tilted Republican. That changed, however, during the 1960s, with the rise of Silicon Valley, which drew the corporate elite out into the surrounding region.
The Summer of Love, which began in 1967 in the Haight-Ashbury (or "Hashbury") neighbourhood, drew tens of thousands would-be hippies to what was geographically a relatively tiny city. Political correctness was virtually invented on the campuses of Berkeley and Stanford, universities which now supply tech firms with the left-leaning San Franciscan entrepreneurs of the future.
By 1977, the electorate was sufficiently permissive to elect Harvey Milk, a well-known activist in the Castro district, to the board of city supervisors, making him America's first openly-gay man to achieve political office. His remarkable rise and tragic assassination was recently chronicled by Sean Penn, in the Oscar-winning movie Milk.
Critics argue, however, that the last two decades have seen San Francisco's default setting shift. The spiralling cost of living (when you factor in housing, it is one of the least-affordable places in the US) has pushed out families and almost all blue-collar workers. Endless gentrification has filled it with million-dollar homes, leaving a population dominated by trustafarians, students, and idealistic twentysomethings.
"San Francisco has always been liberal, in fact Neil Morgan famously called it the Narcissus of the West, meaning that however unique the city was, it was also in love with itself," says the urban historian Joel Kotkin, author of The City: A Global History, and a former resident. "But not that long ago, in the 70s and 80s, it was liberal without being wacky.
"That's now changed. The progressivism has become very judgemental. The permissiveness has morphed into a weird version of puritanism, which you see with the Happy Meal ban. There are more lunatics in that city than I've seen anywhere. The permissiveness is like Amsterdam, but the people don't have the self-restraint of the Dutch."
The irony, of course, is that on the Streets of San Francisco, where they love to call California a "State of mind", that's exactly the sort of criticism they take as a compliment.Reuse content