How do I add a "copy" button to a code snippet?

This gets you pretty close.

If you have a live version of this up and can share the link, I can give you some guidance on the CSS, as it’ll differ slightly depending on your theme, etc.