Email or username:

Password:

Forgot your password?
11 posts total
Axel Rauschmayer

zsh: I never understood why the default for going back through the history is to keep duplicates. I finally looked for a way to fix that: superuser.com/questions/273047

Nikita Karamov

@rauschma this is a nice feature to pair with context. Sometimes I don't only want to know "What was that NPM script?", but also "What do I usually run before and after it?"

HSMW supports it: github.com/zdharma-continuum/h

Axel Rauschmayer

Node.js v22.7.0: If you write a script in ESM format, you previously had two choices:
– Use the filename extension .mjs
– Use the filename extension .js and a package.json with "type":"module"

There is now a third option:
– Use the filename extension .js. If there is no package.json with "type", Node.js assumes CommonJS, but transparently switches to ESM if it encounters ESM syntax (`import`, `export`, etc.).

Also works for filenames without extensions.

nodejs.org/en/blog/release/v22

#NodeJS

Node.js v22.7.0: If you write a script in ESM format, you previously had two choices:
– Use the filename extension .mjs
– Use the filename extension .js and a package.json with "type":"module"

There is now a third option:
– Use the filename extension .js. If there is no package.json with "type", Node.js assumes CommonJS, but transparently switches to ESM if it encounters ESM syntax (`import`, `export`, etc.).

Bob Massarczyk

@rauschma I understand the sentiment that Diablo 1 was "outshined" by its successor. But I feel it sells Diablo 1 unnecessarily short. Not sure whether it was my younger age but I found D1 way darker and scarier than D2. D2 was a fast-paced action slay fest (and amazing at that). D1 a horror story to find out what happened to the king.

Axel Rauschmayer

#VisualStudioCode + #TypeScript:
– Are there plans to provide more refactorings?
– Or is there a commercial product that adds more refactorings to VSC (which I don’t want to give up)?

I’m especially missing:
– Changing function parameters; especially reordering them.
– Inlining function calls. This is very useful for evolving APIs because it allows you to change call sites of old functions.

Axel Rauschmayer

#Mastodon: Profiles don’t show the full Mastodon handle anymore (v4.3.0-nightly). You can use the following bookmarklet at someone’s profile:

javascript:{

function urlToHandle(url) {
const countAts = (str) => (str.match(/@/g) ?? []).length;
const localName = url.pathname.slice(1);
return (
countAts(localName) === 2
? localName
: `${localName}@${url.hostname}`
);
}
navigator.clipboard.writeText((urlToHandle(location)))
.catch((error) => {
alert(String(error));
});

}

#Mastodon: Profiles don’t show the full Mastodon handle anymore (v4.3.0-nightly). You can use the following bookmarklet at someone’s profile:

javascript:{

function urlToHandle(url) {
const countAts = (str) => (str.match(/@/g) ?? []).length;
const localName = url.pathname.slice(1);
return (
countAts(localName) === 2
? localName
: `${localName}@${url.hostname}`
);
}
navigator.clipboard.writeText((urlToHandle(location)))
.catch((error) => {
alert(String(error));
});

Axel Rauschmayer

Are you interested in tools that let you test code in Markdown files?

I suspect it’s a niche but an important one for tech writers—e.g.: It took me a lot of work to test all code examples in my books (*) automatically but it was more than worth it! I detected many issues.
(*) exploringjs.com

Anonymous poll

Poll

Very interested
7
0%
Somewhat interested
9
0%
Not interested
1
0%
0 people voted.
Voting ended 26 February at 18:42.
Matthew Martin

@rauschma Not a niche if you think about how jupyter notebooks are essentially executable code in a file that mixes markdown and code. If you start writing a lot of code in code blocks in markdown, pretty soon you need the entire tool chain to support it (formatters, linters, run-as-script, import library from code block, test running, etc).

Anyhow at least 3 projects in python doing this: github.com/matthewdeanmartin/m

@rauschma Not a niche if you think about how jupyter notebooks are essentially executable code in a file that mixes markdown and code. If you start writing a lot of code in code blocks in markdown, pretty soon you need the entire tool chain to support it (formatters, linters, run-as-script, import library from code block, test running, etc).

AliveDevil

@rauschma
Automatic redirect to <lang>.godbolt.org, with filled in script would be interesting.
But that requires, that the Markdown is complete in the first place.

Most of the time code examples in C#/C++ aren't full-fledged samples, due to the sheer number of possible environments.

Axel Rauschmayer

Using variables in npm run scripts (package (a)rauschma/env-var must be installed locally or globally):

{
"scripts": {
"hi": "env-var echo {{npm_package_config_hi}}"
},
"config": {
"hi": "HELLO"
}
}

Works on Windows and Unix:
npm run hi

More information: exploringjs.com/nodejs-shell-s

#NodeJS

Using variables in npm run scripts (package (a)rauschma/env-var must be installed locally or globally):

{
"scripts": {
"hi": "env-var echo {{npm_package_config_hi}}"
},
"config": {
"hi": "HELLO"
}
}

Works on Windows and Unix:
npm run hi

More information: exploringjs.com/nodejs-shell-s

Braw ☕🏳️‍🌈

@rauschma if you are using pnpm, there's `shell-emulator` configuration option: pnpm.io/cli/run#shell-emulator. It lets you `DEFINE_ENVS=before script` like you'd do in regular POSIX shell. Yarn does use it by default. Kinda wish npm adopted that (probably as an option, to stay backwards compatible).

Axel Rauschmayer

“package.json contains a local aliasing mechanism for import paths called ‘imports’. It satisfies many use cases without tooling-specific solutions like tsconfig.json.”
socket.dev/blog/we-don-t-need- #JavaScript

package.json
{
"imports": {
"#components": {
"browser": "./src/components/client/*",
"default": "./src/components/server/*"
}
}
}

my-module.js
import '#components/customer-table.js';

📖 Details (in my free online book on Node.js): exploringjs.com/nodejs-shell-s

“package.json contains a local aliasing mechanism for import paths called ‘imports’. It satisfies many use cases without tooling-specific solutions like tsconfig.json.”
socket.dev/blog/we-don-t-need- #JavaScript

package.json
{
"imports": {
"#components": {
"browser": "./src/components/client/*",
"default": "./src/components/server/*"
}
}
}

Ori Livni

@rauschma To my knowledge, tools don't support this good enough for now

Axel Rauschmayer

“Apple announces alliance with Adobe, NVIDIA, and others to develop Pixar’s 3D standard”

“Open Universal Scene Description (OpenUSD) was created by Pixar Animation Studios as a 3D scene depiction technology that promises significant interoperability among tools, data, and workflows.”

Apple’s interested in using it for Augmented Reality.

macrumors.com/2023/08/01/apple

Artem R 🇺🇦

@rauschma Apple alliance with NVIDIA, such unexpected move considered their relationship history

Axel Rauschmayer

I suspect that Mastodon will never be as big as Twitter once was. But I don’t mind: I first used it in 2017 and I’m glad that it’s now a lively space, especially for tech.

I’m curious what keeps Twitter users from moving here:
– Personally, I rarely miss search.
– Quote posts are being worked on.
– Some people say it’s too complicated but I don’t understand why.

And there are several great features that Twitter doesn’t have: temporary muting, content warnings for spoilers, etc.

I suspect that Mastodon will never be as big as Twitter once was. But I don’t mind: I first used it in 2017 and I’m glad that it’s now a lively space, especially for tech.

I’m curious what keeps Twitter users from moving here:
– Personally, I rarely miss search.
– Quote posts are being worked on.
– Some people say it’s too complicated but I don’t understand why.

Show previous comments
Naman

@rauschma Using @MonaApp, I never even realize that quote toots are not a native feature. Honestly I see them used a LOT too.

𝓼𝓮𝓻𝓪𝓹𝓪𝓽𝓱🍐【ツ】☮(📍🇬🇧)

@rauschma i think it is just being a pyramid head.

living life according to what is "normal" instead of living it for one's own convictions.

nornal means, house, job, listening to authorities, using react and typescript as a frontend dev, until authorities hype something else, ....and so many other things.

it is easy.
it means just copy what majority does no questions asked.

for sure mastodon gets registered but not as the dominant thing.

...it's the mainstream pattern sadly

@rauschma i think it is just being a pyramid head.

living life according to what is "normal" instead of living it for one's own convictions.

nornal means, house, job, listening to authorities, using react and typescript as a frontend dev, until authorities hype something else, ....and so many other things.

Kevin Teljeur ❄️

@rauschma I miss search a lot, even if just for my own posts. Quote posts is a vex, but not a big deal.

For non-technical users, having to choose a server, the endless discussion of why that is, and the lecturing over why it is better. The endless admonishment over etiquette, the lists. The intensity of ND behaviour, which is diluted on other platforms. The lack of access to public service accounts.

I’m still here and you’re one of the first people I followed, but it can be hard work here.

Axel Rauschmayer

#JavaScript: By default, array.flat() flattens up to depth 1.

> [ 'a', ['b'], [['c']], [[['d']]] ].flat()
[ 'a', 'b', [ 'c' ], [ [ 'd' ] ] ]

To go as deep as possible, pass it `Infinity`:

> [ 'a', ['b'], [['c']], [[['d']]] ].flat(Infinity)
[ 'a', 'b', 'c', 'd' ]

exploringjs.com/impatient-js/c

Shannon Moeller

@rauschma Too bad TypeScript can’t understand this trick. You’re capped at 20.

Go Up