Blog
2022
- Nesting Rounded Corners in CSSConsistency 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.
- Create A Resposive Grid with CSS FlexboxEven 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 LayoutWhen 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 Run Prettier On Changed Files OnlyRun prettier to format files that are changed in Git.
- Change from HTTPS to SSH in a Git RepoThe 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.
- Intercepting a Fetch RequestA 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 ExpressI 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.
- A Simple Hook for React ContextIt is often quite nice to use Context in React, I tend to use this hook to simplify it.
- My Custom Svelte Boop ComponentCreating 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.
- How To Use Custom (Local) Fonts with Tailwind CSSUsing 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 HTMLSometimes 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 LocalstorageStoring 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 SvelteKitDue 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.
- Iterate Over An Array With The Modulo OperatorThe 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 CodeVS 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.
- How To Backup a Remote PostgreSQL Database and Run it Locally With DockerYou 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.
2021
- Get Started With Awk in BashAwk 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 ScriptsBash 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.
- Replace Text or a String in BashSometimes 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.
- Full Width Container in Limited Width ParentA simple hack to allow the children of an limited HTML element to be full width.
- Find Files in Directories in BashBash 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 FixupThe easiest way to clean up your git history by using fixup and autosquash.
- Setup a Remote Development Environment with Linux and VS CodeSetting 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 HetznerA 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.
- How To Allow Remote Access To Your Localhost Apps With NgrokHosting your page on localhost is simple, ngrok allows you to share that connection with people outside your computer for free.
- Fetch Multiple Urls at The Same TimeFetch multiple URLs at the same time using Promises.all
2020
- Save Output to a Variable in a Bash ScriptSave the output of a command in a Bash script to use it later.
- See if a Package Exists in a Bash ScriptHow you can see if a package or commando exists in a Bash script.
- Loop Through Arrays in BashHow to loop through arrays in Bash
- Adding Short (and Long) Flags to Bash ScriptsAdding 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.NETRun any script you want (in this case NPM) before a build in ASP.NET Core.
- Serving Different CSS Files in ASP.NET Core with AngularServe 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 ApplicationSetup state management with NgRx in your Angular application.
- Execute Commands in a Docker ContainerExecute a command within your docker container.
- How To Create a Multi-Step Form in AngularCreate a form in Angular with multiple steps and validation for each step.
- Using a Sidebar And a Topbar In The Same Web App Using CSSCreate an application that uses both a top bar and a sidebar for navigation using CSS and Bootstrap.
- Reactive Forms in AngularHow to build forms and manage validation easy in Angular
- Responsive Sidebar Using CSSCreate a sidebar (navbar) with navigation, that on smaller screens, will turn to a bottom bar with icons using only CSS and HTML.
- Component Communication in Angular with @Input and @OutputThere are a few methods to share data between child and parent components in Angular. This is how using the @Input and @Output method.
- Save a Modified Docker Container As An Image Using CommitIt's easy to find a good Docker container online. Sometimes, it does require some minor changes to make it perfect. This is how you can modify a Docker container, and then save it as a new Docker image using commit
- How To Create a Docker Image, Build and Push It To Docker HubThis is a simple explanation of the Docker workflow. From creating the first Dockerfile to pushing it to Docker.
- How To Stop and Remove All Docker ContainersSometimes you start a lot of containers and the same time, this is a simple way to stop and delete them all.
- How To Delete a Git Branch - Locally and RemotelyBranching is great, it does, however, look much better if you remember to remove your old branches so they don't take up unnecessary space. This is how.
- How To Delete Your Last CommitSometimes things just go wrong, and thankfully we have Git to save some time. This is a short guide on some ways you can delete (or remove) or last commit
- Using Async/Await Within an Angular InterceptorAsync/Await is great, it makes the code much more readable and clean. It is, however, quite tricky to use it within an Angular interceptor. This is how you do it.
- Angular Interceptors - Requests And ResponsesAngular interceptors are great when it comes to handling outgoing HTTP requests and incoming HTTP responses, this is a short guide on how to separate the two, and how to handle each type
- How To Center With CSSCentering with CSS is actually more difficult than one might think. Here are some different ways to center your elements within a container with CSS and HTML
- Auto Fill With CSS Grid To Adjust For MobileCSS Grid is a great tool for styling your web pages. This neat trick will let you adjust your grids with a minimum size so it will look better on phones.
- How To Use Conditional Classes in AngularConditional classes are great. Use one CSS class if one condition is fulfilled, or another class if not. This is a quick guide on how to do that in Angular.
- How To Get Query Parameters in AngularQuery parameters in Angular allows for passing data across routes in your web application. They are often also mixed with the path variables - here I'll show the difference and how to get both of them.
- How To Use Git StashGit stash temporarily saves your changes and stashes them. You usually do it if you quickly need to work on something else without committing your current code.
- How To Commit with GitTo commit your work is probably the thing you do the most with git. It's basically to save a snapshot of your current project, making it possible to go back to that specific snapshot of your code.
- How To Use Git Branches with Git MergeBranching with git is a great feature, this is a simple workflow for how to branch and merge different branches.
- How To Use Git RebaseKeep a clean history with rebase, instead of cluttering your teams commit history. This is the simplest way how to use git rebase.
- How To Git Squash Earlier CommitsSometimes you want to squash, or combine, earlier commits back in your history. This is one way you can do that.
- How To Use Git SquashGit squash can be used to combine several commits into one. This is the easy way to do it.
- See if You Run a Bash Script in WSLThis is how you see if you are using WSL within a Bash script.
- How to Override Local Files with Git PullOverride your local project with the latest changes from your git repository
- How To Install Docker On WSLThis is the quickest way to install Docker on WSL and sync it with your Docker containers.
- How To Install Brew on WSLThe easiest way to install Brew on WSL, in this case Ubuntu.
- Get The CSS Value Of A Property In Java ScriptFetch your CSS values within your JavaScript code
- Calculate How Many Days There Are Between Two Dates in JavaScriptHow to calculate the amount of days between two dates in JavaScript.
- Check If Two Dates Are The Same Day In JavaScriptA simple function to check if two date objects are referring to the same day.
- Remove Duplicates in a JavaScript ArrayA simple and clean method to remove all duplicates in a given array.
- Clear All Node Modules Folders RecursivelyRemove all node_modules folders within a directory with one simple command.
- Backup Linux Data With Rsync Over SSHHow you can backup your data with Rsync in a Linux environment.
- Using Here Docs (<<) in Linux
- How To Kill Processes in LinuxKill processes in Linux to keep down memory and CPU usage.
- How To Use Screen On LinuxThe basics of Screen on Linux, a cheat sheet.
- How To Copy An SSH Key To Another Linux MachineCopy your public SSH key to a remote machine for easier access
- How To Run A Bash Script on A Remote Machine Using SSHExecute a shell script on a remote machine using SSH on bash.
- Hosting a MySQL/MariaDB Server On a VPS With Remote AccessSetup a MySQL/MariaDB server easily on Ubuntu VPS with remote access to use in your projects.
- Setup Debugging in VS Code with ASP.NET Core and AngularWhen working with ASP.NET Core and Angular, debugging is much easier in, for example, Visual Studio. This is a short guide on how to make debugging work in VS Code.
- How To Rename Multiple Keys In A JavaScript ObjectRenaming the keys in a Javascript (or JSON) object can be quite tricky, this is a simple trick to rename all the keys you want.
- Add Meta Description To Your Hugo Posts For SEOSEO is important if you want people to find your articles on Google. This is a simple way to make sure you have a custom meta description for each article you publish.
- Add Custom CSS Or Javascript To Your Hugo SiteHugo themes are great - some do, however, not include custom CSS and JS from start. This is a simple guide on how to add it to your own Hugo site.
- Deploy Any SPA + Express App to Heroku For FreeWhen you have created a full-stack web application (with React, Vue or Angular) and Express, it is quite difficult to host it for free. This guide will help you do that on Heroku
- Print On The Same Line With PythonPrinting on the same line with Python is useful if you, for example, want to use a progress bar or download status in a CLI program. This is a simple way to do that.
- Web Scraping Behind Authentication with PythonPython is a great tool for web scraping, however, getting behind authentication (being signed in) might be a bit difficult. This is a guide on how to do that with the Requests library
- Web Scraping with PythonPython makes it simple to grab data from the web. This is a guide (or maybe cheat sheet) on how you can scrape the web easily with Requests and Beautiful Soup 4.
- Using Virtual Environments with PythonWorking with Virtual Environments is very handy. It allows you to create a self-contained directory that contains a Python installation for a particular version of Python. Install all your dependencies in an environment that you can easily modify or remove.
- Working With Hugo Themes and Git SubmodulesWorking with Hugo themes you probably use git submodules. These are basically subrepositories within your repository. They can be used for several different reasons, but the main one is probably so you can download updates.