9 Matching Annotations
  1. Apr 2018
    1. The second reason this is interesting is because of callbacks that are associated with these two methods. A callback hook like after_save is actually part of the same active transaction that was opened when we called @user.save. So, if we wanted our code to execute outside of Rails’ default transaction that wraps around save or destroy, we’d want to use callback hooks like after_commit or after_destroy. If we want something specific to happen when the save transaction succeeds, we’d have to use the after_commit callback, and if we want something specific to happen when the save transaction fails, we could use the after_rollback hook.

      Rails transaction callbacks done right

  2. Aug 2017
    1. If it does not implement the touch method

      Sequelize only have update method to update the updateAt field. Research is needed to use this kind of touch method.

  3. Apr 2017
    1. //<![CDATA[ window.webpackManifest = {"0":"main.5f020f80c23aa50ebedf.js","1":"vendor.81adc64d405c8b218485.js"} //]]>
  4. Apr 2016
    1. +fx(d, ++i)

      add + sign to the left is a shorthand to converting to numbers.

      • +'-3.2' => -3.2
      • +'yoo' => NaN
    2. i = below << 1 | right

      bit string as index

    3. else

      whenever there's the second node adding in, split the node into 2 leaves in the subtree.

    4. d

      d for data, stored in node.point

    5. d3_functor

      intuitively i think is a simple accessor:

      • d3_functor(x) = (d => d.x)
      • d3_functor(y) = (d => d.y)

      But the implementation is more simpler, it's just a wrapper to make "identity" function:

      function d3_functor(v) {
        return typeof v === "function" ? v : function() { return v; };
      }
      
      d3.functor = d3_functor;
      

      So:

      • d3functor(3) = ( => 3)
      • d3_functor(d => d.x) = (d => d.x)

      : )

    6. if (dx > dy) y2_ = y1_ + dx;

      That's why input (-180, -90, 180, 90) yields extent (-180, -90, 180, 270).

      Making square is just convenient for building quad tree.