If you are using Laravel’s firstOrCreate() method and get a unique id violation error, there is a chance you have repopulated your database retroactively in Postgres. Postgres triggers the next id in the sequence on row creation instead of on import. So it thinks the next sequence in the id field is an existing ID … Read more
You got an error. A composer memory limit error. You go to the documentation. It tells you to search through your PHP ini files and increase the memory limit. You realize that’s going to take a while depending on what env you’re using. You’d rather just copy and paste a command in the terminal. This … Read more
This is a baller gist of common useful Postgres queries.
You know you have to query last month’s records all the time (instead of the last 30 days). Here’s how to get those numbers easily with Carbon. We do the extra fancy footwork for the end of the month to avoid simply getting the same last date of the month for the previous month.
If your query is forcing the db to search through millions of rows to fetch data, indexing a table can help improve performance. Here’s how to do it on Postgres. ELI5 Index If you’re actually five you probably haven’t seen one of those indexes in wooden box that you saw at public libraries, but it … Read more
If you need to pair down your main js file and want to check what packages are eating up the size, BundlePhobia is a great resource to use. While there are several other tools including CLI tools for discovery, BundlePhobia makes it easy to just search and browse. If you have another way of managing … Read more
Ran into this great github thread. Normally, you would extract unique values with Set and spread. But with array of objects, it get’s a little more complicated. Or with Lodash
If you are getting the following brew cleanup error “Permission denied @ apply2files”, the top solution is to reset permissions to /user/local. We are going to rewrite permission to the current user. In your terminal copy and paste below. Another solution is to completely reinstall brew. User the code below to uninstall and reinstall. Good … Read more
If you’re working with Alpine JS, as some Tailwind users do, and want to translate the transition animations to Vue, here’s a handy side by side comparison that will help you get the job done! Just kidding. They’re stacked.