Update gist extension to use Comms and require.js

as a demo more than anything, since it's overkill.
move extensions into extensions/
move js extensions into nbextensions
move gist.js to gistcomm.js
add js-only gist extension
writeandexecute: check for no directory in file argument

Only check whether the directory exist if the file argument
has a directory component. Prevents a error in that case.