All entries of my technical and business blog

Show Alpine Element After Delay

Sep 2, 2024 javascript

Showing and hiding AlpineJS elements on click or other actions are pretty easy. But what if you just wanted to show the element after a little bit of a delay with no user interaction? We can do that easily!

Let's Refactor a Javascript Snippet for Adding Class on Scroll

Sep 2, 2024 javascript

There’s a common design pattern on a lot of websites to alter the header when the user scrolls down. A lot of times this is simply some sort of handler that adds a class (or removes it). (There are other complex, arguably ‘better’ solutions with IntersectionObserver - but that’s not the point of this article.) Let’s take a look at a very simple version of a script that watches for scroll and adds/removes a class on the body. Then, let’s make it better - and learn while we do it.

Laravel Display Markdown Easily in Blade

Sep 2, 2024 laravel

I love writing in Markdown - and offering that functionality in WYSIWYG editors for our users. But, it just seems so complicated to try to show markdown in Laravel blade files. So, I made a quick anonymous component that makes this easier.

Laravel Log Throttled Users

Sep 1, 2024 laravel security

You’ve got Laravel throttling set up on authentication, password reset and other sensitive endpoints. But, how do you know this is actually working to stop people? Or what if you either want to admonish bad users or proactively reach out with support to help them? Perhaps you might want to log your throttled attempts. It’s pretty easy.

Laravel Log Incoming API Request and Response

Jul 21, 2024 laravel

There are packages out there to add logging to the HTTP client in Laravel for outgoing requests freely available. Those are great, but what about if you’re providing an API - and you need to log incoming requests and responses? There’s not a single place to do that - or is there? Let’s look at a middleware to log our incoming requests and responses.

Generate Laravel Seeds Package Idea

Jun 21, 2024 ideas laravel

When projects don’t have a proper set up of dev data using Laravel seeders, getting started can be kind of tough. And if you can help it, you really don’t want to be pulling data from production. User data is precious and should be protected! So what kind of package or utility could help us here? Let me detail out my thoughts - maybe it’s something you want to build!

Git Ignore Without the .gitignore File

Jun 7, 2024 git

As a contractor, I go into a lot of projects. Sometimes these are set up perfectly and other times they need a bit of work for me to be effective and efficient. Some clients are willing to accept updates for tooling, others don’t have the time, budget or ability to accept these updates. So, how can I use my tools - which require configuration files - without editing their project? Actually, git has a nice built-in functionality that will work perfect for this - and it’s not the .gitignore file.

Production Merge in GitHub Actions

May 2, 2024 git github

You’re using Pull Requests in GitHub and everything is working great! Nice workflow! But now you have a problem: deploying from develop to main via a … what? A PR? A merge commit if you bring the two branches down to your local machine? What else? What about a GitHub action that you can use to do this? Here’s a simple proof of concept with explanation - you may still need to alter this for your workflow.

Email Catch All Forwarding on Cloudflare Free

May 1, 2024 email misc-web

Sometimes you want to set up a new project with a domain, but you don’t want to set up the whole email infrastructure. You could ignore the email, and hope people can track you down. Or you can add a catch all email at your domain to gather attempts from people to contact you. I opt for the second. Turns out there’s a free and easy way to do it on Cloudflare. Next steps below with screenshots.

Fix for Mysql Docker Not Running Entrypoint

Apr 3, 2024 docker mysql

When using the Docker MySQL Container, you can specify files in the /docker-entrypoint-initdb.d folder to be imported or ran when the container is brought up. These can be in the form of .sql, .sql.gz or .sh - and get ran after the database is up but before its accepting connections.

But what if you can’t seem to get these to run again? The fix is just so annoyingly simple.