Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Particles – the URL contains the whole program code (easylang.online)
58 points by chkas on June 26, 2022 | hide | past | favorite | 21 comments


Partly this is doable because although RFC 2616 (HTTP/1.1) specifies a max URL length of 2048 bytes, all the major browsers will process URLs which are much longer, with Safari allowing URL strings up to 2GB in size![1]

In 2021 probably one of the bigger blockers of giant URLs is CDNs, which impose various limits on URL size. e.g. Cloudflare limits URLs to 16kb.

[1] https://github.com/apple/swift-corelibs-foundation/blob/b23d...


Using fragments instead of query strings bypasses CDN limits, but obviously those are going to be a lot more fragile in general.


What about in 2022?


What am I missing? the URL is just https://easylang.online/run/

--edit-- ah its in the link, which then is not visible in the address bar anymore. Got it :)


Chrome? I see it on webkit/surf no prob.


flems.io (lightweight online html, js,css editor) does this also. i was very impressed, when i first encountered this. Everything is encoded in the url to share.

https://flems.io/#0=N4IgzgpgNhDGAuEAmIBcIB0ALeBbKIANCAGYCWMY...

cryptpad does the same, i read yesterday. https://cryptpad.fr/


URL parameters starting with # sound interesting, since they are obviously not sent to the server.


It's called a "fragment", and it's never sent to the server in HTTP requests. It was originally intended to have an HTML anchor as its value. Like when you click on a section or paragraph and you see the URL in the location bar gets "#<anchor>".


It now also works with "#" parameter code - which is not sent to the server unnecessarily.

https://easylang.online/run/#code=%23%20Pendulum%0A%23%20%0A...


I looked it up: "#" is the location.hash and sets the anchor part of a URL. And is probably perfect for client side parameters, which is what I need. Such a discussion on HN is really often very helpful. There was a comment here that unfortunately got deleted again before I could reply that mentioned that.


In case anybody would like to view the source, see below (via PowerShell[0]):

    $Post = Invoke-WebRequest -URI "https://news.ycombinator.com/item?id=31883209" -UseBasicParsing
    $Link = $Post.Links.Where{$_.href -like "https://easylang.online/run/?code=*"}.href
    $EncodedCode = $Link -replace "https://easylang.online/run/\?code=(.+)",'$1'
    $Code = [Web.HTTPUtility]::URLDecode($EncodedCode)
    Write-Output $Code
[0]: https://github.com/PowerShell/PowerShell, note that Windows PowerShell 5.x is installed on most Windows systems by default.


Or you click on "Code" on the web page.


THe URL is 1548 character long, which is below the "safe" length limit for URLs of 2058 characters. With Internet Explorer gone, URLs of up to 8192 chars length should work on all browsers.

https://stackoverflow.com/questions/417142/what-is-the-maxim...


Here’s a list of example programs:

https://easylang.online/run/list.html

Also reminds me of this:

https://viz.intelligence.rocks/


Wow, very friendly and welcoming UI/UX that quickly makes me try out stuff. It looks simple but the flow is very polished. Good job! P.S. Do you have more plans for this app? I see there's tutorials on programming.


Thanks. The main motivation was to develop a programming language for beginners. The code runner, the web apps, and the various tutorials were created kind of on the side.


Cool, but why are the variables named like you are trying to conserve memory? I understand `dx` and `dy`, but `thres` and `n_part` ?


For me the code is more maintainable if the variable names are not too long. (thres = threshold, n_part = number of particles)


How is this different from Try It Online https://tio.run ?


It runs in the browser using WASM, not on the server. And it is a beginner-friendly programming language.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: