Live data from Hacker News

Show HN: Scratch.js – Interactive JavaScript Scratchpad

hole.dev

1–10 of 69 posts

Re: Show HN: Scratch.js – Interactive JavaScript Scratchpad

#6
post #4

Can you give us Mac users some love and replace ctrl w/ command ? My muscle memory is giving me a hard time xD

The source is very small and can be used both through the file:// and hosted http protocols. So you can easily make it do whatever you like. I could maybe expose some global variables to make it customizable, but I went for simplicity and smaller source instead.

Re: Show HN: Scratch.js – Interactive JavaScript Scratchpad

#7
post #2

Cool stuff! What was the reason for you to make this?

I find myself opening and using the web console to do simple tasks like string manipulation, maths, sorting often. I wanted a dedicated and persistent way to do this. And also just a place to keep notes, urls and stuff. So I made this "literate programming" notepad.

I'm also former Emacs user, and I like the lisp scratch buffer there, which is similar.

Re: Show HN: Scratch.js – Interactive JavaScript Scratchpad

#8
post #6
post #4

Can you give us Mac users some love and replace ctrl w/ command ? My muscle memory is giving me a hard time xD

The source is very small and can be used both through the file:// and hosted http protocols. So you can easily make it do whatever you like. I could maybe expose some global variables to make it customizable, but I went for simplicity and smaller source instead.

if it helps, all you need to do is add this listener to support the cmd key:

`document.addEventListener('keydown', (e) => (e.metaKey && e.code === 'Enter' && evaluate() && e.preventDefault()));`

The metaKey[1] is only accessible for keydown.

[1] https://stackoverflow.com/questions/3902635/how-does-one-cap...

Re: Show HN: Scratch.js – Interactive JavaScript Scratchpad

#10
post #7
post #2

Cool stuff! What was the reason for you to make this?

I find myself opening and using the web console to do simple tasks like string manipulation, maths, sorting often. I wanted a dedicated and persistent way to do this. And also just a place to keep notes, urls and stuff. So I made this "literate programming" notepad. I'm also former Emacs user, and I like the lisp scratch buffer there, which is similar.

Ah, I do that too, that must be why playing with this app made me happy :-) Thanks for making it, have bookmarked it.
Post reply on HN