Advertisement · 728 × 90

Posts by Sukima

async function tryOp<T>(
  op: () => T | Promise<T>,
): Promise<[T, null] | [null, Error]> {
  try {
    return [await op(), null];
  } catch (error) {
    if (error instanceof Error) return [null, error];
    throw error;
  }
}

const [res, networkError] = await tryOp(() => fetch(…));
if (networkError) {
  console.log(`Network error: ${networkError.message}`);
  process.exit(1);
}

if (!res.ok) {
  console.log(`Server error: ${res.statusCode}`);
  process.exit(1);
}

const [json, jsonError] = await tryOp(() => res.json());
if (jsonError) {
  console.log('Bad payload from server');
  process.exit(1);
}

console.log(`Success: ${json.message}`);
process.exit(0);

async function tryOp<T>( op: () => T | Promise<T>, ): Promise<[T, null] | [null, Error]> { try { return [await op(), null]; } catch (error) { if (error instanceof Error) return [null, error]; throw error; } } const [res, networkError] = await tryOp(() => fetch(…)); if (networkError) { console.log(`Network error: ${networkError.message}`); process.exit(1); } if (!res.ok) { console.log(`Server error: ${res.statusCode}`); process.exit(1); } const [json, jsonError] = await tryOp(() => res.json()); if (jsonError) { console.log('Bad payload from server'); process.exit(1); } console.log(`Success: ${json.message}`); process.exit(0);

Read it! Use it! Love it! #JavaScript

4 days ago 2 0 0 0
Post image
1 week ago 8766 1237 359 120

Yes! been shouting about this from the hill top for years now!

1 week ago 1 0 0 0

A.K.A. dev.to

1 week ago 0 0 0 0
Code snippet: console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(123456789)); // '123.456.789,00 €'

Code snippet: console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(123456789)); // '123.456.789,00 €'

Here's a little party trick. Do you know that you can use `Intl` to format numbers with units and currencies? 😅

You're welcome. :)

https://www.stefanjudis

1 week ago 34 4 2 0

Teaching software engineering has officially FAILED!

If you notice most devs of a certain age say AI will help but not replace developers.

Meanwhile, younger devs seem to claim AI will eliminate developers.

There seems to be a fundamental misunderstanding of software engineering happening here.

1 week ago 0 0 0 0
Video

Every software team will eventually face a heart-stopping mistake, whether it is a developer accidentally deleting live data during a migration or a junior ops engineer unplugging a production server to use a vacuum cleaner... 😬

1 week ago 6 2 0 0
Advertisement

I feel I need to put my gen AI on a PIP.

2 weeks ago 0 0 0 0

Ah so you are saying that the act of designing software is so insignificant it is the same as a boondoggle or menial labor?! We don’t need skilled engineers anymore? I wonder if other forms of engineering should be shamed as well.

2 weeks ago 0 0 1 0
TriTarget.org A blog of personal quality

That is neat. and only a few lines of code worth copy/pasting.

I used a proxy system to perform querySelector magic on prop. Super small but convenient: tritarget.org/cdn/simple-dom.js

2 weeks ago 0 0 0 0
The "Anyone Can Code" Campaign's Impact on Software Engineering - Kagi Assistant Better search results with no ads. Welcome to Kagi (pronounced kah-gee), a paid search engine that gives power back to the user.

The "Anyone can code" movement (2010s) coincided with a $2.4T technical debt crisis. By democratizing coding without emphasizing engineering fundamentals, we may have traded accessibility for quality. 40% of IT budgets now go to fixing rushed code. kagi.com/assistant/c2...

2 weeks ago 1 0 0 0

I feel differently. I’ll disagree with this. I don’t feel the supply chain should be fully responsible for such things and the runtimes should handle most of that. I also think our situation here is based on a restriction that I feel the industry should reevaluate and handle differently. IMHO.

2 weeks ago 0 0 1 0

It is almost as if we were to write and understand our own code; build skill/knowledge toolbelts; instead of relying on others to write every little function for us… 🤔

2 weeks ago 0 0 1 0

In light of the NPM supply chain attacks I like to highlight @tiddlywiki.bsky.social as a fantastic full featured wiki with ZERO dependencies!

2 weeks ago 2 0 0 0

Streams are epic! Thank you for making streaming compatible APIs for your libraries.

2 weeks ago 0 0 0 0
Advertisement

Yes, this has always been an issue. Many of the old forums (Usenet/IRC) would use moderators to help keep content on topic. But the forums that lack oversight go off the rails very quickly.

3 weeks ago 0 0 0 0

I know it isn’t popular anymore but I’ve had great success using PlantUML for diagrams both at work and on my personal blog.

3 weeks ago 1 0 0 0

Strange, FF doesn’t seem to do that on my Linux machine. I wonder why the wide variance in experiences.

3 weeks ago 0 0 0 0
Preview
Wikipedia Bans AI-Generated Content “In recent months, more and more administrative reports centered on LLM-related issues, and editors were being overwhelmed.”

after much deliberation and giving AI the benefit of the doubt, Wikipedia editors have had enough of AI slop. New policy bans LLM generated content, periodt www.404media.co/wikipedia-ba...

3 weeks ago 8308 2312 106 273
Post image

It would be nice if browser automatically load the WebAssembly modules, bind the native web APIs directly (without any JS glue code), and run the module.

We could write the code for web apps in any language and then compile it to a WASM.

hacks.mozilla.org/2026/02/maki...

#wasm #webdev #javascript

1 month ago 1 1 0 0

Safari is T H E W O R S T! Fsck Apple!

1 month ago 0 0 0 0

Tell that to the tech bros signing all our paychecks!

1 month ago 1 0 0 0
Advertisement

"Sunk costs."

Is they just MAGA harder, they'll get there. There's got to be a pony under so much bullshit.

1 month ago 6 4 0 0
Regular language - Wikipedia

Yes but RegExp are really good at parsing regular languages. en.wikipedia.org/wiki/Regular...

1 month ago 1 0 1 0
The lost art of XML — mmagueta

marcosmagueta.com/blog/the-los...
An absolutely perfect historical opinion. Well done.

1 month ago 1 0 0 0

Think AI can popularize generator functions? Or Explicit Resource Management?

1 month ago 0 0 1 0

... when the puriteens in the fandom get like this, I admit, I do have thoughts of "I have fursonas are older than you."

1 month ago 20 7 1 0

class … extends EventTarget {}
class … extends Event {}

Vastly underutilized #JavaScript event mechanics worth having in your tool belt.

1 month ago 0 0 0 0
Why Posting Your Kids Online Is More Risky Than You Think
Why Posting Your Kids Online Is More Risky Than You Think YouTube video by Creating Wealth

I’ve only been shouting this message at the top of the mountain for decades now. youtube.com/shorts/sURAR...

1 month ago 0 0 0 0
Advertisement
Blink Shell is a professional, desktop grade terminal for iOS. With Mosh & SSH clients for iOS, local UNIX tools, lightning fast and fully customizable. The best terminal for iOS and iPadOS.

Blink.sh is the best iPad SSH client I’ve ever seen! So worth it!

For GUI I’ve been using jumpdesktop.com to connect to xrdp server and it works very well except it has an issue of stuck CMD keys after an Cmd-Tab (Apple issue I think).

1 month ago 0 0 0 0