1. Record everything.
Take pictures with your phone or record his reaction. Whether you choose to post it online or not, you are protected from a possible violent response on his part. If the camera is on he likely won’t escalate the encounter.
2. Pretend you didn’t hear him correctly.
Ask the harasser to repeat it over and over again. Pretend you still don’t understand what he’s saying. Have it explained to you. He will end up realizing how stupid he sounds and feeling embarrassed. You win when he leaves or asks you to leave.