There are several types of difficult people at work; a difficult coworker can be the slow one, or the overly perfectionist, or the extremely demanding or the lazy one. Many of those I consider harmless or avoidable; in the sense that they don't really obstruct your progress and in most cases you can find a way around their difficulty.
I don't believe there's a recipe to deal with them, since your success rate depends on several factors: how open your organization is, how long you've been in the job and how much credibility those jerks have in the org, but here are some tips that I follow which I believe help contain their potential damage:
Don't be Reactive:
You tend to make more mistake when you respond immediately to their mean actions/remarks. It's statistical, so don't do it. If it's in a meeting and you have to say something, wait extra 5 seconds before you utter your words. It makes all the difference in the world.
Think About Positive Things:
The sole purpose of those assholes is to make you panic and activate your reptilian amygdala.
Being tolerate may help you reach a higher goal.
Give Them Something:
It's all about damage containment here. Jerks will continue to exist in any working place. So you need to deal with them and sometimes give them what they want. Occasionally, they ask for legitimate things. Always examine your response to them before saying the easy "No". Yes, even with jerks, you have to be objective.
If they ask for something that doesn't make sense and doesn't require a lot of effort from your end, give it to them! By doing that, you win more than what you lose.
Plan Your Way Out:
If this guy is your direct superior, things can become really shitty, and you'll reach to the point where you dread coming to work. Unfortunately, getting out of such situation may requires long-term planning. Devise an ambitious career plan to help you get out: build relationships with other people in the organization, explore other opportunities with great teams. Don't give up and always reach out to people.
Nothing shows off more than your hard work. At the end of the day, companies care about your actual tangible deliverable. The positive impact of your hard work dwarfs the noise caused by jerks around you trying to screw you over.