Don't quit, get laid off (not fired, mind you, laid off). How to get laid off? This is completely up to your employer.
You can also get unemployment insurance benefits if you can provide solid evidence to the UI people that you were forced to quit due to ongoing illegal harassment from your employer. For harassment to be illegal, it must be based on things like your race, religion, disability, or gender, etc.