Today I Learned

TIL, 2018-05-09, Think about Higher-Ordered Components in React

Musings JS

// package.json

"scripts": {
  "start": "NODE_PATH=src/ react-scripts start",
  "build": "NODE_PATH=src/ react-scripts build",
  "test": "NODE_PATH=src/ react-scripts test — env=jsdom",
  "eject": "NODE_PATH=src/ react-scripts eject"
}

Musings, Ruby

  • RubyTapas 38: Caller-Specified Fallback Handler. Punt an error like this:
def get_temp(query, &fallback)
  begin
    fallback ||= DEFAULT_FALLBACK # There is a default proc that executes if something goes wrong, but the client has the option to create their own error handler
    # Do things that can lead to an error ...
  rescue => error
    fallback.call(error)
  end
end
  • RubyTapas 160: Reduce Redux.
    • Reduce to do a deep_fetch?
    • Checksum using Binary XOR.
  • RubyTapas 159: Using Set.
    • Union operator (avdi_list | stacey_list).
    • Intersection (avdi & stacey).
    • Difference/complement between 2 lists: (avdi - stacey).
    • Pipe equals operator: Preserves uniqueness. avdi_list |= ['granola'] to add to the union.
  • RubyTapas 158: Constant Lookup Scope.
    • Planets::Jupiter is different from module Planets; module Jupiter; end; end. The lookup chain is based on the lexical scope of the code, not the current module.
    • No reason to use the shorthand form of module declaration. Declare them explicitly.

This project is maintained by daryllxd