15 Matching Annotations
  1. Aug 2023
    1. I make a file named: app/models/active_storage/attachment.rb. Because it's in your project it takes loading precedence over the Gem version. Then inside we load the Gem version, and then monkeypatch it using class_eval: active_storage_gem_path = Gem::Specification.find_by_name('activestorage').gem_dir require "#{active_storage_gem_path}/app/models/active_storage/attachment" ActiveStorage::Attachment.class_eval do acts_as_taggable on: :tags end The slightly nasty part is locating the original file, since we can't find it normally because our new file takes precedence. This is not necessary in production, so you could put a if Rails.env.production? around it if you like I think.
  2. Nov 2022
  3. Apr 2022
    1. This latter equivalence does not hold exactly when more than two tables appear, because JOIN binds more tightly than comma. For example FROM T1 CROSS JOIN T2 INNER JOIN T3 ON condition is not the same as FROM T1, T2 INNER JOIN T3 ON condition because the condition can reference T1 in the first case but not the second.
    1. Caution: + continues the statement but not the string. puts "foo"+"bar".upcase gives you fooBAR, whereas puts ("foo"+"bar").upcase gives you FOOBAR. (Whether or not there's a newline after the +.) But: if you use a backslash instead of the plus sign, it will always give you FOOBAR, because combining lines into one statement, and then combining successive strings into one string, happen before the string method gets called.
  4. Jan 2022
  5. Dec 2021
    1. The props used for each slot inside the Tooltip. Note that componentsProps.popper prop values win over PopperProps and componentsProps.transition prop values win over TransitionProps if both are applied.
  6. Feb 2021
    1. Because of the way the CSS “or” operator works, I wouldn’t be able to mix the retina conditions with other expressions since a (b or c) would be compiled into (a or b) c and not a b or a c.
  7. Nov 2020
    1. Important caveat: in the combined expression, if the middle command has a non-zero exit status, then both the middle and the rightmost command end up getting executed.

      I don't think that is surprising, is it? Since && and || have the same order of precedence. So I think this is more of a clarification than a caveat.

      I think this is just because:

      a && b || c is equivalent to: (a && b) || c (so of course c gets evaluated if (a && b) is false (that if either a or b is false).

      I think they just mean, in this case:

      bedmap && mv || fail
      

      if mv fails, then fail still gets executed.

      Easier to see with a simpler example:

      ⟫ true && false || echo 'fail'
      fail
      
      ⟫ false && true || echo 'fail'
      fail
      

      Better example/explanation here: https://hyp.is/-foxmCVXEeuhnLM-le_R4w/mywiki.wooledge.org/BashPitfalls

      The caveat/mistake here is if you treat it / think that it is equivalent to if a then b else c. That is not the case if b has any chance of failing.

    1. What's not obvious here is how the quotes nest. A C programmer reading this would expect the first and second double-quotes to be grouped together; and then the third and fourth. But that's not the case in Bash. Bash treats the double-quotes inside the command substitution as one pair, and the double-quotes outside the substitution as another pair.

      subshell > quotes

  8. Sep 2020
    1. By default, npx will check whether <command> exists in $PATH, or in the local project binaries, and execute that. Calling npx <command> when <command> isn't already in your $PATH will automatically install a package with that name from the NPM registry for you, and invoke it. When it's done, the installed package won’t be anywhere in your globals, so you won’t have to worry about pollution in the long-term. You can prevent this behaviour by providing --no-install option.
  9. May 2020
    1. For convenience, conventions have been developed about the precedence of the logical operators, to avoid the need to write parentheses in some cases. These rules are similar to the order of operations in arithmetic. A common convention is:
  10. Oct 2013
    1. I do not think it of so much importance as to wish men who have arrived at mature age to spend time in learning it. It is enough that boys should give attention to it; and even of these, not all who are to be fitted for usefulness in the Church, but only those who are not yet engaged in any occupation of more urgent necessity, or which ought evidently to take precedence of it.

      Rhetoric is helpful, but to Saint Augustine, not as important as "knowledge."