For code, this hasn't been so much of a problem since Github made private repos free. Dump a copy of every piece of code you write up there, and you'll be a lot less likely to lose it...