You might have noticed that often when you post code in the forum it gets cut and some parts are omitted.
This is what I do to make it work:
1. Write your entire post with code and everything.
2. View source code (ctrl + shift + s)
3. Select all (ctrl + a) and copy (ctrl + c)
4. Submit post.
5. Edit post
6. View source code (ctrl + shift + s)
7. Select all (ctrl + a) and paste (ctrl + v)
8. Submit post.
That does the trick for me. Alternatively use www.pastebin.com.