You are a professional and should act accordingly, both inside and outside the courthouse. Often, opposing attorneys engage in quite questionable and thoroughly unprofessional behavior. Rise above it and do not lower yourself to their level. Show them how a true professional behaves.
But, this does not mean you should be a pushover. You can respond to them in such a manner that makes it clear you think they are an idiot, without coming right out and telling them that. If it gets to the point where you can no longer converse directly with them, make all your written correspondence clear and to the point, without getting sidetracked into irrelevant issues.
This is especially important when you are appearing in court. Sarcasm and snarkiness have no place in your pleadings or your oral arguments. Make sure you address the judge directly, and not the opposing attorney. If the opposing attorney makes an untruthful accusation, clearly and calmly convey the facts to the court, be professional, and do not get caught up in a tempest manufactured by the opposing attorney.
At all times maintain a calm and professional demeanor. The contrast of your professional behavior and calm demeanor to the opposing attorney’s raving will be duly noted by the court. Whose side do you think the judge is inclined to favor, the person who is engaging in irrelevant ad hominem attacks, or the one who is calmly and pointedly addressing the issues which are presently before the court?
The court will be more inclined to rule in your favor simply because you’ve shown yourself to be professional and intelligent. And judges talk to each other. Your reputation of courteous and soundly reasoned argument will spread throughout the courthouse. As a result, your professional reputation will be established, and most likely in the future you will be treated with courtesy and respect by the court.