lol yeah that is quite the tall order.
We've been using Unfuddle (paid SaaS, with free versions) internally for 3-4 years now and absolutely love it. They have an API which I've integrated into vBulletin back in the vBlogetin days, but I just started using it again for a newer product.
I'd be willing to share that code for free, but if nobody uses or wants to use Unfuddle, it's pretty useless.
I thought I'd ask at least.