As you know, DRY means «Don’t repeat yourself». It sounds easy, isn’t it? When I first read about this, I said, “Yes, I’ve done that before! Hmm … «Piece of knowledge». What’s it? Doesn’t matter”. Yes, I tried to find out more as soon as possible. But the knowledge about the “Piece of Knowledge” still came to me… Through pain. Now let’s see how it was!

Imagine you have some kind of service where you can create and handle a client. Let’s dwell on the client creation. You wrote a cool, simple and modern component:

The component loads some…

Before talking about the Alt provided by fp-ts, we need to understand two terms. Associativity and Distributivity.

By associativity, I mean the composition of functions in which the order of the above functions is not important for result. Example from arithmetic:

`(a + b) + c = a + (b + c)`

Distributivity can be understood as the consistency of two functions on one set of three arguments. Example:

`x * (y + z) = (x * y) + (x * z)`

Now let’s look at examples of these terms in Javascript.

Nowadays create-react-app is commonly used to get started quickly developing React apps. But what if we need to add custom dependencies? We usually have a pool of dependencies that we use in each of our applications. For example redux or MobX for data storage and ESLint or TSLint for quality code. It is very tedious to add and customize them every time. In this article, I will show you how to create your own create-react-app using Yeoman.

Yeoman is a generator ecosystem. In this ecosystem, there are many different generators for different tasks, not only for creating web applications. You…

On one project it was necessary to carry out calculations with fractions. Gradually, the project began to appear scattered functions for working with fractions. In the end, we decided to combine all this into one class. Fraction has a divisor and a denominator, so we will pass these two arguments to create a class.

*/***

* @constructor

* @param {number} nominator

* @param {number} denominator

*/

constructor(nominator, denominator) {

*/** @private */*

this._nominator = nominator;

*/** @private */*

this._denominator = denominator;

}

Perhaps this is enough, but we wanted the class to create fractions not only from numbers but also…

A simple, at first glance, task — multiplying numbers, can cause a lot of problems if these numbers are large. I faced such task on Сodewars. In addition to the basic rules of multiplication, there were the following conditions:

- The arguments are passed as strings.
- The numbers may be way very large.
- Answer should be returned as a string.
- The returned “number” should not start with zeros e.g. 0123 is invalid.

There are several options for solving this problem. The most popular solution from yangzj1992. …

Front end developer, Moscow