swlkr / janetdocs

A community documentation site for the janet programming language
https://janetdocs.com
MIT License
34 stars 9 forks source link

Playground to add "Share" button? #37

Open MikeBeller opened 3 years ago

MikeBeller commented 3 years ago

Hi @swlkr -- I'd like to add a feature to the Playground to assist in sharing examples, but want to run by you the approach first. I'd like to add a "SHARE" button to the playground which saves the current playground code in the db as an "ad-hoc example", and returns a permalink. The user can then send the permalink to someone else who can see and run the code. Only a logged-in user could create one of these ad-hoc examples, I would put them in a separate table from the "real" examples, and I would tag the item in the db with the user's id. (in case of abuse for example)

My thought was to use the existing sqlite db to store these (but a new table as I said). But if you are not happy with the janetdocs db adding potentially tens of thousands of little briefly-used examples, I could create a separate db file for this.

What are your thoughts?

swlkr commented 3 years ago

This is essentially codepen for janet right?

I mean this could be separate from janetdocs since it’s not really about docs.

Maybe it’s too niche to stand on its own?

It might be nice to go to one place for janet on the web vs two so maybe this does fit in.

Anyway, if you did want to add this still, I think it’s fine to just naively save the playground examples to a table in the db, sqlite can handle a crazy amount of traffic, and data which we won’t be getting haha

MikeBeller commented 3 years ago

Thanks. Like you say -- it could potentially stand on its own, but it would be very niche. I think there might be more synergy from it being a part of janetdocs (which already has Janet community attention). I will take a shot at a PR and you can decide if you like it.