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

The simplest HTTP proxy with custom headers

posted in Nodejs on 2020-05-06   proxy headers authorization node local request server req http basic pass

These days I had an interesting problem to solve. At work, on our staging environment, we have basic authorization. It works really well but for some older versions of Chrome we experienced a weird issue. The browser did not pass the authorization header. The app runs fine but as soon as it does a fetch request to a local endpoint the request fails with 401 not-authorized error. In the modern browsers that's not happening because the browser kinda knows that we came here with basic auth and automatically includes authorization: basic ... header.

read more

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

You are managing state? Think twice.

posted in JavaScript on 2017-10-27   state input false state machine isinprogress request isloggedin submit states message

Recently I started questioning the state management in React applications. I’ve made some really interesting conclusions and in this article I’ll show you that what we call a state management may not be exactly about managing state.

read more

Hacking a weird failing HTTP request

posted in Architecture on 2015-12-04   request nginx server st http router problem external api

I recently finished watching Mr. Robot. If you didn’t check out the show please do. Last few days I felt like I’m hacking something. Just like Elliot in MR. Robot. This blog post is about fixing a weird bug. Really strange problem with a failing HTTP request.

read more

Enforce standards while submitting a pull request

posted in JavaScript on 2015-11-29   template textarea javascript bookmarklet n n template var code pull request

GitHub’s pull requests are an important part of my/our development process. That’s why I was thinking about creating a template that will enforce the standards.

read more

Hacking Browserify

posted in JavaScript on 2015-07-04   function require user var return

You’ve probably heard of Browserify. It’s a nice npm module for bundling your JavaScript for a client-side usage. It lets you use similar to Node.js modular system but for the code running in the browser. I had few issues testing modules in an app that uses Browserify. So I had to learn how it works and probably hack it in order to solve my problem.

read more

Cross-browser handling of Ajax requests

posted in JavaScript on 2014-02-23   ops xhr function data request var headers return callback ops method

This blog post is part of series about AbsurdJS. I'll continue filling the library with small and self organized black boxes. In the last article we talked about creating a JavaScript router. This time we will go through the process of making Ajax requests.

read more

Using Node.js to rename set of images

posted in Nodejs on 2014-01-22   file processed path glob files fs require

Today I had to rename a bunch of image files to the same names, but in lower case. Here is how I did it.

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 strange IOErrorEvent.IO_ERROR event dispatched

posted in ActionScript on 2013-06-11   urlrequest var urlloader addeventlistener json encode obj string http site urlstring string http var urlstring string problem

Really simple GET request from a flex based application. However it fails if GET parameters are passed.

read more

mod_rewrite, one simple rule and two stupidly lost hours

posted in PHP on 2013-06-05   public favicon png index php directory htaccess file server request mod_rewrite

Ok, I should admit that mod_rewrite and regular expressions are not my strongest part. Today - as every other day I realize how little knowledge I have. Actually it's good to have such moments. I lost almost two hours fighting with a really really simple mod_rewrite rule in my .htaccess file.

read more

Brian McCallister and the code

posted in Architecture on 2012-05-16   programming profession convert business requirements efficiently convert business full article bugs read repeatable manner things programming computer

_Programming and the Profession of Programming are quite different things. Programming is being able to efficiently tell a computer exactly what to do in a repeatable manner. The profession of programming is being able to efficiently convert business requirements into bugs._Read the full article here.

read more

MySQL vs JSON file data storing

posted in PHP on 2012-02-12   records requests data json ms time request mysql res count array function

I'm not exactly a performance perfectionist, but currently I'm working on a tool which will be used in a large system. It will deliver texts to a multi-language environment and there will be several sites/apps which will performe big amount of request to it. It is the right moment for me to choose how to speed up my code and the work of the tool overall.

read more

Reported Attack Page in Firefox

posted in Other on 2010-08-17   site code add tools milware click request review check message remove

Before a couple of days the code of my site was injected with some milware script code. In this article I will advice you how to remove this message.

read more