Lister and Rimmer from Red Dwarf. They both loathe each other, yet sleep in the same quarters despite having the run of the entire ship, and have saved each others lives on countless occasions whilst always claiming to wish the other dead if only saving them wasn't in their own interests. Hell, in one episode shortly after Rimmer leaves, Lister dreams about Rimmer returning, and they make out.
Depending on the Writer, the friendship between Tony and McGee on NCIS can fall into either category. This relationship has evolved over time, too. At first it was mostly Tony insulting McGee, although as McGee has grown more confident he now throws a few back at Tony.
Gibbs seems to have had a similar relationship with his mentor, Mike Franks. Right down to Franks referring to Gibbs as "Probie".
Law & Order: Special Victims Unit has Detectives John Munch and Odafin Tutuola. The two have vastly different ways of thinking when it comes to crime and politics, but are willing to take a bullet for the other.
Later seasons of Friends could be like the second variety, where many of the characters (especially the females) had flanderized from their various personality quirks and teasing into being just out-and-out vile to each other.
iCarly: Sam and Freddie, especially in later episodes.
Sort of Richie and Eddie from Bottom. For two guys who spend pretty much every minute of every day beating each other with forks, hammers, chairs, pianos, fridges, and pretty much anything else they can get their hands on, they certainly do stick by each other through a lot. Although this is more than likely that no one else would be willing or able to put up with one or the other.
Spock and McCoy from the originalStar Trek. McCoy constantly insults Spock, and Spock's occasional rare outburst of anger or humor is usually a comeback, but they do pull together and worry about one another when danger looms. It would be more even-handed, but Vulcans are too rational to get into open insult exchanges.
Spock does hold his own in said exchanges, though, and usually manages to give as good as he gets — either through Insult Backfire, or more directly (e.g. his ridiculing of Bones's medical competence and his illogical nature, which is surely the gravest insult a Vulcan can think of).
Kipp and Lydia on Less Than Perfect vary between mean/indifferent to each other and openly admitting that the other is the only person each likes to be around.
McKay and Sheppard from Stargate Atlantis: they trade barbs, which frustrates Rodney to no end, combine their skills together in nearly every episode to save the day, but in the end, they are best buds — they take turns saving each other, and despite massive blows to their friendship they continue to have an unbreakable bond.
They've also bonded since the second episode of the first season, showing that their friendship was meant to last.
It should be rather telling that Rodney's testing of a personal force field involved Sheppard throwing him off of a balcony, then explaining, with ridiculously large grins on their faces, that it wasn't the first test they tried;
Sheppard: I shot him!
McKay and Beckett also qualify for this trope, although it's a bit of a combination of the two types. On the one hand, Beckett knows that Rodney isn't kidding around when he insults medicine and everything else, but he brushes them off and sees past McKay's exterior to his heart of gold (also almost immediately) to the extent that they become best friends which at the end of Season Three culminates in a Crowning Moment of Heartwarming after Beckett's "death" which many fans also considered the series' hardest hitting Tear Jerker.
House's House and Wilson. Greg House, Dr. Jerk to the extreme, is the only person allowed to openly mock James Wilson's serial marriages and chronic neediness. They'd fall into the first category, except then you realize that Wilson's no doormat and snipes right back at House.
The end of the season two episode "Safe", a Crowning Moment of Awesome for Wilson, involves them getting fed up with living together and starting a prank war, which Wilson wins by sawing halfway through House's cane so it dumps him on his ass in the middle of the hospital. As Wilson shakes his head and walks away, House actually grins at the cleverness of the prank.
Season 5, episode 6:
House: Did you just invoke your dead girlfriend's name to get me off the trail?... You are my hero.
Really, House is such a bad influence on him.
And then there's the first episode of season 4, where Wilson attempts to blackmail House into hiring a new team by stealing (and vandalizing) House's guitar. Definitely a bad influence.
And then Wilson gets cancer and decides to try out selfishness for himself for a change...telling House that he can either accompany him on his road trip to Ohio willingly, or Wilson will drug and kidnap him. Oh, and remember that this is while House is a parolee and cannot legally leave the state of New Jersey. Naturally, House comes along. Though he did have to fake his own death to avoid a six-month jail sentence for an unrelated parole violation in order to do.
Arguably, Dr. Cox and J.D. from Scrubs are a variation. No matter how many times Cox tells J.D. he is not his mentor nor is he his friend, J.D. always assumes Cox is kidding around. Of course there is plenty of evidence that Cox is just fooling himself given all the scenes that show that he does care for J.D. (he just refuses to admit it).
A case can also be made for Dr. Cox and Dr. Kelso. For two people that can't stand each other, they sure have lunch together or hang out in the break room together a lot.
After Kelso retires, he and Cox go from this to just secret friends. Eventually everyone finds out, so now they're just good friends.
In "My Finale", Dr. Cox actually admits that J.D. is his friend, and an amazing doctor that cares about his patients just as much as he does... only for J.D. to hear it (he had an intern insult him behind his back on purpose) and promptly hug Dr. Cox. The intern has yet to be punished for helping J.D.
Sherlock and John certainly argue a lot. Sherlock likes to insult John's intelligence and blog, while John often gets angry at him for his lack of empathy towards others, and occasionally about the severed heads in the fridge.
On Martin, the title character and Gina's best friend Pam are constantly at each other's throats, but Gina doesn't mind because they have both separately confided in her that they think the other is OK, though they'd kill her if she actually said anything.
Rory Gilmore and Paris Geller from Gilmore Girls. Paris started out as Rory's academic rival but slowly grew to be her closest friend and confidant when Rory couldn't confide in her mother or Lane.
Stephen Colbert treats everyone this way and it's common practice at the ol' Daily Show. Notably, Stephen has mad Vitriolic love for his Papa Bear, Bill O'Reilly. (O'Reilly knows Colbert is shitting him, though.)
Actually, in an honest talk between them, Colbert did admit that, even though he disagrees with O'Reilly on alot of things, he has a great respect for him and pretty much owes his career to him. O'Reilly has also said he respects Colbert since he's rarely ever mean-spirited about any of his jabs at people.
The three presenters on Top Gearlove taking jabs at each other constantly.
James May: We’re good mates because it just wouldn’t work otherwise. But we also quite enjoy hating each other. If Jeremy [Clarkson] was drowning, I probably would go and pull him out. Eventually. But only after laughing for a bit and making him think I wasn’t going to.
Angel and Spike have very strong elements of this in both Buffy the Vampire Slayer and Angel, even more so in the latter's final season. Of course, they'll be happy as ever if someone other than themselves insults the other, but they really prefer to be the ones to do it, and even though most of the time they can't stand each other and make a big show of hating each other and fighting over the smallest things, there have been subtle moments that indicate they may care for each other more than they let on. Especially in After the Fall, as Angel has lost the rest of his close friends (until the Reset Button). One scene has Betta George, a telepathic demon, reveal that Angel and Spike both (simultaneously) thanked each other silently and that Spike thinks of Angel like an older brother (though he immediately denies this).
Willow and Anya from Buffy, with an entire episode in season 5 dealing with the matter.
Also, very famously, Xander and Spike. Also, Buffy and Faith were this before Faith's Face Heel Turn to the dark side.
Alex Reiger and Louie DePalma in Taxi have traits of this.
Subverted with Louie and Jim after he inherited his father's money. Obviously, all the vitriol comes from Louie.
Due South: Fraser and Vecchio, although all of the vitriol comes from Vecchio — often, he's venting his frustration at Fraser's unremitting politeness. It seems to be the way Vecchio compensates himself for the hassle of constantly going along with Fraser's do-gooding escapades.
On Babylon 5 the relationship between Londo and G'Kar veers back and forth between snarky best friends and serious mortal enemies. It's complicated by the fact that Londo has seen in a vision that G'Kar is the one who will kill him.
Of course we finally learn it's because Londo asks him specifically to kill him so as to save Sheridan, and because he is tired of The Masquerade. He didn't plan on retaliating, but the Keeper wakes up and in desperation takes control of Londo. They end up killing each other.
The two Minbari Ranger instructors, Sech Durhan and Sech Turval, in the episode "Learning Curve".
Unsurprisingly, Jeff on Community has this with many people, but Britta specifically. While they hurl insults at each other constantly, they do have a close friendship, and, at one point sexual relationship
The American version of Whose Line Is It Anyway? shows us a lot of this. Entire hoedowns have been composed out of insults and belittling each other's manhoods, yet they seem to get along just fine. (And, of course, Drew Carey did apologise when he felt he crossed the line out of this trope and into simple abuse).
The Mighty Boosh. This is pretty much the gag with Vince Noir and Howard Moon. They spend twenty minutes bragging to and insulting each other, being nasty, inconsiderate, and down right cruel. Howard acts like he hates Vince, and Vince acts like Howard is a loser. But when one sees the other is really in need, they start acting like real friends.
Doctor Who - The Doctor (particularly the Third, who spent the most time with UNIT) and The Brigadier. They traded sarcasm near-constantly and often had quite irate arguments with one another (see Doctor Who and the Silurians) but were obviously fond friends. Nine / Ten sort-of had this with Mickey and Jackie, though it took a while to cool off from outright hostility on both sides. Ten and Donna, meanwhile, spend their entire season acting Like an Old Married Couple, and the Doctor outright calls her his best friend. This dynamic has continued whenever Tennant and Tate work together since (and they've done that a lot).
The Doctor and Rory are beginning to shows signs of this. The Doctor has now realized it's "always with the Rory" and treats him like a Butt Monkey sometimes but they're good friends.
In a mini-episode it's shown that The Doctor trusts Rory to help with repairs to the TARDIS. Yes, he actually trusts Rory enough to let him tinker around with his motor... clearly one of the biggest compliments any man can give to another!
It seems like for every time that Adric and Tegan snap at each other, they have a caring moment to make up for it. Notably, whenever Tegan is missing or possibly in trouble, Adric will be the first to insist that they go save her.
The Sixth Doctor and Peri were supposed to have this dynamic, but the production team ended up taking it too far with the vitriol, ultimately making it seem at times like they were just two people who genuinely couldn't stand each other forced to travel around in time and space with each other. Still, the friendship shone through from time to time, and the serial "The Mysterious Planet" tends to be regarded better than a lot of the Sixth Doctor's TV serials in part because it actually shows the Doctor and Peri meeting the 'best friends' part of the trope and enjoying each other's company for a change.
A fair portion of B.A.'s dialogue on The A-Team is devoted to insulting Murdock and trying to get him to shut up. Sometimes B.A. actually tries to throttle Murdock. Murdock sometimes takes a break from being a pest in B.A.'s general direction to insult B.A. B.A. actually complains about being saved from a life-threatening injury because getting Murdock's blood might make him like Murdock; Murdock encourages these fears after giving the blood. However, it's clear that they care about each other quite a lot. B.A. really worries about Murdock when Murdock is in trouble, and Murdock really does try well-meaningly to help B.A. learn to deal with airplanes, among other instances of sincerely meant aid. There is even one episode where the B.A./Murdock dynamic seems to flip, so that Murdock is giving B.A. much more grief than he's getting.
B.A. also told off at least one person outside the A-Team who complained that Murdock should shut up, and it was nicely done.
Benji and Lewis Caine came across as this in Underbelly. They would rag on each other, tear into each other over who actually killed someone on a hit they were on, but when Benji died it hit Lewis hard.
Avon and Vila in Blake's 7. Although Avon will fling insults at most of the crew, his usual target is Vila - who not only counters the attack but will sometimes actually win. They actually seem to enjoy themselves, and sometimes (particularly in seasons 3 and 4) Avon insults Vila quite fondly. Avon also gets rather annoyed when Tarrant bullies Vila in Vila's A Day in the Limelight episode, but their relationship breaks down somewhat after Avon considers throwing Vila out of a spaceship to gain escape velocity.
The two protagonists of Peep Show, Mark and Jeremy, pretty much embody this. Mark is a frustrated, white-collar Jaded Washout while Jez is a jobless Dreadful MusicianTed Baxter. Their conflicting views on just about everything (Mark's attitude is worn-down world weariness, Jeremy's is pretentious pseudo-artsy ignorance of how the world works on any level, with a dose of sociopathy) fuel a lot of their interactions. Occasionally, one will reference their presumably much happier friendship in university as "The El Dude Brothers", but this is usually just for guilt-tripping. Still, even on a Sadist Show like Peep Show they pull through for each other sometimes.
Leverage: Hardison and Eliot. While Eliot is usually the more vitriolic - to the extent that "Dammit, Hardison!" is a common Catchphrase of the character - you should not mistake his constant ragging on Hardison as permission for you to do the same. During The Office Job the pair are having a running debate as to whether Hardison stole Eliot's sandwich and Eliot is pissed with Hardison for most of the episode until someone tries to throw Hardison off the roof.
Eliot: Nobody throws Hardison off a roof. Except maybe me.
Monk: Stottlemeyer has this kind of relationship with a couple of old high school buddies in one episode. It takes Monk quite a while to fully understand the concept.
On Have I Got News for You, Ian Hislop and Paul Merton often mock and insult each other but are actually good friends. The one time Merton took it too far, quite gratuitously calling Hislop "that little shit", he was mortified and immediately began apologising profusely. By way of contrast, Merton's dislike of the original host, Angus Deaton, was completely genuine, and the banter could turn from amusing sniping to uncomfortable quickly on occasion.
Ray:(leans over and kisses Alex on the cheek) And Alex? If you tell anybody, I'll put itching powder down your knickers for a month. You'll be praying for a dose of the clap just to take the heat away.
MythBusters: Jamie and Adam aren't friends, but come very close whenever a more dangerous stunt is on the schedule. Don't believe it? Watch this clip from "Underwater Car"... but don't watch Adam (playing the trapped driver), watch in-car safety diver Jamie. Video here.
Adam has gone on record saying he and Jamie don't like each other and "annoy the crap out of each other every day ... [but they] have a tremendous amount of respect for each other."
Reba and Barbra-Jean in Reba. Usually Reba's the one firing off insults.
Well, what would yours be if you had to deal with Camelot's resident Tall, Dark and Snarky Klutz every morning at the crack of dawn and then not have him go away until you went to sleep again? And sometimes be woken up in the middle of the night and find him under your bed doing Merlin knows what?
Vinnie and Junior of American Choppers. Even when they are in serious danger of not meeting a deadline on one of their bikes, they are snarking away at each other.
CJ and Toby on The West Wing, (as CJ was the only one who didn't tiptoe around Toby's Hair-Trigger Temper and Toby the only one who dared to boss CJ around), often engaging in passive-aggressive word wars all episode only to drop them in a heartbeat in favor of quiet support and appreciation when a problem took a turn for the worse.
Every host of Fear the Boot (with the exception of the guest hosts that they don't know personally) is like this. They've admitted on the show that they're even worse to each other off the air.
On Everybody Loves Raymond, Robert is usually jealous of Ray's success and resents the fact that Ray is their parent's favorite. Ray thinks Robert overstates the favoritism and whines too much. But if anybody ever else ever really offends one of them, the other brother can be expected to step to defend his brother and give a verbal lashing to the offender.
Jackson and Rico from Hannah Montana. Constantly trying to one-up each other, they eventually show their softer sides in the final episodes of the series.
Also, Oliver with Miley and Lilly.
Amiable shit-talking is pretty commonplace on The Wire, be it coming from the police, the gangsters, the unions, the journalists, the politicians... hell, even the school kids are constantly making cracks.
Aeryn and D'Argo of Farscape are heavy on the vitriol, though they do have their moments.
Frasier and Niles Crane on Frasier, although they're brothers, so it's not as much of an oddity. They snark at and insult each other almost every time they speak, but seem to view it as some form of strange etiquette and assurance of the other's state of mind, with one often complimenting the other's skill with words after a particularly witty jab with a raised cup or knowing grin. If one really impresses the other with an insult, the insultee will go so far as to say "touche".
Also, over the seasons Niles and Roz developed into this after starting out as enemies. In an outstanding instance of Character Development, the insults they threw back and forth in later seasons are exactly like the ones they threw back in season 1, but their delivery and demeanor changed subtly over the years from vicious contempt to good-natured teasing.
Santana seems to be this way with everyone on Glee. Rachel is probably the one who receives most of the vitriol since Santana actually has to be held back by the others from beating the living daylights out of her, but there are a few moments when they compliment one another. Brittany, Santana's true best friend, points out that Santana doesn't really hate Rachel: The Glee Club is like a family. No matter how much the piss one another off, they still love each other.
Mercedes, Rachel, and Kurt also fit into this trope. It's moreso because Rachel is completely clueless when it comes to how friendships work and because they're all incredibly ambitious divas...which, as Rachel points out, is why they're friends in the first place.
Sue admits that she is Vitriolic Best Buds with Will (Will does bite back on occasions) after he not only calls her out on her rude behaviour toward Becky, but runs her sister's funeral, including reading the speech Sue had prepared when she breaks down crying. Other episodes confirm this whenever someone else tries to ruin the Glee Club's chances and Sue jumps in at the last minute to save them. She even once admits that she thinks Will is a great teacher and the Glee Club is good for the kids.
As is fitting for the Heterosexual Life PartnerBeta Couple they are, Esposito and Ryan have this kind of dynamic as well. They'll snark each other to death, but are utterly inseparable.
Detectives Esposito and Ryan and Lanie the coroner also count to a lesser degree — all three are perfectly willing to snark on Castle at every opportunity, but it's pretty clear that they think the world of him and he's long since become one of the family.
The five main characters of How I Met Your Mother are like this: they're constantly giving each other trash-talk that's actually far more good-natured and non-personal than most "snarky" conversations in just about every other sitcom. Their insults can be quite brutal, but they're almost never truly mean-spirited. If someone does put a toe out of line in their teasing of another, the other characters are guaranteed to smack him/her down with a Dude, Not Funny!.
Michael Wilbon and Tony Kornheiser of Pardon The Interruption are like this both on and off screen. The main difference, according to Kornheiser on his radio show, is that when they're not on camera, there's a lot more profanity.
Jade and Cat from Victorious, almost to the point of being "friends in name only". Cat will share a thought or suggest an activity to Jade, Jade will make a snarky statement or even a death threat. Cat will happily laugh it off, only for Jade to say "I'm serious" in a completely serious tone. Cat then laughs for a couple more seconds before all the joy disappears from her face. This has happened NUMEROUS times.
Sheldon towards almost everyone on The Big Bang Theory due to being The Friend Nobody Likes, but it's most pronounced in his relationship with Penny. She's the Nebraskian born tough but girly and sweet one, he's the nerdy Insufferable Genius, Man Child that insists everything go his way. They love volleying insults at each other and Penny takes a lot of enjoyment in screwing with him in various ways, most notably messing up his trademark knock. However at the end of the day she's something of a Parental Substitute for him and he regards her as one of his closet friends (which coming from Sheldon means a lot).