Keyboard shortcut/aliases for the WP CLI, Git, Grunt & PHPCS commands for windows

In development, We spend a lot of time on the command line. We type a lot of commands on regularly.

I have created a shortcut for the most of the commands which I use on a daily basis some of them are below:

WP CLI

Command Keyboard Shortcut/Aliases
wp theme list wpthl
wp plugin list wppll

Check all the available WP CLI commands etc. (all WP CLI commands list)

Example 1. Using shortcut wpthl instead of wp theme list

Example 2. Using shortcut wppll instead of wp plugin list

Some more commands with keyboard shortcuts/aliases are below:

Grunt

Command Keyboard Shortcut/Aliases
grunt release grr
grunt minify grm

PHPCS

Command Keyboard Shortcut/Aliases
phpcs pb
phpcbf pbf

Git

Command Keyboard Shortcut/Aliases
git add . gaa
git commit –message gcm
git checkout gco
git pull origin gpu
git push origin gpp
git status gs

To create keyboard shortcuts using aliases is very simple. We can create any command shortcut/aliases.

Follow below simple steps:

  1. Open the file .bashrc which is found in location  C:\Users\USERNAME\.bashrc and
  2. Add below sample commands of Git & Grunt.

I found the article Terminal/Bash Command-Line Shortcuts with Aliases written by @jonsuh to create keyboard shortcuts for the Terminal/Git Bash.

I have added some more commands of Grunt, WP CLI & PHPCS on my local environment.

Advertisements

Using absint() in WordPress

It convert a value to non-negative integer.

Internally this function used abs( intval( $maybeint ) ).


You can try below examples yourself.

Examples Output var_dump
absint( 0 ) 0 int(0)
absint( '0' ) 0 int(0)
absint( 1 ) 1 int(1)
absint( '8' ) 8 int(8)
absint( -27 ) 27 int(27)
absint( '-8' ) 8 int(8)
absint( 'abc' ) 0 int(0)
echo absint( 0 );
// Output: 0 
// var_dump() int(0)

echo absint( '0' );
// Output: 0 
// var_dump() int(0)

echo absint( 1 );
// Output: 1 
// var_dump() int(1)

echo absint( '8' );
// Output: 8 
// var_dump() int(8)

echo absint( -27 );
// Output: 27 
// var_dump() int(27)

echo absint( '-8' );
// Output: 8 
// var_dump() int(8)

echo absint( 'abc' );
// Output: 0 
// var_dump() int(0)