Yeah they do. Run `wsreset.exe -i` in powershell and it'll install the Windows Store after a few minutes.
513 karma · joined October 14, 2011
const foo = `aaaaaaaaaaaaaaa${bbbbbbbbbbbbb}ccccccccccccccc${ddddddddddd}`;
prettier would fix it to const foo =
`aaaaaaaaaaaaaaa${
bbbbbbbbbbbbb
}ccccccccccccccc${
ddddddddddd
}`;
(or something similar) and it would be fully equivalent.I don't like it doing that either tbh but hey prettier is good enough in most cases its worth putting up with it
for now
const useCallback = (fn, deps) => useMemo(() => fn, deps);
That's it. That's all it is. `useCallback` is a shorthand for `useMemo`, when you want to memo a function definition.Example:
const handleButtonClick = useCallback((event) => {
event.preventDefault();
window.alert(`Hello, ${name}!`)
}, [name])
is just shorthand for const handleButtonClick = useMemo(() => (event) => {
event.preventDefault();
window.alert(`Hello, ${name}!`)
}, [name]) const config = {
rootDirectory: "/tmp",
shouldFrobnicate: false,
}
I'm far from a python expert, more like a TS dev who occasionally tries to write Python, but when I'm in that situation I find that writing one-off classes seems to be python's way of doing things. I'm not a super big fan of it myself, but it works: from dataclasses import dataclass
def _create_config():
@dataclass(kw_only=True)
class Config:
root_directory: str = "/tmp"
should_frobnicate: bool = False
return Config()
config = _create_config()
I experimented with making a decorator that could do something like this, but never got it working with `mypy` so I gave up: @iife
def config():
@dataclass(kw_only=True)
class Config:
root_directory: str = "/tmp"
should_frobnicate: bool = False
return Config()
the `@iife` would make it so that `config` was a variable, not a `def`, but yeah the whole thing stank so I gave upno no no you're missing the point: on POSIX systems, go with XDG by default. cmon guys it's 2023 not 2003
So far, I uninstalled Docker-Desktop and installed Podman-Desktop, and now I can run `podman` from powershell but not from fedora. I'm about to try `sudo dnf install podman` and hope it connects to the podman-machine? I dunno, it's not exactly clear
<div class="example">
<h1 id="heading">This is an example</h1>
<h2>creating React markup</h2>
<AnotherComponent foo="bar">
<li>
<a href="http://whatever.com">One list item</a>
</li>
<li>
Another list item <hr />
</li>
</AnotherComponent>
</div>
would translate to something like this: ["div", {"class": "example"}, [
["h1", {"id": "heading"}, ["This is an example"]],
["h2", {}, ["creating React markup"]],
[AnotherComponent, {"foo": "bar"}, [
["li", {}, [
["a", {"href": "http://whatever.com"}, ["One list item"]],
],
["li", {}, [
"Another list item",
["hr", {}, []],
],
],
]
and that all Rux/JSX/hyperscript/whatever would compile down to that input: Record<string, unknown> const safeSplice = (items, start, deleteCount, ...itemsToAdd) => {
const copy = [...items];
const deleted = copy.splice(start, deleteCount, ...itemsToAdd);
return {
deleted,
list: copy,
};
};
We could put this as a jsdoc-style typescript comment just before the `const safeSplice` line: /** @type {<Item>(items: Array<Item>, start: number, deleteCount?: number, itemsToAdd?: Array<Item>) => { deleted: Array<Item>, list: Array<Item> }} */
or as a multi-line type declaration: /** @type {<Item>(
* items: Array<Item>,
* start: number,
* deleteCount?: number,
* itemsToAdd?: Array<Item>
* ) => {
* deleted: Array<Item>,
* list: Array<Item>
* }}
*/
Alternatively, you could do something like this in place of the above: /*
* @template Item
* @param {Array<Item>} items
* @param {number} start
* @param {number} [deleteCount]
* @param {Array<Item>} itemsToAdd
*/
I started out doing the former because I liked using the typescript notation, but I ended up doing the latter more often as I could leave the return type off the signature, which I prefer to do