c3n7 (
Laravel 10.x + Livewire 3.x Pre-Commit Linting and Formatting
Introduction When creating Laravel+Livewire projects, especially for teams, pre-commit hooks come in handy by ensuring everyone on the team follows the same formatting standards and adheres to some level of code quality. In this blog-post we will use: husky: Sets up pre-commit hooks prettier: To format *.css, *.js and *.blade files. @shufo/prettier-plugin-blade: A prettier plugin for formatting *blade files laravel/pint: to format PHP files like classes, traits, etc. larastan: does PHP static analysis....
ORDER BY x LIMIT y Gotcha
Introduction On a production environment I was watching a query I had just made attempts at optimizing take longer and longer as days went. Usually I would look at WHERE clauses to inform me on indexes that need creating or queries that need restructuring but often overlooked ORDER BY clauses, turns out both need equal attention. Reproduction I will be using Laravel for this because of easy EXPLAIN statements provided by barryvdh/laravel-debugbar and FakerPHP that we’ll use to seed the database with lots of records....
Mapping Huion Keys on Linux
Introduction This post assumes you already have the tablet working and the xsetwacom command already exists on your linux installation. For this post I’ll be mapping the buttons on my HS611 Tablet. A HS611 tablet has 8 buttons on the pad and 2 buttons on the stylus. Setting Things Up Let us get the name of the graphics tablet: $ xsetwacom --list The command above gives the output below if the connected tablet is a HS611...
Debugging C++ in Vim
Vim can work with GDB to debug C++ programs. This feature works in Vim version 8.1+. In this blog post, we’ll go through debugging C++ in Vim. Setting Things Up You need to load the plugin using the command: :packadd termdebug You have to do this every time you want to debug. If you want this to happen automatically, add the command to your .vimrc. In vimrc: packadd termdebug The Sample Program The code below is for the sample program that we are going to debug....
Django Project Structure
Today I aim to make you know more about how a Django project is structured. We’ll start with how to do initial setup, move on to describing how Django apps look like, talk about the request/response cycle, and templates Initial Setup We first have to setup the environment before we can create a Django project. You have to install Python then create a virtual environment. There are several ways of creating a virtual environment....