I write my code on another machine - including extensive comments.
I use either hash (#) or c-style (//) comments in my code.
Then I use sed to remove all the comment lines and display to my screen when I'm ready to put code into a device. Select all, copy and paste into the webcontrol programming text area then send.
It's convenient, lets me maintain multiple versions of the code with full comments etc, and have a decent editor.