This past week, I ran into a problem while working on the reducer logic of my application. I needed to ensure the reducer was not adding duplicate data to state. Normally, I would utilize a
Set can remove any duplicates of the same object within an array but cannot detect that different objects have identical keys and values.
A naive approach would utilize a nested loop to iterate through the collection, checking each element with…
Rake, which stands for “Ruby Make”, is a ruby utility that takes place of the common Unix
make utility. If you’ve worked with rails at all I’m sure you’re familiar with using commands such as
rake db:migrate or
rake db:rollback to manage your server’s database. These default rake tasks are automatically bundled with your rails install, but you can also write custom rake commands to automate any task of your choosing.
Your custom rake tasks must be written in a file with a
.rake extension which must be located within
Declaring a task within our
Though I’ve moved on to other pursuits, the knowledge and wisdom I gathered while studying music will always stay with me. One such nugget of wisdom comes from the great Clark Terry: “Imitate. Assimilate. Innovate.” Clark Terry was an absolute goliath of a musician, an expert at both the trumpet and flugelhorn who played with Count Basie, Duke Ellington, Ella Fitzgerald, Thelonious Monk, Dizzy Gillespie, Ray Charles, Quincy Jones, and so many more.
That mantra—imitate, assimilate, innovate—proved to be an excellent guiding principle during my musical years, and continues to pay dividends to this…
When it comes to CSS, everything is a box. It doesn’t matter if it’s a button, an input, a div, a span, etc. At the end of the day, they’re all boxes in the viewport. You can see this pretty easily by opening up dev tools and adding a custom style rule.
border: 1px solid green !important;
The QuickSort algorithm is one of many examples that utilize the divide and conquer paradigm. As the name suggests, this paradigm involves breaking the problem down into smaller and smaller chunks until a base case is reached. At that point, you’ve broken the problem down into small enough bits that it’s easier to solve for the few base cases that exist. Keep this strategy in mind as we look at how the QuickSort algorithm is implemented.
In plain English, QuickSort works by selecting a pivot element which is then used to sort the remaining elements in the array. Any element…
In my last post, I covered the ins and outs of the Binary Search algorithm. The binary search method assumes that the collection you are browsing has already been sorted, and the two pointers technique is no different. However, whereas binary search locates a single element within a collection, the two pointers technique is used to locate two elements within an array that together meet a condition. Let’s take a look at how it works.
Let us turn to a brute force, naive solution to a problem where the two pointers technique might be better suited.
Given an array of…
The default database framework installed with Rails is
sqlite3 . As the name implies, it’s a lightweight SQL-based database system that works straight out of the box. Unfortunately, the framework isn’t supported by Heroku, which requires your code to utilize Postgres to function. I figured it’d be a good idea to set up a local Postgres server to familiarize myself with the framework.
There are multiple options when it comes to installing and managing Postgres. Postgres.app is a GUI that will also download and initialize a Postgres server for you. PgAdmin comes automatically with the installer provided by the Postgres…
In my last blog post, I introduced Noodlr, an online step sequencer that programmatically generates music based on user input. Due to popular demand, I decided to implement a feature that encodes the state of the sequencer a URI safe, base 64 string.
One of my least favorite things online is when websites force you to create an account to interact with their content. As such, it was important to me that vamps could be easily shared with anyone, not just other users with Noodlr accounts.
I built Noodlr as part of my final project at the Flatiron School. The requirements for the project were rather open-ended and, unsure of what to make, I asked a couple of my friends for suggestions. A good friend of mine is a drummer, and he suggested came up with the idea of creating an online web metronome which I thought would be a good challenge.
I had never worked with web audio before, and admittedly felt a little lost when I was first working on things. After a few days of research, I discovered Tone.js, an amazing open-source web…
As I’m learning more about programming and software development I’m quickly realizing the importance of understanding algorithms. Sure, many higher-level languages have all sorts of search and sort functions built-in, but the importance of truly understanding how these functions work cannot be understated. This post will give a walkthrough of the binary search algorithm, a foundational tool that should be in every programmer’s kit.
One of the simplest methods available, the linear search, starts from the beginning of the collection and works towards the end, checking each element until the target is found.
Think of trying to find a name…
Full Stack web developer. Former Creative. Amateur baker, barista, and cat dad. he/him