Month: January 2014

Java User Agent Detection code

Java User Agent Detection code

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters /* ******************************************* // LICENSE INFORMATION // 

PHP profiling using webgrind and Xdebug

PHP profiling using webgrind and Xdebug

Install xdebug sudo apt-get install php5-xdebug Then update config Add following line in /etc/php5/fpm/conf.d/20-xdebug.ini xdebug.profiler_enable = 1 xdebug.profiler_output_dir = /tmp After that please restart php5-fpm sudo service php5-fpm restart Load page you want to optimize It will take time (If its taking too much time 

Nginx forwarding rule

Nginx forwarding rule

server {
    listen 80 ;
    listen 443 ssl;
    server_name oldserver.com;
    ssl_certificate /var/www/oldserver.com/cert/server.crt;
    ssl_certificate_key /var/www/oldserver.com/cert/server.key;
    rewrite ^ $scheme://newserver.com$request_uri? permanent;
}
FQL query for all your facebook photos (Uploaded + Tagged)

FQL query for all your facebook photos (Uploaded + Tagged)

In facebook graph api there isn’t any endpoint where you can get all your photos but this can done using very easy FQL query. SELECT pid, src, caption from photo where owner = me() or pid IN (SELECT pid FROM photo_tag WHERE subject = me()) 

Debug WordPress, BuddyPress, WooCommerce javascript

Debug WordPress, BuddyPress, WooCommerce javascript

By default in production mode WordPress, BuddyPress and WooCommerce use minified version of css and javascript. If you are developer and want to debug any core(WordPress) and plugins(BuddyPress and WooCommerce) script or css file then just add following line in your wp-config.php file. define(‘SCRIPT_DEBUG’, true);

Delete a remote Git tag

Delete a remote Git tag

This is not advisable to delete any tag(because of why we tag ), but in case you need to delete tag this will help you.

For example you have tag v1.1.0

Delete Tag from local git:

git tag -d v1.1.0

Delete Tag from remote

git push origin :refs/tags/v1.1.0
Check if it is WooCommerce Page

Check if it is WooCommerce Page

Default WooCommerce function is_woocommerce  return true for only that pages which use WooCommerce templates. Cart, Checkout,My Account … etc page are standard pages with shortcodes so that are not checked by that function. is_realy_woocommerce_page is wrapper of is_woocommerce function and also check if the page is 

Fix for WordPress SEO (by Yoast) bbPress breadcrumbs issue

Fix for WordPress SEO (by Yoast) bbPress breadcrumbs issue

By default wordpree-seo plugin disable bbPress default breadcrumbs. When i open any topic page, I expected the plugin to do this: Home > Forums > Parent Forum > Child Forum >Topic Instead it did this: Home > Topics > Child Forum > Topic It gives 

Fix for yum-complete-transaction command not found

Fix for yum-complete-transaction command not found

Following command snippets is fix for issue yum-complete-transaction command not found 

wget -c ftp://ftp.muug.mb.ca/mirror/centos/6.5/os/i386/Packages/yum-utils-1.1.30-14.el6.noarch.rpm

yum localinstall yum-utils-1.1.30-14.el6.noarch.rpm

yum-complete-transaction –cleanup-only