Thursday, April 22, 2021

CSS: Position Sticky

A 5-minute read on CSS sticky: https://elad.medium.com/css-position-sticky-how-it-really-works-54cd01dc2d46 

Sunday, March 21, 2021

OO vs FP

 Fumbled across this article that explained in simple terms the difference between Object Oriented Program Vs Functional Programming.

https://www.codenewbie.org/blogs/object-oriented-programming-vs-functional-programming

Sunday, March 14, 2021

OAuth

 What if a little thing that you learned increases your appetite and inquisitiveness to learn more? I found the following you tube introductory tutorial on OAuth and got into the rabbit hole of learning more. Check it out:

https://www.youtube.com/watch?v=t4-416mg6iU

About OAuth flows from the same presenter:

https://www.youtube.com/watch?v=3pZ3Nh8tgTE

Here's another one from the same author on JWT:

https://www.youtube.com/watch?v=soGRyl9ztjI


Monday, January 18, 2021

TypeScript: A basic understanding

  • TypeScript is a superset of JavaScript.
  • TypeScript file gets transpiled into a JavaScript file.
  • TypeScript is all about Types. A JavaScript variable can be assigned with any primitive type. TypeScript on the other hand helps to define the type of a variable.
  • Following are the pre-defined types in TypeScript: boolean, bigint, null, number, string, symbol, object, undefined, any, unknown, never, void.
  • On the other hand, TypeScript provides two syntaxes to build types: Interfaces and Types.
  • Also, TypeScript helps you to create complex types by combining simple ones. There are two popular ways to do so: Unions, Generics.
  • Read more: https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html. This page is good enough to get a clear understanding of TypeScript.
Other references:

Jest (just) in Five Minutes

  • What is Jest?
    • Jest is a JavaScript testing framework maintained by Facebook, Inc.
  • Any easy tip to remember the syntactical steps of what you do when you write a test?
    • DIE Matchers (Describe the Test(It) that Expects the result to Match the expectation)
  • How does Jest supports mocking?
    • jest.fn - allows you to mock a function. All mock functions have this '.mock' property.
    • jest.mock - allows you to mock a module (module is the JavaScript module that was exported using module.exports or export default)
    • jest.spyOn - allows you to mock either the whole module or the individual functions of the module. At its most general usage, it can be used to track calls on a method (read this nice article: https://blog.echobind.com/how-to-mock-using-jest-spyon-d13d57a8434d)
    • NOTE: you can't spy something that doesn't exist on the object.
  • How does the mock functions help you in the testing?
    • Mock functions allow you to test the links between code by erasing the actual implementation of a function, capturing calls to the function (and the parameters passed in those calls), capturing instances of constructor functions when instantiated with new, and allowing test-time configuration of return values. Read more: https://jestjs.io/docs/en/mock-functions

What if I try here to cover a little bit on Jasmine?

  • How does Jasmine supports mocking?
    • jasmine.createSpy - to mock a function
    • jasmine.createSpyObj - to mock a module
    • jasmine.spyOn - to mock the individual functions of the module



Wednesday, January 13, 2021

Friday, January 8, 2021

DOM, Shadow DOM, and Virtual DOM

Found this article today that made a good effort in explaining the DOM, Shadow DOM, Virtual DOM and the differences between them.

Read on:

https://www.blog.duomly.com/what-is-the-difference-between-shadow-dom-and-virtual-dom/