PHP CodeSniffer – Coding Standard Tool

Install PHP-Coding-Standards

> pear install PHP_CodeSniffer-2.8.1

Install WordPress-Coding-Standards

> cd /var/www/html
> git clone -b master wpcs
> phpcs –config-set installed_paths /var/www/html/wpcs

Install Codeigniter-Coding-Standards

> git clone
> ant


> ant -Dphpcs.dir=”/usr/share/php/PHP/CodeSniffer”

Check Supported standards

> phpcs -i

Uninstall PHP-Coding-Standards

> pear uninstall PHP_CodeSniffer-2.8.1

Check Errors and Warnings

> phpcs file.php

Autofix Errors

> phpcbf file.php


Install MongoDB on Ubuntu 14.04

Step 1 — Importing the Public Key

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10

Step 2 — Creating a List File

echo "deb "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

Step 3 – Update the packages list

sudo apt-get update

Step 4 — Installing and Verifying MongoDB

sudo apt-get install -y mongodb-org

Step 5- Check status

service mongod status

If MongoDB is running, you’ll see an output like this(with a different process ID).
mongod start/running, process 8962

Start MongoDB

service mongod start

Stop MongoDB

service mongod stop

Restart MongoDB

sudo service mongod restart

Git Notes – Basics

Initial commit

mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin
git push origin master

Clone to local repo

git clone folder-name
git add .
git commit -m "Initial commit"
git push origin master

Clone a specific Git branch

git clone -b my-branch

MySQL Export From Remote Server Through Terminal – Ubuntu

mysqldump from remote server

 mysqldump -P3306  -h192.168.20.151 -uroot -p database > /home/manager/Downloads/my.sql

mysqldump specfic table from remote server

 mysqldump -P3306  -h192.168.20.151 -uroot -p database tablename > /home/manager/Downloads/my.sql

mysqldump multiple tables from remote server

 mysqldump -P3306  -h192.168.20.151 -uroot -p database tablename1 tablename2 tablename3 > /home/manager/Downloads/my.sql

Validate xml via terminal – Ubuntu

To validate xml via terminal

install xmlstarlet or xmlint

To install xmlstarlet,
install via ubuntu software center

> apt-get install xmlstarlet

> xmlstarlet val "test.xml"


test.xml - valid


> xmllint --noout "file.xml"