Today I Learned

TIL, 2018-05-07, show books in the front-end.

Musings, JS

  • [On “Link cannot appear as a descendant in react-bootstrap’s NavItem][]
  • [ is not a function][]: You’re trying to iterate over a non-array. You’re iterating over the JSON hash, not the books inside the JSON hash.
  • [Flow type for is a thing][] for type-checking JS.
  • I used flex-basis and flex-wrap to solve column things.
  • [Preprocessors for browsers?][]
  • Array.join(' ,') also works for JS now? Yay.
  • <NavItem componentClass={Link} href="/expenses" to="/expenses" active={window.location.pathname === '/expenses'}>

JS Project Guidelines


  • Git: Feature branch, develop branch, PR to develop, update local develop branch and do an interactive rebase before pushing your feature and making a PR, delete local and remote feature branches after merging, make sure your feature branch builds successfully.
  • Git workflow: Feature-branch workflow with interactive rebase.
    • git rebase -i --autosquash develop to squash all commits into a single commit.
  • Commit messages: Separate subject from body with a newline, capitalize subject line, do not end with a period, imperative mood.
  • [README template.][]
  • Environments: separate development, test, and production environments.
    • nvm and .nvmrc in the root.
    • preinstall script to check node and npm version.
    • Use Docker image if you can.
  • Testing: test mode.
    • Naming convention: *.test.js or *.spec.js.
    • Use a static type checker.
  • Structure and naming: organize your files around product features, not roles.
  • Code style:
    • ESLint as linter.
    • AirBNB JS Style guide.
    • prettier and .editorConfig.
  • Code style checker to remove console logs in production. Use logging libraries (winston, node-bunyan).

Musings, Ruby/Back-end

  • [API Security checklist.][]
  • [Disadvantages of Pub-Sub Implementation][]
    • The event payload must be well-defined, so when it’s changed, all Subscribers must be changed. So it’s harder to refactor Publisher code.
    • Need to make sure that the Messaging Bus is stable. Services such as Rabbit, Pusher, etc. are more stable than Wisper for more complex systems.
  • [Implementing PUB/SUB in Rails; using ActiveSupport::Notifications][]
    • Mail deliveries + code, instead of after_save, we use the PS to publish a “user signed up” event.
    • “User milestone reached”.
    • Pubsub is synchronous, you still need a Sidekiq or something.
  • [Sucker Punch][]
    • A single-process Ruby asynchronous processing library. This means you can run it inside the Rails app. You can do this thing in the background within the same process as your web app.
  • Tried out AWS Transcribe. Wow it’s actually really smart, to be honest. But I was listening to like really cool shit anyway. I need to ask people about it.

This project is maintained by daryllxd