Skip to content

Instantly share code, notes, and snippets.

@adrianbonnici
Created December 14, 2021 01:01
Show Gist options
  • Select an option

  • Save adrianbonnici/d9c4aa681d9db6c3dfa952bedcf4f15c to your computer and use it in GitHub Desktop.

Select an option

Save adrianbonnici/d9c4aa681d9db6c3dfa952bedcf4f15c to your computer and use it in GitHub Desktop.

Revisions

  1. Adrian Bonnici created this gist Dec 14, 2021.
    155 changes: 155 additions & 0 deletions ama-resources.md
    Original 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;
    ```