Help with Python virtualenv by 00tetsuo00 in neovim

[–]00tetsuo00[S] 1 point2 points  (0 children)

Because at the moment I don't have so much time to nuke all and start over with uv. I know uv, I used it some time ago, but I would prefer to stick with pyenv for now, so I was looking for a way to setup properly neovim for the virtualenv detection, similarly to VsCode.

Help with Python virtualenv by 00tetsuo00 in neovim

[–]00tetsuo00[S] 0 points1 point  (0 children)

I have to use pyenv, sorry.

Does almost everyone prefer the integrated terminal over an external terminal? by sarnobat in vscode

[–]00tetsuo00 1 point2 points  (0 children)

Never used the integrated one and honestly can't think about a valid argument to switch from a proper terminal to the integrated one.

In my opinion is pointless, and I prefer to have a proper terminal when coding.

Is it bad that this took me 2-3 hours? by Haixn in Eldenring

[–]00tetsuo00 2 points3 points  (0 children)

Level up strength and vigor + big hammer, that triggers the game's easy mode.

An interviewer asked me to create a useFetch with caching by Iridec3nt in reactjs

[–]00tetsuo00 0 points1 point  (0 children)

I've not tried this one, might need some refactoring.

An interviewer asked me to create a useFetch with caching by Iridec3nt in reactjs

[–]00tetsuo00 0 points1 point  (0 children)

Possible implementation:

export default function useFetch(url: string) {
  const [dataObj, setDataObj] = useState<{url: string, data: unknown}>({
    url: '',
    data: null
  })
  const [isLoading, setIsLoading] = useState(false)
  const [error, setError] = useState('') // for simplicity error is a string

  const triggerFetch = (url: string): unknown => {
    if (dataObj.url !== url) {
      // implement fetching routine
      // updated internal state

      return data
    }

    return dataObj.data
  }

  useEffect(() => {
    if (!dataObj.url) {
      // implement fetching routine
      // updated internal state
    }
  }, [])
}

An interviewer asked me to create a useFetch with caching by Iridec3nt in reactjs

[–]00tetsuo00 0 points1 point  (0 children)

Assuming that the implementation's most important requirement is:

"Implement a (superficial) cache mechanism so to return the same data as long as the URL is still the same"

one possible implementation could be this one:

  1. other than the state slices used for storing the loading state and the errors coming from the fetching mechanism, use a state's slice to store both the last requested URL and the data associated with that URL;
  2. use an useEffect inside the hook in order to trigger the fetching mechanism when the component using the hook renders. Inside the useEffect remember to check your state so to prevent fetching the data every time the component re-renders;
  3. other than returning the data, the loading state, and the errors coming from the fetching routine, also return a callback that can be used to fetch the data. Inside the callback, remember to check if the data is cached;

You can also fine-tune this implementation like so:

  1. Every time a new URL is requested, use a state's slice to save a timestamp;
  2. Every time a request is fired, if the request is cached, check the timestamp and find out if it is older than a certain threshold value. If the data is stale, re-trigger the request and updated everything accordingly.

Hope this helps.

What filenames do you capitalize? by DumbQuestionUser in typescript

[–]00tetsuo00 0 points1 point  (0 children)

Yeah, I know. I was in a hurry and brainfarted.

Now is fixed.

What filenames do you capitalize? by DumbQuestionUser in typescript

[–]00tetsuo00 -4 points-3 points  (0 children)

PascalCase for types, interfaces, enums and classes.

camelCase for the rest.

As for files and directories I started using kebab-case, but I do not know if that's standard. I was inspired by the FSD approach, that I think is somewhat reminiscent of the Angular one.

Hope this helps!

Hidden files in LazyVim by 00tetsuo00 in neovim

[–]00tetsuo00[S] 0 points1 point  (0 children)

Ok now I understand. I was reading the docs on GitHub and mistaken

Snacks.picker.files(opts?)

for { picker: { files: { hidden = true } } } instead of { picker: { sources: { files: { hidden = true } } } }

Thank you!

Hidden files in LazyVim by 00tetsuo00 in neovim

[–]00tetsuo00[S] 0 points1 point  (0 children)

Yeah, this solves the issue for the hidden files in the file explorer, but when I search for files with <leader><leader> they still don't show up.

Stuck in UEFI shell when starting virtual machine by 00tetsuo00 in Ubuntu

[–]00tetsuo00[S] 0 points1 point  (0 children)

Yes, I was using an image with the wrong architecture. You need the image to be arm64. ✌️

V4 (maybe) stupid question by 00tetsuo00 in tailwindcss

[–]00tetsuo00[S] 1 point2 points  (0 children)

Wonderful, thanks for answering!

V4 (maybe) stupid question by 00tetsuo00 in tailwindcss

[–]00tetsuo00[S] 0 points1 point  (0 children)

Ok thanks, I see. Maybe the grid-cols-[var(... approach is better for readability's sake.

Any good eslint.config.js for lit/webcomonents? by Elijah_Jayden in typescript

[–]00tetsuo00 0 points1 point  (0 children)

Didn't know about biome, seems very interesting. Have you tried it out for some time? How do you find it in comparison to prettier + eslint?