It also would have been more honest if it said "Web Spreadsheet in 99 lines using AngularJS and 11,331,980 lines of Code[1] in a modern web browser like Firefox."
[1] https://www.ohloh.net/p/firefox/analyses/latest/languages_su...
Back when it appeared on HN, the first thing I entered was =(function(){for(;;){}})() — which predictably froze the browser.
Trying to find a sufficiently-robust way around this restriction ended up shaping the Web Worker based structure. So, thanks for the inspiration & golfing!
Not 99 lines anymore, hence no bragging rights
And # of lines stop being a problem since VAX computers
I think the point being made here is that the OP only had to write 99 lines of original code using a few libraries and tools to get a rather impressive web based spreadsheet. If that's not impressive to you than your standards might be slightly too high.
Excel spreadsheet in 1 line of code:
<iframe width="400" height="560" frameborder="0" scrolling="no" src="https://onedrive.live.com/embed?cid=20F065AFC1ACDB2E&resid=2...
Technically, Web Worker is not a library, and Traceur is used to translate ES6 to ES5 while browser support catches on, so AngularJS is the only library used.
The non-Traceur ES5 version at https://github.com/audreyt/500lines/tree/master/spreadsheet/... has exactly the same line count, but with more idiomatic workarounds that's less clear to students new to web development (the audience of this book).
It is possible to replace AngularJS (the only external library) with regular blur/focus/change handler as @xem shows — without affecting the line counts — but the separation of concerns between view, logic and worker would be less clear.
In my previous writeups such as http://g0v.asia/tw/ , I've followed SPJ's "writing a paper" guidelines ( HN: https://news.ycombinator.com/item?id=6989806 ) — almost to the letter — which was immensely helpful as well.
Anyway, nice bunch of new ES6 features out there
The version at https://github.com/audreyt/500lines/tree/master/spreadsheet/... has exactly the same line count, but with more idiomatic workarounds that's less clear to students new to web development (the audience of this book).
It is possible to replace AngularJS (the only external library) with regular blur/focus/change handler as @xem shows — without affecting the line counts — but the separation of concerns between view, logic and worker would be less clear.
The DOM-only version had to construct its own view in JS, and use an additional #_A1 encoding to fill in calculated values into display, while the AngularJS version is declarative in that regard.
EtherCalc is mostly in maintenance mode at this moment, and the "99 lines" engine described here is an attempt to simplify its core logic both for educational and refactoring purposes.
Nice work anyway.
Here is the version — by popular demand — that only uses DOM methods and does not use Angular, still clocking at 99 lines:
https://audreyt.github.io/500lines/spreadsheet/as-without-an...
I have joined some short statements, but each line is still at most 99 characters.
Source code is at: https://github.com/audreyt/500lines/tree/master/spreadsheet/...
It was an interesting exercise — thanks for suggesting it!
Please check out the great write-up and thank you author(s).
Also, your attitude in dealing with the comments here is extremely commendable.
Excel like spreadsheet editing in the browser