-
LeetCode 112. Path Sum Solution | Javascript | Leetcode
Problem: → https://leetcode.com/problems/path-sum/ Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum. A leaf is a node with no children. Example 1: Input: root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22Output: trueExplanation: The root-to-leaf path with the target sum is shown. Example 2: Input:…
-
JavaScript: Arrays vs Sets
In ES2015, we got a new data type Set. Most developers are quite familiar with Arrays. Therefore, in this blog post, we will take a look at the differences between Array & Set. What is a Set and an Array? Set Set is a data type that stores data that are unique values of any type, whether primitive or…
-
The Difference Between Hierarchical and Non-Hierarchical Taxonomies in WordPress?
‘hierarchical’=>false When you specify a ‘hierarchical’=>false you get the following type of metabox which is the metabox format WordPress also uses for Post Tags: Taxonomy Term Metabox in the Post Edit Screen when $hierarchical==false ‘hierarchical’=>true However when you specify ‘hierarchical’=>true you get the following type of metabox which is the metabox format WordPress also uses for Categories: Taxonomy Term Metabox…
-
Don’t repeat yourself (DRY)
Try to observe the DRY principle. Do your absolute best to avoid duplicate code. Duplicate code is bad because it means that there’s more than one place to alter something if you need to change some logic. Imagine if you run a restaurant and you keep track of your inventory: all your tomatoes, onions, garlic, spices, etc.…
-
Singleton Design Pattern
What is singleton ? Singleton is a creational design pattern, which ensures that only one object of its kind exists and provides a single point of access to it for any other code. Singleton has almost the same pros and cons as global variables. Although they’re super-handy, they break the modularity of your code. You can’t…
-
Understanding the GitHub flow
In this post I present the GitHub flow is a lightweight, branch-based workflow that supports teams and projects where deployments are made regularly. This guide explains how and why GitHub flow works. Why git? For a thorough discussion on the pros and cons of Git compared to centralized source code control systems, see the web. There…
-
Why good commit messages matter
If you browse the log of any random Git repository, you will probably find its commit messages are more or less a mess. For example, take a look at these gems from my early days committing to Spring: Yikes. Compare that with these more recent commits from the same repository: Which would you rather read? The former varies in…
-
WordPress Terminology
Now, here are some terms which you will find handy when talking about WordPress – Back End – The back end refers to the area of your site where you can log in and manage everything from your Dashboard. Codex – The official WordPress manual with support articles, documentation, code snippets, and links to external resources. Content…