Far and wide, you’ll find only just a few samples of self joins. The first source you’ll probably go to is the Active Record documentation.

A famous example of a self join in social media is Twitter’s follow system. I only realized how novel a pattern this is after finally implementing my first self join for a project I did recently with collaborator, Jen, on a project we did using vanilla javascript and a rails backend api.

The best way to get the hang of these is to make them. To follow along here, you need to know some Ruby…


Image for post
Image for post
Image credit: Invader Zim, created by Jhonen Vasquez

What is Vim?

Vim is a command line editor. Its predecessor was Vi — a UNIX based editor, that was eventually improved to the point, they gave it a new name: Vi IMproved. Hence: VIM.

How to Get Started

It’s easy to start up with Vim. I won’t cover installing since it comes prepackaged with Max & Linux. However, if you want to install it on pc/windows, go ahead and visit this site and read the instructions.

Create a new text file using Vim

It’s pretty easy: first start up your terminal and use the ‘vim’ command and specify a filename of your choice. I’m going to name mine ‘new_file.rb’:


a heap of chopped garlic chives to demonstrate a real-life heap representing a heap in computer science
a heap of chopped garlic chives to demonstrate a real-life heap representing a heap in computer science
image by freeimageslive.co.uk — freefoodphotos

What’s a heap?

In real life, a ‘heap’ is literally a pile of items. In computer science and programming, a heap is fairly similar, but more specific to organizing data.

To understand what a ‘heap’ is, first go and understand what a ‘tree’ is. Once you’ve read and understood what a ‘tree’ is, understand that a heap is basically a tree with slightly different rules.

Two Different Ways of Defining a Heap

Whichever way you define it, a heap is tree with no order and slightly different rules depending on what kind of heap you use. …


Searching Siblings in a Tree

Image for post
Image for post
Breadth First Search is an important part of a programmer’s arsenal.

What’s this all about now?

A good student of computer science will probably already know this; but a tree is a way of organizing information. In computer science, it’s a very efficient method for storing data for quick retrieval later.

What’s a Tree?

In this case, we’re referring to a data structure that consists of nodes that inherit from other nodes, referred to as ‘parents.’ So every node that is above another node is a ‘parent’ and every node that is below another node is a ‘child.’


After working on a React project for a little bit, I realized it would look a lot nicer as a single page with a “scroll-to” navigation from my site’s navbar.

For React, there’s a great library called ‘react-scroll.’

But I wanted to understand the basic JavaScript of how it’s done. I actually found a few different articles from old hands saying how they used to always have to basically do everything from scratch.

scrollIntoView()

That is, before the JS method scrollIntoView() was added. You can look at tutorials of how to do everything from scratch, but at the end of the…


Problem solving is a process. It’s easy to forget that in order to solve a problem, you need to actually focus on solving the problem.

I’ve been using a Udemy course by an instructor named Colt Steele, called JavaScript Algorithms and Data Structures Masterclass. In this course, Colt has an entire section devoted to Problem Solving and lays out actionable steps.

At first, I just made quick notes and moved on as quickly as possible. However, as I progressed in my endeavor to practice problems for tech interviews, I realized I had a problem. …


I was messing around with Google Cloud’s Text to Speech API and wanted to test it out by making the call on a Rails backend and receiving the response with a React frontend and playing the sound.

I won’t go into how to use the Google Cloud Text to Speech SDK Gem for Rails, but needless to say, the example code given in the documentation has everything you need.

I will, however, walk through how I made the call to Google Cloud to get the “sound” of the text I sent it.

I created an App called “Du It!” which…


This is an in-depth look at promises in JavaScript.

Most of the research done was gleaned from the Mozilla Development Network (MDN) page for Promises, so definitely look below to see the link.

Promises are relatively new in JavaScript and were implemented to deal with asynchronous functions and keep entire programs running while background processes are either waiting to complete or waiting for input, etc.

Here’s the purpose of a Promise in one sentence: to defer actions until after a previous action has completed.

The full defiitioin of promises says:

“The promise is an object that represents an intermediate state…


Hash…

Hash Browns?

Image for post
Image for post

No … Hash.

I’ve been curious about the name and the purpose behind the word ‘hash.’ Referring to just the name means a datatype to store information. Referring to a ‘hash value’ is usually done in the context of authentication.

In general, a hash function is a function that takes a string and returns a value.

The question is: What are they used for and how many different kinds are there?

Cryptographic Hash Functions

Josh M.R. Allen

Crazy cool like a mouth full of 花椒 (Sichuan peppers)! Software Engineer | Rails | React | JavaScript | Ruby | AWS S3 | Proud father of a precocious explorer.

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