I'm sure that money is an issue, as are most projects, but you might consider something like:
This example is for Arduino, I backed them on Kickstarter and bought 5, of which I have sadly only used 2. (if anyone is also looking for one, let me know, good deal and NIB; NOT AN AD)
The PI has an option i've seen in use here:
http://www.modmypi.com/raspberry-pi/bre ... s/ups-pico
You can easily program to monitor the I2C battery status and shutdown or run script on low battery. Have it run the code it needs to save, and then force shutdown. Either way it'll get down cleanly for the Card's sakes. When it comes back on, it'll charge while the PI boots and runs. Or if you choose, you can increase the battery size to 3000maH which ought to get you stable for almost 8 hours. Not sure how long your outages last.
Just my two cents, but i'm lazy, as most engineers are, but why would I work all day to figure out how to make resilient code or hardware, when I know I could just make the power situation better.
As an off shoot, some of those USB power banks do auto-switching, so you can run the power to it, power the PI from USB to it, and when power fails, it kicks over...the reverse on power-on. No examples, but some buddies use it for silly Pi projects.