CS50 Sandbox is a web app at sandbox.cs50.io, for students and teachers especially, that allows users to
create temporary programming environments (sandboxes) quickly and
share copies of those sandboxes with others.
For instance, a teacher might
begin a class by asking students to visit sandbox.cs50.io and start a sandbox for C with a terminal window and text editor, with a file called
hello.c, all of which the app’s landing page facilitates,
provide students with a pre-configured link like
https://sandbox.cs50.io/?file=hello.c&window=editor&window=terminal(perhaps shortened via a URL shortener) that, when visited, would yield the same, or
provide students with starter code, as by creating a sandbox, editing one or more files, and asking students to clone that sandbox by visiting its unique URL.
CS50 Sandbox is essentially a lightweight version of CS50 IDE, CS50’s web-based integrated development environment, but CS50 Sandbox
does not have
debug50, CS50 IDE’s graphical debugger for C and Python,
does not offer file revision history, and
does not support real-time collaboration or chat.
To use CS50 Sandbox, students and teachers need only have a (free) GitHub account via which to log in.
CS50 Sandbox supports, via both GET and POST, these HTTP parameters:
cmd, which, if present, specifies the command to be run in the sandbox’s terminal window (if not
bash, the default).
file, which, if present, is a file path to pre-create within the sandbox in
windowhas a value of
editor(potentially among other values), that file, if not binary, will also be pre-opened in the code editor.
window, which must have a value of
terminal(so that the sandbox will have a terminal window) and may have additional values of
browser, in which case the sandbox will have an embedded browser, pre-configured with an address of
editor, in which case the sandbox will have a code editor, and/or
x, in which case the sandbox will have an embedded X window.
For GET, then, the shortest supported URL is
A URL with multiple values for
window, meanwhile, might be
window are mutually exclusive.
Unsupported parameterizations will yield an HTTP status code of 400.
When submitted via POST, each value of
file can be an actual file encoded as
multipart/form-data, as via a form like the below:
<form action="https://sandbox.cs50.io/" enctype="multipart/form-data" method="post"> <input multiple name="file" type="file"> <input name="window" type="hidden" value="editor"> <input name="window" type="hidden" value="terminal"> <input type="submit"> </form>