98 Matching Annotations
  1. Last 7 days
    1. Note that the :task option for step configures this element as a low-level circuit interface, or in other words, it will skip the wrapping with the task interface.

      This bit me because I didn't realize that. Was getting error:

      TypeError: no implicit conversion of Symbol into Integer
      

      Finally checked ctx and found it was an array...

      At least this is documented here.

    2. Using Track() with a new track semantic only makes sense when using the [:magnetic_to option] on other tasks.
  2. Feb 2021
    1. Of course our object doesn't have any contacts yet, so our controller will need to make sure that the form has at least one fields_for block to render by giving it one on initialization
    1. If you need your grid to utilize a gap between columns / rows, you won't be able to use the gap property when using this method. You'd instead need to resort to some negative margin manipulation to handle the extra gap space.
    1. You use grid-area, so the place for the side nav is allocated at start. If you hide (or even delete) the side nav, that won't change anything about this. You have to do a little trick: Set the width for the first column to 0 and change the grid-gap because otherwise you will have a (not needed) gap at the left.
    1. This gives me the layout with the full-width image and two sections of content placed; however, if I add the background to the sections, it will stop above the row-gap between section and the full-width image.
  3. Jan 2021
    1. In case you changed something in the [Install] directive, you may need to run sudo systemctl reenable YOURUNITFILE in order to recreate the symlinks in the .target directories.
    2. Just in case, daemon-reload isn't universal, have got to run systemctl --user daemon-reload for user services
    1. Note that the mere presence of this header causes premailer to be skipped, i.e., even setting skip_premailer: false will cause premailer to be skipped. The reason for that is that the skip_premailer is a simple header and the value is transformed into a string, causing 'false' to become truthy.
    1. Note that the value of canvas will be undefined until the component has mounted, so we put the logic inside the onMount lifecycle function.
    1. Note: your arrow must be an HTMLElement (not an SVGElement). To use an SVG arrow, wrap it in a <div> tag with the data-popper-arrow attribute.
    1. Elements with the disabled attribute aren't interactive, meaning users cannot focus, hover, or click them to trigger a tippy.
    1. but you'll find that wherever you have an img tag inside a link, the image will have a red border under it.
    2. if you set text-decoration: underline for all links then you will have to set text-decoration: none for special links which you don't need an underline.
    1. “JSONP is JSON with extra code” would be too easy for the real world. No, you gotta have little discrepancies. What’s the fun in programming if everything just works? Turns out JSON is not a subset of JavaScript. If all you do is take a JSON object and wrap it in a function call, one day you will be bitten by strange syntax errors, like I was today.
  4. Dec 2020
    1. JSON.parse() does not allow single quotes
    2. JSON.parse() does not allow trailing commas
    3. If the reviver only transforms some values and not others, be certain to return all untransformed values as-is, otherwise, they will be deleted from the resulting object.
  5. Nov 2020
    1. true && { echo true; false; } || { echo false; true; }
    2. Bash (like all Bourne shells) has a special syntax for referring to the list of positional parameters one at a time, and $* isn't it. Neither is $@. Both of those expand to the list of words in your script's parameters, not to each parameter as a separate word.
    3. However, this construct is not completely equivalent to if ... fi in the general case.

      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.

    4. true && ((i++)) || ((i--))
    5. Here we go again. [ is a command. It is not a syntactic marker that sits between if and some sort of C-like "condition". Nor is it used for grouping. You cannot take C-like if commands and translate them into Bash commands just by replacing parentheses with square brackets!
    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. The potential problem: if second_task fails, third_task will not run, and execution will continue to the next line of code - next_task, in this example. This may be exactly the behavior you want. Alternatively, you may be intending that if second_task fails, the script should immediately exit with its error code. In this case, the best choice is to use a block - i.e., curly braces: first_task && { second_task third_task } next_task Because we are using the -e option, if second_task fails, the script immediately exits.
    1. But using internal api's is dangerous as these may change when you update svelte. If you decide to use this, add a line to your project Readme.md mentioning which internal api's you used and why. Try to write it using other methods when you can.
    1. It's important to only prepend it with ~, because ~/ resolves to the home directory.
  6. Oct 2020
    1. The only tricky part is that the error will come back as meta.submitError, so you need to check for both when displaying your error.
    2. Some user experience issue with the proposed solution: This won't show up the inline field error message if you just hit on submit and other fields already contained errors since the code on the onSubmit won't be hit
    1. My version of https://svelte.dev/repl/9c7d12357a15457bb914705702f156d1?version=3.19.2 from https://github.com/sveltejs/svelte/issues/4586

      to try to simplify and help me understand it better.

      So the lack of synchronousness is only noticed inside handleClick.

      By the time the DOM gets updated, it has a consistent/correct state.

      In other words, the console.log shows wrong value, but template shows correct value. So this might not be an actual problem for many/most use cases.

    1. I too have been confused by behavior like this. Perhaps a clearly defined way to isolate atomic units with synchronous reactivity would help those of us still working through the idiosyncrasies of reactivity.
    2. For performance reasons, $: reactive blocks are batched up and run in the next microtask. This is the expected behavior. This is one of the things that we should talk about when we figure out how and where we want to have a section in the docs that goes into more details about reactivity. If you want something that updates synchronously and depends on another value, you can use a derived store:
    1. Anyway, If this is an expected behaviour, we should probably add an asterisk to the docs, describing the pitfall, because I believe many will be bitten by this.
    1. A simple rule of thumb: the name of the updated variable must appear on the left hand side of the assignment. For example this... const foo = obj.foo; foo.bar = 'baz';...won't update references to obj.foo.bar, unless you follow it up with obj = obj.
    1. Sometimes we can’t implement a solution that’s fully spec-compliant, and in those cases using a polyfill might be the wrong answer. A polyfill would translate into telling the rest of the codebase that it’s okay to use the feature, that it’ll work just like in modern browsers, but it might not in edge cases.
    1. The clean-up function runs before the component is removed from the UI to prevent memory leaks. Additionally, if a component renders multiple times (as they typically do), the previous effect is cleaned up before executing the next effect. In our example, this means a new subscription is created on every update.
    1. Note that if you are calling reset() and not specify new initial values, you must call it with no arguments. Be careful to avoid things like promise.catch(reset) or onChange={form.reset} in React, as they will get arguments passed to them and reinitialize your form.
  7. Sep 2020
    1. I don't understand why it just launches the mutation once and then it throws the error Function called outside component initialization, the only way to make it work is to do something like $: result = mutation(...) but it doesn't make sense, I don't want to run the mutation after each keystroke.
    1. Child can't update things by reassignment if you do:

      <Child bind:things={things} />
      

      but can if you do;

      <Child bind:things={$object.things} />
      
    1. Just throwing in <div class="{$$props.class || ''} otherChildClass"></div> seems the easiest, and it'll avoid undefined classes. I feel like many aren't noticing the undefined values getting inserted in their classes.
    1. It’s confusing enough, in fact, that the React team don’t trust you to write correct hooks code without using the special lint rules they devised.

      But even that introduces new problems. The only difference between the app on the left and the one on the right is that on the right, I’m using a custom useLocalStorage hook instead of useState. It behaves equivalently. So why do I have this lint warning all of a sudden?

      It turns out that certain built-in hooks have special treatment hard-coded in. So when you’re told that hooks are just functions, and you can do all the things you normally do with functions, it’s true… but there are some interesting caveats around that statement.

    1. In mapbox.js you'll see this line: const key = {};We can use anything as a key — we could do setContext('mapbox', ...) for example. The downside of using a string is that different component libraries might accidentally use the same one; using an object literal means the keys are guaranteed not to conflict in any circumstance (since an object only has referential equality to itself, i.e. {} !== {} whereas "x" === "x"), even when you have multiple different contexts operating across many component layers.
    1. The module specifier is always fixed. That is, you can’t change what you import depending on a condition. And you can’t assemble a specifier dynamically.
    1. In React, use the ternary operator (?) or a logical AND (&&). The logical AND can cause errors if the variable is not a boolean, so be careful with that one (or just stick with the ternary operator).
  8. Aug 2020
    1. Note that beforeUpdate will first run before the component has mounted, so we need to check for the existence of div before reading its properties.
  9. Jul 2020
    1. Because Svelte's reactivity is based on assignments, using array methods like .push() and .splice() won't automatically trigger updates.
  10. Jun 2020
    1. However, when you use an SD card as internal storage, Android formats the SD card in such a way that no other device can read it. Android also expects the adopted SD card to always be present, and won’t work quite right if you remove it.
  11. May 2020
    1. For instance, cor does not distribute over cand: compare (A cand B) cor C with (A cor C) cand (B cor C); in the case ¬A ∧ C , the second expression requires B to be defined, the first one does not
    1. Unfortunately, you cannot index an expression, which has a sub-query in it. If you want to index it, you need to create a function for it:
  12. Apr 2020
    1. As mentioned in StateMachines::Machine#state, you can define behaviors, like validations, that only execute for certain states. One important caveat here is that, due to a constraint in ActiveRecord's validation framework, custom validators will not work as expected when defined to run in multiple states.
    1. Google Tag Manager allows you to avoid tagging scripts as described below, although this is limited to a certain category of scripts – scripts that are not positional/do not define a position. It, therefore, does not handle embed scripts such as those related to advertising banners, youtube video widgets, facebook like buttons etc.
    1. Remember to call super in any subclasses that override teardown.

      And yet the Rails core chose not to use RSpec, citing how it would be too easy to write subject == expected on accident?

    1. For Rails 5, note that protect_from_forgery is no longer prepended to the before_action chain, so if you have set authenticate_user before protect_from_forgery, your request will result in "Can't verify CSRF token authenticity." To resolve this, either change the order in which you call them, or use protect_from_forgery prepend: true.
    1. This is pretty old now, but it should absolutely be mentioned that you can NOT always fall back to html - I suspect that MOST places that support markdown don't support html.

      Not sure if this is true, though. GitHub and GitLab support HTML, for example.

      Maybe comments on websites wouldn't normally allow it; I don't know. But they should. One can use this filter, for example, to make it safer.

    1. The rate limit can be just that - a limit rather than also dishing out punishment via the 24 hour block

      Why can't a plain rate limit (without additional blocking) by used even if not authenticated? Seems like it could.

    1. If all you want to do is print the results you might be used to leaving out the -print action. You generally don't want to do that when using -prune.
    2. which means that it'll also print out the name of the directory you're pruning, which usually isn't what you want. Instead it's better to explicitly specify the -print action if that's what you want
    1. This situation usually arises from external constraints not design choices such as my example with Sequel. My point is that assigning a value to a constant is allowed by Ruby in certain scopes and not others. It used to be up to the developer to choose wisely when to perform the assignment. Ruby changed on this. Not for everyone's good.
  13. Mar 2020
    1. Our WordPress plugin automatically blocks scripts that are generated on the server side (therefore returned by PHP by WordPress). Scripts that are inserted into the page via JavaScript after the loading process of that page are not and cannot be blocked automatically.
    1. YouTube will not collect and store info on the users, that are visiting your site, on its server unless they view the video
    2. unless they view the video
    1. While you can't completely stop YouTube from installing cookies through the embedded videos on your site, enabling privacy-enhanced mode will allow You Tube to install the cookies only when a user actually clicks to play one of the videos
  14. tonydye.typepad.com tonydye.typepad.com
    1. The absolutely worst thing that can happen in your anti-spam solution is to block a good email and not let anybody know about it!  Anti-spam solutions should always generate an NDR such that a legitimate sender can know their message didn't get through. (Of course, we know many legitimate users don't read nor understand NDRs, so there's still an issue)  A really good anti-spam solution should not only generate an NDR, but that NDR should have an "escape clause" in it that gives that legitimate user a special way to get through the anti-spam solution, if they take some reasonable steps.
    1. Cookies may not be detected by scanner if the related tag is triggered by actions such as form submission, scroll depth, timing delay, etc. These tags will need to be controlled by manual methods.

      With all these caveats listed, it makes me wonder for which tags auto-blocking does work. Only script tags inside of head?

      They are a bit vague in their "how it works" description...

    2. Cookies set by in-line scripting directly in the HTML is not supported by the auto-blocking functionality.
    1. However imagine we are creating a format string in a separate file, commonly because we would like to internationalize it and we rewrite it as: <?php$format = 'The %s contains %d monkeys';echo sprintf($format, $num, $location);?> We now have a problem. The order of the placeholders in the format string does not match the order of the arguments in the code. We would like to leave the code as is and simply indicate in the format string which arguments the placeholders refer to. We would write the format string like this instead: <?php$format = 'The %2$s contains %1$d monkeys';echo sprintf($format, $num, $location);?> An added benefit is that placeholders can be repeated without adding more arguments in the code.
    2. $format = 'There are %d monkeys in the %s';

      Compared to below:

      $format = 'The %s contains %d monkeys'
      
  15. Jan 2020
    1. before_destroy callbacks should be placed before dependent: :destroy associations (or use the prepend: true option), to ensure they execute before the records are deleted by dependent: :destroy.
    1. Please do not make the mistake of trying to reduce the HAVING clause with a little false relational algebra to: 1 HAVING COUNT(PS1.plane_name) = COUNT(H1.plane_name) because it does not work; it will tell you that the hangar has (n) planes in it and the pilot_name is certified for (n) planes, but not that those two sets of planes are equal to each other.
  16. Dec 2019
    1. When you do sudo you are running commands as root, another user in another shell and hence all of the setup that RVM has done for you is ignored while the command runs under sudo (such things as GEM_HOME, etc...). So to reiterate, as soon as you 'sudo' you are running as the root system user which will clear out your environment as well as any files it creates are not able to be modified by your user and will result in strange things happening
  17. Aug 2019
    1. The parentheses ( ... ) around the assignment statement are required when using object literal destructuring assignment without a declaration. {a, b} = {a: 1, b: 2} is not valid stand-alone syntax, as the {a, b} on the left-hand side is considered a block and not an object literal.
    2. Your ( ... ) expression needs to be preceded by a semicolon or it may be used to execute a function on the previous line.