-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
As mentioned in #459, I'm building a website where people can create, edit, browse, share, fork, run, embed, like, dislike, etc., user-created snippets in wenyan language.
https://wenyan-snippets.glitch.me/
Currently I have a proof-of-concept that is running on free server from gltich.com. It uses sqlite to store user snippets. It is rough and susceptible to hacks, but is usable. If people are liking it we can build a bigger better, more secure version.
Please check it out and give feedback! If you have experience building sites like this, your help will be very much appreciated!
Creating Snippets
- Click
+
button - There is a
token
field on the top bar, this is like a secret password. Leave it aspublic
to allow anyone to edit the code. Press the shuffle icon to generate a random token. You'll need to remember the token so you can edit the snippet later.
Editing/Forking Snippets
- On upper right corner of each snippet, there is an edit button (the pencil icon) and a fork button (no it's not USB icon).
- If the lower right corner says "PUBLIC" instead of showing a lock, you can edit the snippet without a token. But be nice and don't vandalize.
- Most of the time you would want to use the Fork button to duplicate the snippet and work on your own copy.
Compiling/Running
- Anywhere you see a right-pointing triangle, you can click it to run the code. A sub-window should pop up displaying the results (or errors).
- Use the console to see intermediate results such as the compiled javascript code.
Submit/Publishing
- When you're happy with your snippet, you can submit it for everybody to see. Click the submit button upper right corner of the editor (it looks like an arrow pointing into a ceiling)
- Again, be nice and don't submit trash :P
Upvoting
- You can click
+1
button on the lower left corner of a snippet to upvote it (or-1
to downvote it) - Currently the site doesn't prevent you from refreshing the page and vote again, so be nice and don't do that.
- Snippets will be sorted by popularity
Searching
- Type any phrase to search title/author/code
- Use
by:AuthorNameHere
to search code by a particular author - Use
#id
to find snippet by its unique ID. (ID is shown on upper left corner of every snippet)
Embedding
- Click the link button on upper right corner of each snippet to get a link for embedding the code
- It works with the new Runtime.
- You can
GET
a snippet with this url:https://wenyan-snippets.glitch.me/api?id=666
.
Implementation Details
- Code editor is now powered by industry standard CodeMirror with robust highligting and editing support. Yay!
- SQLite is used to store user programs. But I'm considering (ab)using Github Gists to manage the database instead, so I don't need to worry about many nuances.
You can view the source code of the site with this URL:
https://glitch.com/edit/#!/wenyan-snippets
Caution
The site is still in its early stage, I'm sure there's a million ways to break it. Before you do that, please report it intead. Also, don't rely on the storage just yet, I'll try my best not to lose the programs, but can't guarentee that someday I won't accidentally nuke the SQL, so save your work elsewhere too :)
Again, feedback and help are most welcome! Thanks!