-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support share snippets functionality #12
Comments
It seems that 3 approaches are popular in online playgrounds: a) The playground owner manages storage for user snippets (b) is minimal work for the playground's maintainer. It keeps the playground stateless. That's what DartPad does. It's less convenient for the snippet writer though. |
I most certainly would like to add this feature! It's not entirely straightforward though.
This is the nicest, and is used by many playgrounds (most importantly by play.tinygo.org), but I'm a little bit unsure about handling user data like that. Ideally I want a service I can put online and then ignore. I'm not a sysadmin.
Thank you for the suggestion! I didn't think of that. It is doable, but not as straightforward as it might seem. For the TinyGo playground, the data looks more like this: {
"defaultHumanName": "Circuit Playground Express",
"code": "package main\n\nimport (\n\t\"machine\"\n\t\"time\"\n)\n\nconst led = machine.A3\n\nfunc main() {\n\tprintln(\"Hello, TinyGo\")\n\tled.Configure(machine.PinConfig{Mode: machine.PinOutput})\n\tfor {\n\t\tled.Low()\n\t\ttime.Sleep(time.Second)\n\n\t\tled.High()\n\t\ttime.Sleep(time.Second)\n\t}\n}\n",
"parts": {
"main": {
"location": "parts/circuitplay-express.json",
"x": 0,
"y": 0
},
"9ibtl21zeiq": {
"config": {
"type": "led",
"humanName": "LED",
"svg": "led-tht-5mm.svg",
"color": [255, 0, 0],
"id": "9ibtl21zeiq"
},
"x": 28.707291666666663,
"y": -25.730729166666663
}
},
"wires": [
{
"from": "main.A3",
"to": "9ibtl21zeiq.anode"
}
],
"created": "2022-01-26T14:03:30.542Z",
"name": "circuitplay-express-2022-01-26T14:03:30.542Z"
} For a gist, I suppose we could extract the There are also security implications. The referenced JSON file ( |
I've implemented this in the PR over here: tinygo-org/tinygo-site#410 (comment) |
It would be great if I could share a code snippet with other people like https://play.golang.org/ (Share button).
The text was updated successfully, but these errors were encountered: