Today I Learned

TIL, 2017-12-27

Reference

  • webpack-dev-server to run your own server from which to load assets.
  • webpack-watcher to watch for changes in app/javascript directory.
  • environment.js or shared.js.
  • Adding jQuery:
$ yarn add jquery

> Add an alias to the src

// config/webpack/shared.js

resolve: {
  alias: {
    jquery: "jquery/src/jquery"
  }
}

> ProvidePlugin to make the thing available.
> Require jQuery in your pack.
  • Data Transfer Object: an object used to encapsulate data. Reference
  • The indentation change after private which drives me crazy is to mark that those methods are private.
  • Rails routes url_for and direct.
  • Hash#transform_values
    • hash.transform_values { |x| x * 2 }
    • hash.transform_values(&:downcase)
  • Kernel#itself: returns self. Useful for collection.group_by(&:itself).transform_values(&:count) Reference
  • Just reviewing has_many: The foreign_key is on the other table, the primary_key is on your table. No error gets raised if you forgot the id.
  • Use Time instead of DateTime? Reference
  • Youtube API is really straightforward. :)

This project is maintained by daryllxd