One of the things I get asked a lot is how I managed to stay sane when the world turned inside out and dead people kept trying to kill me and my son. Truth be known, I never gave the situation as a whole a lot of thought. I focused on what was in front of me and what I needed to do to survive. I found that when I took care of today, tomorrow became easier to handle. Days turned into weeks and weeks into months. Kill the zombie in front of you and worry about the next after that.
In addition, a sense of humor helps a lot. If you can find the ridiculous in the macabre, you'll do okay.
Third, surround yourself with like-minded people. If you hate whiners, don't hang around one.
Finally, no matter how unrealistic it might seem at the time, envision a better future and believe in it. Make it the goal you work for, because without it, you don't have a world. You're just waiting for the end.