How do you handle holding your temper?

Today I feel kinda bad at myself. I usually try to keep an up beat attitude, but I just got depressed and angry at my current situation. I was having a conversation with a lady I know at the gym. I was talking with her about some of my personal issues, and then she started to preach to me about having faith in god. She kept going on and on to the point I got irritated. I told her god never done anything for me and I don't believe he exists. Then she felt the need to say if I don't have faith in god, then he won't have faith in me and won't help fix my problems.

So I got abit upset and yelled at her, but then I calmed down and apologized afterwards. She was just trying to make me feel better and I took it the wrong way. Now I feel bad and I usually just workout to clear my head, but today I didn't feel like it. I almost felt the urge to smoke again, but I haven't smoked sense I was 18. I didn't want to kick back the old habit and fuck up my body. So I ended up just laying in the bathtub for hour, and even now I still feel like shit.