Is it permissible for one to masturbate in order not to commit fornication?
This is called committing the milder of the two evils such as eating a carcass in fear of death, and this happens when committing fornication is very likely to occur.
What is the ruling on working for a company that manufactures cigarettes?
All Perfect Praise is due to Allah, The Lord of The Worlds
Working for a company that manufactures cigarettes is forbidden because smoking itself is forbidden, so its production, selling and circulation are forbidden as a result since they aid in committing sin, and whoever aids in that is like the sinner himself. And Allah Knows Best.
Is the marriage contract considered valid if concluded at home by the marriage official (Ma`zon)?
Yes, it is valid as long as it is registered at the court.
Does passing wind from the anus affect ritual purity?
Ablution is nullified by the passing of wind from the anus, but washing the anus is not required as wind leaves no impurity.