Skip to content
Emanuele edited this page Nov 2, 2017 · 2 revisions

Stargazer cannot save your programs by itself, it runs entirely on your browser and every time you close it you loose your changes. There are three ways by which you can save and share your programs:

  1. Via Gists (recommended)
  2. Via .stargazer files
  3. Via program-embedding links

Stargazer can load more than a program at once; a set of programs is called a suite. With methods 1 and 2 you can share and store full suites, while method 3 is restricted to single programs.

Gist integration

Loading and format

Stargazer can load any gist-stored suite by setting the gist url parameter to the gist's id, for example, to load the suite stored at

http://gist.github.com/bordaigorl/6e54093b297c0f9df01d0c82f65b89f6

you can go to

http://stargazer.emanueledosualdo.com?gist=6e54093b297c0f9df01d0c82f65b89f6

To be understood by Stargazer, a gist should contain a .pi file for each program in the suite, containing the program's source code.

Optionally, you can pair a program name.pi with a JSON file name.json with settings for that program. The settings can include:

  • showLabels (boolean) determines if the labels are shown in the communication topology
  • showGlobals (boolean) determines if the global names should be included in the communication topology
  • gravity (boolean) determines if the gravity toggle is set
  • showCode (boolean) determines if the source code sidebar is initially shown
  • pallette (map from process id to colour)

Also optional is a file named default.json that can contain the defaults for the options and an optional extra setting default which should contain the name of the program (without the .pi extension) of the suite to be open by default when opening the suite. If default is not specified, one is picked arbitrarily.

Saving

A convenient way to create a gist is from Stargazer itself. From the "Open suite" dialog you can select "New suite" and write your own programs. Once you are happy with them, you can click on the share button and select "Save to a new Gist". This will create a private anonymous gist, the link of which will appear in a dialog in Stargazer. Keep a record of the link/id to be able to share/modify the suite of programs.

Note that gists created this way are not linked to your GitHub account, even if you are logged in when you created them.

Using .stargazer files

From the share menu you can click on "Download a copy" which will let you download a .stargazer (JSON) file containing all the programs in the suite.

You can then load the file through the "Open suite" dialog.

Using links

By selecting "Share as link" from the share menu you will get a link you can share. In case the suite is stored as a gist you get a link pointing to the gist. By appending #NameOfProgram to the url, you can have a link that opens the suite at the gist and selects the corresponding program instead of the default.

In the "Share as link" dialog, if you select a specific program of the suite you get a link with the program url parameter set to and encoded version of the source code; sharing this will make sure that exactly the same program will be loaded by opening the link, as opposed to the gist version where changing the gist may change the program.

Clone this wiki locally