Articles
PhantomJS (at least version 1.9.8) is not loading resources when you want to use relative path. However, after some research and experimenting here what’s working for me. Example:
var page = require('webpage').create(),
content = '',
relativeScriptPath = require('system').args[0],
fs = require('fs'),
absoluteScriptPath = fs.absolute(relativeScriptPath),
absoluteScriptDir = absoluteScriptPath.substring(0, absoluteScriptPath.lastIndexOf('/'));
console.log('scriptDir: ' + absoluteScriptDir);
content += '';
conten[......]Read more
After some struggling with upgrading npm itself from version 1.4.8 to 2.1.14 I ended up with following solution:
- I have installed NodeJS, newest version (just overwritten current installation)
- The npm was installed in (1) C:\Program Files\nodejs\node_modules\npm
- I have installed new version of npm:
npm install npm -g
the new version has been located in (2) %USERPROFILE%\AppData\Roaming\npm\node_modules\npm
Now, all you need is to delete all files in directory (1) and copy all files from directory (2) to (1).
[……]
Read more
By default, Git uses whatever you’ve set as your default text editor or else falls back to the Vi editor to create and edit your commit and tag messages. To change that default to something else, you can use the core.editor
setting. Example for setting default Git editor in Windows to Notepad++:
git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Note: use above as a one line command.[……]
Read more
Introduction
Like many other version control systems, Git has a way to execute custom scripts when certain important actions occur. One of the good thing to do is to automatically valid the code before you commit it to repository. Even, if you are doing it manually frequently you may forget to do that just before commit and this means that you’ll send invalid code. For example you may run just your unit test and forget to run unit tests for whole project. To prevent from it we can use Git pre-commit
hook. What this does:
The pre-commit ho[……]
Read more
When you start measuring performance of downloading files by the browser then don’t forget to check if you have a turned on your cache. For example, you may have open browser developer tools and due of that the cache may be turned off (because you checked it in the settings long time ago and forgot about that). This means that the files are always downloaded and you may think that files are never cached.[……]
Read more
Whenever I was using custom events there were:
something.on("changed", function myonchange() {
do_something_here
});
However, now I start to use better way:
something.changed(function myonchange() {
do_something_here
});
The benefits of this change are:
- The list of events can be seen in the debugger.
- Events can be copied from one object to another.
- Several events can be aggregated into one.
[……]
Read more
I set my font size in OS to 125% to make them little bit bigger. However, when I started make a screenshots then I realized that the size of the box was different than I defined in CSS. So, take a look at this picture:

In developer console I saw that the width
is about 600px
. However, when I made a screenshot and measured the width in Gimp then I found that the width is… 875px
. See picture:

Conclusion: when you make a screenshot make sure your font size in OS is sets to 100% to avoid a problems with checking sizes of the element[……]
Read more
How to
I wanted to delete a folder that contains thousands of files and folders (I’ve used Windows 2012 Server). If I use Windows Explorer to delete the folder (just in my case) then it takes ~4 minutes 30 seconds (not always, but often). Too long. Unfortunately, Windows Explorer is slow for this as it first scans the whole directory so that it can show the estimate and then copies everything into the recycle bin or not, if the directory is too big. Small tip: you can hold SHIFT key when you click option do delete files and Windows will not[……]
Read more
I was experimenting with RAM disk and was changed the localization of temp
folder. After all I’ve uninstalled not needed anymore software that was responsible for managing RAM disk and because of that I couldn’t work with Microsoft Word 2010. So, for those who had the same issue with temp
folder problem and Microsoft Word 2010 here is the solution:
The error message “Word could not create the work file. Check the temp environment variable”. Can be caused by incorrect registry values in the key:
HKEY_CURRENT_USER\Software\Microsoft\Windows[……]
Read more
Let’s say you want to generate dynamically iframe
and instead of point to external source:
<script>
var iframe = document.createElement('iframe'),
body = document.body || document.getElementsByTagName("body")[0];
iframe.src = "myiframecontent.html";
if (body) {
body.appendChild(iframe);
}
</script>
you want to create dynamically content inside iframe
. Sounds crazy, but… it’s possible. Partially. We can use data
URI with content encoded using base64. By the way, you can use base64 encoding/decoding online t[……]
Read more
Pagination