Email or username:

Password:

Forgot your password?
1,311 posts total
Aleksei � Matiushkin

I had an intent to allow quick typo fixes for my blog via PR on GH, but it turned out there is no ability to accept direct PRs on GH from everybody.

And asking strangers to fork my repo to tell me about my typo is too much.

Aleksei � Matiushkin

Как бы отфильтровать из ленты всех, у кого по математике было три? Люди на серьезных щщах удивляются, что пять процентов от ста вдвое меньше пяти процентов от двухсот.

moscowtimes.ru/2023/12/25/chis

Aleksei � Matiushkin

Написал заключительную часть про разработку ПО ambment.cat/posts/2023-12-26-1

Mirai Kumiko

@mudasobwa как насчёт статьи касающейся рациональности девопсов, тестеров и других прикладных профессий?

Aleksei � Matiushkin

— Говорят, В. И. Ленин умел плавать задом. Правда ли это?
— С. Д., «Заповедник»

Aleksei � Matiushkin

Fancy dancing around environmental resources:

2021. The most powerful country says NATO expands all around Russia.
2022. The most powerful country explodes Nord Stream.
2023. The most powerful country delegates the commitment to spend dozens of billions of dollars on European war to the EU.
2023. The most powerful country claims Arctic shelves are now theirs.

FWIW, the most powerful country is the only country having the logistical ability to deliver weapons to Gaza.

rcinet.ca/eye-on-the-arctic/20

Fancy dancing around environmental resources:

2021. The most powerful country says NATO expands all around Russia.
2022. The most powerful country explodes Nord Stream.
2023. The most powerful country delegates the commitment to spend dozens of billions of dollars on European war to the EU.
2023. The most powerful country claims Arctic shelves are now theirs.

Aleksei � Matiushkin

Nowadays we have an ability to instantly validate the señority level of the applicant in computer science.

Ask, if they think AI aka copilot might help a developer to be more productive.

If the interviewee answers yes, they are a junior at best.

Johann Savalle

@mudasobwa well... honestly, when there is repetitive refactoring tasks (especially in the frontend world) AI automation ability to vomit template code that's usable is a real time saver. Though maybe you didn't mean frontend work...

Aleksei � Matiushkin

Написал третью часть про разработку ПО ambment.cat/posts/2023-12-25-2

Rubikoid

@mudasobwa

Пост интересный, но одно место вызывает вопросы)

> Так делать не нужно. По двум причинам: если это π, оно никогда не изменится, и его никто не спутает с ФИО генерального.

Не соглашусь.
В случае пи, его, конечно, желательно взять вообще из констант самого языка, а не задавать самому.

Однако бывают такие случаи, когда нужно положить явную константу, не предполагаемую к изменению через «настройки», потому что это может, например, сломать логику или привести к каким-нибудь странным сайдэффектам.

Michael Kalygin

@mudasobwa мне понадобилось лет 10, чтобы начать это понимать.

Но этот подход любят усложнять и требовать, например, заменяемость БД (репозитория). Ни разу ещё не видел, чтобы это было нужно. Кроме очень специфических случаев.

Для себя правило я сформулировал так: решения в коде сегодня должны минимизировать ограничения для новых решений в будущем как можно дешевле.

Сделать конфиг сразу или потом? Если легко сделать потом, то можно и потом. Если дороже будет — сейчас.

DELETED

@mudasobwa
>Я стараюсь не разводить у себя на домашней машине лишних окружений. Виртуальная машина — как проститутка: легкодоступна, но для настоящего секса малопригодна.

она может быть полезна, когда хочется поиграть с другим дистрибутивом развлечения ради (это мой юзкейс виртуалок)

Mirai Kumiko

@mudasobwa я думаю можно ещё проще.

Написать bash скрипт который создаёт папочку в которой будут находится компоненты статьи и через scp закиндывает её на сервер в папку articles и добавляет ссылку на статью в каталоге статей. А уведомление в мастодон можно реализовать через curl.

Aleksei � Matiushkin

Are there JS gurus all around?

I needed to sort an array of files of the following format: `YYYY-MM?-DD?-N?` where month and day parts might be given as 1 or two digits, and N is the trailing number that might be omitted.

I came out with something so ugly that I was afraid to look at it.

.sort(
(a, b) => [a, b].map(
(e) => e.slice(2).split("-").map(
(i) => parseInt(i)
).reverse().reduce(
(a, b, idx) => a + b * 100 ** idx
)
).reduce((a, b) => a > b ? -1 : 1)
)

Please advice.

Are there JS gurus all around?

I needed to sort an array of files of the following format: `YYYY-MM?-DD?-N?` where month and day parts might be given as 1 or two digits, and N is the trailing number that might be omitted.

I came out with something so ugly that I was afraid to look at it.

.sort(
(a, b) => [a, b].map(
(e) => e.slice(2).split("-").map(
(i) => parseInt(i)
).reverse().reduce(
(a, b, idx) => a + b * 100 ** idx
)
).reduce((a, b) => a > b ? -1 : 1)
)

Nanao Ei

@mudasobwa чатжпт:

Yes, there are JavaScript gurus all around! Sorting an array of files with the given format can be done more efficiently and elegantly. Here's an alternative approach you can consider:

```javascript
const files = ["2021-05-05-2", "2020-12-01", "2022-01-15-1", "2019-10-10-4"];

files.sort((a, b) => {
const [aDate, aNum] = a.split('-');
const [bDate, bNum] = b.split('-');

const [aYear, aMonth, aDay] = aDate.split('-').map(Number);
const [bYear, bMonth, bDay] = bDate.split('-').map(Number);

const aNumber = Number(aNum || 0);
const bNumber = Number(bNum || 0);

return (
new Date(aYear, aMonth - 1, aDay) - new Date(bYear, bMonth - 1, bDay) ||
aNumber - bNumber
);
});

console.log(files);
```

This code breaks down the filenames into their respective parts (year, month, day, number), converts them to numbers, and then uses the `Array.prototype.sort()` method to sort the files first by date and then by the number.

@mudasobwa чатжпт:

Yes, there are JavaScript gurus all around! Sorting an array of files with the given format can be done more efficiently and elegantly. Here's an alternative approach you can consider:

```javascript
const files = ["2021-05-05-2", "2020-12-01", "2022-01-15-1", "2019-10-10-4"];

files.sort((a, b) => {
const [aDate, aNum] = a.split('-');
const [bDate, bNum] = b.split('-');

Rustem Zakiev 🔥

@mudasobwa looks like this sorter is going to provide other than intended result - if you have that trailing N in any of the names, that name goes above those without one.
Is having filenames with proper leading zeroes in MM and DD not an option?

Rustem Zakiev 🔥

@mudasobwa my ugly shot:
.sort(
(a,b) => [a, b].map(
(e) => e.slice(2).split("-").map(
(i) => i.length < 2 ? "0" + i : i
).join("-")
).reduce((a, b) => a > b ? -1 : 1)
)

avverushka

@mudasobwa что слышит потусторонние звуки

Aleksei � Matiushkin

Motivational quotes are bullshit.

Motivation should be born by a willingness to make the life of others better, not by what some weirdos said decades ago.

Aleksei � Matiushkin

#ВижуРифму @shuro

метр снимал в коммунальной сортире
спал на тамбур в плацкартной вагоне
не хочу жить в шикарном квартире —

DELETED

@mudasobwa @shuro ВОЗЬМИ ИПОТЕКУ И РАБОТАЙ КАК ВЕЗДЕ-НА ЗАПАДЕ И В РОССИИ

Aleksei � Matiushkin

Написал про важность частных и неанализируемость целого. И про диаграммы немного.

ambment.cat/posts/2023-12-24-1

Rustem Zakiev 🔥

@mudasobwa
Кластеризация имеет смысл, если контекст правильный. Боксёров вон по весу кластеризуют, и ни у кого не возникает когнитивных диссонансов (что, конечно, не отменяет аутлаеров в 54 кг, которые устойчиво способны уронить центнер).
Или страховщики вон кого-то более охотно/задешевле страхуют - тоже интуитивно понятно.

Злой оптимист

@mudasobwa думаю, древнегреческий ученый Гиппократ мог бы поспорить. Его острый ум ещё лет так тысячи две с половиной все-таки провёл анализ и разделил человеков на четыре типа:
Сангвиник - мозги управляют чувствами.
Холерик - чувства управляют мозгами.
Флегматик - мозгам не хватает чувств.
Меланхолик - чувствам не хватает мозгов.
И если ты с помощью родителей умудрился родиться, то судьба твоя и сложиться по тому или иному раскладу. Мне, как сангвинику, это уже шесть десятков лет известно.

Michael Kalygin

@mudasobwa статистику и графики придумали, чтобы люди в интернете могли подпитывать свой confirmation bias и тыкать в людей ссылками с фактами.

А если серьёзно, то упрощения уместны при описании модели. Но модель имеет конкретную задачу, которую решает, и граничные условия. С интерпретацией у людей всё плохо, потому здесь огромный простор для натягивания совы на глобус в интересах пропаганды. И качество моделей, само собой, в большинстве случаев — так себе.

Aleksei � Matiushkin

I’m on the road, empty and cold
To a distant destination, without a dime
Been thinking ’bout dinner, way back in days of old
It's hard to admit it, I am starving to death, an old friend of mine

Cashbacks to our plastic, my enemy is past that has already gone
I never paid enough to gain that remedy
Cashbacks for my purchases, which I had never done
It keeps holding, holding on me wrong

I don’t deserve poverty, c’mon

Original lyrics by Elena Alexandra Apostoleanu aka INNA.

I’m on the road, empty and cold
To a distant destination, without a dime
Been thinking ’bout dinner, way back in days of old
It's hard to admit it, I am starving to death, an old friend of mine

Cashbacks to our plastic, my enemy is past that has already gone
I never paid enough to gain that remedy
Cashbacks for my purchases, which I had never done
It keeps holding, holding on me wrong

Aleksei � Matiushkin

There is an easy way to become a better developer: create and maintain your own library, supporting the last ten releases of all the dependencies and never breaking a backward compatibility, even between major versions.

Aleksei � Matiushkin

Another pro tip: provide pull requests for all the libraries you use on a daily basis, including, but not limited to the language core itself.

Aleksei � Matiushkin

The worst damage that docker made to the development culture is the ability to fine-tune the environment to the point when it’s easier to build the whole production server on the local machine to test stuff manually rather than think over and produce meaningful tests.

Since several years ago I have not set up the environment for manual tests on my local. Never.

I write the code, considering as many corner cases as I can, and then I push it to GHA where it gets tested on several environments.

Go Up