buried treasure: n.

A surprising piece of code found in some program. While usually not wrong, it tends to vary from crufty to bletcherous, and has lain undiscovered only because it was functionally correct, however horrible it is. Used sarcastically, because what is found is anything but treasure. Buried treasure almost always needs to be dug up and removed. “I just found that the scheduler sorts its queue using bubble sort! Buried treasure!