28 Matching Annotations
  1. Apr 2022
    1. This would work if your transaction only wraps a single model's save operation. I need to wrap at least Node + Version + Attachment

      looking for a callback that you can register to happen after current transaction is committed, not just after_commit of model -- though actually, that might fire precisely when current transaction is committed, too (except that it might only get triggered for nested transactions, not the top-most transaction), so it could maybe go there ... but I think the problem is just that it doesn't belong there, because it's not specific to the model...

      I guess the OP said it best:

      I am not looking for model based after commits on update/create/etc, I want to be able to dynamically define a block that will be executed only if the current (top-most) transaction passes:

  2. Jan 2022
  3. Sep 2021
  4. Aug 2021
  5. Jul 2021
  6. Mar 2021
    1. xdg-open should do the same thing - actually, it will call gnome-open, or kde-open, or whatever, depending on your desktop environment. Thus it's more portable.
    2. The advantage is that you can use gnome-open for almost all file-types, URIs and directories. It's one command to learn, instead of trying to remember about obscure commands like sensible-browser
  7. Feb 2021
    1. One way to alleviate this configuration fatigue is by making configuration consistent and composable. That’s what Sprocket’s new “manifest.js” seeks to do.
    1. Not all cases can be covered and easily restored. And sometimes when we will reuse this function for different use-cases we will find out that it requires different restore logic.
    2. But why do we return 0? Why not 1? Why not None? And while None in most cases is as bad (or even worse) than the exceptions, turns out we should heavily rely on business logic and use-cases of this function.
    3. So, the sad conclusion is: all problems must be resolved individually depending on a specific usage context. There’s no silver bullet to resolve all ZeroDivisionErrors once and for all. And again, I am not even covering complex IO flows with retry policies and expotential timeouts.
    1. while ActiveForm currently fits 99% of my use cases, I do sometimes make modifications based on the product requirements
    2. I will continue to use form objects and push changes into the repo when I feel they are universally relevant and valuable.

      new tag?:

      • code that is universally relevant/valuable
      • non - _-specific logic
  8. Jan 2021
    1. A Svelte component that monitors an element enters or leaves the viewport/parent element. Performant and efficient thanks to using Intersection Observer under the hood. Can be used in multiple projects including lazy loading images, infinite scrolling, playing/pausing the video when in the viewport, tracking user behaviour firing link pre-fetching and animations and many many more.
  9. Oct 2020
    1. In the many projects I have maintained so far, sooner or later I always run into the same issue: circular module dependencies. Although there are many strategies and best practices on how to avoid circular dependencies. There is very little on how to fix them in a consistent and predictable way.
    2. This is how I solve circular dependency issues nowadays.
    1. As we've briefly seen already, you can listen to any event on an element with the on: directive:
  10. Sep 2020
  11. Apr 2020
  12. Jan 2020
    1. I understand this is a relational division type problem, involving having and count. These posts describe what I want to do, but I can't figure out how to apply the examples to the particular case above: