Access Control Patterns

When debugging this issue in Co-Authors-Plus plugin for WordPress, I’ve read relevant classes, functions, and hooks regarding roles and capabilities in WordPress core. That triggers my curiosity to get to know more about how to design access control for applications.

This post is not really a summary or research. It’s more a note of mine for articles I’ve collected.

Continue reading “Access Control Patterns”

Cachegrind – Profiling Tool

I’ve recently worked in a code test project in my company A8C and it has a task to improve the performance of an existing code. The excellent part is that the test gives a suggestion to use cachegrind. I was really impressive how this tool can help profiling the code, visualize profiling results, and find out exactly places where performance issues happen.

Continue reading “Cachegrind – Profiling Tool”

add_action – WordPress and SICP

I am going through the well-known Structure and Interpretation of Computer Programs book and come across a mention about add_action.

This immediately brought my attention as WordPress has a similar concept called hooks (add_action and add_filter). Section 3.3.4 of the book gave an example of how this concept is deployed, which is simple but brings a lot of flexibility to the system.

Such an enlightened and connected feeling!

Woo Viet 1.5.0 and OnePay Gateways

It has been one year since my previous release 1.4.5 for Woo Viet – WooCommerce for Vietnam. In this version 1.5.0, I focused on two main issues:

I tracked this version with the milestone feature in GitHub.

Continue reading “Woo Viet 1.5.0 and OnePay Gateways”

Currency Conversion – My React Side Project

I often travel abroad and currency exchange is somewhat I need to deal with in every trip. There are a lot of great apps out there but they also usually come with ads. After having finished a few courses and guides about React, I wanted to get started with a real project whose features and scopes are defined by myself. That’s my main motivation for this project!

Have a quick look at demo or code on Github!

Continue reading “Currency Conversion – My React Side Project”

WordPress: Detect Homepage on Functions.php

Sometimes you may want to write code that triggers a hook in the homepage of your WordPress site. You try using this code:

// Wrong way if you want to use a hook
if ( is_home() || is_front_page() ) {
  // Add a hook (filter/action) here

It can not work because these functions can be really triggered in WordPress template files only. More specifically, they can only be triggered after the main WordPress query is run.

A simple workaround looks like this and actually it can apply to any site, not just WordPress:

// Correct way if you want to use a hook
if ( $_SERVER[ 'REQUEST_URI'] === '/' ) {
  // Add a hook (filter/action) here

MERN Course on Udemy

In half of this year, I have spent time on freeCodeCamp to learn thoroughly all JavaScript courses from the basic one to the most complicated one. I had a basic understanding of all of them. However, when it comes to how to organize and connect all pieces into a real project, I was still not sure. 

From the recommendation, I finished this course on Udemy two weeks ago. This is a great course to gather all knowledge fragments about MongoDB, ExpressJS, React/Redux, and NodeJS.

Continue reading “MERN Course on Udemy”

Computer Networking: A Top-Down Approach

With the wish to build up my computer science skills, I read and did exercises in this textbook based on the recommendation from TeachYourselfCS website.

The reason I chose Networking first is that I have worked with Internet everyday since I started working. But I did not expect that I will master the Networking field after learning this textbook. I just wanted to have the general understanding about Networking.

Continue reading “Computer Networking: A Top-Down Approach”