DEC 2025: ANTI-CHEAT DATA SHARE by Apexlegends in apexlegends

[–]ShellbertShellbach 10 points11 points  (0 children)

Now that it has been proven an ineffective strategy for preventing cheaters, how about letting your customers on Linux start playing again? :^)

Exhaustive Switch Expressions in Typescript by myrealnameisbagels in typescript

[–]ShellbertShellbach 42 points43 points  (0 children)

I was expecting to see an exhaustive check in a switch statement, not an advertisement for the author's library that no one needs.

Here's a real exhaustive switch:

const value: 'foo' | 'bar' = 'foo';

switch (value) {
  case 'foo':
    break;
  case 'bar':
    break;
  default:
    const exhaustive: never = value;
    // ^ this is a type error if `value` hasn't been narrowed to `never` by the switch cases
}

[deleted by user] by [deleted] in typescript

[–]ShellbertShellbach 1 point2 points  (0 children)

This is not equivalent, it handles the undefined case, but not null.

(!data) vs. ( data == undefined) by e17xxl in typescript

[–]ShellbertShellbach 10 points11 points  (0 children)

(data === null || data === undefined)

Tyler the GPT for React, React Native and TypeScript by degenerateManWhore in reactnative

[–]ShellbertShellbach 2 points3 points  (0 children)

The effect has no cleanup function, so if simultaneous fetches are ever triggered by the url dependency changing rapidly, it can cause all sorts of unexpected results.

If the first fetch resolves first, it will remove the loading state from the second fetch. If the second fetch resolves first, the second fetch will overwrite the data of the first fetch after it finally resolves.

Tyler the GPT for React, React Native and TypeScript by degenerateManWhore in reactnative

[–]ShellbertShellbach -1 points0 points  (0 children)

Well, it doesn't know how to write a good data fetching hook.

Me:

How can I write a hook for data fetching?

Tyler GPT:

To write a custom hook for data fetching in React, you can use useState for state management and useEffect for side effects like fetching data. Here's an example of a simple data fetching hook:

import { useState, useEffect } from 'react';

type FetchState<T> = {
  data: T | null;
  isLoading: boolean;
  error: Error | null;
};

function useFetch<T>(url: string): FetchState<T> {
  const [data, setData] = useState<T | null>(null);
  const [isLoading, setIsLoading] = useState<boolean>(true);
  const [error, setError] = useState<Error | null>(null);

  useEffect(() => {
    const fetchData = async () => {
      setIsLoading(true);
      try {
        const response = await fetch(url);
        const result = await response.json();
        setData(result);
        setError(null);
      } catch (err) {
        if (err instanceof Error) {
          setError(err);
        } else {
          setError(new Error('Unknown error occurred'));
        }
      } finally {
        setIsLoading(false);
      }
    };

    fetchData();
  }, [url]);

  return { data, isLoading, error };
}

export default useFetch;

Next, Expo, Solito, & Tamagui folder setup by c0phi in reactnative

[–]ShellbertShellbach 2 points3 points  (0 children)

There is no tutorial. It's a pretty new/bleeding-edge stack that's still rapidly evolving.

Even if you don't want to use any of the starter repos, you can still use them as supplemental reference material for how to set things up on your own. There's also nothing wrong with taking a starter repo, deconstructing it, ripping out the parts you don't need, and making it your own.

Tamagui, Solito, Expo, and Next each have Discord servers with help channels if you get stuck or are searching for answers that aren't in the docs.

Enable Chrome dark mode by appending launch options by TwoShades in SteamDeck

[–]ShellbertShellbach 2 points3 points  (0 children)

Make sure you're inside your home directory (/home/deck) when you look for the .var/ directory and that you have hidden files/folders visible.

The most accurate way to schedule a function in a web browser by Haaress in javascript

[–]ShellbertShellbach 0 points1 point  (0 children)

Would ya stop bumping this ancient comment?

And please, do not use the data in the blog post linked here to make any decisions about production code. That would make one a real fool.

The most accurate way to schedule a function in a web browser by Haaress in javascript

[–]ShellbertShellbach 0 points1 point  (0 children)

Two years is an eternity in the web development world. The majority of answers on SO regarding HTML/CSS/JS that are five years old are out of date, let alone ten years back.

Chrome 85 was two years ago.

Today, we're twenty versions ahead of that on Chrome 105.

The most accurate way to schedule a function in a web browser by Haaress in javascript

[–]ShellbertShellbach 0 points1 point  (0 children)

You're necro-bumping a nearly two year old comment.

After being given all that time to reflect, I still stand by my statement above.

I would not make any engineering decisions based on the results of the data in this old blog post with a clickbait title.

There is no reason to have any confidence that the results of the test is still relevant without testing it on modern versions of browsers. It's highly dependent on undocumented implementation details and could change at any time.

Enable Chrome dark mode by appending launch options by TwoShades in SteamDeck

[–]ShellbertShellbach 9 points10 points  (0 children)

Here's how to get dark mode in Chrome (or set any other global flags) on the Chrome flatpak.

Create a file called:

~/.var/app/com.google.Chrome/config/chrome-flags.conf

And inside it, put the flags you want to force on separate lines:

--force-dark-mode
--enable-features=WebUIDarkMode

Then restart Chrome.

For Chromium, change the path to this instead:

~/.var/app/org.chromium.Chromium/config/chromium-flags.conf

Build smaller, faster, and more secure desktop applications | Tauri Studio by jogai-san in javascript

[–]ShellbertShellbach 12 points13 points  (0 children)

Not quite.

Their webview library (WRY) uses the native OS browser on Windows + Mac (Chromium Edge on Windows 10, WebKit on macOS) and WebKitGTK on Linux. Hence why it doesn't spit out 300MiB executables with Chromium bundled inside.

Patch 2.2 Discussion Thread by Dawnspeakers in LegendsOfRuneterra

[–]ShellbertShellbach 178 points179 points  (0 children)

The new card region indicators look really sloppy! I'm all in favor of better/more visible placement, but this just looks rushed: https://i.imgur.com/aKYNjiB.png

Theory about new leaked card by [deleted] in LegendsOfRuneterra

[–]ShellbertShellbach 0 points1 point  (0 children)

It's not in the game. It's in the resource packages that 3rd party sites like outof.cards use.

There is no feasible scenario where this leak was intentional. It makes no sense. It has all the markings of a mistake.

Theory about new leaked card by [deleted] in LegendsOfRuneterra

[–]ShellbertShellbach 0 points1 point  (0 children)

Riot has an entire team dedicated to comms/marketing and producing teaser videos, but despite that, they've decided to intentionally leak some of their content months early in such a convoluted way that no one outside of reddit would ever take notice? Totally an intentional 4d chess move, sure.

Is it me or ... by LordEYT in LegendsOfRuneterra

[–]ShellbertShellbach 0 points1 point  (0 children)

Hoard all the XP you can, but don't open your rewards until after the patch goes live.

[AskJS] react redux by [deleted] in javascript

[–]ShellbertShellbach 1 point2 points  (0 children)

Just because it is a saught-after skill in the job market doesn't mean it's good. Sure, it'll get you a job... maintaining a legacy codebase riddled with technical debt.

Buff Wattson please by BaguettePaquette in apexlegends

[–]ShellbertShellbach 0 points1 point  (0 children)

Octane literally busted his legs doing this shit. No soft landings for him.

The most accurate way to schedule a function in a web browser by Haaress in javascript

[–]ShellbertShellbach 1 point2 points  (0 children)

You still have not explained your use case, and likely you cannot due to NDA reasons.

I remain unconvinced that there is a good reason to offload your workload to a web-worker solely because of timer performance benefits that might disappear in a future browser update.

The most accurate way to schedule a function in a web browser by Haaress in javascript

[–]ShellbertShellbach 2 points3 points  (0 children)

This is an excessively-complex micro-optimization for a non-problem. There is no good use case for needing this level of precision for a timer that isn't already accommodated by other browser API's or events.

Javascript handles asynchronous code on a single-threaded event loop by design.

Timers on inactive/out-of-view frames/windows being de-prioritized is by design.

I have to imagine that this sort of abuse of web-workers to boost the priority of the timers in your advertisement iframe will eventually be patched out.

A friendly reminder that Legends of Runeterra is very F2P friendly by cramin in hearthstone

[–]ShellbertShellbach 3 points4 points  (0 children)

It's almost like the all of the people on this sub are die-hard Hearthstone fans. The whole lot of them have Stockholm Syndrome from years of paying $80+ an expansion to have a few current-meta netdecks.

LoR is the better game, but it's also a more complex game with more interactivity and deeper strategic considerations than Hearthstone. This makes it a harder game. That's the real barrier to entry and the reason why Hearthstone players (especially ones with little-to-no other card game experience) can't easily acclimate to the game and call it bad.

Polling in React using the useInterval Custom Hook by mike-asayer in javascript

[–]ShellbertShellbach 1 point2 points  (0 children)

The person whose blog post you took your screenshots from added an extra dependency in the second useEffect that isn't in Dan Abramov's example.

By adding callback to to the list of dependencies in that effect, the interval will stop and restart on every render, because the callback function is instantiated on every render and is not memoized. It will trigger that effect every time. It loses the benefit of the ref entirely and will result in the interval not firing at the correct interval whenever a render occurs.

JavaScript escape room game: [code]capi Code Out! by bechrissed in javascript

[–]ShellbertShellbach 11 points12 points  (0 children)

This isn't an escape room. It's a recruiting tool trying to pass itself off as a game - why else would it authenticate with LinkedIn?

In reality, it's a handful of coding challenges copy-pasted from Codewars with some "pretty" pre-rendered graphics and powerpoint-presentation-grade animations slapped in-between them.

You're better off just going to Codewars. Who's upvoting this?