- Jan 2021
-
svelte.dev svelte.dev
-
https://github.com/sveltejs/svelte/issues/1037#issuecomment-737872461
Explanation (from https://github.com/sveltejs/svelte/issues/1037#issuecomment-739458005):
@AlexGalays register is an action created and passed in from the parent node (Wrapper) which allows the child to register with it. Not builtin to svelte.
That's very clever @PatrickG. Nice one. I was a bit confused when first looking at it to understand what was going on, but I think that will be a handy tool in the toolbox.
But why do we need this? If we remove all use:register, it still toggles just fine. Seems the only benefit is that this allows cleanup.
-
- Dec 2020
-
developer.mozilla.org developer.mozilla.org
-
This creates an options object with a getter function for the passive property; the getter sets a flag, passiveSupported, to true if it gets called. That means that if the browser checks the value of the passive property on the options object, passiveSupported will be set to true; otherwise, it will remain false. We then call addEventListener() to set up a fake event handler, specifying those options, so that the options will be checked if the browser recognizes an object as the third parameter.
-
- Oct 2020
-
dylanvann.com dylanvann.com
-
Using another reactive statement with $effect we have Svelte automatically handle subscribing and unsubscribing to the store
-
-
-
Proposed workarounds get particularly awkward for multiple stores
good example follows
-
- Sep 2020
-
svelte.dev svelte.dev
-
github.com github.com
-
Using a reactive statement is a good way to explicitly turn a reactive variable into a store
-
-
github.com github.com
-
Some Svelte component's allow you to bind to internal data which doesn't make too much sense outside of Svelte yet they often form an important part of the API. Instead I have added the option to use a watch* prop (similar to the on* prop). This also takes a callback function and recieves the value you wish to watch as its only argument. watchNumber={ n => setCount(n) } would watch the internal value number, when number changes the callback you passed to it would be executed receiving the new number value as its only argument. This may seem strange but many Svelte components are written to make use of this bind syntax, without it there is often a hole in the API leaving you unable to respond to internal state changes. You will probably want to control your state with React, this watch* prop is an escape hatch that allows you to pull out those internal values to use however you wish.
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
github.com github.com
-
Force everything to the git root per NPM lameness
-
- Aug 2020
-
github.com github.com
-
Safari sends following order application/xml (q is 1) application/xhtml+xml (q is 1) image/png (q is 1) text/html (q is 0.9) text/plain (q is 0.8) \*/\* (q is 0.5) So you visit www.myappp.com in safari and if the app supports .xml then Rails should render .xml file. This is not what user wants to see. User wants to see .html page not .xml page.
-
- Jul 2020
-
code-examples.net code-examples.net
-
JSON parsing is always pain in ass. If the input is not as expected it throws an error and crashes what you are doing. You can use the following tiny function to safely parse your input. It always turns an object even if the input is not valid or is already an object which is better for most cases.
It would be nicer if the parse method provided an option to do it safely and always fall back to returning an object instead of raising exception if it couldn't parse the input.
-
- May 2020
-
-
This is it. I'm done with Page Translator, but you don't have to be. Fork the repo. Distribute the code yourself. This is now a cat-and-mouse game with Mozilla. Users will have to jump from one extension to another until language translation is a standard feature or the extension policy changes.
-
- Apr 2020
-
stackoverflow.com stackoverflow.com
-
The issue I see is that the browser agent might be smart enough to learn the autocomplete attribute and apply it next time it sees the form. If it does do this, the only way I can see to still get around the problem would be to dynamically change the autocomplete attribute value when the page is generated.
-
Simply make your input readonly, and on focus, remove it. This is a very simple approach and browsers will not populate readonly inputs. Therefore, this method is accepted and will never be overwritten by future browser updates.
-
-
stackoverflow.com stackoverflow.com
-
queue.acm.org queue.acm.org
-
We neglected to implement any form of partial export as well, which means that power users sometimes need to resort to silly things such as breaking up their export files by hand in order to have better success when importing
Tags
Annotators
URL
-
- Mar 2020
-
www.wired.com www.wired.com
-
More than two years later, one of those fixes is erasing gorillas, and some other primates, from the service’s lexicon. The awkward workaround illustrates the difficulties Google and other tech companies face in advancing image-recognition technology
-
- Feb 2020
-
unix.stackexchange.com unix.stackexchange.com
-
COLUMNS=9999 top -b -c -n 1 | sed 's/ *$//'
-
- Jan 2020
-
database.guide database.guide
-
Or to bring it up to SQL Server 2017 level: ALTER DATABASE MyDatabase SET COMPATIBILITY_LEVEL = 140;
-
- Dec 2019
-
stackoverflow.com stackoverflow.com
-
For those (like me) wondering why is the space needed, man bash has this to say about it: > Note that a negative offset must be separated from the colon by at least one space to avoid being confused with the :- expansion.
-
-
reactjs.org reactjs.org
-
This problem can also come up when you use npm link or an equivalent. In that case, your bundler might “see” two Reacts — one in application folder and one in your library folder. Assuming myapp and mylib are sibling folders, one possible fix is to run npm link ../myapp/node_modules/react from mylib. This should make the library use the application’s React copy.
-
-
stackoverflow.com stackoverflow.com
-
In case anyone wants a hack, here is what I came up with.
-
-
-
Sadly, generating .d.ts files isn't supported by the webpack integration (not sure if this is planned), and due to microsoft/TypeScript#29490 it requires a separate tsconfig.json file to make it all work:
-
- Nov 2019
-
material-ui.com material-ui.com
-
This does not set the native input element to indeterminate due to inconsistent behavior across browsers. However, we set a data-indeterminate attribute on the input.
-
-
developer.mozilla.org developer.mozilla.orgwith1
-
Using with is not recommended, and is forbidden in ECMAScript 5 strict mode. The recommended alternative is to assign the object whose properties you want to access to a temporary variable.
-