Notes of Maks Nemisj

Experiments with JavaScript

javascript

What you see is NOT what you get

Recently I’ve got a pleasure to debug some bug inside node.js app. Run-time was breaking with the following error: Quite usual error, meaning that object has no forEach function. Let’s see the code itself: I bet you were surprised like I was. This is just not possible from the first look, right?. If you read […]

, , ,

Why not to use NODE_ENV for defining environments

Recently I’ve came across a couple of node.js projects which use NODE_ENV for defining environment for the Development, Testing, Acceptance and Production (DTAP) pipeline. At first sight this looks like a good idea, but I would advise against it. What we often see is that npm modules are consuming NODE_ENV as either ‘production’ or something […]

, , ,

JSON.parse welcome to my consciousness

Today JSON is widely used in different corners of software development. It’s used as data format, as configuration or even as in memory database. At my current company we also use it as configuration format. The more I use it, the more I have feeling that it’s “a bit” inconsistent and “raw”. You would expect […]

, , ,

The place where I WILL use getters in javascript

It’s going to be a short one, but powerful. Do you remember I wrote previously why getters/setters is a bad idea in JavaScript? I didn’t change my mind, I do still think so, but now I found one valid place where I can and DO want use them. You will never guess. (just kidding) Unit […]

JavaScript execution

Do you know what would be the result of the following code executed in node.js without babel and any transpiling? example.js Do you know the result ? Think good …       And one more time       Well, it appears that it depends on the version of the node.js ( and guess […]

, ,

Error handling in isomorphic node.js application

When preparing application for deploying to production env I want to ensure that everything is properly logged, especially things which are unexpected in code. That’s why, I think, proper error handling is crucial to any application. This is a short article on how to do an error handling when going live in isomporhic web app […]

, , , , , , , , ,

React.js: propTypes in ES6/ES2015 components

If you’ve decided to move react components to es6/es2015 syntax you’ve might found out that defining propTypes and contextTypes is not that seamless as it was. Babel@6.7.7 doesn’t yes support static properties on Classes and the most evident way to use propTypes is to append them to the class at the end: Though there is […]

, , , ,

Ubuntu 16.04, ViM and broken plugins

If you have moved to Ubuntu 16.04 you can find out that your old ViM stuff is not working – Some plugins are broken. This is due to the change in python interpreter for ViM ( https://wiki.ubuntu.com/XenialXerus/ReleaseNotes#VIM_defaults_to_python3 ) To fix this you have to use different package of vim, like vim-gnome-py2. If you’re like me […]

, ,

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 […]

,

Previous Posts