Saturday, August 22, 2015

Cheap ExtJS 4.x SASS watcher (ready to be wrapped with gulp/grund or any other build tool)

ExtJS 4.x does't has reliable SASS watcher out of the box. Recommended approach of "compass watch" introduced in ExtJS 4.x doesn't works anymore in ExtJS 4.2 as it doesn't understand the structure of themes, leaving "sencha ant sass" as only option to build SASS, which is so slooooow and takes around 30-40 seconds to rebuild the whole theme.

Wednesday, September 10, 2014

URL params parsing on pure JavaScript

ES3 compatible URL params parsing on pure JavaScript:

/**
* Detects hash params and builds an array of values
*
* We have the following URL: "http://www.domain.com/path/page.html#param1=value1&param2=value2"
* this function will extract the part: "param1=value1&param2=value2" and build an array:
* param1 = value1
* param2 = value2
*
* inspired by: http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html
*
* @returns {Array}
*/
function getHashVars()  {
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('#') + 1).split('&');
    for(var i = 0; i < hashes.length; i++) {
        hash = hashes[i].split('=');
        vars.push(hash[0]); 
        vars[hash[0]] = hash[1];
    }
    return vars; 
}

Saturday, July 26, 2014

Selenium WebDriver + Xvfb + PHP PHPUnit

Selenium WebDriver is one of the best and most mature tools for functional testing of WEB applications, supports wide range of browsers and bindings for all major language platforms.

Here is brief overview of possible selenium setup, which by the way has a lot of possibilities for improvement but can be good for quick and easy start.


Tuesday, September 10, 2013

Add sidepars in Wordpress theme

The shortest post ever.
The file names for the right and left sidebars should be
sidebar-right.php and sidebar-left.php respectively.





Wednesday, October 10, 2012

PHP Copy and Paste detection tool installation

In order to install it you will need to:

1. Upgrade to latest PHPUnit 3.7
2. Install https://github.com/theseer/fDOMDocument (see instructions inside)
3. Install https://github.com/sebastianbergmann/phpcpd (see instructions inside)

Then you can run it like:

$ phpcpd /path/to/project/directory

You will see the copy&paste report:


Found 3 exact clones with 53 duplicated lines in 5 files:

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157
    /usr/local/src/phpunit/PHPUnit/Framework/Constraint/And.php:143-164

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157
    /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Xor.php:141-162

  - /usr/local/src/phpunit/PHPUnit/Framework/Comparator/Scalar.php:121-132
    /usr/local/src/phpunit/PHPUnit/Framework/Comparator/Numeric.php:102-113

0.19% duplicated lines out of 27640 total lines of code.

Thursday, September 6, 2012

Zend Framework 2.0 stable release

Finally after all these years I'm glad to announce the Zend Framework 2.0 stable release. It is still not ideal but as we have stable release now - we can start polishing it and try and use it for our needs.
Congratulations to everyone!

Sunday, June 10, 2012

Easy start with Jenkins for PHP developer

Lets look into the quick and minimal Jenkins setup for middle sized fast growing PHP project.
In order to easy follow this article you should at least:
  • have PEAR installed on server
  • use phpUnit for unit tests
  • build your app with Phing