Q: If somebody masturbates during the month of Ramadan but without any discharge, is his fasting invalidated?
A: if he do not intend masturbation and discharging semen and nothing is discharged, his fasting is correct even though he has done a ḥarām act. But, if he intends masturbation or he knows that he usually discharges semen by this process and semen really comes out, it is a ḥarām intentional breaking fasting.
Okay, do not masturbate before eating if you are a muslim.
And if you are a Republican, during voting -- though obviously before is okay.