Thursday, December 16, 2021

Git tips & tricks: Fixup last commit

Tuesday, November 26, 2019

ES6 Recipe: JSON.stringify Map

The keys of a Map can be anything, including objects. But JSON syntax only allows strings as keys...

Let's stringify Map instance to JSON...
Monday, November 25, 2019

TypeScript Recipe: Type Transformations in Practice

Compile-time errors are the best help to avoid mistakes during writing the code and prevent potential runtime-errors

So let's squeeze some juice from Ts Mapped types
Tuesday, June 5, 2018

TypeScript Recipe: Elegant Parse Boolean

There are many ways to convert String to Boolean or Number to Boolean, etc.
Here we will do it all in one and stop worry about form of boolean like parameters we receive from outside.


Lets' Convert 1 '1' and 'true' to true and 0 '0' 'false' null and undefined to false
Thursday, April 5, 2018

React Recipe: Components Error Handling

This article is about the Errors Handling in React Components using TypeScript

Not handled error in any part of the UI could crash the whole application.
Error Boundaries only catch errors in the components below them in the tree.
As of React 16, errors that were not caught by any error boundary will result in unmounting of the whole React component tree.
Catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI.
Use JS error reporting services, so that you can learn about unhandled exceptions as they happen in production, and fix them.
Thursday, December 7, 2017

Chasing the Trunk Based Development

A source-control branching model, where developers collaborate on code in a single branch called trunk, resist any pressure to create other long-lived development branches by employing documented techniques. They therefore avoid merge hell, do not break the build, and live happily ever after..
Release branch is typically a snapshot from trunk with an optional number of cherry picks that are developed on trunk and then pulled into the branch.
Tuesday, October 3, 2017

CSS Recipe: Using the Flexbox layout mode

This article is about the using the flex-box layout mode in CSS3
Flexbox is the most useful in the context of the Responsive Web Design.
Thursday, June 29, 2017

JavaScript Recipe: Round to a number of decimal places stripping trailing zeros

JS uses binary floating point to handle decimal based operations.
JavaScript calculations with floating point causes the Nonsense cases especially during the result comparisons & displaying.
If the variable was created as a Number, not a String, extra trailing zeros would be dropped automatically.
Friday, March 31, 2017

Angular recipe: Get State updates from Redux

This article is about the possible ways to retrieve your data State in Angular (read 2 or 4) from Redux Store.


It's assumed that you are already familiar with Redux ecosystem. If not click an image below:

Wednesday, March 8, 2017

Pair your Total Commander file manager with Cmder console

Do you want to feel yourself as happy on Windows as on Mac? Well, sleek console and good file-manager could help you a lot...

Cmder


Cmder is a powerful console emulator for Windows.

Here is a short tip how to pair you Cmder Console with Total Commander file manager.
Monday, March 6, 2017

Keynote: Quick Creation of Angular2 App

This article is about fast setup & start working on your ng2 application.


The process feels quite similar to Node modules creation through npm CLI commands, but here we will use Angular Command Line Interface (Angular-CLI).

Thursday, March 2, 2017

Keynote: Quick Creation of Node.js Module

This is short note about fast creation, publishing & using Node.js module via using Command Line Interface.
  • Use npm init to create package.json.
  • Run npm install --save to install dependency and save it to package.json.
When the code in the foo package does require('bar'), it will be loaded either foo/node_modules/bar or from core modules if it was installed as a global module via nmp install -g command.
Monday, February 27, 2017

Git tips & tricks: Merge vs Rebase (When to use?)

Keeping a clean history and smooth git workflow comes down to knowing the base use-cases & rules.
Rebases are how changes should pass from the top of hierarchy downwards and merges are how they flow back upwards.

  • Use git pull --rebase when pulling changes from origin.
  • Use git merge when merging feature branch changes back to master.
Rebasing Deletes Merge Commits! Never rebase master onto your feature branch!
see also –preserve-merges flag.
Using merge when pulling changes from origin ties two histories together creating interleaved messy thread of histories:
  • Interleaved history during merge: their feature X, my feature Y, their feature X, my feature Y...
  • Linear history during rebase: their feature X, their feature X, my feature Y, my feature Y...
Monday, January 30, 2017

Java recipe: Initialize an ArrayList with zeros

It's often useful to have a list filled with zeros of the specified length N.
Why would you want one? Well, it's handy during the work with algorithms, or just to avoid null checks.
Usually, instead of the List filled with 0s an Array is enough: new int[N]
- creates an array of N integers with zero value.
new ArrayList(N) (has the size 0) is NOT the same as new int[N] (has the length N)

- The integer passed to the constructor of list represents its initial capacity (the number of elements it can hold before it needs to resize its internal array) which has nothing to do with the initial number of elements in it.
Whatever, below are the bunch of ways to create the List filled with zeros, if you need one.
In each example we will create a list filled with 100 zeros. (Java8 implementation with StreamAPI included).
Monday, January 16, 2017

Keynote: URL types

More or Less, everyone could imagine what is URL, cause most web browsers display it in the address bar.
At the same time, if we'll dig dipper, many of the software engineers are not aware of the all use cases or even URL types.
So, here are some short-notes to refresh your memory.
Thursday, December 22, 2016

The Liskov Substitution Principle (LSP) flashback

Violations of the Liskov Substitution principle make your code behavior unexpected, therefore hard predictable & bad maintainable...

Liskov Substitution Principle

Subtypes must be behaviorally substitutable for their base types - official formulation
That is, if S is a subtype of T, then objects of type T in a program P may be replaced with objects of type S without altering any of the desirable properties(correctness) of that program P.

Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program. - general form
It means that we must ensure that new derived classes extend the base classes without changing ancestor's behavior.
Child classes should never break the parent class’ type definitions - simplified interpretation
Otherwords, Subclass should override the parent class’ methods in a way that does not break functionality from a client’s point of view.
Friday, September 23, 2016

Atom.io Navigation Shortcuts

Atom is a text editor that's modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file.
But, there is always an obstacle to switch IDE, cause you got used to the certain shortcuts of your current one.
I guess, on the first step an ability to navigation fast through the code is a crucial for developer.
Here are notes of the most usable Atom navigation shortcuts:
Thursday, September 22, 2016

SEO: Your Site description in Google search

When you search for something Google displays results with site/page description snippets.
Those could be either auto-generated from the keywords in page context or meta description snippet.
I bet, you could describe, what is your site about much more precisely, than search engine can assume, right?

Monday, August 22, 2016

The easiest way to start your Local Webserver with Node.js

On client-side development, it's often needed to quickly check or prove some script behavior in separate environment, so it's always good to have an extremely fast way yo launch your index.html on local web server.

npm http-server

http-server is a simple, zero-configuration command-line http server. It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development, and learning.
Tuesday, August 16, 2016

Pair your Atom editor with Cmder console

Do you want to feel yourself as happy on Windows as on Mac? Well, sleek console and cross-platform editor could help you a lot...