{"id":20875014,"url":"https://github.com/servicestack/gistlyn","last_synced_at":"2025-05-12T15:30:58.888Z","repository":{"id":43651840,"uuid":"55801342","full_name":"ServiceStack/Gistlyn","owner":"ServiceStack","description":"Run Roslyn Gists ","archived":false,"fork":false,"pushed_at":"2022-02-26T01:21:20.000Z","size":22007,"stargazers_count":82,"open_issues_count":8,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-18T00:56:00.877Z","etag":null,"topics":["csharp","editor","gists","nuget","online","playground","repl","roslyn","tutorial","walkthrough"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ServiceStack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-08T18:36:37.000Z","updated_at":"2023-12-22T22:07:10.000Z","dependencies_parsed_at":"2022-08-22T19:10:53.466Z","dependency_job_id":null,"html_url":"https://github.com/ServiceStack/Gistlyn","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ServiceStack%2FGistlyn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ServiceStack%2FGistlyn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ServiceStack%2FGistlyn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ServiceStack%2FGistlyn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ServiceStack","download_url":"https://codeload.github.com/ServiceStack/Gistlyn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225140097,"owners_count":17427089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","editor","gists","nuget","online","playground","repl","roslyn","tutorial","walkthrough"],"created_at":"2024-11-18T06:41:05.516Z","updated_at":"2024-11-18T06:41:06.251Z","avatar_url":"https://github.com/ServiceStack.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gistlyn - a C# Gist IDE powered by Roslyn\n\nGithub project powering [gistlyn.com](http://gistlyn.com) - A C# Gist IDE for creating, running and sharing \nstand-alone, executable C# snippets.\n\nGistlyn is the ultimate collaborative tool for trying out and exploring C# and .NET libraries on NuGet \nfrom a zero install - modern browser. It's ideal for use as a companion tool for trying out libraries during \ndevelopment or on the go from the comfort of your iPad by going to [gistlyn.com](http://gistlyn.com). \n\n[![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/home-screenshot.png)](http://gistlyn.com)\n\u003e Live Demo: [gistlyn.com](http://gistlyn.com)\n\n### Maintain C# snippets in your Github Gists\n\nGistlyn is an **open platform** where all C# snippets and documentation are hosted entirely in Github gists \nthat lets anyone create new C# Gists or fork, update or rename and add new files to existing ones - providing\na complete UI authoring experience for your C# snippets that gets saved directly to \n[your Gists on Github](https://gist.github.com/). You can easily Create or Fork a copy of any Gist by \nhitting `Ctrl+S` which will save any of your changes to your modified copy.\n\nThe [Hello World Gist](https://gist.github.com/gistlyn/f57b06f975f53ba920985b2853cfa876) shows a minimal\nC# example of what it takes to run in Gistlyn, i.e. just a valid C# source code fragment in a `main.cs` file: \n\n#### main.cs\n\n```csharp\n//Variables in top scope can be inspected in preview inspector\n\nvar name = \"World\";\nvar greeting = $\"Hello, {name}!\";\n```\n\nHitting `Ctrl+Enter` (or clicking play) will execute your code on Gistlyn's server, running in an \nisolated context where each of the variables defined in the top-level scope can be inspected further.\nThe preview inspector also includes an Expression evaluator that can be used to evaluate C# expressions \nagainst the live server session:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/hello-expression.png)\n\n## Downloads\n\nThanks to the [React Desktop Apps](https://github.com/ServiceStackApps/ReactDesktopApps) VS.NET Template \nGistlyn is available in a variety of different flavours:\n\nDeployed as an ASP.NET Web Application on both Windows / .NET and Linux / Mono servers at: \n\n - [gistlyn.com](http://gistlyn.com) - Ubuntu / Vagrant / Windows 2012 Server VM / IIS / .NET 4.6\n - [mono.gistlyn.com](http://gistlyn.com) - Ubuntu / Docker / mono / nginx / HyperFastCGI\n\nHaving both Windows and Linux versions of Gistlyn is useful when you want to test whether a feature has the \nsame behavior in both .NET and Mono. Where after saving you can add/remove the `mono` subdomain to run \nyour scripts on different Operating Systems.\n\n### [Run Gistlyn on your Desktop](http://gistlyn.com/downloads)\n\nIn addition to a running as an ASP.NET Web App, Gistlyn is also available as a self-hosting \n[Winforms Desktop or cross-platform OSX/Linux/Windows Console App](http://gistlyn.com/downloads). \n\nRunning Gistlyn on your Desktop lets you take advantage of the full resources of your CPU for faster \nbuild and response times and as they're run locally they'll be able to access your RDBMS or \nother Networked Servers and Services available from your local Intranet.\n\n## Instant Feedback\n\nGistlyn shines at being able to quickly navigate, run code and preview results at a glance where you can \npreview complex types with nested complex collections in a human-friendly format for instant feedback. \n\nTo give you an example, here's what the preview inspector shows after running the\n[OrmLite Reference Test Data](http://gistlyn.com/?gist=84529771d447f7f64b3756bbf341923f\u0026collection=991db51e44674ad01d3d318b24cf0934)\nsample C# code below:\n\n```csharp\n//SELECT all artists including their Track references\nvar allArtists = db.LoadSelect\u003cArtist\u003e();\nallArtists.PrintDump(); // Dump to Console\n```\n\nAfter it's executed all the variables get shown in the preview inspector. Then clicking on `allArtists` \nexecutes it in the Expression Evaluator and displays the results below:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/inspector-screenshot.png)\n\n\u003e The `T.PrintDump()` and `T.Dump()` extension methods are ideal for dumping and quickly seeing the \nresults of any variable to the Console.\n\n## Snapshots\n\nGistlyn gets a lot of natural benefits from being a \n[React](https://facebook.github.io/react/) web-based IDE, from deep linking to being able to quickly \nnavigate back/forward through your browser history. It also saves every change to your `localStorage` \nthat restores instantly, so you can close your browser at anytime and revisiting [gistlyn.com](http://gistlyn.com) \nwill bring you right back to the same state where you left it. Drafts of every Gist you visit are\nalso saved, so you can happily be working on multiple gists without losing any changes. \n\nAnother feature Gistlyn naturally benefits from is Snapshots...\n\nSnapshots lets you save the **entire client state** of your current workspace (excluding your login info) \ninto a generated url which you can use to revert back in time from when the snapshot was taken or send to \nsomeone else who can instantly see and run what you're working on, who'll be able to continue working from \nthe same place you're at.\n\nLike everything else in Gistlyn, a snapshot is just a `snapshot.json` document of your serialized State \nsaved to your User Account in a private [Github Gist](https://gist.github.com). \n\n### Capturing a Snapshot\n\nAs snapshots are saved to your gists, you'll need to first sign-in to be able take a snapshot. After you're \nauthenticated with Github you can click on the camera icon that appears in the footer to take a snapshot:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/snapshots-icon.png)\n\nThis will open the Snapshot Dialog where you can enter the name of the Snapshot which by default is \nautomatically populated with the timestamp of when the Snapshot was taken:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/snapshots-dialog.png)\n\nClicking **Save Snapshot** serializes your captured snapshot and saves it as a `snapshot.json`\ndocument in a new private gist. Gistlyn then just appends the **id** of the newly created Gist to the \n`?snapshot` queryString to form the url for your new snapshot:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/snapshots-created.png)\n\n### Loading a Snapshot\n\nThere are 2 ways to load a snapshot, either by clicking on the generated url to launch it in a browser:\n\n - [gistlyn.com/?snapshot=c0977cc2f74a7eedfb3232908357396b](http://gistlyn.com/?snapshot=c0977cc2f74a7eedfb3232908357396b)\n\nWhich will load a new Gistlyn session initialized with the snapshot, complete with the contents of all \nworking files, the state of the preview window, any console logs, etc:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/snapshots-load.png)\n\nThe alternative is to paste the **id** of the Gist into Gistlyn's URL bar:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/snapshots-url.png)\n\n\u003e Incidentally you can paste the **id** of any C# Gist, Collection or Snapshot in the URL Bar\n\n## [Gistlyn Collections](http://gistlyn.com/collections)\n\nIn our mission to make Gistlyn an immensely useful and collaborative learning tool for exploring any .NET library, \nGistlyn includes a streamlined UX for editing Collections making it easier than ever to create \"Live documentation\" \nwhich we believe is the best way to learn about a library, mixing documentation and providing a live development \nexperience letting developers try out and explore what they've just learned without losing context by switching \nto their development environment and setting up new projects to match each code sample.\n\nGistlyn makes it easy to share C# snippets with colleagues or reporting an issue to library maintainers with \njust a URL or a saved Gist ID which anyone can view in a browser at [gistlyn.com](http://gistlyn.com) or on their \n[Desktop version of Gistlyn](http://gistlyn.com/downloads). \n\nHere's an example of the new Collection authoring features in action:\n\n[![](http://i.imgur.com/156wYPJ.png)](https://youtu.be/FkdzYsx2lYw)\n\n### Plain-Old Markdown Document\n\nThe best thing about Gistlyn collections are they're just plain Github Gist's with a single `index.md`\nMarkdown document. So if you've previously created documentation in Github or asked questions in StackOverflow \nyou already know how to create Github collections.\n\nAll documentation within Gistlyn including this and the [Home page](http://gistlyn.com?collection=2cc6b5db6afd3ccb0d0149e55fdb3a6a) \nare Gistlyn Collections which can be viewed by clicking the **Collections** header icon:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/collections-icon.png)\n\nThe **Collections** icon opens the Home Collection by adding its Gist **id** to the `?collection` query string:\n\n  - [?collection=2cc6b5db6afd3ccb0d0149e55fdb3a6a](http://gistlyn.com?collection=2cc6b5db6afd3ccb0d0149e55fdb3a6a)\n\nWhen adding links in your collection you should only include the `?querystring` portion and not the \nabsolute url, e.g `http://gistlyn.com?collection=...` so your links also work in \n[Desktop versions of Gistlyn](http://gistlyn.com?collection=74d7b0467a197f678bb4220b2c301ac3) \nwhich are instead run from `localhost:4000`.\n\n### Creating Collections\n\nCreating a Collection can be done at anytime from Gistlyn's main menu:\n\n![](http://i.imgur.com/UVbKOWn.png)\n\nThis will open an [Empty Markdown Document](http://gistlyn.com?gist=854ec4df3502ecdfe9ca24d4745e484f) into the **Markdown Editor**.\nHit `Ctrl+S` to save your modified copy to [your Github Gists](http://gist.github.com). After saving, the top bar will \nturn **Green** to indicate you're viewing or modifying one of your own Gists or Collections:\n\n![](http://i.imgur.com/PiMHll3.png)\n\n### Creating New Gists or Collections\n\nOnce editing the document you can use the **Markdown Toolbar** to quickly access Markdown specific \nformatting features like the **Insert Link** icon:\n\n![](http://i.imgur.com/XWCmjXl.png)\n\nWhich opens the Insert Link dialog and quickly create and link to new Gist or Collection by \nselecting the existing Gist or Collection you wish to use as a template:\n\n![](http://i.imgur.com/IRBGD4V.png)\n\nThis lets you quickly create multiple C# Gists using a copy of an existing Gists `packages.config` and\nsupporting `.cs` source files, significantly reducing the effort for creating multiple C# samples.\n\n### Uploading Images\n\nYou can add images to your document by click on the Insert Image icon below:\n\n![](http://i.imgur.com/oRe5UVV.png)\n\nThis will open the **Insert Image** dialog where you can drag multiple images to upload them\nto imgur and embed them in your document:\n\n![](http://i.imgur.com/n8zYoqJ.png)\n\nAfter each image has finished uploading to Imgur, it will be embedded in your document from your \nCursors position using the Markdown Image Format below:\n\n```\n![](http://i.imgur.com/n8zYoqJ.png)\n```\n\n### Navigating, Browsing and Editing Collections\n\nAs you're authoring your Markdown Document you can freely jump between different Gists or Collections \nas Gistlyn automatically saves as-you-type so you can use the **Back** button to jump back \nto your new collection as you left it without missing a beat.\n\nAfter navigating away from your page, the arrow icons shown below will appear in the middle to indicate \nwhat you're editing on the left no longer matches the same page on the right:\n\n![](http://i.imgur.com/JATmJJ8.png)\n\nUse the top **right arrow** icon to load the page you're editing in the preview window on the right \nto load the real-time preview of your Markdown document.\n\nUse the bottom **left arrow** icon to load the Collection you're viewing on the right in the Editor. \n\n### Manually adding links in Collections\n\nIf manually linking to Gists, other Collections and Snapshots use the following formats below:\n\n  - Gists: `?gist={id}`\n  - Collections: `?collection={id}`\n  - Snapshots: `?snapshot={id}`\n\nWhen Gistlyn sees these links it loads them into your current Gistlyn session. All other links are \nhandled by the browser which navigates to the specified URL causing a full page load. If you're linking to an \nexternal site outside of Gistlyn we recommend opening it in a new browser Window by using HTML instead of \nMarkdown links. e.g:\n\n    \u003ca target=\"_blank\" href=\"http://example.org\"\u003ename\u003c/a\u003e\n\n### Executable Documentation\n\nCollections are a great way to create learning resources and tutorials for C# letting you create \nstep-by-step walk-throughs explaining how something works on the right whilst providing links to \nexecutable C# fragments which users can try out and explore live in the code editor on the left. \n\n### Collection Examples\n\nYou can find all of Gistlyn's Collections as Gists under the \n\u003ca target=\"_blank\" href=\"https://gist.github.com/gistlyn\"\u003eGistlyn Github Account\u003c/a\u003e. Looking through some of\nGistlyn collections below and their Markdown sources should provide a good resource for learning how to create \nCollections in Markdown:\n\n - Gistlyn Collections (this page) ([source](https://gist.github.com/gistlyn/457a7035675513ba1365195658a5d792))\n - [Home](http://gistlyn.com?collection=2cc6b5db6afd3ccb0d0149e55fdb3a6a) ([source](https://gist.github.com/gistlyn/2cc6b5db6afd3ccb0d0149e55fdb3a6a))\n - [OrmLite Interactive Tour](http://gistlyn.com?collection=991db51e44674ad01d3d318b24cf0934) ([source](https://gist.github.com/gistlyn/991db51e44674ad01d3d318b24cf0934))\n   - [OrmLite SELECT Examples](http://gistlyn.com?collection=cd381848f252be2a84f8c239ed0d241b)  ([source](https://gist.github.com/gistlyn/cd381848f252be2a84f8c239ed0d241b))\n   - [OrmLite UPDATE Examples](http://gistlyn.com?collection=849680f095fb2721b2714d0bbcddc8d7)  ([source](https://gist.github.com/gistlyn/849680f095fb2721b2714d0bbcddc8d7))\n - [Gistlyn Snapshots](http://gistlyn.com?collection=1576fda8eea87abbe94fa8051b4fed34)  ([source](https://gist.github.com/gistlyn/1576fda8eea87abbe94fa8051b4fed34))\n - [Add ServiceStack Reference](http://gistlyn.com?collection=363605c3c121784ebababac4a03e8910)  ([source](https://gist.github.com/gistlyn/363605c3c121784ebababac4a03e8910))\n\n### Human Friendly short URLs\n\nInstead of sending links with unmemorable gist ids, you can also request to have easier to remember URLs for \nlinks to any Gistlyn collection by leaving a comment on the \n\u003ca target=\"_blank\" href=\"https://gist.github.com/gistlyn/59e45270e41c1bd550b53436707eec21\"\u003eFriendly Names Gist\u003c/a\u003e\n\nWhere any link in the above Gist are available to Gistlyn, so instead of publishing links to a long \n`?collection={id}` URL, you can use a shorter and easier to remember name instead, e.g:\n\n  - [/ormlite](http://gistlyn.com/ormlite) \n \nThat like a URL shortener, redirects to the linked url: [http://gistlyn.com?collection=991db51e44674ad01d3d318b24cf0934](?collection=991db51e44674ad01d3d318b24cf0934)\n\n## [Add ServiceStack Reference](http://gistlyn.com/add-servicestack-reference)\n\nGistlyn's integrated support for [Add ServiceStack Reference](http://gistlyn.com/add-servicestack-reference) \nfeature generates a Typed API for remote [ServiceStack Services](https://servicestack.net) \nwhich can be used in any of ServiceStack's typed \n[C# Service Clients](https://github.com/ServiceStack/ServiceStack/wiki/C%23-client)\nto call Web Services and view their results - within seconds.\n\nThe easiest way to use this feature is to add the **BaseUrl** for your remote ServiceStack instance to the \n`?AddServiceStackReference` query string, e.g:\n\n - [gistlyn.com?AddServiceStackReference=techstacks.io](http://gistlyn.com?AddServiceStackReference=techstacks.io)\n\nThis will open the Add ServiceStack Reference dialog that automatically validates if the specified url is\nto a valid ServiceStack instance:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/add-ss-ref-dialog.png)\n\nHitting `Enter` then: \n\n - creates a **new Gist**\n - adds your generated C# DTOs with the **filename** specified\n - initializes a `JsonServiceClient` with your **BaseUrl** \n - and provides an example of a `Get()` Request using the **first GET Request DTO** it can find\n\nWhich for [techstacks.io](http://techstacks.io) results in:\n\n```csharp\nusing System.Linq;\nusing ServiceStack;\nusing ServiceStack.Text;\n\nvar client = new JsonServiceClient(\"http://techstacks.io\");\n\n//Call techstacks.io APIs by sending typed Request DTO's\nvar response = client.Get(new GetAllTechnologies {  });\n\n//response.PrintDump();  // Uncomment to Print Response to Console\n```\n\nSo without having written any code, Users can hit `Ctrl+Enter` to execute the generated Gist which for\ntechstacks.io returns details of All Technologies it maintains in its database that it shows in the\nPreview Inspector. Uncommenting `response.PrintDump();` will also dump the contents of the Web Services \n`response` to the Console.\n\n## URL Customizations\n\nOne thing you'll likely want to do is change which **Request DTO** gets used by specifying it in the \n`?Request` query string, e.g:\n\n - [gistlyn.com?AddServiceStackReference=techstacks.io\u0026Request=AppOverview](http://gistlyn.com?AddServiceStackReference=techstacks.io\u0026Request=AppOverview)\n\nYou can also pre-populate the C# expression and have it **autorun** with:\n\n - [?AddServiceStackReference=techstacks.io\u0026Request=Overview\u0026expression=response.TopTechnologies[0]\u0026autorun=1](http://gistlyn.com?AddServiceStackReference=techstacks.io\u0026Request=AppOverview\u0026expression=response.TopTechnologies[0]\u0026autorun=1)\n\nWe then end up with a **live** link that anyone with a modern browser on their Desktop or iPad can\nclick on to call [techstacks.io](http://techstacks.io)'s public API to find out what its Most popular \ntechnology is, in seconds.\n\n## Adding ServiceStack References to existing Gists\n\nSimilar to how \n[Add ServiceStack Reference](https://github.com/ServiceStack/ServiceStack/wiki/Add-ServiceStack-Reference)\nworks in most major IDE's, you can also add the reference to existing Gists using the **Editor Context Menu**:\n\n![](https://raw.githubusercontent.com/ServiceStack/Assets/master/img/livedemos/gistlyn/add-ss-ref-popup.png)\n\nThen after clicking **Add Reference** Gistlyn adds your remote Services Typed DTOs to your existing gist \nusing the **filename** specified.\n\n### v4.0.62 required\n\nIf you're adding a Service reference to a version of ServiceStack before v4.0.62 you will need to manually \nremove any C# namespaces as they're not supported in Roslyn Scripting.\n\n## Gistlyn's Stateless Architecture\n\nOne surprising thing about Gistlyn is that it's entirely stateless where it runs without any kind of backend \ndb persistence. All state is either persisted to Github gists or in your browser's `localStorage`. \nNot even your Authenticated Github session is retained on the server as it's immediately converted into an \n[encrypted JWT Cookie](https://github.com/ServiceStack/ServiceStack/wiki/JWT-AuthProvider#encrypted-jwe-tokens)\nthat is sent with every Ajax request, so redeployments (or even clean server rebuilds) won't lose any of your \nwork or force you to Sign In again until the JWT Token expires.\n\n## Source Code\n\nThis Github repo provides a good example of a modern medium-sized ServiceStack, React + TypeScript App \nthat takes advantage of a number of different ServiceStack Features:\n\n - [React Desktop Apps](https://github.com/ServiceStackApps/ReactDesktopApps) - \n tooling for packaging Gistlyn's ASP.NET Web App into a Winforms Desktop and Console App\n - [Server Events](https://github.com/ServiceStack/ServiceStack/wiki/Server-Events) - providing real-time \n Script Status updates and Console logging\n - [TypeScript](https://github.com/ServiceStack/ServiceStack/wiki/TypeScript-Add-ServiceStack-Reference) - enabling end-to-end Typed API requests\n - [Github OAuth](https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization#auth-providers) -\n authentication with Github\n - [JWT Auth Provider](https://github.com/ServiceStack/ServiceStack/wiki/JWT-AuthProvider) - enabling both JWT and JWE ecrypted stateless Sessions\n - [HTTP Utils](https://github.com/ServiceStack/ServiceStack/wiki/Http-Utils) - consuming Github's REST API \n and creating an authenticated HTTP Proxy in [GitHubServices.cs](https://github.com/ServiceStack/Gistlyn/blob/master/src/Gistlyn.ServiceInterface/GitHubServices.cs)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservicestack%2Fgistlyn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fservicestack%2Fgistlyn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservicestack%2Fgistlyn/lists"}