eBay has been pretty liberal in letting me open source the things I've asked to. The only requirements that I know of are that it:
1) Isn't sufficiently complex to be considered proprietary,
2) Doesn't presume on eBay-internal infrastructure, and
3) Has a name that doesn't infringe any public trademarks.
Whenever I start working on a new feature, I design a generic library and then test it by writing a proprietary implementation. There are many benefits to working this way. Most importantly, I can share an exact replica of my environment modulo any project-specific code, which makes reporting dependency bugs or soliciting architectural feedback trivial when it would usually be nearly impossible. It also means I'll always have access to the tools I create here, regardless of what happens to my projects, my team, or my relationship with eBay.
Even if no one else ever found the stuff I've released useful, it's been beneficial for me to be able to share it.
The law is actually designed to product employees (so your ad network employer can't sue you if you work on fitness apps in your spare time), but modern large companies have their fingers in every pie.
(If they won't, that's a sign not to work there.)
An example from my organization: Two big projects, one OSed and one private. The private one has configuration values hard-coded (passwords, ldap url's etc.), a setup that is impossible to run ("it works on my machine") and the deployment is a secret that no one really knows (not prepared for someone being hit by a bus).
The OSed project, while not perfect, has separated these concerns and always had re-usability an easy-setup in mind. We can't just push some code that works, the thought of it being public makes us put more pride in what we write, so the QA is good. Of course, there is some overhead in all this, but it wins in the long-term.