Demonstration of code folding using the code in foldcode.js. Press ctrl-q or click on the gutter to fold a block, again to unfold.
foldcode.js