WordPress – how to make a post sticky on home page
In wordpress you can make any post sticky and make it appear on home page at top even when there is more recent posts. Here read more
How to show wordpress pages on front page with skip_home custom field
By default WordPress pages donot show up on home page. Only posts are displayed on home page. Here is wordpress php code which can be read more
Fetch wordpress rss feed as FeedBurner user agent on command line
In case you have setup your wordpress feed to redirect to Feedburner url for regular user-agents, you can use either curl or wget (Mac or read more
Get image width and ppi using imagemagick identify on command line
Imagemagick identify is pretty handy utility to get information about an image. You need to have imagemagick installed on your Mac or Linux for the read more
Vim (vi) – multiline search replace with confirmation
Vi (or Vim) is a very powerful and light weight editor which is available on any Linux or Mac. Even if you are working on read more
Mac brew – how to relink installed binaries for a package
When brew installs a package, it also links the binary commands to brew prefix location. In case you have installed a package and for reason read more
How to resize image (including animated gif) using Image magick convert
Imagemagick convert can be used to resize and image (including animated gif). Here are some scenarios where convert can be used to change size of read more
How to edit animated gif speed (FPS) using imagemagick convert
Imagemagick convert can be used to edit animated gif speed (FPS). Here are some scenarios where convert can be used. For these commands to work read more
How to create animated gif using Mac preview
Mac preview can be used to create simple animated gif by taking multiple screenshots of a window and then stitching then together in Mac preview read more
Git – how to view diff for a given commit id
Diff commit id with its first parent commit id Here are some approaches to view diff between first parent of commit id and commit id. read more
Php equal (==) vs identical (===)
Equal (==) compares two values after type changing one value to another. Identical compare values and types both and returns true only if they both read more
Mysql find current timezone offset
Print current local and global timezone SELECT @@global.time_zone, @@session.time_zone; Here is the outcome @@global.time_zone @@session.time_zone +05:30 +05:30 Find timezone offset using convert_tz select TIMEDIFF(now(), convert_tz(now(), read more
Mysql difference between CURDATE() and NOW()
Mysql CURDATE CURDATE() returns only date portion of date in current timezone. select CURDATE(); Outcome 2015-12-02 Mysql NOW NOW() returns full time in current timezone. read more
Query to find recently modified posts in WordPress
It can be sometime handy to query recently modified (last month or last few days) posts in wordpress mysql tables. Here are some handy queries: read more
Vim – how to go back to last edited line/context
Sometimes we are editing a certain section of code in vi and then navigate to different section for reference. It is tedious to come back read more
Running php eval on code with tags
php eval on code wrapped in php tags Here is the code snippet which calls php eval on a code which is wrapped in <?php read more
WordPress – how to add filter to description meta tag
If you using Yoast seo plugin, then you can use its filter wpseo_metadesc to change meta description tag as per your needs. Typically you want read more
WordPress – write custom php log to separate file
Why write php log to separate file Using default php error log in wordpress php code for informational messages can pollute php error log file. read more
Mysql query to find all yoast meta description
In case you are are using Yoast plugin for SEO and using it to enter meta post description, you can query meta descriptions of all read more
jQuery – difference between html() and text()
Jquery can be used to set content on and element (div, etc.) using text() and html() methods. Methods text(content) will first convert the content using read more
How to open vim at previous location
Vi (or Vim) editor can remember location at the time of exiting a file. This can be fairly convenient while editing files during development. .vimrc read more
Using WordPress custom field for displaying code
WordPress custom fields (post meta keys) can be used to store key value pairs for a post. This can be very useful to store code read more
jQuery – make a div stick at top on scroll
To make a div stick at top on scroll we can use css position property fixed. Here are the steps: Find initial position of div read more
Vim redo (undo of last undo)
In case there are two many undo done, vi (vim) redo can be used. One redo in vi Approach 1 [ESC] + [CTR] + r read more
jQuery – check if an element exists
jQuery when used with selectors like element tag, class, id can potentially return a jQuery object with no element in it. Since jQuery contains number read more
egrep pipe example on Apache access log
Some egrep pipe examples for Apache access logs on Ubuntu Linux egrep http status code 301 entries $ cat /var/log/apache2/access_log.2015-11-29 | egrep ” 301 ” read more
Linux – Yesterday’s Date in YYYYMMDD format
Linux Bash code for yesterday’s date in YYYYMMDD format $ date –date=”yesterday” +”%Y%m%d” 20151128 $ date –date=”-1 days” +”%Y%m%d” 20151128 Mac Bash code for yesterday’s read more
php cli – find which ini file is loaded
Command to find which ini file is loaded for php cli $ php -i | grep “Loaded Configuration File” Sample outcome on Ubuntu Linux Loaded read more
php get array value with default
Code snippet to get a value from php array and return a default value it key does not exist <?php function get_value($arr, $key, $default=null) { read more
PHP command line – show errors
To show errors on php command line (cli) without changing php.ini php -d error_reporting=E_ALL code1.php Sample php code code1.php <?php echo $non_existing_var; ?> Sample output read more
Linux – how to run a command as different user
Often we need to run a command as different users. Some of these users may not even have a login shell (e.g. www-data on Ubuntu read more
Linux – how to add a user using useradd
Adding a new user on Linux can be easily done on command line using useradd. These are some scenarios and handy commands to add a read more
Linux how to modify a user using usermod
Modifying a user on Linux can be easily done on command line using usermod. These are some scenarios and handy commands to modify a user read more
Linux – how to enable password login on ssh server
By default password based on login may be disabled on you Linux Server. Even though it is better to use private and public key for read more
Find authentication methods an ssh server supports
It is sometimes handy to know which authentication methods an ssh server supports. This may be useful if you want to enable or disable certain read more
How to install AWStats on Ubuntu Linux
AWStats is a powerful and featureful tool to analyze apache access logs. Using AWStats, you can view various stats 404, etc. Here are steps to read more
Mac finder – change search default folder to current folder
If you frequently use Finder on Mac to search stuff, you will find if handy to change default search to use current folder instead of read more
How to enable Chrome tabs on Android Lollipop
In case you like Chrome tabs on Android and these are not enabled by default, you can enable these. Android Lollipop’s default settings have these read more
How to view desktop site from android mobile
Sometime we need to view desktop version of a web site from Android mobile phone. This may be useful to see how Desktop site looks. read more
Iterate over specific file extension in a dir in shell script
Sometimes we need to iterate over all files of a specific file extension using a bash script. This can be used to convert one type read more
How to search files by name in Mac Finder
Mac finder can be used to find files on Mac or in a specific folder. By default search is done on file contents. Sometimes we read more
How to delete orphan wordpress wp_postmeta rows
WordPress keeps the post meta values in wp_postmeta table. When a post is deleted, its meta data may become orphan. It is harmless data but read more
How to disable dropbox photo auto upload on mobile and desktop
Dropbox automatically upload you photos from your Android mobile to Dropbox account. This is a fairly handy feature if you have limited number of photos. read more
How to clear Chrome HTTP 301 redirect cache
By default Chrome caches HTTP 301 redirect from one page to another. If you are using Chrome during a web site development and working on read more
Convert wordpress page to posts and vice versa
Sometimes we want to convert a wordpress page to post or vice versa. WordPress treats a post slightly differently. e.g. WordPress shows posts automatically in read more
svn – how to undo last commit
Often we need to undo our last commit or an old recent commit in svn. These are quick steps you can follow to undo last read more
Debug javascript using node-inspector, node-debug, nodemon and Chrome
In case you are using node to run javascript on command line, you can use Chrome to debug javascript. It support GUI debugger functionalities like read more
How to prevent ssh session freezing due to timeout
It can be quite annoying to kill a frozen ssh session and the restart it. This can happen if you leave an ssh shell idle read more
Why and how to log Content-Type in apache access log
It is very handy to log Content-Type in apache access log. It can be used to grep visit of specific content-type (e.g. text/html). Here is read more
How to restrict dropbox network bandwith on Mac
Dropbox can sometime consume high bandwidth and you may need to restrict dropbox’s upload and download bandwidth in certain situation. This may be the case read more
How to customize wordpress image alt tag
In case you want to beautify image alt tag for all your wordpress posts, you can use filter hook the_content. Attach a filter function to read more
How to disable sleep during android usb debugging
If you are using android mobile phone for usb android development and debugging, it may be quite annoying to see it going to sleep mode read more
How to customize wordpress rss feed
By defaul WordPress will include all posts sorted by creation time for rss feed. If you want to customize wordpress feed, you can write custom read more
git – how to diff two branches
It is sometimes useful to be able to diff two branches in git. This can be useful to understand the changes in a git repository read more
Handle pagination in wordpress custom php code
In case you are writing wordpress custom code and need to show lot of content, it may be a good idea to support pagination. The read more
How and why disable android auto update
Android default auto-update setting updates android applications whenever your mobile is on WiFi internet connection. While this may be a good thing for some people, read more
Find all user created wordpress custom field keys
Sometime we need to find all user created custom field key names (or meta key) in wordpress. This may be needed to find all posts read more
WordPress – exclude specific posts from archive pages
Sometime we need to exclude specic posts and pages from wordpress archive pages. If there are some internal pages behind auth, you may want to read more
find if a wordpress page is leaf page
Sometime we want to consider pages which have children as browse pages and may treat them separately in plugins etc. For example we may not read more
How to display wordpress top level pages
Displaying wordpress top level pages may be useful for displaying sitemap or browse interface on a wordpress site. Here is the code you can use read more
display method names from php WP_Query object
Sometimes it is useful to display all methods name given a reference to object. This can be used to debug and understand wordpress or any read more
How to do recursive grep with specific file pattern
Recursive grep is pretty handy way to searching a pattern in a directory recursively. Sometimes it is useful to restrict search to specific file pattern read more
How to find mysql query rate on Linux
Sometimes we want to know the current queries rate being sent to mysql server. This can be useful to get some idea on query load read more
Apache – add basic auth to a location or directory
In case you want to protect a directory from public access, you can add Apache basic auth to it. This may be needed if you read more
Block directory access using htaccess 404
RewriteRule in Apache .htaccess is a convenient way to block directory access to a directory in your Apache document root. This can be useful to read more
How to list git branches
These are various command to list git local and remote branches. Note that local branches may be different from remote branches. List git local branches read more
Android studio keyboard shortcuts for beginners
In case you are using Android studio for android app development, it a good idea to use keyboard shortcuts for various operations for increasing productivity. read more
How to find a user’s first tweet
Twitter has a service – discover your first tweet which can be used to find any user’s first tweet. This can be useful in case read more
How to remove password from pdf using Chrome
In case you want to remove password from a pdf there are multiple options. For automation command line tool qpdf is a good choice. In read more
How to test a site using pytest
Python is fairly good programming language for writing and maintaining unit and functional tests. One advantage of python is that it does not require compilation read more
How to use qpdf to add/remove password from pdf on mac
Sometimes we need to add or remove passwords from a pdf file. You can do it using Google Chrome or many other UI tools also. read more
How to install new fonts in Photoshop on Windows
Sometimes we need to use more fonts in addition to default fonts in Photoshop. There are plenty of sites that will allow us to download read more
How to use preview to add password to pdf file on mac
Preview is a powerful Mac utility to view various types of files. It can also be use to export a document to pdf and optionally read more
How to do keyword traffic research using adword
Adword is a great tool to do keyword research in addition to other functionalities it provides. It can be used to find searches for a read more
How to enable/disable gmail inbox category tabs
Gmail inbox tabs is pretty useful to automatically categorise mails in Social, Promotions, etc. labels. This also helps reduce your unread emails in inbox. Here read more
How to return a value from bash function
Returning a variable from functions in bash script can be little tricky. Bash functions are not similar to functions in other languages but these are read more
How to sort using a specific field on Linux
Sometime we need to sort a file on a specific field. This may be useful if a file is in csv or tsv formart (probably read more
Impact on LC_ALL on Linux sort
Linux sort is a handy Linux command line tool to sort text files. It can sort fairly large files without consuming too much memory. The read more
How to show environment variable for a process id (pid)
Sometimes it may be useful to see what environment variables were passed to a process. e.g. you may want to see LC_ALL value for a read more
How to specify environment variable for a command on Linux
Sometime we need to run a command with specific environment variables. These can be either just needed for the command or for the whole bash read more
How to add more DNS servers to Wi-Fi interface on Mac
When you are using WiFi or wired network using home broadband or mobile hotspot, you are assigned a default DNS server. It sometimes may be read more
DIG quick start tutorial for DNS Lookup
Dig (Domain information groper) can be used to do DNS lookup on Linux, Mac or windows machine. It will connect a DNS server (default or read more
How to transfer android apk using adb
Android debug bridge (adb) can be used to transfer an apk from mobile to computer over usb port. This can be useful when you are read more
How to download apk from mobile using AirDroid
Sometime we need to transfer the apk from android mobile to computer. This can be needed in case you wish to inspect the content of read more
Git – how to undo last commit
Sometime we need to undo last commit in git. This is fairly useful to undo a change made accidentally. Here are quick instructions to do read more
How to take screenshot on android phone
Often we need to take screenshot of what is displayed on android phone. This can be used in many ways. E.g. to capture a web read more
How to view your WiFi password on Mac
Sometime we connect to a Wi-Fi on Mac and then later forget the password we entered earlier. It can be easily viewed on Mac if read more
How to view wifi connection speed on Mac
When you setup your wifi router and you mac is connected to it, you may want to know what is wifi link speed (the bandwidth read more
How to change computer display name on Mac
Display name on Mac device can decide how your Mac appears on network and at other places like command line shell. Mac display name can read more
Mac Finder – how to change default folder
Finder app on Mac when opened start with a default folder. Sometimes it opens “all my files” which takes somewhat long time to display. You read more
How to remove hard drive icon from mac desktop
Mac shows some icons by default on desktop including hard drive. In case you want to save space and keep desktop tidy, you can remove read more
How to recover svn lost password on Linux
If you are using simple web auth to connect to svn server, you can choose to store it at client side. This way you don’t read more
How to enable usb debugging on android
Debugging on Android phone requires USB debugging to be enabled on Android. This lets you install apk through USB and also run adb shell on read more
How to clear default app on android
Android can set a default app for a certain file type or action (e.g. click on a url). When you click on a link for read more
How to insert multiple rows in google sheets
Sometime we need to insert multiple rows in Google Sheets. We can always insert one at a time by right clicking and then clicking insert read more
How to change default chrome search engine
Its pretty convenient to search by directly typing a keyword in Google chrome address bar. You can set Google or some other search engine as read more
How to delete files starting with dash/hyphen
Deleting files starting with dash or hyphen can be little tricky as dash is interpreted as option prefix on Mac and Linux. Here is what read more
Mac – open a terminal from a folder
Sometimes we want open Mac terminal from a specific folder which should automatically change directory to that folder. This can be achieved in Mac by read more
Mac terminal – how to close shell on exit
It is somewhat tedious to close a terminal window shell manually after the shell exit. By default Mac terminal does not close the shell on read more
Setup xdebug for remote wordpress debugging
Using xdebug is pretty useful for debugging and sometimes understanding existing code. In a typical setup where wordpress in installed remotely on EC2 or any read more
Mac – how to open apps not from App Store
By default security settings of Mac does not allow apps by unknown developers not downloaded from app store to be opened by double clicking on read more
How to remove xmlrpc from wordpress headers
If you don’t need xmlrpc in your wordpress, you can disable it at various places like http x-pingback header, html meta tags, etc. Here are read more
Bulk convert jpeg files to png using sips on mac
mac sips (scriptable image processing system) is a very handy tool to convert image from one format to another. This can also be used to read more
mac pkgutil – quick start guide
pkgutil can be used to query Mac OS X Installer packages on Mac. This can be useful to get information about various packages and files. read more
Android chrome – create website bookmark on home screen
Opening a site by typing complete url can be pretty painful on a mobile device. On android it is pretty handy to create a website read more
Command line – run python webserver
Sometime we need to run a quick static webserver which can serve various files in a directory. This can be pretty handy to serve html read more
haxe openfl on mac – quick start guide for mobile development
Haxe is a cross platform toolkit and supports cross compilation in many different languages. It is a pretty good choice for game and app development read more
Convert mp3 to ogg on Mac using ffmpeg
Sometimes we need to convert mp3 files to ogg files. Ogg is an open format and produces fairly small size files. Here are the instructions read more
adb – android debug bridge – quick tutorial
adb (android debug bridge) is a command line tool which lets you communicate with your usb connected android devices or android emulators. Here are some read more
How to join multiple pdf files on Mac
Sometimes we need to combine multiple pdf files in one pdf file. This means the combined pdf will have pages from the first files and read more
How to upgrade wordpress manually
Recently I upgraded wordpress from version 3.5.1 to 4.3.1. There are couple of ways you can upgrade wordpress and easiest one is do it using read more
Linux rsync tutorial
Rsync is a great tool to copy and sync directories and files across computers. It can also be used to manage source code and data read more
Custom terminal tab title and ssh on mac
In case you are using ssh private keys to connect to remote Linux servers on cloud, it is better to automation connection to various machines read more
How to include wordpress pages in archives
WordPress archives are very useful in providing users and search engine bots like Googlebot a great way to browse all content on a wordpress site. read more
How to add tag and category to wordpress pages
Using wordpress tag and category is a handy way to browse various posts by tag name. WordPress supports browsing all posts for a specific tag read more
How to use custom identity file with rsync on Linux
Rsync uses ssh to sync files between two machines and usually it will use default identity file present in ~/.ssh/ directory on Linux. In case read more
Find which process is listening on a port on Linux
Sometimes we need to find out what process is using or listening on a specific port on Linux machine. This can be fairly useful in read more
Use x2go to access remote Ubuntu Linux
X2Go enables you to access a graphical desktop of a computer over network. It is a remote desktop solution for Linux. In this article we read more
Edit a file without changing its timestamp on Linux
Usually anytime a file a edited, its timestamp is also changed. There are cases when you want to change the content of a file but read more
Linux file timestamps
Linux stores creation, modification and access file timestamp of a file. Here is brief definitions of these three timestamps: Creation, modification and access file timestamp
Find memcache request hit rate on linux command line
Memcached gives you stats like total hits so far and total miss. It can also tell you total uptime. This can be used to find read more
migrate multiple mysql databases using mysqldump on Linux
Sometimes we need to migrate all mysql databases to a new machine. This can be the case when you are migrating your multiple wordpress blogs read more
prevent wordpress xmlrpc.php attack
Sometimes you may see too many POST requests to xmlrpc.php in your apache access log. Large number of hits to xmlrpc.php can slow down your read more
Find recently modified files on Linux
There are times when we want to find recently modified files in a directory. We can use command line tool find on Linux or Mac read more
How to zip/unzip a directory with password
Zip and unzip utility can be used to compress a file or directory on Mac. These should also work on Ubuntu or other Linux flavours. read more
CSS menu using css pseudo element :hover
CSS hover pseudo element can be used to create simple menu without using any Javascript. This is achieved by making menu children visible when parent read more
How to add a user on Linux with sudo access
Sometime we need to add a user on Linux environment from command line or from a shell/bash script and give it sudo access. Linux has read more
How to fix a broken sudoers file on AWS/EC2 Linux
In case you are using Ubuntu or Amazon linux on Amazon EC2 and introduce a syntax error, you won’t be able to run any sudo read more
How to install drupal on Mac usin MAMP
Drupal is an open source popular cms system powering millions of websites and applications. This article covers how to install Drupal on Mac using MAMP. read more
How to use exerciser monkey tool for android stress testing
Exerciser monkey tool can be used to generate pseudo-random streams of user events such as clicks, touches, gestures and system-level events. This can be used read more
How to use rrdtool plot traffic from network interface
rrdtool open source tool is used to log time series data and create nice graphs form that data. Official information can be obtained from rrdtool‘s read more
NFS client and server handy commands
In case you are using NFS server, here are some handy commands you can use while working in production. These were tested in Ubuntu Linux. read more
Mongo – cli quick start guide
Using mongo cli utility can be handy way to query mongo db and automate few simple use cases. This article covers some handy commands which read more
Ngrep – quick start guide
Ngrep is similar to tcpdump with ability to look for regex search in packets playload and show matching packets to screen. This can be very read more
Some handy linux gnu date commands
Using date command is pretty handy way to covert unix timestamp to string format and vice versa. This can also be used to print unix read more
Linux screen – quick start guide
When working on remote Linux terminals its a good idea to use screen manager as it will protect your session from disconnection. Here are some read more
Memcache – how to dump all keys and values on command line
Memcache is a very simple, distributed memory cache used widely with mysql and other databases. Often we want to inspect what is in memcache server read more
How to use pm2 to manage node.js application in production
PM2 can be used to manage and run application in production. For this article we are going to use Ubuntu 14.04.2 LTS. But it should read more
redis cli quick start tutorial
Redis is a fast key value cache and store. It is useful to get familiar with some handy redis command line interface (cli) commands. Here read more
curl – some handy commands
Command line utility curl (on Linux, Mac and other operating systems) is pretty handy tool for web developers and can be used to multiple activities. read more
CSS – use :before to add heading to a div
Css pseudo element/selector :before can be used to prepend some content before an element using a class or any other selector. This can be pretty handy read more
Alexa rank – how reliable is it?
Alexa provides a global and country specific site rank for a web site. For a country site rank, the site needs to have significant traffic read more
Xml sitemap – quick introduction
Submitting an xml sitemap to Google webmaster tools is recommended way to get site urls indexed by Google. This helps google to reach various urls read more
Mac command line utility open – some handy tips for better productivity
Mac command line utility open can be use to open files, folders, etc. It is pretty handy if you use terminal quite often on mac. read more
PhantomJS – find all fonts-families on a web page
PhantomJS (Headless browser javascript library based on webkit) can be used to find the font-families used on a website page using jQuery. This can be read more
How to install and run Chrome PageSpeed insights for measuring site performance
Page speed insight is a browser extension (Chrome and Firefox) which can be used to measure a website performance. It is an indispensable tool if read more
how to debug javascript in Chrome
Chrome developer tools can be used to debug javascript by inserting break point in the javascript code. This is pretty handy to not only debug read more
Php preg_match_all – test online
preg_match_all usage PHP regular expression match $retval = preg_match_all($pattern, $content [, array &$matches [, int $flags = 0 [, int $offset = 0]]]) (this page read more
How to convert HTML canvas to png image using javascript
HTML canvas element (HTML5) be used to draw 2D shapes using Javascript. Once a shape is drawn, it can also be converted to an image read more
view event handlers in Chrome
Chrome developer tools can be used to view event handlers/listeners on any element in an html page. This is pretty handy to quickly view event read more
Php preg_match – test online
preg_match usage PHP regular expression match $retval = preg_match($pattern, $content [, array &$matches [, int $flags = 0 [, int $offset = 0]]]) (this page read more
jQuery jsonp and cross domain ajax
JSONP or “JSON with padding” provides a method to request data from a server having a different domain. Typical web browser prohibit cross domain request due to same read more
Requirejs – quickstart guide for beginners
RequireJS is a JavaScript file and module loader. It can be used in browsers and other javascript environments like Node. This article is intended as read more
viewport and media queries for mobile browsers – quick introduction
Html meta tag viewport should be set to appropriate value for responsive web sites. Viewport content values like width define how the site will render read more
Javascript in header vs footer
Javascript should be placed in footer of html document wherever possible. For libraries like jQuery we don’t often have a choice as there may be read more
How to include angularjs javascript in wordpress post
AngularJS is great framework for declaring dynamic views in HTML documents. To include AngularJS we just need to include the angularjs javascript file in the read more
How to include bootstrap javascript and css in wordpress post
Bootstrap is pretty handy javascript and css library/layer over jquery which provides many useful pre-built functionalities like responsive design, transitions, modals, buttons, etc. In case read more
How to use html pre tag to display code
Html pre tag can be used to display code on WordPress blog or any site. HTML pre tag represent preformatted text. Text within this element is read more
Meta robot noindex, follow for wordpress tags and category pages
In case you want search engines to either not index or not follow links on a page, you can use robot meta tag. The default read more
Internal vs external css
There are two ways to include a css on a site. In case you are using a wordpress site, many plugins involving frontend ui element read more
How embed youtube video slice (specific start and end time)
Youtube iframe video embed code can be used to embed a slice of a video using extra parameters start and end. These are the steps read more
How to create and embed youtube playlist
YouTube has pretty nice playlist feature with lots of powerful options. You can add multiple videos to a list and play them together on YouTube read more
Python selenium webdriver – quick start guide on Mac
Selenium is an excellent tool which automates browsers. One of the commonly approach is to use Selenium webdriver which has API in many languages like Python, Java, etc. This read more
How to create Linux instance on Amazon AWS/EC2 Classic
[Update: This article is for Amazon classic. For Amazon VPC instructions may be slightly different] One has to make couple of choices while installing Linux read more
How to use phantomjs to create site/url snapshot thumbnail
PhantomJS in a scriptable webkit written by Ariya Hidayat. Chrome and Safari are based on webkit. This is the formal definition as per the official site: PhantomJS is read more
How to hide a post from home and RSS feed in wordpress
Sometime we want to hide a post from wordpress home page. One not-so-good alternative is to create it as a page. One drawback of that read more
Vim mini cheat sheet – handy commands reference
I use vi quite frequently (Ubuntu/Centos Linux and Mac) for many of my editing needs in addition of couple of other editors (eclipse, intellij, etc). read more
How to capture php code or included file output in a variable
Sometimes we want to reuse a php function or include a file and want to capture the output (from echo, print, etc.) of that function/file read more
WordPress SEO – beginner guide
Most of the SEO (Search engine optimization) can be done with very little effort. Ideally speaking there should not be too much effort in SEO read more
Mac brew (homebrew) – quick start guide
Many command line tools (e.g. wget, pstree) don’t come pre-installed on Mac. Homebrew is one of the easiest ways to install and manage these missing read more
How to use CasperJS to automate website testing
CasperJS is a navigation scripting & testing utility for PhantomJS, written in Javascript. Its a pretty handy utility to automate functional testing of a website. I’ll read more
How to write custom php in wordpress
If you are just writing text articles then you never need to write any custom php in wordpress. In case you want to write dynamic read more
Chrome memory usage – some tips to keep it under control
Google Chrome browser can take lot of computer memory specially when lots of tabs are used. To be able to use Chrome best it is read more
How to setup wordpress custom query params with pretty url format
WordPress pages can handle query parameters in url in the traditional format of “key=value”. e.g. If you want to create a page to display details read more
How to display date in wordpress pages
The default Twenty Twelve theme which comes with wordpress and many other themes display creation date in wordpress posts but do not display any date read more
Web fonts – beginner’s survival guide to web typography
There are lots of fonts available which can be used when you are designing a web site. There is no strict rule on choice of read more
Using JSLint on command line on Ubuntu linux – quick start guide
Sometimes javascript is developed and tested by pushing it to the website and then checking if it is working in browser as intended. If your read more
Logo creation high level checklist
Every site needs a logo and many times we end up changing logo multiple times for a site. There are multiple online services which lets read more
PHP preg_replace – dot all (PCRE_DOTALL) example – sandbox
HP preg_replace example for dot all (PCRE_DOTALL) match. By default dot does not match newline char. When we specify dot all (using “s” regex modifier read more
PHP preg_replace – back reference within pattern example – sandbox
PHP preg_replace example for back reference within pattern. Here the match is grouped using parentheses and that group is accessed using backslash followed by the read more
PHP preg_replace – optional character group regex example – sandbox
PHP preg_replace example for optional char group match. Here the regular expression (regex) pattern contains optional character group enclosed within parentheses and followed by questiom read more
PHP preg_replace – optional one character regex example – sandbox
PHP preg_replace example for optional one char match. Here the regular expression (regex) pattern contains question mark (“?”) and the char precedded by “?” is read more
Cross browser site testing – what browsers to cover
Cross browser development and testing is very important to any web based tool or site. There are so many web browsers like Google chrome, Firefox, read more
Mailchimp lightweight subscription form code
If you are using mailchimp for managing your newsletter campaigns, then you can either use a link to mailchimp site or use subscription form directly read more
PHP preg_replace – test regex online
preg_replace usage PHP regular expression search replace usage $replaced_content = preg_replace($pattern, $replacement, $content [, int $limit = -1 [, int &$count]]) Notes on preg_replace behavior read more
HTTP cookie and sub domains
When a cookie is set from a webserver, it can be for a specific domain or for a domain and all its subdomain. This article read more
Embed youtube video with javascript on-click lazy loading approach
Embedding youtube video using the default iframe code fetches couple of files and makes the page load little slower for the end user. Many users read more
Run Internet Explorer (IE) on Mac using VirtualBox and ievms script
For people who use Macbook as their primary machine, testing a site on Internet explorer (IE8, IE9, IE10) can be really painful. If you want read more
How to Preload cache in wordpress on Linux
I’m using memcache with w3c total cache plugin to cache pages on my wordpress site on Ubuntu Linux. The way it works is whenever someone read more
How to upgrade EC2 Ubuntu Linux micro instance to small
I was running my wordpress site on Amazon EC2 Ubuntu micro instance and it was performing pretty good. Even though I did not see any read more
PHP apc – setup and performance benchmarks on Ubuntu Linux
APC (Alternative php cache) is opcode and object cache for php. It caches the php bytecode on first execution of a php script which increases read more
Ubuntu – dpkg and apt-get beginner tutorial
Installing and managing packages is the first thing you do when you use any Linux system. It takes a while to get hang of it read more
How to install and monitor memcache for php on Ubuntu Linux
Memcache is one of the most popular distributed memory based cache system. It can give excellent performance results if configured correctly. Its a good idea read more
Php apc vs memcache
When you are running a site in php (wordpress or non-wordpress), there are two popular options for in-memory cache. APC (Alternative PHP cache): Opcode and read more
Handle XSS restriction using different domain for user entered javascript
Under normal circumstance we disallow any javascript to be executed from the user entered input as it can lead to cross site scripting (xss) problems. read more
How to bypass cross site scripting (XSS) protection by browsers
Cross site scripting (XSS) protection is handled by many browsers. I was able to test it in Google Chrome and IE (IE 8 and higher). read more
How to undo HTTP 301 site/domain redirect
In case you have moved a site to new domain and set all the HTTP 301 redirects (HTTP permanent redirects), then user who visits your read more
How to display wordpress page list with specific custom field value
WordPress lets you display a list of pages as links with many customizations. You can use wp_list_pages or get_pages to display or get list of pages. read more
How to setup MailChimp Rss email campaign
MailChimp can be used to setup email campaign and send a regular email newsletter to all the email address in a list. Most common use read more
How to setup MailChimp email list
MailChimp is very popular tool to manage email campaigns/newsletters. The first step in setting up any campaign or newsletter is to create an email list read more