Enforcing unique constraints where order doesn't matter

After seeing this question pop up on forums multiple times, I wrote a quick tip about enforcing unique constraints where order doesn't matter.