Created
December 14, 2021 01:01
-
-
Save adrianbonnici/d9c4aa681d9db6c3dfa952bedcf4f15c to your computer and use it in GitHub Desktop.
Revisions
-
Adrian Bonnici created this gist
Dec 14, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,155 @@ # Learning Notes - ๐ [Things I Donโt Know as of 2018 โ Overreacted](https://overreacted.io/things-i-dont-know-as-of-2018/) - ๐ [The โBug-Oโ Notation โ Overreacted](https://overreacted.io/the-bug-o-notation/) - ๐ [The Elements of UI Engineering โ Overreacted](https://overreacted.io/the-elements-of-ui-engineering/) - ๐ [Fix Like No Oneโs Watching โ Overreacted](https://overreacted.io/fix-like-no-ones-watching/) - ๐ [Coping with Feedback โ Overreacted](https://overreacted.io/coping-with-feedback/) - ๐ [Name It, and They Will Come โ Overreacted](https://overreacted.io/name-it-and-they-will-come/) - ๐ [My Decade in Review โ Overreacted](https://overreacted.io/my-decade-in-review/) - ๐ [Goodbye, Clean Code โ Overreacted](https://overreacted.io/goodbye-clean-code/) - ๐ [The WET Codebase โ Overreacted](https://overreacted.io/the-wet-codebase/) - ๐ [Increment: Software Architecture](https://increment.com/software-architecture/) - ๐ [Increment: APIs](https://increment.com/apis/) - ๐ [The EverestEngineering Manifesto. We want our companyโฆ | by Sebastian Luehr | EverestEngineering | Medium](https://medium.com/everestengineering/manifesto-63d477287dc6) - ๐ [Software Engineering at Google](https://docs.google.com/document/d/1F8sV0geesBwOc6LouJi9lX-4UCtoFk23jhalqPHdhVk/edit#heading=h.xu2gexukxzv6) - ๐ [Turn the Ship Around!](https://www.audible.com/pd/Turn-the-Ship-Around-Audiobook/B00CQ9O36A) - ๐ [1x Engineer](https://1x.engineer/) - ๐ [GitHub - jbranchaud/til: Today I Learned](https://github.com/jbranchaud/til) # Browser * ๐ [Inside look at modern web browser (part 1) ย |ย Web ย |ย Google Developers](https://developers.google.com/web/updates/2018/09/inside-browser-part1) (Part 1 - 4) * ๐ [Processes and Threads - Computer Science Wiki](https://computersciencewiki.org/index.php/Processes_and_Threads) * ๐ [web.dev/learn](https://web.dev/learn/) ## 1. Loading Performance - ๐ [User-centric performance metrics](https://web.dev/user-centric-performance-metrics/) - ๐ [Understanding Low Bandwidth and High Latency ย |ย Web Fundamentals](https://developers.google.com/web/fundamentals/performance/poor-connectivity) - ๐ [Optimizing Content Efficiency ย |ย Web Fundamentals ย |ย Google Developers](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency) - ๐ [Reduce JavaScript Payloads with Tree Shaking ย |ย Web Fundamentals](https://developers.google.com/web/fundamentals/performance/optimizing-javascript/tree-shaking) - ๐ [The Offline Cookbook ย |ย Web Fundamentals ย |ย Google Developers](https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook) - ๐ [web.dev](https://web.dev/fast/) (Lazy Loading Resources) - ๐ [Apply instant loading with the PRPL pattern](https://web.dev/apply-instant-loading-with-prpl/) - ๐ [Resource Prioritization โ Getting the Browser to Help You](https://developers.google.com/web/fundamentals/performance/resource-prioritization) - ๐ [Introduction ย |ย Web Fundamentals ย |ย Google Developers](https://developers.google.com/web/fundamentals/performance/webpack) - ๐ [Itโs time to lazy-load offscreen iframes!](https://web.dev/iframe-lazy-loading/) - ๐ [Choose the best build tool for your project with tooling.report](https://web.dev/introducing-tooling-report/) - ๐ [Prevent layout shifting and flashes of invisibile text (FOIT) by preloading optional fonts](https://web.dev/preload-optional-fonts/) - ๐ [Native image lazy-loading for the web](https://web.dev/native-lazy-loading/) - ๐ [Extract critical CSS](https://web.dev/extract-critical-css/) ### Performance Profile Report * ๐ [Summary of Optimizations for Coupang (Lotus)](https://docs.google.com/spreadsheets/d/1uC8NtTiJlDt2opuxIEkkpc93tHR1gBHmzOR-sCgAa3I/edit#gid=693925356) * ๐ [Analysing Runtime Performance](https://docs.google.com/presentation/d/11EKujUPGxuLExjXu1PRv9SkFkt6NhhjUKQcW2cxDTso/edit) ## 2. Render Performance - ๐ [Rendering Performance ย |ย Web Fundamentals ย |ย Google Developers](https://developers.google.com/web/fundamentals/performance/rendering) - ๐ [Layers, layers, layersโฆ Be careful! | by Mariola Moreno Gonzรกlez | MรกsMรณvil Engineering | Medium](https://medium.com/masmovil-engineering/layers-layers-layers-be-careful-6838d59c07fa) - ๐ [content-visibility: the new CSS property that boosts your rendering performance](https://web.dev/content-visibility/) - ๐ [Optimize Largest Contentful Paint](https://web.dev/optimize-lcp/) - ๐ [Optimize First Input Delay](https://web.dev/optimize-fid/) - ๐ [Optimize Cumulative Layout Shift](https://web.dev/optimize-cls/) - ๐ [Monitor your web pageโs total memory usage with measureMemory()](https://web.dev/monitor-total-page-memory-usage/) - ๐ [Fixing layout instability](https://web.dev/fixing-layout-instability/) - ๐ [Are long JavaScript tasks delaying your Time to Interactive?](https://web.dev/long-tasks-devtools/) - ๐ [What should you measure to improve performance?](https://web.dev/what-should-you-measure-to-improve-performance/) ## 3. Chrome DevTools - ๐ [Chrome DevTools ย |ย Google Developers](https://developers.google.com/web/tools/chrome-devtools) ## 4. V8 Engine - ๐ [Features ยท V8](https://v8.dev/features) - ๐ [Blog ยท V8](https://v8.dev/blog) ## 5. RAIL Model - ๐ [Measure performance with the RAIL model](https://web.dev/rail/) ## 6. Security - ๐ [Security](https://developers.google.com/web/fundamentals/security) - ๐ [Why you need โcross-origin isolatedโ for powerful features](https://web.dev/why-coop-coep/) - ๐ [Know your code health with the ReportingObserver API](https://web.dev/reporting-observer/) ## 7. DOM & CSS - ๐ [Cascade and inheritance - Learn web development | MDN](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance) - ๐ [Introduction to the DOM - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction) - ๐ [CSS Basic Box Model - CSS: Cascading Style Sheets | MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model) - ๐ [ResizeObserver: itโs like document.onresize for elements](https://web.dev/resize-observer/) # JavaScript - ๐ โMental Models: Javascriptโ by Dan Abramov - ๐ [What Is JavaScript Made Of? โ Overreacted](https://overreacted.io/what-is-javascript-made-of/) - ๐ [On let vs const โ Overreacted](https://overreacted.io/on-let-vs-const/) - ๐ [Trampolines in JavaScript](https://raganwald.com/2013/03/28/trampolines-in-javascript.html) - ๐ [Meta programming - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Meta_programming) - ๐ [Proxy pattern - Wikipedia](https://en.wikipedia.org/wiki/Proxy_pattern#:~:text=In%20computer%20programming%2C%20the%20proxy,an%20interface%20to%20something%20else.) - ๐ [Proxy - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) - ๐ [GitHub - anvaka/set-vs-object: What is faster Set or Object?](https://github.com/anvaka/set-vs-object) - ๐ [javascript promises, the event loop, and the job queue - Stack Overflow](https://stackoverflow.com/questions/55676922/javascript-promises-the-event-loop-and-the-job-queue?rq=1) - ๐ [Understanding Event Loop, Call Stack, Event & Job Queue in Javascript](https://medium.com/@Rahulx1/understanding-event-loop-call-stack-event-job-queue-in-javascript-63dcd2c71ecd) - ๐ [Underscore.js | _.defer() - GeeksforGeeks](https://www.geeksforgeeks.org/underscore-js-_-defer/) - ๐ [Efficiently iterate on Javascript arrays](https://blog.kuzzle.io/efficiently-iterate-on-javascript-arrays) - ๐ [arrays - What is the difference between ( forโฆ in ) and ( forโฆ of ) statements in JavaScript? - Stack Overflow](https://stackoverflow.com/questions/29285897/what-is-the-difference-between-for-in-and-for-of-statements-in-jav#:~:text=Difference%20for..in%20and%20for,values%20of%20an%20iterable%20object.) - ๐ [Performance of Object.keys vs Object.values for getting the number of props of an object ยท GitHub](https://gist.github.com/flekschas/5aad97d1c2520db7af0a9623deec005f) - ๐ [Benchmark: isArray - MeasureThat.net](https://www.measurethat.net/Benchmarks/Show/2872/0/isarray) - ๐ [Monkey patching in JavaScript - Aurelio De Rosa blog](https://www.audero.it/blog/2016/12/05/monkey-patching-javascript/#:~:text=Monkey%20patching%20is%20a%20technique,that%20were%20missing%20in%20JavaScript.) - ๐ [JavaScript - Implicit Return | javascript Tutorial](https://riptutorial.com/javascript/example/17665/implicit-return) - ๐ [The shortest way to conditional insert properties into an object literal - DEV Community](https://dev.to/jfet97/the-shortest-way-to-conditional-insert-properties-into-an-object-literal-4ag7) - ๐ [AggregateError - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError) - ๐ [Guide to Web Authentication](https://webauthn.guide/) ## 1. Code review tips This section is meant to serve as an example on how I personally keep track of feedback from various code reviews. ### Examples 1. Wrap `console.log` or `throw new Error()` for development related error messages in a: `process.env.NODE_ENV !== โproductionโ` condition. 2. Alphabetise imports. 3. You could use the following pattern so the reduce has a single return point: ```js const _fields = this.get('ticketFieldViews').reduce( (acc, fieldView) => { if (!fieldView.get('isDestroyed')) { ... } return acc; } ) ``` 4. Optimisation: You should define a single callback function outside of the reduce instead of creating one for each field: ```js const isReactContainerViewEnabledCallback = () => false; ``` 5. You might want to move the declaration of `allowList` in the global space at the top of the file (as a constant) so JS does not have to reprocess it every time the setter is built. 6. Those VOICE constants as well the array `[VOICE_HOLD, VOICE_INBOUND, VOICE_OUTBOUND]` should be defined at the global scope so we don't reprocess it every time: ```js const VOICE_ACTIVE_STATUSES = ['voice_hold', 'voice_inbound', 'voice_outbound']; ``` 7. No need to call `Object.prototype.hasOwnProperty.call()`, use the function available on the object instead: ``` ticketTab && ticketTab.hasOwnProperty('omnitabData'); ``` 8. Please move `Object.keys(eventChannelTypes)` outside of the reduce loop. 9. Keep a collection intuitive and also applying memoization / lazy invoking to expensive regex computation. 10. Put parameters with a default value at the end of the parameter list in a functionโs parameters list. 11. Add a `isDevelopment` flag to indicate which code to be run in development mode only. 12. Hereโs another clever trick (not that Iโd particularly recommend using this one ๐) ```js const myArray = [1, 2, 3]; const {length, [length - 1]: lastItem} = myArray; ```