portfolio designers contact


Destructuring Assignment in JavaScript

September 29th, 2018

Destructuring assignment (Przypisanie destrukturyzujące, Деструктурирующее присваивание) is a nice feature of modern JavaScript as of ES2015:

var [a, b, …theLot] = [10, 20, 30, 40, 50];
let {age, color} = {color: ‘red’, age: 17}

Then a:number, b:number, theLot:number[], age:number, color: string become available as separate variables in the given scope. It is especially handy when you want to pass a lot of (perhaps, structured) parameters to a function:

function checkOut({age, color=’green’} = {}) {
    console.log(age, color);

You no longer have to care about the order or presence of parameters, and can pass them encapsulated in a single object value!

After installing homebrew…

November 15th, 2017

Provided it is installed into /usr/local

echo "/usr/local/homebrew/bin" | sudo tee /etc/paths.d/homebrew

sudo chown -R $(whoami) /usr/local/homebrew/var/homebrew

Как выбрать формат графического файла для веб-страниц?

February 28th, 2014

В принципе, всегда на глаз. Сравните визуально, как выглядит картинка при сжатии в JPG или PNG. Выбор зависит от рода проекта: в одном важнее качество фото, в другом – скорость загрузки.

Но есть и золотое правило, которое поможет быстрее прийти к оптимальному выбору:
JPG – для фотографий, PNG или GIF – для изображений с большими участками одного цвета.

Пример того, как эффективно PNG и JPG сжимают гладкоцветные картинки, смотрите тут.

Rounded Corners 2013

February 19th, 2013

Everybody who’s been in HTML/CSS design for some years know the pain of rounded corners. The arrival of the border-radius CSS property does not make our life much easier since the Internet Explorer (stifle a sarcastic “of course!”) does not support it in its version prior to 9. Having tried some solutions, I finally opt to emulate support of border-radius in Internet Explorer 8- via PIE.

Upon a premature sigh of relief I experienced some frustration while using the recommended HTC version of PIE with jQuery UI: the page would load properly but when opened again through a hyperlink the site would have its button sets scattered all over the place.

Luckily, switching to the Javascript version of PIE resolved the issue.

May this experience be useful to many.

The best jQuery-based replacement <SELECT>

February 11th, 2013


  1. Possibility to style the drop-down control (<SELECT>) in a cross-browser compatible way
  2. It should hide, update, and follow underlying select tag, so that when the select tag is changed (for example, by the user a Reset button on the form) the visual replacement changes its state accordingly. Ideally, the replacement should trigger whatever events the select tag listens to (i.e., onChange = “window.location=’/choice.php?id=this.value()’;”) Read the rest of this entry »

Check the syntax of a PHP script before uploading

December 18th, 2009

Saves you some time and nerve. Especially when you’ve been writing code for a while, check it locally before you upload it to a remote server, even to a test site.

php -l ~sites/mysite/functions.php

This -l option means “check syntaxt only”.

Simple? Yes, and that’s the point!

Converting DVD video for the web (QuickTime .MOV)

November 11th, 2009

Here I’d like to share my good experience in posting video on the web.

I sometimes get video from a client in the form of a DVD. Of course, the high quality, low-compression (mpeg2) of a DVD video would be an overhead if put on a web site as it is, so some conversion is necessary. After some experiments, trials and tribulations, I came to using two free utilities streamlined in this order.

  1. First, we need to turn DVD video into an editable file to work with, this is done by HandBrake, which produces an .MP4 file for every track of the subject DVD. Tip: it is a good moment to scale down your video to minimize the space occupied by the files you will edit at later stages.
  2. When you have the .MP4 files, drag them into MPEG StreamClip. They will form a seamless video footage you can edit as a whole. The editing capabilities of StreamClip are very basic, so if you need, for example, a caption or fade out, you will have to look for a more advanced video editor. However, in simpler cases when you just want to cut ads or other undesired bits, just mark them IN and OUT and select Cut from the menu.
  3. When done editing, select Export to QuickTime, choose a compression method (I opt for Apple MP4 codec), quality (the default 50% is good), video bit rate (say 500kbps), then sound options (32kHZ 128kbps MP3 stereo or even mono would satisfy most web viewers) and – very important – check Fast Start. The latter option will allow the browsers to start showing the video on-the-fly, just when the viewer clicks the link to your video file on the web server.
  4. Press the Make Video button and after a while you have your .MOV file ready to be put on a web site and linked just like this: <a href=”my_movie.mov”>my_movie</a>

Enjoy, comment, and please drop by for updates!