TIL, 2017-12-27
webpack-dev-server
to run your own server from which to load assets.webpack-watcher
to watch for changes inapp/javascript
directory.environment.js
orshared.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 areprivate
. - Rails routes
url_for
anddirect
. Hash#transform_values
hash.transform_values { |x| x * 2 }
hash.transform_values(&:downcase)
Kernel#itself
: returnsself
. Useful forcollection.group_by(&:itself).transform_values(&:count)
Reference- Just reviewing
has_many
: Theforeign_key
is on the other table, theprimary_key
is on your table. No error gets raised if you forgot theid
. - Use
Time
instead ofDateTime
? Reference - Youtube API is really straightforward. :)