Allow passing block to code and demo

This will get passed the resulting app so you can do things like wire up
additional closing commands on an app without having to modify it's source
directly.