-
Notifications
You must be signed in to change notification settings - Fork 159
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
Have "code links" upload code to a service and generate an ID instead of sending raw code #60
Comments
Hmm. It'd be nice to keep it in the URL wherever possible (especially as Espruino doesn't have that much memory anyway) - I think for now we could just refuse to make a URL that was too large - but Gist might be an idea. I wonder what compressed and base64 encoded would get down to: http://stackoverflow.com/questions/294297/javascript-implementation-of-gzip It'd be quite easy to implement... |
Yea, I wanted to start this issue just to get options being discussed really, as like I say, I think we could hit the limit really quickly. I guess we could support both to be honest. If we capture /code as being raw code, but /gist could capture a gist snippet for things that are more complex? I do like the idea of compression, but I'm also wondering how this would affect people linking code snippets from their site? Would they need to use a javascript widget type thing to do the compression and generating the link? Matt (I might have a go at that Gist lookup :)) |
Cool, that was easy :) Pull, reload, Click Me! |
We could provide a bit of code that makes the URL from code blocks I guess - just a By the way, just did some rough tests: http://jsfiddle.net/36hDP/3/ I can't seem to use btoa on lzw-encoded text (which seems a bit strange). |
Neat! Now you just need to be able to automatically submit it :) Also - we ought to think of a way of handling Blockly - I think that just looking for '' as the first 5 chars might be good enough? |
ooh yea, good thinking. From a gist perspective, you can say you need to set a filename. If it ends with .js treat it as JS, if it ends in .xml or .blk or something, we can treat it as blocks? From a code perspective though, I guess there are 2 options 1) parse it and look for a pattern or 2) have two urls ?code= is js and ?blocks= is blockly? |
Sorry, I got markdown'd. All we need to do is to search for |
for the submitting thing within the IDE, I'd be tempted for that to be a custom webservice we call as I think it'll get abused with lots of dummy / throw away code snippets? or do you think it would be better to submit it to gist? (maybe under a specific account?) |
if that's how blockly files start then yea, can't see a problem with that (make sure you account for whitespace though) |
Yeah, I was wondering about that. I think for now, just display a message that tells you how to paste your code into gist - as I guess you'll need a username to actually put code in yourself. I guess if you've got such a big bit of code you probably know what you're doing anyway :) |
maybe just experiment first with how much you can get into a URL, then decide from there? |
yea, so maybe compress the code, check then length, and alert them saying it's too long, and they should try adding it to a gist with a link to documentation. |
I was just thinking, max url length is around 2000 characters so are we going to be limited by how much code can be sent in a URL with the code links we added in #55
Maybe we could use github gists? or do you have any other ideas for sending larger amounts of code?
The text was updated successfully, but these errors were encountered: