1. End things on good terms. Do not say any thing which puts company/people in the bad light, when you are asked on the reason of leaving. In other words, avoid criticizing anything, even if you feel honestly about it.
Good relations go a long way. Also, the problems at "first" job, are most likely problems at "any" job. so dont be too harsh/negative on them.
2. This is kind of obvious, but since its your first resignation, I will speak out loud anyways. Resign in person. Do not resign over phone, or worse email. Thank them for all the opportunities you got there, things you've learned and fun you've had, and positive stuff you've had to say on for the job (Do not exaggerate, though). Do not say any negative stuff.
3. Give as much notice period to them, as they need, as much as possible (for reasonable time-frame of-course, You do not want to piss off the future employer/jeopardize your chances). Give them the opportunity to transition as seamlessly as possible.
4. Send a Thank you email to all the co-workers, on the last day of work.