This should go without saying, but unfortunately we see common sense tossed to the wayside time and time again. So we'll say it one more time -- don't be an idiot.
For instance, don’t decline a position over email. And for all that is sacred, don’t ever give notice if all you have is an offer via text or phone call. Nail everything down before you make a move. It is a wise person who waits for legal documents, and a fool who runs to give notice with nothing more than a verbal agreement. You need an offer letter in hand, before you give formal notice.
You can’t enforce it if something goes wrong, and you’ll look like an idiot if you have to go to your boss and beg for your job back. So don’t jeopardize your current relationship until you have a tangible offer.