Data Structures and Binary Trees

There are plenty programming data structures each with their own characteristics, pros and cons. A data structure is just a way to organize data to be usable. Examples include arrays, linked-list, matrixes, and binary tress. Binary trees are defined by nodes and up to 2 children, a left and right pointer.

URL parameters or sometimes called query strings is a concept of structuring additional information in the URL. The parameters follow a “?” and multiple parameters are separated by the ‘&’.

These parameters are great ways to include additional data that is readily available and accessible at all times. For example, if our url looked something like this

https://www.videostreaming.com/watch?cat_memes

Being able to target the keyword from the URL could be very useful in certain cases so quickly let’s see how to do that.

const search = window.location.search;
console.log(search);

window.location.search grabs the url search params which is everything after the ‘/’ or main domain. After saying the params to a variable we can then parse the variable with the urlParams.get() method.

const watch = search.get('watch');
console.log(watch);

If we do this correctly we will get access to a string called “cat_memes” under the variable watch.

The access modifier is the keyword that precedes all other keywords when creating a class, method or even a variable. There are four keywords, public, private, protected & default, each with different levels of access. I believe it be best practice to start with the lower access levels and more up as needed. A variable that controls the width and height of a window can safely be reserved for private access.

“Final” is a powerful keyword as well, it makes those variables unchangeable after initializing. If you want a height, width, grid to be the same all the time binding those variables to final is a good idea.

So what’s going on?

In this example, we can see the use of both public and private. These two access modifiers in particular are very popular and you will see them everywhere. Understanding…

Efficiency in algorithms is very important when it comes to scaling and sizing. Total execution time and space required for an algorithm can be the difference between a seamless experience and one that is laggy and robust. Let’s quickly run through a practical example, this is algo to calculate whether a number is prime or not.

In order to check if a number is prime we will loop through all numbers from 2 to but excluding the actual number and check its divisibility.

If we stick to numbers relatively tiny in size we can expect to return a result in a second or two. …

Importing styled components into your React applications can bring peace and mind to styling your front-end. Before styled components I would struggle to maintain .css files with 100+ lines of code. When you factor in the many components that any React project may have it can become incredibly difficult and overwhelming. My preferred method with styled components, is to extrapolate each component to its own styled file and import that file.

So to get started with styled components we need to install it.

npm install --save styled-components

Once installed we can get started with style components. There are many ways…

This blog will examine arrays in JavaScript and how to manipulate the elements inside and predict outcomes. In order to illustrate this we will look at common entry level interview questions and walk through them to better understand arrays and how to approach problems in a similar vein.

I. Palindrome

A common entry level interview question is to compare the elements within an array to meet a certain expectation. Typically this question is phrased as “Finding the palindromes” or reversing strings but the general idea involves manipulating data types within the array. An array is just list of strings, numbers or any…

Hey this will be a quick DIY ad blocker guide. They are incredibly simple to make and they can be a great project to understand how your browser responds/requests data.

Manifest.json

First we will need to create a manifest.json file if you are making this project from scratch. Manifest files are just headers that hold details about the current project. The only two key that are required are “permissions” and the “background”. The rest can just be personal information. Here is my manifest for example.

"permissions":[ "webRequest", "webRequestBlocker", "<all_urls>"] => We want to give permissions to chrome webRequest API, and then…

Iframes, written in HTML as “<iframe>”, is a great resource for holding and displaying images. Anything from an intractable map pulled from an API or other HTML code itself to be render. This article will show you the latter, it gets pretty meta so let’s take a look.

Setting up iframe tag

First we will take look at the iframe and its attributes. There are many important ones but for the purpose of this article we will inspect the srcdoc attribute. The srcdoc is where we will store all our HTML code to be displayed in the iframe.

The srcdoc code looks very similar…

Define “this”

Simply put “this” is a JavaScript keyword that always refers to an object, the object can vary depending on how the object invokes a function. “This” will always reference an object and if it is called on a function held in the global scope, then that reference’s value will be the ‘window’ object.

function print() {
console.log(this)
}
print() // Window {window: Window, self: Window, document: document, name: "", location: Location, …}

Simple function that logs “this”. …

GitHub Logo

What is GitHub, Whats a Git?

GitHub is a cloud based code hosting service, it allows programmers to collaborate and manage projects at anytime. GitHub does this through the use of Git repositories, a collection of source code states archived at the request of the user(s). With options to clone or fork these repositories it makes it extremely easy to examine the source code, make adjustments and then upload the source code again. It has revolutionized the industry and has given developers of all levels a place to share projects. Theres a reason Microsoft acquired the company for $7.5 …

Kody Samaroo

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store