Practical uses of Capacitors in Arduino projects?

Actually a capacitor probably saved my future in hobby eletronics.

I had a basic relay opening/closing to swap between 2 leds. My wife came over and pressed the button and she thought she got shocked and said if i didn't fix it she would take my toys away.

Added a capacitor and it fixed it. She didn't get shocked, the relay fired so quickly over and over it felt like it.