Snippets are short examples of working code. CoCalc offers curated, annotated snippets with Jupyter Notebooks and Sage Worksheets. They can save you time when you’re learning a new programming technique or need a reminder how to do something. CoCalc offers code snippets in many programming languages, including Python, R, Sage, Bash, Julia, Octave, and GAP.


Snippets are available in many programming languages


example of Python Snippet


opening Snippets from a Jupyter Notebook


opening Snippets from a Sage Worksheet

You can browse categories and titles, and search for keywords.

With one click, you can insert a code snippet with accompanying description, right where you are in your document. After that, you are ready to inspect and modify the inserted code.

If you have a snippet you’d like to contribute, click Contribute at lower left in the Snippets pane and you will be taken to the CoCalc Snippets source code repository on GitHub.

Note: Snippets first appeared in CoCalc under the name “Assistant” and were announced in this blog article: Examples Assistant.