Microsoft, surprisingly, seems to have a rather friendly written moon-lighting policy, excluding situations where you sit on the board of directors of a for-profit company. The main stipulation is to avoid competing with Microsoft, having a conflict of interest, or using any confidential/proprietary/secret information (including what the employee in question and their colleagues are working on).
Google's policy is very open source friendly but they want to own it (e.g. you add Google copyright notices) rather than spend lawyer time determining whether or not it is safe for Google to disclaim ownership.
If you think you're building something you want funding for then you should quit first, but that's not really what I was talking about.