RSSAmplifier

Blog

Home

Some of my code snippets and stuff.

banjocode.comRSS feed ↗84 posts

Latest posts

The Guide to Hashing I Wish I Had When I Started

Learn the basics of hashing in this beginner-friendly guide. Discover what hashing is, how it works, its key principles, common algorithms, and practical examples in Node.js for password storage and file integrity.

Unpacking Node.js Memory - From Raw Bytes to Usable Data

Explore how Node.js handles binary data under the hood with a simple guide to ArrayBuffer, TypedArray, and Buffer. Learn how these core concepts work together for efficient file and memory management in Node.

How to Debug Node with TypeScript in Neovim

Debugging Node.js with TypeScript in Neovim can be a bit tricky, a lot of custom setup might be needed to get the basic functionality. This is a guide that will try to cover some of the most important parts. I'll also share some ways I work with it.

Nesting Rounded Corners in CSS

Consistency in rounded corners is something I came upon every now and again. It would really bother me until I found this very neat trick to solve it.

Intercepting a Fetch Request

A stumbled upon a nice script that helped a lot of people to book a train in Sweden, and got interested in how it works. This is just a quick summary of that.

Convert a SVG File to PNG and Serve It in Express

I tend to use SVG:s a lot, however, sometimes I feel like it simpler to render them as PNG:s for some special workflows. This a neat trick to do that in your own API.

My Custom Svelte Boop Component

Creating a Boop component might be a bit tricky with the spring effect. This is my component I tend to re-use whenever I want to use it in a project.

Create A Resposive Grid with CSS Flexbox

Even though CSS Grid is more or less designed to create grids with, flexbox can actually be used to create some responsible grids without much effort.

Align Text On The Same Vertical Line Using Flow Layout

When there is a lot of text on a page, it's generally looks much better if every paragraph and heading starts at the exact same vertical line. This is a short guide how to do that and still keep the page responsive

How To Use Custom (Local) Fonts with Tailwind CSS

Using custom fonts locally is quite normal in web development. The tailwind documentation does not quite cover that part though. This is a simple guide on how to do that.

Remove Images That Are Not Found Using HTML

Sometimes you might want to fetch a photo dynamically, if that fails you most likely would want to remove it or replace it with another picture. This is how.

A Persistent Svelte Store With Localstorage

Storing data in localstorage is very common in most web applications, this is a neat trick to do that with a Svelte Store

How To Add A Client Side Only Library To SvelteKit

Due to the nature of SvelteKit, it might sometimes be a complicated to run (or import) a client only library, this is a quick fix for that.

How To Run Prettier On Changed Files Only

Run prettier to format files that are changed in Git.

Iterate Over An Array With The Modulo Operator

The modulo operator is often used to calculate if a value is odd or even, however, it comes to great use when you want to iterate (and re-iterate) an array without having to deal with to much logic.

How To Get the Inferred TypeScript Types From VS Code

VS Code automatically infers your TypeScript types in a project, even if you haven't implicitly declared it yourself. However, if it is long it will hide some parts of it. This is how you get the full type.

Change From HTTPS to SSH in a Git Repo

The default way of cloning and maintaining Git repos for some might be using HTTPS. In case you want to switch to SSH, this is a very short guide on how to do that.

How To Backup a Remote PostgreSQL Database and Run It Locally With Docker

You probably access remote databases all the time, however, if you want to work offline it could be cumbersome not to have access to your database. This is a simple method to back it up and run it locally using Docker.

Get Started With Awk in Bash

Awk can be very useful when working with text files in Bash. This is a short cheat sheet on some of the commands you'll most often use.

Bash Essentials To Create Useful Automation Scripts

Bash syntax is quite complex and can be hard to grasp. This is a guide, or cheat sheet, to give you all the bash functionalities that you need to write useful automation scripts.

Setup a Remote Development Environment with Linux and VS Code

Setting up a development environment can be quite tedious. Especially if you want to use it remotely. This is a quick get started guide so you can access your workspace from anywhere, using Ubuntu, VS Code, and SSH.

How To Setup a Linux (Ubuntu) Server On Hetzner

A remote linux server could be very useful. Hetzner provides cheap and reliable servers that are easy to maintain. This is a short guide on how to setup one easily.

Replace Text or a String in Bash

Sometimes you might need to replace some text in a string - the bash allows you to do so easily. This is a short summary on how you can do that.

How To Allow Remote Access To Your Localhost Apps With Ngrok

Hosting your page on localhost is simple, ngrok allows you to share that connection with people outside your computer for free.

Full Width Container in Limited Width Parent

A simple hack to allow the children of an limited HTML element to be full width.

Find Files in Directories in Bash

Bash provides some great feature for you to find the files you are looking for, this is a simple way to do that.

Clean Your Git History With Git Fixup

The easiest way to clean up your git history by using fixup and autosquash.

Fetch Multiple Urls at The Same Time

Fetch multiple URLs at the same time using Promises.all

Save Output to a Variable in a Bash Script

Save the output of a command in a Bash script to use it later.

See if a Package Exists in a Bash Script

How you can see if a package or commando exists in a Bash script.

See if You Run a Bash Script in WSL

This is how you see if you are using WSL within a Bash script.

Loop Through Arrays in Bash

How to loop through arrays in Bash

How to Override Local Files with Git Pull

Override your local project with the latest changes from your git repository

Adding Short (and Long) Flags to Bash Scripts

Adding flags to your bash script will probably simplify your developing experience. This is a short guide on how you can add both long and short flags without using getopts.

Run NPM (Or Any Other) Scripts Before Build With ASP.NET

Run any script you want (in this case NPM) before a build in ASP.NET Core.

How To Install Docker On WSL

This is the quickest way to install Docker on WSL and sync it with your Docker containers.

How To Install Brew on WSL

The easiest way to install Brew on WSL, in this case Ubuntu.

Get The CSS Value Of A Property In Java Script

Fetch your CSS values within your JavaScript code

Calculate How Many Days There Are Between Two Dates in JavaScript

How to calculate the amount of days between two dates in JavaScript.

Check If Two Dates Are The Same Day In JavaScript

A simple function to check if two date objects are referring to the same day.

Remove Duplicates in a JavaScript Array

A simple and clean method to remove all duplicates in a given array.

Clear All Node Modules Folders Recursively

Remove all node_modules folders within a directory with one simple command.

Backup Linux Data With Rsync Over SSH

How you can backup your data with Rsync in a Linux environment.

Using Here Docs (<<) in Linux

How To Kill Processes in Linux

Kill processes in Linux to keep down memory and CPU usage.

How To Use Screen On Linux

The basics of Screen on Linux, a cheat sheet.

How To Copy An SSH Key To Another Linux Machine

Copy your public SSH key to a remote machine for easier access

How To Run A Bash Script on A Remote Machine Using SSH

Execute a shell script on a remote machine using SSH on bash.

Serving Different CSS Files in ASP.NET Core with Angular

Serve different CSS files based on a header parameter on an Angular application with an ASP.NET Core backend.

How To Setup NgRx in an Angular Application

Setup state management with NgRx in your Angular application.