Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser

Build your own interactive JavaScript playground

posted in JavaScript on 2018-11-13   code function const console exports editor require file error js

Recently I spent some time working on my own JavaScript playground called Demoit. Something like CodeSandbox, JSBin or Codepen. I already blogged about why I did it but decided to write down some implementation details. Everything happens at runtime in the browser so it is pretty interesting project.

read more

React and separation of concerns

posted in JavaScript on 2018-05-27   loading users return error component react function data app css

Years ago when Facebook announced their JSX syntax we had a wave of comments how this was against some of the well established good practices. The main point of most people was that it violates the separation of concerns. They said that React and its JSX are mixing HTML, CSS and JavaScript which were suppose to be separated.

In this article we will see how React and its ecosystem has quite good separation of concerns. We will prove that markup, styles and logic may live in the same JavaScript land and still be separated.

read more

Implementing an async queue in 23 lines of code

posted in JavaScript on 2018-05-07   tasks taskindex getnexttask numofworkers function result promise task array process error run

Recently we had an interesting task at work. The user makes a selection of items and clicks a button. Then for every selected item we have to make a request to our API. The thing is that the user may click as many items as he/she wants. In order to speed up the process we decided to handle four requests in parallel and once some of them is finished we pull the next one. If you ask why exactly four requests in parallel read this paper.

read more

Meet the JavaScript pattern of the year or how to handle async like a boss

posted in JavaScript on 2017-11-24   generator player function result return position error const console log yield call player

Sometimes when you learn something new you get really excited. Excited to that level so you want to teach it to someone. That is the case with the concept which I found a couple of months ago. It is an implementation of the command pattern using generators. Or the well known saga used in the redux-saga library. In this article we will see how the idea makes our asynchronous code simpler and easy to read. We will also implement it ourself using generators.

read more

Getting from Redux to a state machine

posted in JavaScript on 2017-11-10   state error machine const user redux credentials login submit stent

This article is about Stent - a Redux-liked library that creates and manages state machines. Stent implements some of the Redux’s core ideas and in fact looks a lot like it. At the end of this post we will see that both libraries have a lot in common. Stent is just using state machines under the hood and eliminates some of the boilerplate that comes with Redux’s workflow.

read more

Node.js: managing child processes

posted in Nodejs on 2014-05-21   error stdout js exec console log stderr visits function var module

These days I spent some time working on Yez!. Chrome extension whose main role is to replace the annoying switching between the terminal and the browser. It uses Node.js module to run shell commands. So, I had to deal with child processes, and I decided to document my experience.

read more

JavaScript: sequencing function calls #2

posted in JavaScript on 2013-07-10   chain error console log arguments function res chain errors run object chainends

I created a simple JavaScript library for running functions in a sequence. The story behind this is published here. Today I made few interesting changes which deserve a new blog post.

read more

Flash, nodejs sockets and cross-domain policy file

posted in ActionScript on 2013-06-13   socket port xml policy file server anotherhost error flash player make

Ok, that was a long journey. I took an already build project and I had to make some changes. It's a complex system involving flex applications, nodejs and a mobile site. Before to start making changes I had to setup the project and make it work on my local machine. I spend few days doing this. At the end I successfully compile the flex application and made the necessary corrections. I uploaded the new swf file and of course it didn't work.

read more

How to display php errors when display_errors is set to off

posted in PHP on 2010-09-17   display_errors ini_set server lines found set

I successfully finished an interactive project for one of my clients. We did a great job and finally I had to install the system on their server. I received the FTP and MySQL information from their IT team, but when I uploaded all my files the site didn't work at the first time. The server didn't show any errors and I wasn't able to find out the problem.

read more