Not a pleasant story, but true...
I used to work at a place where one of the guys wrote a horribly complicated piece of code that about half of the system depended on. He was also quite an unpleasant man who routinely mocked everyone else in the company for not being as clever as he was.
The company ran out of money and needed to halve its workforce - one of my friends overheard him boasting that there was no way that they could get rid of him, as no-one understood what he had written.
I was asked about his code - I said no-one but him could maintain it, but give me three months and I could rewrite it.
I don't like to revel in other's misfortunes but the look on his face as he left the office on the day of the redundancies was a picture.
In the end I kept half of his code (ring-fenced so it was effectively a black box that no-one touched) and rewrote the rest in about a month.
Personally, I work hard, make it visible (as Luyt says), own up to my failures and every now and then go beyond the call of duty. And I try very hard to be nice to people, even when they're acting like idiots.