-
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
-
Debugging your front-end like it's 2019
posted in JavaScript on 2018-01-20 kuker step answer redux state events robot event result -
(If you are lazy jump to this section to learn what is this article all about.)
Remember The Island movie from 2005. I watched it again these days and I realized that the old sci-fi titles start with something really interesting. It is funny how they create a world of flying vehicles and say something like "The year is 2019 …". Well, we are 2018 and the public transport is still on the ground. We still can't clone people (I hope so) or travel in a giant spaceship which looks like a fully-functional city.
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
-
Meet sequence expression
posted in JavaScript on 2016-02-02 var item b returns sequence expression true return skipif result loop -
You have no idea how fun is to transpiler JavaScript. I’m digging into that last few weeks and there is a step where I have to transform an AST into valid code. There is one tree node which I really like - sequence expression.
read more
-
The return statement is not the end (but it should be)
posted in JavaScript on 2016-01-05 function format return result var defined function dosomething code var format function result var format return result var -
Well, I kind of lied in the title of this article. Of course that it is the end of the function. Once we call
read morereturn
everything else after that is simply not executed. Ops … I did it again, I kind of lied again.
-
Using Mocha with ES6 spec files
posted in JavaScript on 2015-12-23 mocha babel es6 package json file es5 babel preset es2015 tests test results javascript mocha reading spec files written -
The new ES6 specification of JavaScript simply works better for me. It helps expressing my ideas in a shorter and cleaner way. So, I want to write ES6 everywhere. Even while I’m testing my applications.
read more
-
PHP: please, please, clear my cookies
posted in PHP on 2013-10-31 time cookies result arr setcookie request_ids time setcookie app_request_type time store needed -
I'm currently working on a JavaScript application which is using the facebook API. There are some things which I need to pass from one page to the other. So, I decided to use cookies. The storing works like a charm, but the deleting doesn't. I needed one hour to find the exact problem.
read more
-
A bad side effect of the aspect oriented programming
posted in JavaScript on 2013-08-15 thing result function thing prototype dosomething start prototype dosomething function aspect oriented programming problem original class -
I just read this very interesting article published on know.cujojs.com. It's about aspect oriented programming. At the beginning I thought "Oh, that's kinda cool", but when I start thinking about how I'll use it in practice I notice something bad. The blog post itself is well written and informative, but doesn't include any cons of the used technique.
read more
-
PHP: simple captcha script
posted in PHP on 2013-08-08 array code expression alphabet result im -
In my company, we have a lot of WordPress sites. Some of them require contact form with captcha field. The short way for solving such task is to use a plugin. However, as you may guess, the add-ons are available for everyone, which means that they could be easily explored and probably hacked. That's why I suggested a simple, custom script, which is developed by us.
read more
-
CSS: The background color and overlapping rows
posted in CSS3 on 2013-05-22 element background result h1 facilisis metus feugiat tempor tincidunt erat consectetur adipiscing elit amet consectetur adipiscing sit amet consectetur dolor sit amet -
The goal is to achieve a background of the text inside an inline element.
read more
-
Web Highlights #2
posted in HTML5 on 2013-04-10 media queries css regions chrome web app ui adaptive web app asset downloading results query asset downloading media query asset understanding typographic hierarchy browser -
Some of the cool and helpful things which I found in the net.
read more
-
CSS: using float property
posted in CSS3 on 2013-04-08 check pen clear float property element floating elements block floated result problem -
float property is one of those CSS rules which are somehow difficult to understand. Before a couple of days I had a problem with floating divs. I solved it and decided to write an article about the solution. The article also covers some basics about floating.
read more
-
GoogleMaps JS API: address to coordinates transformation
posted in JavaScript on 2011-06-01 map google maps function address locations var results location google maps latlng step -
When we are talking about maps, Google is an absolute leader. Their GoogleMaps tool is free, well documented and works really good. What I didn't find directly in the documentation is how to get the exact location based on plain text. I.e. to convert an address to google.maps.LatLng object. That's why I wrote a simple function that did this job.
read more
-
FlashDevelop scripting: open file by name (part 2)
posted in ActionScript on 2011-03-29 file results script open -
After a couple of days of using my script for file opening I decided to rewrite it and add more functionalities.
read more