journal (Thu May 21 2020)

Today I learnt

  • #jsonapi
  • #stocks
  • #rails

Learnt about the structure of JSONAPI error format

Here's an example

  "errors": [
      "status": "422",
      "source": { "pointer": "/data/attributes/firstName" },
      "title":  "Invalid Attribute",
      "detail": "First name must contain at least three characters."

HTTP status codes Learnt that 4xx is for when the error is due to the client and 5xx is when the server is aware that the error is due to the server

Learnt about the shape of error objects in axios Basically, you have error.response which has properties like status

Learnt about a youtube channel on growth investing by Joseph Carlson

Payout ratio for a stock - The percentage of its earnings a compay pays out as dividends. The higher this number, the worse the stock. Because then the company is not investing its profits to grow and simply paying it out.

Learnt about the difference between various attribute accessors in rails cattr_accessor is not available on services, but it is on controllers.

If you dont pass a keyword argument to a ruby function, it uses a default. If you pass in null, it uses null and omits the default.

Other notes

Using hash.fetch is pretty much like lodash.get