Skip to content

Add snippet sharing support. #11

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

Merged
merged 5 commits into from
Jan 10, 2015
Merged

Add snippet sharing support. #11

merged 5 commits into from
Jan 10, 2015

Conversation

dmitshur
Copy link
Member

@dmitshur dmitshur commented Jan 6, 2015

Closes #6.

This PR is a very rough start, the code needs to be cleaned up, reviewed and improved. This is my first time using AngularJS, so I may be doing things in a suboptimal way. I've already marked the things I know are poor/incorrect with TODOs.

This is to get the process started.

Known remaining tasks:

  • Improve style of share-url text box.
    • Right now it's too small, needs a gray background, possibly not be editable.

@dmitshur dmitshur mentioned this pull request Jan 6, 2015
}()
})
})
// TODO: Should be sending as binary blob or is text okay?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Text is not okay, it causes last newlines to be lost/added, etc. We want byte-for-byte precise data transfer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'm not completely sure if it causes issues, it might've been due to something else.

@dmitshur
Copy link
Member Author

dmitshur commented Jan 8, 2015

Any suggestions on what else should be done for this to be merged?

I think it might be helpful to move the XHR request code into helper functions, since it's pretty verbose.

)

type Line map[string]string

var output []Line

//const snippetStoreHost = "localhost:8080"
const snippetStoreHost = "gotools.org:26204" // TODO: Decide on where the snippet-store server will be hosted.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend hosting it at a subdomain; makes it easier to move the service to a different server without having to update the JS file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still need a custom port, so, snippets.gotools.org:26204?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example; although I'm not sure why you need the custom port, a frontend proxy could do the right thing per-domain (proxy gotools.org:80 to your current thing, proxy snippets.gotools.org:80 to the snippet service)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I can do that. snippets.gotools.org then.

Unless someone else wants to host it, or create a Heroku account as Richard suggested and deploy it there instead.

@dominikh
Copy link
Member

dominikh commented Jan 8, 2015

Imho, if it works, merge it and improve it in later revisions.

Use "snippets.gotools.org" as the current snippet store host.
Change error language from "cannot do something" to "failed to do
something". I think this is more clear and suggests that it's a
(potentially temporary) system failure, rather than the user doing
something wrong.
It did get quite a bit larger due to use of dom and xhr packages (which
are somewhat overkill for this tiny project if we wanted to really
optimize its size, but I think worth it in general and shows better
example code).
@dmitshur
Copy link
Member Author

dmitshur commented Jan 9, 2015

Imho, if it works, merge it and improve it in later revisions.

I tend to agree, and I think it's basically ready now. It definitely works in my testing. I think it can be merged, but I'll wait for some feedback/review for now.

@dmitshur
Copy link
Member Author

As Richard said,

@shurcooL @dominikh @ajhager Is it okay for you guys if I leave this up to you? I don't have so much time and I would like to spend it on improving GopherJS itself. I'm sure you'll come up with a great solution.

This is up to us. If @dominikh and @ajhager can review and +1 this, let's go ahead and get this feature out.

Let's keep in mind one thing from the README:

The playground is a place where users can explore GopherJS without needing to install anything, or to share code with others. Our motivation should be that a potential user could easily be turned of by a bad experience here.

I want to make sure we don't compromise the current great experience of the GopherJS Playground.

From my local testing (a link where you can try/test it is in #6 (comment)), I do not see any more issues that need to be solved, which is why this PR has LGTM from me. If you spot any usability or other issues, let me know!

@ajhager
Copy link

ajhager commented Jan 10, 2015

LGTM! Great job on this @shurcooL 🎯

@dmitshur
Copy link
Member Author

Thanks! @dominikh says it looks okay to him too, so I'll merge (i.e., deploy) this change tomorrow morning!

Yay, snippets.

@dmitshur
Copy link
Member Author

Merging now. Please let me know if you spot any issues.

dmitshur added a commit that referenced this pull request Jan 10, 2015
@dmitshur dmitshur merged commit 5501e13 into gopherjs:master Jan 10, 2015
@dmitshur
Copy link
Member Author

Well, this immediately makes one issue obvious, that I overlooked prior. See #14.

@dmitshur dmitshur deleted the feature/add-snippet-sharing branch January 10, 2015 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playground: Gist support
3 participants