I believe that according to USA law, but as well as in other countries, such as UK, what you in the company's premises belongs to the company. In cases the law is vague, many companies state this in their sign up contract (I have signed this with my current employer). You would not want to jeopardise the ownership of a project if it has to be sold etc, or of the charity you contribute, because you did something within working hours.
I believe I have read in a Spolsky article a case when the company owns even what you do outside working hours, but that's another story and I could not find a link.
I suggest you to read the Dropbox Y-Combinator application, where they explain how they own all their code, including what was written in another company's premisses.
Quoting:
Are any of the founders covered by noncompetes or intellectual
property agreements that overlap with your project? Will any be
working as employees or consultants for anyone else?
Drew: Some work was done at the Bit9 office; I consulted an attorney and have a signed letter indicating Bit9 has no stake/ownership of any kind in Dropbox.
What I do when having a personal project, is to do "internet research" such as choosing frameworks, reading articles at most code a snippet, but nothing that would distract me from my day to day activities or would jeopardise my output's ownership. If they want a hello world in node.js they can claim it :-). Every line of code written or anything else, is committed to a cloud hosted repository producing a third party trusted "out of office hours" - timestamp.