Introduction Dev Machine My main machine for development at the moment is a 12th Generation Intel Framework Laptop.
This series has been inspired by Dev Workflow Intro by Josh Medeski.
In this series of posts, I will go over how I have set up my developer workflow and explain why I have made certain decisions and why I use certain tools. This series aim to make it less daunting for you to start your journey on improving your developer workflow.
...
This series has been inspired by Dev Workflow Intro by Josh Medeski.
This is sort of a precursor to my series about how I have set up my development workflow. Hopefully, you will be able to pick a few tips and tricks you can add to your development workflow to make it more efficient. Or even give me tips on how I can make my workflow more efficient.
In this post we will go over arguably the least important, but at the same time quite important, part of our workflow.
...
My latest iteration of my dotfiles, where I am now using a Laptop as my main development machine (Framework). I’m also using Hyprland as my window manager. Most importantly using NixOS and home-manager to declaratively define the state of my machine i.e. what packages to install, dotfiles.
CURRENTLY A WIP
🏠 My dotfiles repo, setup using nixos/home-manager
Install 🔥 I wouldn’t recommend just blinding using my dotfiles. They are setup for my specific use-case.
...
Recently I’ve been trying to work out how to update packages that I define declaratively in my Nix config. I think I figured out how to do it using my Nix flake. By running nix flake update and then sudo nixos-rebuild switch --flake ~/dotfiles#framework to update the packages.
However, I have some plugins say for tmux which are defined like so:
t-smart-manager = pkgs.tmuxPlugins.mkTmuxPlugin { pluginName = "t-smart-tmux-session-manager"; version = "unstable-2023-06-05"; rtpFilePath = "t-smart-tmux-session-manager.
...
Introduction In this post I will show you how you can setup tmux (plugins) using the nix package manager, specifically using home-manager. I will also show you how you can avoid an issue I encountered where tmux resurrect wasn’t working properly due to plugin ordering.
Typically we use the tmux plugin manager to manage our tmux plugins. However, when I moved to NixOS, I wanted to move away from having lots of different ways of managing what is on my system.
...
Recently I decided to move from Arch Linux to NixOS. Rather than doing what I should’ve done which was try to use NixOS in a VM first and learn Nix properly. I decided to jump into the deep end and completely delete my current Arch Linux build with Nix. This included replacing my dotfiles setup using DotBot moving them to Nix flakes and home-manager (more on this in a bit). In this post, I’ll go over why I moved over to NixOS, and why I am staying put for now.
...
TIL: How to use NUR with Home-Manager & Nix Flakes
NUR is the Nix user repository like the Arch user repository (AUR). It exists so that:
The NUR was created to share new packages from the community in a faster and more decentralized way. - https://github.com/nix-community/NUR
If we want to install packages from NUR in our home manager config which is set up using Nix Flakes. Assuming you build your home manager like
...
TIL: How to Declaratively Setup Mullvad VPN with NixOS
I have recently moved to NixOS, one of the great features of NixOS is that you can set up your entire machine from a single git repo. We can do this declaratively, what we mean by this is we tell nix what we want the state to be and nixos will work out how to get there.
For example, we can install Mullvad set various options already.
...
TIL: How to Add Vim Navigation FZF
FZF is an amazing fuzzy finder tool, that is super flexible and you can create some cool cli one-liners with it. For example, I use it with the fish shell plugin to search through my command history (CTRL + R).
In this post, I will show you how vim style navigation to the FZF pop-up preview. All we need to do is add the following to the relevant file i.
...
TIL: How to change the fish greeter
In this post I will show you how you can change your fish shell greeter from the default
Welcome to fish, the friendly interactive shell Type `help` for instructions on how to use fish To something custom, this will run every time you open a new shell!
To do this, go to your fish_greeter.fish file which can usually be found at ~/.config/fish/functions/fish_greeting.fish. Where mine looks like:
...
Following on from my previous post about dotfiles and my development workflow (WIP), in this post I will go over my operating system.
Arch As the name implies I use Linux as my main operating system. I am a big fan of Linux because not only is free and open-source, it provides a great developer experience where I find tools that just work on Linux. It also is a lot more customisable as compared with Windows or MacOS.
...
I know I recently made a post about my dotfiles but I’ve made a few changes since then, so here are my updated dotfiles.
out of date These dotfiles are out of date check out my updated ones here System Overview OS: Arch Linux DE: Gnome Shell: Fish Prompt: Starship Terminal: Alacritty Editor: Neovim (using LazyVim config) Colorscheme: Catppuccin for EVERYTHING!!! Fonts: Mono Lisa Extensions I use the following Gnome extension.
...
Workflows Change This post is accurate as of date of publish. But likely will go stale, if I update my workflows I will likely publish another post. In this blog post, I will go over my current development workflow using the above tools namely, fish shell tmux and neovim. I’ll be using the dotfiles found here.
I aim to move away from using my mouse as much as possible as it just slows me down when my hands are away from my keyboard.
...
This post is a quick introduction to dotfiles, accurate as of 25th of April 2023.
out of date These dotfiles are out of date check out my updated ones here Dotfiles 🏠 My dotfiles setup using Dotbot.
Install 🔥 I wouldn’t recommend just blinding using my dotfiles. They are setup for my specific use-case. I think you’re better picking and choosing what you like 😄.
git clone [email protected]:hmajid2301/dotfiles.git cd dotfiles make install profile=arch System Overview OS: Arch Linux DE: Gnome Shell: Fish Prompt: Starship Terminal: Alacritty Editor: Neovim (using astronvim config) Colorscheme: Dracula Icons: Tela-circle-dracula-dark Fonts: Mono Lisa Extensions I use the following Gnome extension.
...
In this post, I will show you how to get code coverage reports from your Playwright tests in your SvelteKit app. So let’s imagine we are starting with the basic SvelteKit template. First, we need to install:
npm i -D vite-plugin-istanbul We need the vite plugin to instrument our code using Istanbul. Istanbul is a tool which allows us to instrument our code such that it can determine which lines were covered by our tests.
...
I use VS Code as my text editor, one of the features I really like about VS Code is that it will format our file on save. Which saves needing to run a CLI tool to do it. For example, running prettier. As part of the formatting on save you can set an option to organise your imports as well.
If you open your settings.json, you can add a section like this:
...
I have a repo which I use to store all of my conference and similar talks. This repo includes any code examples and most importantly the slides.
At the moment all the slides are RevealJS “sites”, which means it’s a presentation built in HTML. Now I would like to have all my talks deployed to single GitLab pages site. For example something like:
https://hmajid2301.io/talks/an-intro-to-pocketbase/ https://hmajid2301.io/talks/docker-as-a-dev-tool/ So how can we do this ?
...
TIL: How to Mock Classes Using Vitest
Recently I have been creating a SvelteKit app, when creating a new SvelteKit app you get a choice of different things you can add. Such as using vitest for unit testing.
I needed to spy on/mock a method in a class, to see if it was called when a button was pressed and, it was called with the correct arguments.
Let’s say we have a Button component which looks like this:
...
TIL: How to Load Authenticate State in Playwright
In this post, I will quickly show you how you can reduce boilerplate code to log in to your app in Playwright tests. Log in to our app is a very common action that will likely be required in most of our tests.
You can read this documentation here, which will explain how you can set this up. However, what do you do if you want to say test the login flow or the register flow?
...
In this post, I will go over how you can use Hugo’s archetypes to quickly create new posts. I have previously used NetlifyCMS to help create new posts, but recently I have found that to be a bit overkill for my blog.
So I decided to simplify my workflow by using Hugo’s archetypes 1. Archetypes allow us to create templates markdown files, which is then used to create our blog posts.
...
TIL: How to Set a Relationship on Golang Pocketbase
Pocketbase is a backend as a service, it is very nice because it is written in Golang it can compile down to a single binary. It also allows us to extend it using Golang and use it as a framework. In my case, I needed some extra logic before adding data to the database so I decided to extend Pocketbase and write some of my business logic.
...
TIL: How to Run Parallel Jobs on Gitlab CI (Different Stages)
If you are familiar with Gitlab CI you probably know that jobs in the same stages will run in parallel. However you can also run jobs in different stages at the same time. Let’s see our .gitlab-ci.yml looks like this:
stages: - test - deploy format: stage: test script: - task format lint: stage: test script: - task lint deploy:preview: stage: deploy only: - merge_request image: docker script: - task deploy So for my use case when a user creates a merge request, I want to run some tests against the code, such as linting and formatting.
...
Hi everyone, I recently went about setting up notifications about my Netlify deploys in Discord. Netlify does have an official way to do however, you cannot use it on the free tier.
So I looked at other solutions, and I eventually discovered a SaaS product called PipeDream. It is a website which allows us to connect different components without needing to write any code. Such as what to do when we receive a webhook.
...
TIL: How to fix structuredClone to work on Netlify SvelteKit Site
Recently I was working on my SvelteKit site and added some code like so to my hook.server.ts:
try { if (event.locals.pb.authStore.isValid) { await event.locals.pb.collection("users").authRefresh(); event.locals.user = structuredClone(event.locals.pb?.authStore.model); } } catch (err) { console.log("failed to refresh auth", err); event.locals.user = undefined; event.locals.pb.authStore.clear(); } I needed to add the structuredClone function so that only POJO (plain old javascript objects) would get stored in the event.
...
TIL: How to Autofocus on Inputs in Svelte
In this post, I will show you how you can autofocus on input that is in a child component. So in my use case, I want the user to click a button to add a “collection” and then it will show the input and immediately focus on it. Which looks something like this:
So how can we do this?
Let’s say we have a child component called Input.
...