Что общего между Telegram-ботами, турникетами и светофорами: конечные автоматы на практике

Представьте обычное утро в метро. Вы подходите к турникету, прикладываете карту, и... турникет решает, пропустить вас или нет. В этот момент происходит маленькое чудо автоматизации – турникет действует как конечный автомат, простая но эффективная система принятия решений.

Источник: <a href="https://api.vc.ru/v2.8/redirect?to=https%3A%2F%2Flenta.ru%2Fcomments%2Fnews%2F2022%2F01%2F19%2Fmmetro%2F&postId=1767177" rel="nofollow noreferrer noopener" target="_blank">пресс-служба Московского метрополитена</a>
6
1

Microsoft выпустили TypeScript 5.7 Beta

Что интересного появилось:

Небольшой пример использования оператора satisfies в TypeScript

Оператор `satisfies` указывает TS на то, какой тип переменной мы ожидаем без переопределения ее собственного типа. В некоторых случаях такая возможность оказывается очень полезной. Рассмотрим простой пример, где данный оператор может оказаться полезным.

Разработка браузерных игр с использованием Phaser3, React, Typescript

Думаю, ни для кого не секрет, что каждый уважающий себя разработчик программного обеспечения должен иметь в своем портфолио хотя бы один пет-проект, а лучше полноценный продукт, дающий дополнительный постоянный заработок. Предметных областей и тематик приложений великое множество, но среди них есть одна, которая заслуживает отдельного внимания — ра…

React Custom Hook: useTimeout

React Custom Hook: useTimeout

React Custom Hook: useStorage

React Custom Hook: useStorage

One of the key advantages of this custom hook is its simplicity. You can use it to store any type of data, such as strings, numbers, or even complex objects, with just a few lines of code. Additionally, useStorage handles the serialization and deserialization of data for you, so you don't have to worry about converting values to and from JSON.

React Custom Hook: useStateWithValidation

React Custom Hook: useStateWithValidation

One of the key advantages of this custom hook is its flexibility. You can pass any validation function that suits your specific requirements. Whether it's checking the length of a string, ensuring a numeric value falls within a certain range, or performing more complex validations, useStateWithValidation has got you covered.

React Custom Hook: useStateWithHistory

React Custom Hook: useStateWithHistory
  • Automatic history tracking: useStateWithHistory automatically keeps track of the values you set, allowing you to access the complete history whenever you need it.
  • Efficient memory usage: The hook utilizes a capacity parameter, ensuring that the history doesn't grow indefinitely. You can define the maximum number of historical values to keep, prevent…

React Custom Hook: useScript

React Custom Hook: useScript

One of the significant advantages of useScript is its ability to handle script loading asynchronously. By setting the script's async attribute to true, you ensure that it won't block the rendering of your application. This improves the performance and overall user experience, especially when dealing with larger scripts or slow network connections.

React Custom Hook: useRenderCount

React Custom Hook: useRenderCount

One of the major advantages of using useRenderCount is its simplicity. By abstracting the logic into a reusable hook, you can easily integrate it into any component without cluttering your codebase. Additionally, it provides a clear and concise way to monitor render behavior, which can be crucial for performance optimization and debugging.

React Custom Hook: usePrevious

React Custom Hook: usePrevious

This custom hook can be a game-changer in various scenarios. For instance, you can utilize usePrevious to compare and visualize changes in data, track state transitions, or implement undo/redo functionality. Additionally, it can be valuable in form handling, animations, and any situation where having access to the previous value is crucial for your…

React Custom Hook: useOnScreen

React Custom Hook: useOnScreen
1