I worked at a computer repair shop where technicians processed computers in the order that they came in, according to how long they predicted the repair will take. Every day they had a running list of computers that needed to be opened and tested. However, if there was an emergency where a customer needed their data right away, we could sometimes push their computer to the front of the line.
The technicians were using a priority queue in order to handle repairs, where computers with the highest priority were handled first.
I’m currently working on a project using Express and React in order to practice my TypeScript and Jest chops. I’m using the NYC Benefits Screening API, and midway through writing types and interfaces for my API requests, I thought, “Wow, wouldn’t it be great if I could share my types with someone else who might want to use this API?”
After some research, I learned that I should write a type declaration file and include it in a package on NPM. …
When I was younger, I used to have files and folders randomly strewn about on my desktop and external hard drives. As I reached high school where most of my work was done on a computer, I realized that it was really difficult to find anything on my laptop since the file organization was haywire.
It took a full weekend to completely re-organize all of my files — this was before USB 3.0 came out. Other than a few hectic times in college, my files and folders stayed pretty clean, and it helped when cloud storage started to take over.
Before the advent of cellphones and the internet, we used these things called phone books. Most of you probably know what a phone book is, but just in case: a phone book is a directory where businesses pay to list their phone numbers, usually arranged by type of business, and then alphabetically within each section.
Let’s say you hear from a friend that they used a service called “Roach-B-Gone”, but they forgot the number. Since it’s 1991, we have to look in the phone book. We open it up to around the halfway point and see an listing for “Larry…
Stacks and Queues are probably the most self-explanatory data structures, but to some they can still seem intimidating. Let’s think of them in terms of real-world applications.
You use a stack every day when you are browsing the internet or editing text. A stack is what keeps track of the websites visited/changes made so that our back/forward and undo/redo buttons function properly. Whatever goes on top of the stack is the first thing to get removed.
Note: This is a continuation of an earlier blog that I’ve written here. If you are new to TypeScript, I highly recommend starting with the first blog before moving onto what’s below.
Now that we’ve covered basic assignment for primitive data types and data structures, we can move onto some of the more non-traditional features that TypeScript offers us.
If you’ve ever used or written an API before, you know that an essential part of using it correctly is understanding the data in the response. In order to work with the data, you need to understand the shape it comes in, and the types of data within that shape. TypeScript allows us to pre-determine the shapes and types of our data in order to avoid errors and have organized code.
Merge and Quick Sort use a concept called recursion. Recursion is when a function calls itself…
When programmers see the word “list”, we usually immediately think “array”.
Arrays are great for storing data to iterate over, but since they have numbered indexes, manipulating elements in the array can be costly in terms of time and space complexity.
For example, if we wanted to insert a new element at the 10th index in a 100-element array, we’d have to re-index the other 90 elements after insertion.
If we need to work with a list of data that is constantly updated, we might want to use a data structure known as a linked list. …
Testing and Test-Driven Development is one of the most valuable skills in a developer’s toolkit. When I say testing, I don’t mean quick manual tests like using debugger/console.log (JS) or using Pry/Byebug (Ruby). I’m talking about writing separate test files with a library like Jest (JS) or Rspec (Ruby).
“So you’re telling me I have to write code that tests the code I just wrote?”
Writing tests is beneficial to your code in multiple ways.
It makes you think about your code. When writing tests, you have to think about all of the edge cases that may or may not…
Web Developer in Brooklyn, NY