75 Matching Annotations
  1. Jan 2022
    1. Oh, I just figured out a workaround for my project, in case it helps someone. If you want the source of truth on the prop to come from the child component, then leave it undefined in the parent. Then, you can make the reactive variable have a condition on the presence of that variable. eg: <script> let prop; $: prop && console.log(prop); </script> <Child bind:prop/> Might not work for every use case but maybe that helps someone.
  2. Nov 2021
    1. Fixing with containIf we give each article the contain property with a value of content, when new elements are inserted the browser understands it only needs to recalculate the containing element's subtree, and not anything outside it:
  3. Oct 2021
    1. Please note that gtk-launch requires the .desktop file to be installed (i.e. located in /usr/share/applications or $HOME/.local/share/applications). So to get around this, we can use a hackish little bash function that temporarily installs the desired .desktop file before launching it. The "correct" way to install a .desktop file is via desktop-file-install but I'm going to ignore that.
    1. Applications can safely autoload constants during boot using a reloader callback: Rails.application.reloader.to_prepare do $PAYMENT_GATEWAY = Rails.env.production? ? RealGateway : MockedGateway end Rails.application.reloader.to_prepare do $PAYMENT_GATEWAY = Rails.env.production? ? RealGateway : MockedGateway end Copy That block runs when the application boots, and every time code is reloaded.

      workaround to problem described earlier

  4. Sep 2021
    1. An #each tag can loop anything with a length property, so: {#each {length: 3} as _, i} <li>{i + 1}</li> {/each} will also work, if you prefer.
    1. One good use for /dev/tty is if you're trying to call an editor in a pipeline (e.g., with xargs). Since the standard input of xargs is some list of files rather than your terminal, just doing, e.g., | xargs emacs will screw up your terminal. Instead you can use | xargs sh -c 'emacs "$@" </dev/tty' emacs to connect the editor to your terminal even though the input of xargs is coming from elsewhere.
    1. One solution is to run this command to reset your keyring password: rm ~/.local/share/keyrings/login.keyring
  5. Aug 2021
    1. Or, maybe better, interpret the list as a tuple type: const list: ['a','b','c'] = ['a','b','c']; // tuple
    2. You can force the type system to remember each value as a literal string: const list = ['a' as 'a','b' as 'b','c' as 'c']; // infers as ('a'|'b'|'c')[]
  6. Jun 2021
    1. Use this to build a ClassAdder component. ClassAdder components are useful for reducing the size of your bundle. If you have tons of simple components that just need to add classes/props or set a context, using ClassAdder components means there's only one "big" Svelte component in your bundle for all of these many tiny components.
    2. This is useful when you need to add classes to a component, since Svelte's "class:" directives don't work on components.
  7. May 2021
    1. on CSR it connects to the svelte-kit endpoint which just use a localhost connection. and to optimize this you can use unix sockets in your endpoints to connect to backend server
    1. Thanks. Worked for me. I needed to move the merged directory into a sub-folder so after following the above steps I simply used git mv source-dir/ dest/new-source-dir
    1. The super hacky alternative... using an error's stack trace When I got this to work I literally laughed out loud 😂. It might be the most hacky solution to a problem I've found yet
    1. Large regions of memory can be allocated without the need to be contiguous in physical memory – the IOMMU maps contiguous virtual addresses to the underlying fragmented physical addresses. Thus, the use of vectored I/O (scatter-gather lists) can sometimes be avoided.
  8. Apr 2021
    1. unbuffer disables the output buffering that occurs when program output is redirected. For example, suppose you are watching the output from a fifo by running it through od and then more.    od -c /tmp/fifo | more You will not see anything until a full page of output has been produced. You can disable this automatic buffering as follows:    unbuffer od -c /tmp/fifo | more
    1. fill_in('Foo', with: 'bar', fill_options: { clear: :backspace })

      first sighting: fill_options: { clear: :backspace })

      first sighting: fill_options as an option at all (for fill_in only, I presume)

      I wonder they added at all as a response to this:

      See also: https://hyp.is/ZcXVJJMyEeucgmPXYFP9yg/github.com/teamcapybara/capybara/issues/203

      (which key should have been pressed, backspace, space?)

  9. Mar 2021
    1. Now, if you also want deskopen to pass through any command-line parameters, you can instead use this slightly-modified version: #!/bin/sh desktop_file=$1 shift `grep '^Exec' "${desktop_file}" | sed 's/^Exec=//' | sed 's/%.//'` "$@" &
    1. Note that autosave will only trigger for already-persisted association records if the records themselves have been changed. This is to protect against SystemStackError caused by circular association validations.
    1. To achieve this, we created a small Compressor which wraps the Uglifier compressor and links the source maps so they are written to disk.
  10. Feb 2021
    1. To correct this, you can move these files to some subdirectory of ./app/assets/stylesheets or javascripts; or you can change the manifest.js to be more like how Rails with Sprockets 3 works, linking only the specific application files as top-level targets
    1. I have developed a simple pattern that copies errors from the model or the service into the form object so that the view can still use those errors
    1. Windows and Linux store their time in the BIOS differently, this will cause your clock to be desynchronized when you switch from one OS to the other. The easiest solution for it is to fix it in Linux, forcing it to work the same way as Windows. You can do this through the terminal:
    1. on the other hand, documents from different origins can still communicate using window.postMessage(), for example to implement collaborative iframe auto-resizing.
  11. Jan 2021
    1. The solution is min-width: 0; on the flex child Or min-width some actual value. Without this, the flex child containing the other text elements won’t narrow past the “implied width” of those text elements.
    1. I want to create a filter for all email sent by me only to me. To accomplish this I send all these "notes" to a permutation that I know no one else uses. E.g. john__doe@gmail.com
    1. How to wrap long word (text without spaces) in html table’s cell? This is very, very easy! We must add only a CSS proprty to table cell “td” tag – “word-break: break-all;” then all column’s widths become as intended. 
    1. use of the border-box property. If you add the following at the top of your CSS file, you should be able to avoid many of the problems inherent in using 100% width on your elements:
    1. Interesting . That feature (<slot slot="..."/>) was only recently added in #4295. It wasn't primarily intended to be used that way, but I guess it's a good workaround for this issue. I'm yet to find caveats to slotting components that way, other than it's inconvenient, as opposed to <Component slot="..."/>.
    1. Related to #1824, can do <svelte:component this={Bar}> <slot></slot> <slot name="header" slot="header"></slot> </svelte:component> <script> import Bar from './Bar.svelte'; </script> as a forwarding workaround
    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. If an element is disabled, you will need to use a wrapper element (<span> or <div>) in order for the tippy to work.
  12. Dec 2020
    1. I guess it's about "preloading" and not "navigation", if it's the case, then I guess there is still no way to attach to navigation events, and this issue should be kept open.
    2. No JS event is fired, so there currently isn't any clean way to do this that I can see.
    1. delete is a reserved word in JavaScript. To handle DELETE requests, export a function called del instead.
  13. Nov 2020
  14. Sep 2020
    1. Currently, I can only do this with some ugly JS, by wrapping the <slot> in a div and then selecting all direct children of that div (div>*). But this fix/solution also makes me face a problem: The <div> partially destroys the layout/design compared to when not using that div wrapper.
  15. Apr 2020