If someone tells you a racist, sexist or homophobic joke, don’t get mad at them. Just tell them you don’t get it. Keep telling them you don’t get it until they are forced to explain why women/minorities/homosexuals are stupid/etc.
Then just walk away.
This is actually the best possible reaction, because this way you don’t just get them mad, you get them to think