With a history rooted in the wild west, SF is notably permissive in some ways that some places aren't.
In 2006, the Board of Supervisors passed a resolution making marijuana offenses their lowest priority. Using marijuana is technically illegal, but you're unlikely to experience any hassle unless you're bringing negative attention to yourself in some other way. There are also a large collection of medicinal marijuana dispensaries - which are legal by California/state laws, but not US/national laws. Alcohol is regulated by SF and California, with bars closing at 2am (last call often around 1:30) - no alcohol can be bought anywhere (legally) between 2 and 6am. An additional license is required to sell liquor, so many places have beer and wine only.
*And* San Francisco has no laws against nudity, and the city prohibits the enforcement of state "offensive" laws unless a civilian (not a police officer) makes an arrest... which does not happen.
On warm days/weekends in the Castro, it has been common to see a naked guy or two (often one specific couple) and recently there has been a battle over whether opt-outers should be required by law to sit on a towel when in public - which has increased the nude population many fold! Otherwise, the northern end of Baker Beach is a de facto nude beach. And various levels of nudity are common at large events, especially Folsom Street Fair, Bay to Breakers and Burning Man.
On the not-permitted side, the most common thing most people deal with are parking tickets - which are enforced as if the city depended on them for funding :)