Blog

Categories:

Moving From Wordpress to Static HTML Using Hexo

Here I’ll explain how I’ve made my blog 5 times faster and got 340 ms loading time.
It’s a very honest post, and I will explain how dirty the nice things around you are.
If you wanna leave WordPress in the past, but don’t now how to start - this is a ‘step by step explanation’.
Really, I spent half a weekend for the whole process of migration and pretty happy with a result.

Read More

The Performance Testing of ES6 Generators, ES6 Promises and Callbacks

Hi, guys. It’s going to be a short post.

I investigated the performance of the modern ES6 features and got an interesting result. For benchmarking I wrote the custom benchmark (you can try it here: GitHub). It allows to compare between each other the following features:

  • Async calls with callbacks
  • Async calls with an ES6 promise
  • Async calls with a Generator
    You can manage an amount of iterations, response time in the JS file. It’s hardcoded but exported to separated variables.

It works in a pretty simple way:

  • Draws DOM and calculates initial data
  • Starts benchmark for the first implementation
  • Try to make async action XXX times (you can define an amount of iterations)
  • Calculates time for the each iteration
  • Calculates the average value
  • Choose the second implementation…
  • Draws the results for all of the implementations

Read More

How I Structured English Tenses Into JSON and Visualized It.

I have been learning English strenuously since the end of May. I have got some progress but I’m still suffering from tenses. Yesterday I decided to stop suffering and started the process of structuring of English tenses. As I was expecting the result was successful and now I’m going to explain in which way I have done it.

I have tried to explain everything, so I keep very simple things here too.

You can check the final result here:

http://english-for-engineers.tryshchenko.com/

In the end of the topic I also added GitHub link, feel free to check it and contribute. It’s OpenSource.

Read More

How to Migrate From Chart.js 1.x to 2.x

Now I’ll describe migration process and explain what we will achieve after this. If you never met Chart.js - it’s a simple, lightweight library which allows us to render beautiful charts using HTML5 Canvas. It’s free and opensource, so I’ll promote it a bit - you can check it’s page: http://www.chartjs.org/ .

The 1.x branch of Chart.js was beauty and stupid at the same time. I spent a lot of time to implement functionality like manual step calculation, extreme values calculation, pointers hiding, managing X and Y axis labels etc. But it was open source and was a pretty good option for my purposes.

Read More

Writing a Telegram Bot Step by Step

Hi! This week I interacted myself and wrote my own telegram bot. It’s a brief instruction how to make this shit working.
Firstly - please care about valid SSL certificate. Yes, Telegram requires a valid SSL certificate for webhooks. Yes, for staging server too. If you found a way to avoid it - please tell me, it will make me happy and this post more useful.

I was thinking bot creation process is something complicated but fortunately, I had mistaken. Bot workflow if pretty simple, so I will separate this flow into section

  1. Ask @BotFather for a new bot. (It’s not a joke)
  2. Configure name and avatar of your bot
  3. Doing main steps to make backend working
  4. Writing commands. Why it’s a good idea to separate commands in separate entity.
  5. Test your bot

    Read More

Avoid Selectors Hell

Hi guys. Today’s morning I was finally annoyed by current situation with columns handling in HTML / JS / CSS stack. It’s totally logical but absolutely uncomfortable to work without single column entity. So I decided to develop a single library to solve future headache.
Library is absolutely simple and developed in two editions: jQuery plugin and native js library. Both of them has the same functionality except animations. I keep animations for native version overboard: it’s will increase a library size.
Using this library you can manage columns of your table:

  • Select column to use with jquery ‘addClass’, ‘css’, ‘remove’, ‘append’ or any other options.
  • Also you can select a column in native version of script and use is with native JS DOM methods.
  • Simple hiding, displaying, toggling columns.
  • Possibility to discard all changes by one method.
  • Functions is chainable in both versions
  • DOM selector for native version similar to jquery selector.
  • Extremely small size.
    You can check, download and comment this plugin on it’s github page: https://github.com/ensaier/ash-jquery-plugin

Featured image taken from pixels.com

 

Peer to Peer Communications in a Browser: Part 1 - Basics

I have a lot experience with WebRTC and successfully done a few project using this technology. Basically it’s not a problem to share sound, video (webcam or screensharing) but you will encounter a number of problems with different API implementations in different browsers and even different versions of one browser.

Firstly I should provide you a bit basic information and explain few architecture points. Bellow you can see a simple schema of WebRTC implementation:

Read More

How to Bind Object Scope to a Closure and Invoke It in PHP7

Closures isn’t a popular feature in php community and it’s makes me sad, because closures is an useful option makes possible to increase you performance.

Firstly let’s explain me how closures basically works in PHP. The closure is an unnamed function is helpful as callback parameter.

So here I show this on example:

<?php
$sampleArray = ['1', '2', '3'];

$data = array_walk($sampleArray, function($data) {
	echo $data * 2, PHP_EOL;
});

We will see ‘2 4 6’ on the screen. You can make a callback predefined:

Read More