In Linux (you never mentioned which OS you’re on, so this could be relevant) you can create block devices from RAM and mount them like any other block device (that is, a HDD).
You can then create scripts that copy to and from that drive on start-up / shutdown, as well as periodically.
For example, you could set it up so you had ~/code
and ~/code-real
. Your RAM block gets mounted at ~/code
on startup, and then everything from ~/code-real
(which is on your standard hard drive) gets copied over. On shutdown everything would be copied (rsync‘d would be faster) back from ~/code
to ~/code-real
. You would also probably want that script to run periodically, so you didn’t lose much work in the event of a power failure, etc.
I don’t do this anymore (I used it for Opera when the 9.5 beta was slow, no need anymore).