Hilariously awesome. I'm curious whether the multiple warnings about running untrusted code in the browser are necessary. I feel like all websites are already untrusted code, and the browser is quite well sandboxed and protected from anything too bad happening. What is the worst case scenario here for the user within the JS ecosystem, under known avenues of attack, not counting an unknown zero day browser exploit?
Reminds me of "security expert" warnings in the mass media where every time something happens they tell people effectively the same thing "don't do things unless you know / trust it". Most people have no clue what they're running and can't possibly take the time to know enough to really have a clue.
Stacksort – Searches StackOverflow for sorting functions and runs them (2013)
81–86 of 86 posts
Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)
#82https://github.com/jamesjennings/stacksolve
I cringe at the code now, but still think the idea is neat.
Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)
#83Hilariously awesome. I'm curious whether the multiple warnings about running untrusted code in the browser are necessary. I feel like all websites are already untrusted code, and the browser is quite well sandboxed and protected from anything too bad happening. What is the worst case scenario here for the user within the JS ecosystem, under known avenues of attack, not counting an unknown zero day browser exploit?
Reminds me of "security expert" warnings in the mass media where every time something happens they tell people effectively the same thing "don't do things unless you know / trust it". Most people have no clue what they're running and can't possibly take the time to know enough to really have a clue.
Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)
#84Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)
#85Earlier quoted context omitted.
Is it terrible that I am highly tempted to use this as an API, forcing the value in via headless chrome then printing the page to a PDF and using OCR & regular expressions to extract a sorted list? I'm pretty sure that's an O(1) (ish, not really) which I always heard was the best kind.
It's not O(1). You are only calling the API once, but if you put in a larger list the time will increase in accordance to whatever the complexity is of the sorting happening behind the scenes. Calling this O(1) would be like saying qsort is O(1) because you are only calling the function once.
Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)
#86Earlier quoted context omitted.
That conversation about for..in - any JS experts that can say whether modules or other new advances will help with this? Not being able to use the standard functions on primitives because random other code messes with them sounds like pogo sticking in a minefield.
for (let x of xs) in more recent versions of JS is how you iterate an array without facing that prototype pollution problem. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...