I used exactly the same approach years ago working on code editor with js evaluation - http://labs.onether.com/javascript-sandbox/ (this is some old version only with whitespace characters, it also had syntax highlighting but i couldn't find it).
If anybody still looks here i just added song links in the comments. Write in your comment @[comma separated list of patterns] to create song trigger, e.g @[1,1,1,2,3,4,3,4]
It's super fun to mess around. I think i found a bug - https://imgur.com/BRwst17 - in this setup kick triggers on red instead of green? Or am i tripping?
That doesn't seem to happen for me. If you lower the BPM (the value on the right is a non-obvious text input) does it still seem to trigger incorrectly?
Also, still working on https://drumpatterns.onether.com :)