foursquare / fsq-studio-sdk-examples

Foursquare Studio is a platform to visualize, unify, enrich, and analyze spatial data on a planetary scale.
https://studio.foursquare.com
MIT License
18 stars 12 forks source link

Open API example code in CodePen #54

Closed mletic closed 1 year ago

mletic commented 1 year ago

The idea behind this PR is to allow developers using our SDK to be able to open the example on CodePen, without making any modifications to the html or js that are specific for the CodePen API.

Using this approach we can support both Open in GitHub and Open in CodePen badges at the top with one codebase, with clean code. The idea is to embed these small examples in our API functions documentation pages.

This addToCodePen function will be moved to another file that our examples can call. There we can escape characters for html and js code that is needed for this to work with CodePen and it won't have any effect on our code so that our examples are always functional and free of any CodePen specific code.

There are a couple of flaws (but those are limitations in CodePen):

Preview (feel free to test the html yourself):

codepen

abstractalgo commented 1 year ago

Closing this; soon we will be adding StackBlitz examples (based on https://github.com/foursquare/unfolded-sdk-examples/pull/57#issuecomment-1485430806), and recently we decided internally to use StackBlitz over alternatives (CodePen or CodeSandbox).