Skip to content

Move example gists into the repo #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hdgarrood opened this issue May 3, 2020 · 1 comment · Fixed by #218
Closed

Move example gists into the repo #164

hdgarrood opened this issue May 3, 2020 · 1 comment · Fixed by #218

Comments

@hdgarrood
Copy link
Collaborator

Right now, the code that comes up when you first load Try PureScript is loaded from a gist, whose ID is specified in the configuration (client/config/dev/Try.Config.purs). That gist also contains links to other gists.

I think using gists for these examples is a bit awkward, since you can't do pull requests on them, and access control on gists is not really a thing either. I think it would be ideal to move them inside the repo, although of course we should continue to support loading code from gists. Perhaps we could achieve this by including these examples in the deploy bundle and hosting them at try.purescript.org, and then implementing an example query string parameter which operates in a similar way to the gist one, except that instead of a gist ID to load, it specifies a URL path to a PureScript source file? A query string like ?example=Records could tell the client to fetch try.purescript.org/examples/Records/Main.purs and load it into the editor, for instance.

@hdgarrood
Copy link
Collaborator Author

I'd quite like to generalise this a little and provide a way to load any PureScript source file on GitHub, perhaps via ?github=user/repo/branch/path/to/file.purs. Requests to raw.githubusercontent.com have an Access-Control-Allow-Origin: * response header so I think this should be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant