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

Here you’ll find the actions run during a typical request in the backend admin area.

muplugins_loaded
registered_taxonomy
registered_post_type
load_textdomain
plugins_loaded
sanitize_comment_cookies
setup_theme
after_setup_theme
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
admin_bar_init
add_admin_bar_menus
delete_option
delete_option_rewrite_rules
deleted_option
add_option
add_option_rewrite_rules
added_option
wp_loaded
auth_redirect
_admin_menu
admin_menu
deprecated_argument_run
admin_init
current_screen
load-index.php
add_site_option
setted_site_transient
wp_dashboard_setup
do_meta_boxes
admin_enqueue_scripts
admin_print_styles-index.php
admin_print_styles
admin_print_scripts-index.php
admin_print_scripts
wp_print_scripts
admin_head-index.php
admin_head
adminmenu
in_admin_header
wp_before_admin_bar_render
wp_after_admin_bar_render
admin_notices
all_admin_notices
welcome_panel
right_now_content_table_end
right_now_table_end
right_now_discussion_table_end
rightnow_end
activity_box_end
media_buttons
wp_enqueue_media
posts_selection
in_admin_footer
admin_footer
print_media_templates
admin_print_footer_scripts
before_wp_tiny_mce
after_wp_tiny_mce
admin_footer-index.php
shutdown