If the harasser reacts angrily, we can learn to defuse the situation by separating the harasser’s action from their intention, which may not have been to hurt someone. “What you’re doing is acknowledging the emotion—like, ‘Hey, I hear that you’re really frustrated, that this is confusing,’” May says. “Then say, ‘Things like that can make our co-workers feel uncomfortable, and I know that’s not what you’re trying to do.’”
I like this part very much. As a matter of fact I think there’s no need to reserve this strategy for when the offender is getting angry. It should work especially well for the "ordinary" low key sexist or racist comments. Assuming the offender has the best intentions and is misguided paves the way for an amicable resolution.