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

Running Prettier for specific Git branch

posted in Architecture on 2020-01-14   prettier git bash script branch file awk print echo file awk run prettier line column file mode files project

I'm working on a project in my own git branch. At the end of my working day I want to do one thing - run Prettier so my code is nicely formatted before I submit the PR for code review. Of course I know about the VSCode Prettier extension but right now my editor is kinda broken and I don't want to mess with it. I'm still on my branch and I run Prettier from the terminal. All good but the amount of changes that happened is so big that my 50+ loc updates are like a needle in a haystack. It is like that because apparently there are already malformatted files in the project. It is definitely not possible to understand what I did because of so much noise. So ... I want to run Prettier but only on the files that I touched in that particular branch.

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

My new and shiny tool for live demos - Demoit

posted in JavaScript on 2018-11-05   demoit resources live coding code demo tool css files tools writing don t

I had some time during the weekend and decided to work on my slides for an event at the end of the month. I reached the part where I have to do a live coding session and I was wondering what tool to use. At the end I created my own called Demoit. This is a short article explaining how it works.

read more

The bare minimum to work with React

posted in JavaScript on 2016-06-13   react app function file babelrc return babelify browserify render superclass

The setup here is available at GitHub here.

Half an year ago I published A modern React starter pack based on webpack. The starter provides the basic tooling around React. However, I noticed that very often I need even less stuff than that. That’s usually when I want to hack something quickly. In this blog post we’ll see what’s the bare minimum to work with React.

read more

Constructive destructuring

posted in JavaScript on 2016-02-24   var destructuring function object data enabled files options attachments

Destructuring is one of my favorite ES6(ES2015) features. It just shortens my code and helps me be more explicit with my statements. Let’s see it in action.

read more

Start your own JavaScript library using webpack and ES6

posted in JavaScript on 2015-12-30   library js webpack babel true var file module exports eslint function build

Two months ago I published a starter pack for React based on webpack. Today I found out that I need almost the same thing but without the React bit. This simplifies the setup but there are still some tricky parts. So, I made a brand new repository webpack-library-starter and placed all the stuff that we need for creating a JavaScript library.

read more

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

Distributing React components

posted in JavaScript on 2015-11-23   js react component file build react place src jsx browserify babel js map

While I was open sourcing react-place I noticed that there is some complexity around preparing the component for releasing. I decided to document the process here so I have a solid resource next time. You may be surprised but writing the working jsx file doesn’t mean that the component is ready for publishing and is usable for other developers.

read more

A modern React starter pack based on webpack

posted in JavaScript on 2015-10-01   webpack karma js var config dev plugins loader file react

Checkout React webpack starter in GitHub.

You know how crazy is the JavaScript world nowadays. There are new frameworks, libraries and tools coming every day. Frequently I’m exploring some of these goodies. I got a week long holiday. I promised to myself that I’ll not code, read or watch about code. Well, it’s stronger than me. React werbpack starter is the result of my no-programming week.

read more

My front-end performance case study

posted in Must-see on 2014-08-25   css file blog time page images performance pagespeedinsights main

I’m reading and watching a lot of interesting things regarding client-side performance. I’m interested in the browser’s processes happening before and just after the page’s load. There are tons of stuff to think about. Before a couple of days, I joined the online workshop of Vitaly Friedman. I had a great time and learned some clever facts about performance optimization.

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

ExpressionEngine: thumbnail could not be created for the image under Windows

posted in PHP on 2013-11-28   file windows thumbnail file upload preferences image created

I'm a Windows user and I'm working on a ExpressionEngine based site. I'm using EasyPHP as a server and everything works as expected. However, once I decided to upload a file I got "Thumbnail could not be created for the image. Please make sure the thumbnail directory is writable.".

read more

Security sandbox violation error even with crossdomain.xml

posted in ActionScript on 2013-06-26   http file security sandbox violation

Again, a very nice surprise by Adobe. I have a flex application which makes cross-domain requests to another server holding REST API. There is a crossdomain.xml file, but the request still doesn't work.

read more

Deploying ExpressionEngine based site

posted in PHP on 2013-06-25   php file database config files dblogger sql local operations define

I found ExpressionEngine framework very good. It brings the flexibility which I need and still has a good amount of features. However, as many other similar tools, the deployment could be a little bit difficult.

read more

Insert css or javascript dynamically

posted in JavaScript on 2013-06-18   var function css files

That's a super simple function for adding new css or javascript files in the current document. I didn't test it in all the browsers, because I'm using it in the chrome extension and I need only Chrome supported.

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

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

Git under windows (console mode)

posted in Architecture on 2013-05-29   git windows powershell file aliases function command status alias set

I'm a Windows user. I also have a virtual machine with Ubuntu installed and coding there from time to time. I use Git a lot and in general I prefer console mode over the GUI. Under Unix everything works just great, but Windows's command prompt requires more efforts from our side. However I found some helpful tips, which could make your life easier.

read more

Make the web faster

posted in HTML5 on 2013-03-31   faster browser applications underlying problem tune slow javascript code js profiler chrome tracing ll talk structural profiler pages chrome devtools built build

Slow JavaScript code on your pages? Chrome provides both a sampling, and a structural profiler to help you track down, isolate, and fix the underlying problem. Tune in to learn how to use both profilers, and how to improve your own workflow to build better, faster browser applications! We'll talk about chrome://tracing, the built-in JS profiler in DevTools, and much more.

read more

AssetsPack - a friend of the front-end developer (pack your assets with NodeJS)

posted in Nodejs on 2013-03-16   css js file assetspack pack tests data type packing html module

AssetsPack is a NodeJS module which helps in organization, compilation and minification of assets. It's meant to be used in local environment during the development process. It was made generally for HTML/CSS/JavaScript based applications.

read more

Compiling iOS application under Windows with Flex SDK

posted in ActionScript on 2013-03-06   file developer application step openssl certificate device app p12 ios

As you may know, Apple doesn't allow creation of iOS applications just like that. Especially under Windows. It's somehow a complex process, which requires several steps in a specific order. However it is still possible and you can do that without Mac.

read more

SVN: Ignoring files and directories

posted in Architecture on 2013-01-28   svn file propset svn ignore svn propset svn svn ignore yourdirectory directory

I really like GIT and I think that is a better version control system than SVN. Anyway, I still have to use SVN for some projects and ignoring files is always a problem.

read more

AS3: runtime font loading (embedding)

posted in ActionScript on 2011-04-25   font field loader import flash swf public static const format font_export_name string font_file_name class

Flash is wonderful technology and has many advantages. Before a couple of years it was really popuplar to use it for displaying fonts that are not installed on the user's machine. Flash is still powerfull tool for such kind of tasks. These days I worked on a project which had to use a lot of fonts. It wasn't possible to embed all of them so I decided to implement runtime embedding.

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

FlashDevelop scripting: open file by text selection

posted in ActionScript on 2011-03-20   file script projectpath system path text private static string plugincore

FlashDevelop is one of the most preferred editors for the flash development. I've been also using it last few years. I found it helpful for writing JavaScript, HTML, CSS and PHP code as well. I just took a big project with over 1000 php files and it is a little bit difficult to open the right file, even by using the Project panel. That's why I decided to invest time in solving this task and found that I can write my own C# script and run it.

read more

PHP: Simple javascript obfuscator (merging files)

posted in PHP on 2010-12-30   jsstr jsstr jsstr str_replace jsstr str_replace jsstr str_replace jsstr jsstr js files fh file comment js core plugins

Currently I'm working on a big JavaScript project. It has a lot of files that have to be compressed. I wrote a simple php class that merges all the files into one. It has also a useful simple obfuscator method.

read more

How to generate SWC file from ActionScript package

posted in ActionScript on 2010-12-18   swc file classes output generated swc file compc exe usage

SWC file format is really useful when you want to transfer or to compact your ActionScript libraries. It is also used for exporting assets, which can be used later. Let's imagine that you want to create a .swc file for only small part of your application, i.e. pure .as files. I searched a lot for the fastest and easier solution and finally I think that the usage of compc.exe is the best option.

read more

How to import images directly into the html code (base64)

posted in PHP on 2010-11-11   base64 file html css small form data fp image
read more

checkPolicyFile flag was not set

posted in ActionScript on 2010-10-26   loader var context loadercontext crossdomain xml file checkpolicyfile flag set

Sometimes the uploading of crossdomain.xml file is not enough to get the things working.

read more

How to protect your SWF file

posted in ActionScript on 2010-10-15   function swf protect void check file import flash public ondatafiledtoload onfailed files string

Is there any way to protect your flash work? To be honest the answer is NO. As you probably know everything that is uploaded on a web server and is accessible from a web browser is downloaded to the users' computers and could be found in the temporary directories. Once someone gets your swf file he could use one of the dozen decompilers to reproduce the .fla and .as files. Anyway, there are still some ways to make stealing difficult.

read more

Export mysql data to SQL script or CSV

posted in PHP on 2010-09-04   server data mysql export good solution phpmyadmin didn t work export data php file mysql exe mysql server received host

Yesterday I received host name, user name and password for a MySQL server. I needed to export the data from it. I didn't have access to PHPMyAdmin, I tried to connect to the server by mysql.exe on my PC, but it didn't work. And then I found really good solution - PHPMyAdmin in only one php file. I launched it from my localhost and it works. So if you need to export data or just see it, use Adminer. I also uploaded the file on my server, you can download it from here.

read more

Load MySQL data in Flash with AS3

posted in ActionScript on 2010-07-10   text data city import flash ondatafiledtoload php file onloaddata string url

There are some things that I'm doing in almost every project. Loading of data in Flash is actually one of them. In this article I'll show you how to load information from MySQL database. We will use PHP as a junction between the Flash and the database. You need an Apache server like XAMPP or EasyPHP installed or just a hosting account that supports php.

read more

How to exclude directory from .htaccess file

posted in PHP on 2010-06-17   htaccess file

Did you ever wonder how to exclude a directory from a .htaccess file. Here is the solution, it works perfect for me.

read more