Care to give us some insight into the situation?
For me, it really depends on the situation - I'm pretty straight forward and to the point when collaborating with co-workers on any project. For the most part, I take the lead and set to tone which tends to alleviate any kind of passive-aggressive or snarky comments. However, in the past, when confronted with someone with a rotten attitude, I've found a way to address their shitty attitude in a way that controls the situation without making them feel attacked (attacking them, in my experience, or approaching the situation negatively yourself, tends to only escalate their shitty behavior rather than alleviate, which is the optimal outcome.).
To do this I'll usually find a way to address it one on one or, in a very neutral tone, say something along the lines of, "That attitude/comment is not helping us accomplish (insert goal here)" .. and then I'll just power forward with whatever it is we're working on. Another variation is "I don't appreciate your comment/attitude at the moment - it's not contributing to our goal" or something like that. Again, stay neutral as if you're swatting an annoying fly. Because, honestly, that's all that type of behavior is is an annoyance and detrimental to a cohesive group project or environment.
Of course, sometimes, if it's not really a pervasive behavior, ignoring it might be the best approach. Not even acknowledging it and just keep moving forward with project, usually. Keep in mind, this person might have some other shit you don't know about going on (kind of like you do .. I know you have some difficult things in your life right now which could affect your mood at work of which you may not be aware). If it's not affecting the outcome of whatever it is you're working on, don't give it any attention.
So, again, it really depends on with whom I'm working, our relationship both professionally and personally, and whether or not that person is usually a dink, or this atypical behavior. But again, I generally take the lead and set the tone of most collaborations with co-workers and tend to have great working relationships with them - even those who have been known to be snarky dicks to others.