i think there is no better way in quitting it, than just making yourself some target.
For example, today you are not going to lose more than 10$. Next day only 5$. etc,etc and you will get well.
It is very easy to stop yourself if you are not addicted to gambling but there are a way in stopping you in playing gambling and if a person is really addicted with gambling there is a way but it is expensive so I think you need to evade from getting addicted with gambling