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

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

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

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

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

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

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 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