IF you find yourself writing any kind of code that is for more than just giggles keep one single thing in mind before you write any code:
There is always time for testing.
Test-driven development not only defines a clear expectation of the code you write, it makes the world a more magical place. Especially if you plan on doing anything with your code, write tests for it. This will save you headaches hunting down bugs later when you could have identified exactly what was acting up right after you wrote the code for it.
Otherwise, you'll have to hire someone like me to come in and write it for you, hehe.