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