Adrien Prokopowicz
2017-07-15 23:37:04 UTC
Hello Everyone !
These past few days I had fun putting together an online playground for
Gambas !
You can find it here : https://gambas-playground.proko.eu/ :)
The playground is a little place to write and run Gambas code snippets,
which I
think could be very useful in the mailing-list where codes flies around
everywhere. :)
You can also directly share a link of your code in the playground using the
"Share" button, which will generate a link like this :
https://gambas-playground.proko.eu/?gist=07db52169ef8b747d26f8bee4a4a19e9
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 ! :) ),
there are
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
much)
- You cannot make any network access whatsoever (there are no network
cards,
and the process does not have permission to open sockets).
- You *can* read, write or delete any file, but all changes to the
filesystem
are discarded when the process ends.
- There are probably a few edge cases I didn't think of, so please don't
abuse
it. :)
However, a few components are available, just add the USE instruction to
load
it, just like you would in a Gambas script. Here is an example :
https://gambas-playground.proko.eu/?gist=8a49aae5f5e24569c3f7f7e55c619f05
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.inotify,
gb.markdown, gb.option, gb.settings, gb.signal, gb.term, gb.util,
gb.util.web,
gb.vb, gb.xml, gb.xml.html
(Basically, any component that doesn't depend on networking or GUI, tell
me if
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
has
a simple "runner" Gambas application as its init process, which takes the
code,
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
proper
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 ! :)
These past few days I had fun putting together an online playground for
Gambas !
You can find it here : https://gambas-playground.proko.eu/ :)
The playground is a little place to write and run Gambas code snippets,
which I
think could be very useful in the mailing-list where codes flies around
everywhere. :)
You can also directly share a link of your code in the playground using the
"Share" button, which will generate a link like this :
https://gambas-playground.proko.eu/?gist=07db52169ef8b747d26f8bee4a4a19e9
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 ! :) ),
there are
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
much)
- You cannot make any network access whatsoever (there are no network
cards,
and the process does not have permission to open sockets).
- You *can* read, write or delete any file, but all changes to the
filesystem
are discarded when the process ends.
- There are probably a few edge cases I didn't think of, so please don't
abuse
it. :)
However, a few components are available, just add the USE instruction to
load
it, just like you would in a Gambas script. Here is an example :
https://gambas-playground.proko.eu/?gist=8a49aae5f5e24569c3f7f7e55c619f05
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.inotify,
gb.markdown, gb.option, gb.settings, gb.signal, gb.term, gb.util,
gb.util.web,
gb.vb, gb.xml, gb.xml.html
(Basically, any component that doesn't depend on networking or GUI, tell
me if
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
has
a simple "runner" Gambas application as its init process, which takes the
code,
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
proper
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 ! :)
--
Adrien Prokopowicz
Adrien Prokopowicz