If you are using Nightwatch JS to test a website and you need to test an anchor nested in an unsorted list, be sure to add the name attribute in the anchor, otherwise, the click command will fail. Let’s see a simple case with an HTML markup like this:

Read More

Let’s say you are using the simple stateless component below:

function MyStateLessComponent( props )
{
  const enableReading = props.enableReading || false;

  if( enableReading ) {
    // do something...
  {

  return(
    <div className="my-component-class">
      <div {...props} className="my-component-class-content">
        Hello, world!
      </div>
    </div>
  );
}
Read More
I have updated to version 2.0.0 my React Switch button control component. This is a Switch control built with and for React.

In this new version, I’ve rewritten the component model with some alignment for ES6. Also, I’ve added the disabled feature. You can see a Demo example here.

Read More

MorrisJS is a simple Javascript library used to draw simple beautiful charts. It is based on Raphael Javascript library.

A few time ago, I had written the first PHP version of this library. Now, I’m glad to release the Laravel service provider version of that library.

Read More

I love Laravel, and you? Overall, the Facades feature! When you use a facade like some Eloquent model, you have noticed the following case:

MyModel::where( 'id', $id )->where( 'name', $name )->first();

Here, we have two feature very important and useful:

  • the chain
  • the call to the static method where, and the call to the instance method where

Now, the chain is clear. It is very easy to implement. In fact, you need only return the $this pointer in your methods. Let me show an example:

Read More

I spent a lot of time to translate my previous PHP code from cURL in Guzzle Http. So, beware because if you use Guzzle you have to use a request in multipart. For example, this was my previous code:

Read More

Useful Laravel PHP artisan command to handle supervisor. Download here.

    Usage:
      shell:supervisor [options]

    Options:
          --list            List supervisor processes
          --start[=START]   Start supervisor process by process name
          --stop[=STOP]     Stop a supervisor process by PID or process name
          --start-all       Stop all supervisor processes
          --stop-all        Stop all supervisor processes
          --up              Start supervisor service
          --down            Stop supervisor service

Actions and filters are so awesome in WordPress. They provide a very simple and powerful way to customization the WordPress core. So, Plugins and themes can execute code before or after a specified event or change the result of many core functions. On the web, I found a few discussion about the Javascript porting of actions and filters.

Read More

Here you’ll find some useful jQuery snippets for document loaded.

jQuery Document Ready

// Common method
jQuery( document ).ready( function() {} );

// Or, if no conflict
$( document ).ready( function() {} )

// Variant method
jQuery( document ).ready( your_function );

// Alternative method
jQuery( function() {  
    console.log( 'Document Ready!' );  
});

// Alternative method and jQuery $ context
jQuery( function( $ ) {  
    console.log( 'Document Ready!' );  
}); 

Javascript Class

/**
 * Description
 *
 * @class           $CLASS_NAME$
 * @author          =undo= <info@wpxtre.me>
 * @copyright       Copyright (C) 2012-$YEAR$ wpXtreme Inc. All Rights Reserved.
 * @date            $DATE_NOW$
 * @version         1.0.0
 *
 */  
 
jQuery( function ( $ )
{
  "use strict";
  
  window.$CLASS_NAME$ = (function ()
  {

    // This object
    var $t = {
      version : '1.0.0',
      init    : _init
    };

    /**
     * Return an instance of $CLASS_NAME$ object
     *
     * @return {}
     */
    function _init ()
    {
      // Your init here

      return $t;
    };

    return _init();

  })();

});

Replace $CLASS_NAME$

Use strict directive

(function(){
  "use strict";

  // Define your library strictly...
})();

You can find out more stric directive in the John Resig – ECMAScript 5 Strict Mode, JSON, and More page.

Tips

The following snippets issue the same effect

+function() { 
  console.log( 'Hello World'); 
}();

// or

(function() { 
  console.log( 'Hello World'); 
})();

// or

(function() { 
  console.log( 'Hello World'); 
}());

// or

+function( $ ) { 
  console.log( 'Hello World'); 
}( window.jQuery );

// or

(function( d, $ ) { 
  console.log( 'Hello World'); 
}( document, jQuery ));


As usual, please don’t hesitate to leave any questions or comments in the feed below, and I’ll aim to respond to each of them.

Here you’ll find the list of actions run during a typical request by the frontend.

muplugins_loaded
registered_taxonomy
registered_post_type
load_textdomain
plugins_loaded
sanitize_comment_cookies
setup_theme
after_setup_theme
auth_cookie_malformed
auth_cookie_valid
set_current_user
init
widgets_init
wp_register_sidebar_widget
update_option
update_option__transient_doing_cron
updated_option
set_transient__transient_doing_cron
setted_transient
http_api_debug
delete_option
delete_option_rewrite_rules
deleted_option
add_option
add_option_rewrite_rules
added_option
wp_loaded
posts_selection
template_redirect
get_header
wp_head
wp_enqueue_scripts
wp_print_styles
wp_print_scripts