Pages

Computer science, programming and code examples, blog posts, and small projects.

Fixing CORS Preflight Errors on Your Express.js API

Trying to access or allow users to access your Express.js API but getting CORS errors? Fix the errors by adding these few lines of code.

View

Real-Time Social Proof Ticker using WebSockets with Node.js

To encourage ticket sales, I built a real-time tickets purchased ticker in Node.js using WebSockets in an incredibly short amount of code.

View

Lifting State Up with React and Submitting a Form

By lifting-state-up and maintaining your application's state in a parent module you can ensure modularity and the separation of views.

View

Dynamic Page Metadata with React and Express.js

Do you have a site built in React that you want to generate organic traffic? If so, you need to search engine optimize your site and it starts with custom, dynamic metadata.

View

Exporting a Browser Event Listener Class in TypeScript

Creating a TypeScript class is a great way to write code efficiently. Here's how you can create an eventListener class and implement it in a browser.

View

Practical Image Magnification using Canvas and JavaScript

I like using Canvas - especially for practical purposes such as making lightweight and user-friendly image magnifications.

View

My Founder's Journey

9 Product Hunt Submissions, a couple dozen domain names registered, dreams to last for years, and other notables from my journey as a solo-preneur.

View

Why I Created a New CMS for My Clients in Node.js

Usually, there are tools out there that make a project more efficient, but sometimes it's best to build something from scratch. Here's why I built a Node.js client CMS ...

View

Complete Binary Search Tree Code Implementation in JavaScript

Binary Trees are common data structures used in computer science specifically for programs geared toward high efficiency searching and output.

View

Start Over: The Simple Way to Accomplish Nesting Level 0

Avoid out-of-control if-else nesting conditional statements known as 'pyramids of doom' with these easy return statements.

View

Check if Binary Search Tree Structure is Valid

Binary search trees allow for efficient functionality but only when their nodes follow the rules. Here's how to check if a binary search tree is valid.

View

Hash Table JavaScript Implementation with Linear Probing

Probing allows hash tables to have dynamic sizes which greatly influence memory and time efficiency. Here's how you can build the functionality in JavaScript.

View

Building a Binary Max Heap in JavaScript

Binary max heaps allow for efficient data insertion and max value extraction and are used for the efficient heap sort algorithm.

View

DRY Routing Techniques Using Express Middleware and MySQL

When utilizing a lot of data from multiple MySQL databases, routes in Express can get a little messy. Here's my strategy on leveraging Express Middleware to achieve DRY code.

View

Binary Max Heap Sort Algorithm in JavaScript

The heap sort algorithm is one of the most efficient ways to sort values in computer science. This post includes a concise JavaScript implementation of the algorithm.

View

Combining Routes with Closures in Express.js

Combining Express.js route calls and using closures in a way that will make any DRY programmer giddy ...

View

Binary Search Algorithm with Arrays in JavaScript

The binary search algorithm is one of the most efficient ways to find an element in an already-sorted set of data. We can implement binary search with a simple array data structure in JavaScript.

View

Computer Science Background Effect with HTML5 Canvas

Using Canvas to make an interesting and interactive background effect.

View

How I Reduce Contact Form Spam

Website-generated spam is a major problem - one that doesn't go away and is next to impossible to solve. Here's what I did to all but solve the problem entirely.

View

Storing Big Data With Distributed Hash Tables Simulation

Hash tables provide a great data structure method for storing large quantities of data because, on average, they provide constant time search access to the data.

View

Creating a Constant-Time JavaScript Stack

You can create a stack object in JavaScript that will enable you to maintain your data in constant time including pushing, popping and getting the maximum value.

View

Adding Tooltips to Links Using JavaScript Closures

Closures in JavaScript provide a great way of manipulating multiple items in the DOM. Here's how I use a closure to make my links opening in new tabs accessibility-compliant.

View

Network Packet Processing Simulation in JavaScript

This is a simulation of a network packet processor actively receiving new packets, placing incoming packets in queues and processing them according to size and memory constraints.

View

Maximum Value in JavaScript Sliding Window Queue

We can create an object in JavaScript to behave like a stack and a queue to help us with the sliding window, constant-time conundrum.

View

Using Priority Queues to Simulate Parallel Processing

We can use binary heaps to create efficient priority queues. In this code example, we simulate a scheduler program that sends jobs to multiple processors based on priority.

View

Check balance of brackets in code

Code examples for validating string balance particularly when it comes to opening and closing brackets.

View

Check User's Dark Mode Preferences Automatically in CSS and JavaScript

Some users prefer to view content with their screen set on 'dark mode'. Not only can we set up our website to provide a dark mode option, but we can automatically set it based on the user's preferences.

View

Tree Data Structures in JavaScript & PHP

See how to create, add to trees, remove from trees, traverse trees and more in these JavaScript and PHP coding examples.

View

Replicating a Dynamic Array in JavaScript

Although arrays in JavaScript size-up automatically, we can create a stack object to replicate the process of creating a dynamically allocated array.

View

Linked List Data Structure Implementation

Linked Lists are a computer science data structure that uses pointers to connect nodes located at different points in memory. Here we implement linked lists in JavaScript.

View

Merge Sort Algorithm Implementation in JavaScript

The merge sort algorithm works by dividing larger data sets into small ones - think divide and conquer - before rebuilding the dataset in the sorted order.

View

Radix Sort Algorithm Implementation in JavaScript

The Radix Sorting Algorithm is an interesting program that puts integers in order by breaking up integers into their individual places - think 1s place, 10s place, 100s place and so on in decimal.

View

Selection Sort Algorithm Implementation in JavaScript

The Selection Sort algorithm sorts a dataset by finding the smallest value and moving it to the left of the data structure. When it locates the smallest number from the remainder of the unsorted dataset, it'll swap it with the value that currently resides in the left-most opening.

View

Shell Sort Algorithm Implementation in JavaScript

Shell sort is an in-place comparison sort. It can be seen as either a generalization of sorting by exchange (bubble sort) or sorting by insertion (insertion sort).

View

Bubble Sort Algorithm Implementation in JavaScript

Bubble Sort is a simple linear algorithm that loops through a dataset comparing elements that are side-by-side and swapping their order if the next value is smaller than the current one.

View

Insertion Sort Algorithm Implementation in JavaScript

The Insertion Sorting algorithm is a program that runs one loop through a dataset and upon coming to a value, it checks for values in the dataset prior to the current value that are larger than the current value. Then, if there are larger values, it moves the current value forward to its ordered place and shifts all other values back.

View

Quick Sort Algorithm Implementation in JavaScript

The Quick Sort algorithm is similar to Merge Sort in that it divides the dataset into smaller, more manageable datasets and sorts them before combining and returning.

View

Find Inorder Successor in Binary Search Tree

Binary search trees aren't a linear data structure, but here's how you can return the next value in the data set just like you can with arrays and linked lists but more efficiently.

View

Sorting Algorithm Animations

Animations and code examples for popular sorting algorithms.

View

Computer Science Flashcards

Hundreds of flashcards that I've put together to help with the transformation from self-taught coder to computer scientist.

View

Depth-First Traversal Orders in Binary Trees

Unlike common data structures such as arrays, stacks and linked lists, tree data structures can be traversed and values returned in multiple ways. Here are a few depth-first traversal orders.

View

Using Rabin-Karp's Algorithm to Find All Occurrences of Substring

Rabin-Karp's Substring Algorithm allows us to find occurrences of substrings in text using hashing. Here is an implementation of the algorithm in JavaScript.

View

Storing Phone Numbers with Direct Address Hashing

Direct addressing is method of storing values in a variable that allow for constant time addition, deletion and value returning. Here's a JavaScript implementation.

View

Reverse Each Word in the Sentence in JavaScript and PHP | Programming Interview Question

How to answer the common interview question 'Given a string, reverse each word in the sentence' in JavaScript and PHP.

View

Solve a Given Function Containing Multiple, Separate Parameters in JavaScript and PHP | Programming Interview Question

How to answer an interview question regarding multiplication function combinators in JavaScript and PHP.

View

Empty an Array and All References in JavaScript and PHP | Programming Interview Question

Here's how you can successfully answer the interview question about how to empty an array and all references to it in PHP and JavaScript.

View

Maintain Returned Values Using Closures in JavaScript and PHP | Programming Interview Question

Here's how you can maintain and use a previously returned function value using closures in PHP and JavaScript.

View

#CORS#preflight#Express#Node#API#JavaScript#Node.js#Express.js#websockets#socket.io#React#state#TypeScript#Classes#Namespace#Canvas#CMS#client software#binary tree#binary search tree#avl tree#order statistic tree#logarithmic time#nesting#conditionals#pyramid of doom#tree data structure#hash table#linear probing#binary max heaps#heap sort#Middleware#DRY#MySQL#sorting#algorithm#closures#lambda#binary search#array#Spam#distributed hash tables#consistent hashing#overlay network#distributed storage#stack#constant time#accessibility#network#packet processing#simulation#sliding window#queue#object#binary heap#PHP#string balance#linear time#CSS#dark mode#prefers-color-scheme#UX#recursion#traversal#dynamic arrays#linked list#javascript#merge sort#radix sort#selection sort#shell sort#bubble sort#insertion sort#quick sort#inorder successor#trees#graphs#Rabin-Karp#hashing#search#direct addressing#string#interview#function combinator#multiply#reference

Tweet me @tylerewillis

Or send an email:

And support me on Patreon