If you find yourself in a funk after spending time with a complainer you can attribute it to "emotional contagion." Yes, there is such an affliction, as mysterious as it sounds. Studies show that this is a phenomenon in which you actually catch emotions from other people, whether positive or negative.
So what's your story? Have you been contaminated? Have you been breathing in bad vibes, causing you to spew out contagious complaints of your own?
The work place can be contentious, full of people on edge, a simmering boil. Because of its inherent intensity, it's a great place to challenge yourself with gratitude.
Keep an eye on what's right about your work place. Perhaps you have smart colleagues who challenge you to be your best. Or perhaps you have a boss who inspires you to be more self-disciplined than you'd be otherwise.
Whatever the case, keep your focus on gratitude and breathe out good vibes. Take it upon yourself to change the work environment. If you get discouraged, bear in mind you have a fighting chance. Don't ever forget that your positive emotions are just as contagious as negative ones.