A lot of people think they have no negotiating ability. You do. When you're thinking of signing on with some company, and they send you a boiler-plate contract to sign, don't just sign it and send it back. Read it carefully. Alter it as you see fit, striking out sections, adding sections, and initialing each change. Then sign it, make a copy for yourself, and send it back.
Where it says:
company owns the rights to all work produced during the term of employment
Just strike it out, and change it to:
company owns the rights to code written during working hours and in direct furtherance of any tasks assigned by the company
See how much nicer that reads? Now, when you do this, there are two possibilities: either the company will ignore it and hire you, or they will object to your alteration of the contract. In the second case, if they stand firm on the boiler-plate contract, I suggest you simply ask for more money - for instance, if you were expecting an 8 hour/day job and their contract asserts that they own what you do 24 hours/day, then you'll need at least three times as much salary to compensate.
And if you and the company cannot reach an agreement, well, maybe you didn't want to work for them anyway. If they're already screwing you before you've even signed on, that's not a good omen.
There's already some good advice in the comments on the perlmonks story, so I'll leave it at that.