2017-07-15 23:37:04 UTC
These past few days I had fun putting together an online playground for
You can find it here : https://gambas-playground.proko.eu/ :)
The playground is a little place to write and run Gambas code snippets,
think could be very useful in the mailing-list where codes flies around
You can also directly share a link of your code in the playground using the
"Share" button, which will generate a link like this :
The code is actually stored in a GitHub Gist, rather than in the playground
itself, which makes it completely stateless.
Of course, since this is a web service (i.e. not your computer ! :) ),
a few limitations :
- Your code cannot run for more than 2 seconds, or it will get SIGKILL'd
- It cannot use more than 16 megabytes of RAM (it segfaults if you use too
- You cannot make any network access whatsoever (there are no network
and the process does not have permission to open sockets).
- You *can* read, write or delete any file, but all changes to the
are discarded when the process ends.
- There are probably a few edge cases I didn't think of, so please don't
However, a few components are available, just add the USE instruction to
it, just like you would in a Gambas script. Here is an example :
The following components are available in the playground :
gb.args, gb.clipper, gb.complex, gb.compress, gb.data, gb.debug, gb.draw,
gb.eval, gb.eval.highlight, gb.geom, gb.image.effect, gb.image,
gb.markdown, gb.option, gb.settings, gb.signal, gb.term, gb.util,
gb.vb, gb.xml, gb.xml.html
(Basically, any component that doesn't depend on networking or GUI, tell
any is missing :) )
Behind the scenes, it is a simple Gambas application serving a REST API,
which takes the code as input. It then spins up a Docker container, which
a simple "runner" Gambas application as its init process, which takes the
feeds it to the Gambas Scripter (gbs3) and then returns its output.
The app is still a bit rough on the edges (for instance, I should make a
Gambas highlighter for the editor, instead of using the VBScript one :p),
but I think it is good enough to see some use.
Tell me if you have some ideas to improve it, and have fun with it ! :)