The lesson to take from the big layoffs at Twitter and Facebook is this: "The job will never love you back." No matter how much effort you put in, no matter how clever you are, no matter how long you've committed yourself to $COMPANY, when push comes to shove, you're just a replaceable part in the machine.
Keep your weekends and your evenings. Leave your bugs at work. Your time is for you, and your boss won't send you flowers.