From The Blog

Error running npm command

If you already faced this error: /usr/bin/env: ‘node’: No such file or directory Then you are probably installed npm on Ubuntu using package...

Read more
Drupal: Form Validation Messages Order

Hello all Drupalists, Have you ever had a problem with form validation messages order, ... I think we all had this issue. For some reason...

Read more
Drush command terminated abnormally due to an unrecoverable error

This error might be very frustrating to you, specially when you can't see any issue with your code, can't check error log, and obviously can't do...

Read more
How to test RSYNC before already syncing

Wrong execution of rsync command can result a mess that you may cost you some precious time to fix later, so you can test the rsync command before...

Read more
MySQL: Select all tables that has a column with name

How to select all tables that has a column / columns: SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('column1','...

Read more
Git: List changed file names only between two commits?

Occasionally you are in the situation that you need to know which files were changed from a commit to commit either to check an issue or to deploy...

Read more
Drupal: Custom node edit menu callback, image upload widget disappears when change file

I had an issue with a custom node edit menu callback, that when the remove button is clicked to replace the current uploaded image, the whole widget...

Read more
Show which git branch you are using on terminal

You can Add this code in your ~/.bashrc file to view the current branch in your project like   function parse_git_branch () { git branch...

Read more
Drupal7 Views3: Empty "Row style output" templates

I had an issue when I was trying to create a new display and tried to theme it, I found the "Row style output" template suggestions like the...

Read more
Javascript: stop submitting form on pressing ENTER key

//stop submitting form on pressing enter key //This code will allow enter key on textarea function stopRKey(evt) { var evt = (evt) ? evt : ((event...

Read more
MySQL: Get locked tables

To get locked table you can use: show open tables WHERE In_use > 0   To get locked table in database (for ex.: database name: test_db) show...

Read more
Wordpress: WooCommerce: Add a custom currency / symbol

To add a custom currency paste this code in your theme functions.php file or in a complementary plugin for WooCommerce and swap out the currency code...

Read more
Wordpress: WooCommerce plugin: How to Override WooCommerce Template File Within a Plugin

Override WooCommerce Template File Within a Plugin The goal of this article is to describe one approach to overriding WooCommerce core template...

Read more
Wordpress: add menu order support to posts and other post types

How to add menu order support to posts and other post types ?   add_action( 'admin_init', 'posts_order' ); function posts_order(){...

Read more
Javascript: have variable variables

In PHP to have "Variable" variables. For example $x = "variable"; $$x = "hello, world!"; echo $variable;" //"hello, world!" So as a workaround...

Read more
PHP - Ubuntu: supported locales

1. First of all list supported locales: cat /usr/share/i18n/SUPPORTED 2. Copy the locales for your region. I will copy the following lines: sv_SE.UTF...

Read more
PHP: Problem getting date in different locale

Have you ever faced a problem trying to get date in another locale ? The way you can do it right is as follows: You will use set setlocale(), ...

Read more
CSS: How to disable text selection ?

.no-selection{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user...

Read more
PHP: Regex match anchor text and url in a string

To match anchor text and url in a string: $sourcestring = 'this is a good test <strong><a href="http://wordpress.org">file (.docx)</a...

Read more
Wordpress: Featured image box not showing ?

Have you ever been developing in wordpress and did not found the featured image box ? Sure you have missed adding the support to post thumbnails,...

Read more
jQuery Colorbox: Hide background page vertical scroll bar on open

To hide the scroll bar of the background page when the colorbox opens "like facebook for example"   /* make the page scroll dissapear when...

Read more
HTML5 Javascript: get file input upload size locally

if (typeof FileReader !== "undefined") { var size = document.getElementById('upload_file').files[0].size; size = Math.round(size / 1024); console.log...

Read more
Wordpress: Using WP_Query Arguments

<?php /** * WordPress Query Comprehensive Reference * Compiled by luetkemj - luetkemj.com * * CODEX: http://codex.wordpress.org/Class_Reference/...

Read more
Get the sources of img tags from html

/** * get the sources of img tags from html input parameter */ function get_html_img_sources($html){ //$html = types_render_field( "gallery_image",...

Read more