Notes of Maks Nemisj

Experiments with JavaScript

javascript

Implicit return in arrow function got me…

I still have to used to this new arrow functions and implicit return statement. If you’re unfamiliar with them, here is the doc – https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions Look at this two ‘almost’ identical parts of code and think what is the difference between them? code-one.js and this one code-two.js They look the same, except that one will […]

,

Why getters/setters is a bad idea in JavaScript

UPDATE (15 May 2020) : I see a lot of comments regarding TypeScript and that there is no issue with setters/getters while using static typing. Of course, you can safely use getters/setters in the environment, which guarantees static type check, but this article is about vanilla JavaScript. This article is my opinion why I think this […]

, , ,

How to test React.js components

In this article I will explain “Why should you test react.js components”, “How can you do testing” and “What are the problems you might come across”. Testing solution which I use, doesn’t rely on the Test-utils of React and on DOM implementation ( so that you can do the node.js testing ). Why/How to test […]

, , , ,

Conditional ie comments in react.js

Sometimes easy things appear to be more complicated, than initially thought. For example conditional IE comments in HTML, which I had to add today to a code I write. At my work we have to support Internet Explorer browser version 9 an higher . In order to use media-queries we decided to use https://github.com/weblinc/media-match polyfill […]

, , , , ,

NPM, tmp and npm-xxx uncleaned paths

UPDATE: Created npm module to fix this stuff – https://www.npmjs.com/package/clean-npm-tmp Today I came to work and it appeared that builds on our Jenkins ( CI environment ) are broken due to “No space left on device” error. Further investigation showed that the whole /tmp folder was filled with strange “npm-xxx” folders, which in their turn […]

, ,

“git root” – root folder of the git repository

How often do you wanted to go to the root of the git repository? If not very often, then I do it quite often. Mercurial has this nice command hg root, but git not. In order to do it in git you have to use some long command ‘rev-parse –show-toplevel’ which I even can’t remember. […]

,

Using = null; instead of ;

How often have you done this in you code? Instead of this? While it might be used to accomplish the same result, the code above has some hidden pitfall in it. Image situation that you always use the code above, also inside your for statements. If you wouldn’t be careful enough, you might trap in […]

,

Previous Posts Next posts