I often just ignore people who are often mean. It's not worth associating with them. Sometimes I think ignoring them causes them to lighten up a bit on being mean, but not always.
Sometimes all you can do is put up with them though, and that's easier said than done. But if I can, I try not to be friends with those people, because I don't want to be around negative people too long.