A free alternative to GitHub Copilot
Amit Merchant
by Amit Merchant
1w ago
GitHub recently revoked my free access to GitHub Copilot. Essentially, since I’m an active open-source contributor, I was allowed to use it for free. But for some reason, GitHub decided to revoke my access to the service. Maybe some glitch on their end. And because I was so used to the Copilot, naturally I wanted something similar in my workflow And that’s where I found Supermaven. It’s a free alternative to GitHub Copilot. Basically, they provide a free tier and it’s pretty generous. There are minimal restrictions in the free tier and you can continue using it for as long as you want unless ..read more
Visit website
Talk to websites and PDFs with this free Chrome Extension
Amit Merchant
by Amit Merchant
1w ago
AI has taken over our lives in ways we never imagined. From chatbots to voice assistants, AI has made its presence felt in almost every aspect of our digital lives. While AI tools are great, they don’t come cheap. Most AI tools require a subscription or a one-time payment, which can be a barrier for many users. But what if I tell you that there is a free AI tool using which you can talk to websites and PDFs? Enter Elmo. Elmo is a free Chrome extension that uses AI to help you talk to websites, PDFs, or even YouTube videos. It’s like having a personal assistant that can read and summarize conte ..read more
Visit website
RunJS — A JavaScript Playground on your desktop
Amit Merchant
by Amit Merchant
2w ago
In the fast-paced world of JavaScript, sometimes you just need a quick solution without the hassle of setting up an entire project. Whether you’re tinkering, prototyping, or learning, the need for a lightweight tool to write JavaScript code becomes evident. The problem Enter RunJS Why use RunJS? Level Up with a License The web version In closing The problem Picture this: You have a brilliant idea for a JavaScript snippet, but the mere thought of creating files, setting up a project, and dealing with configurations dampens your enthusiasm. We’ve all been there. Sometimes, you just want to div ..read more
Visit website
Spicing up text with text-emphasis in CSS
Amit Merchant
by Amit Merchant
1M ago
There are a lot of ways to style text in CSS. You can change the color, size, font, and even add effects like shadows and outlines. But recently, I learned about a sleek CSS property that I hadn’t heard of before and it’s pretty rad! It’s called text-emphasis and it’s a shorthand for a combination of text-emphasis-* properties that allow you to add emphasis marks to text. These marks can be used to highlight text in various ways, such as adding a dot, circle, double circle or text above or below the text. Here’s an example of how you can use text-emphasis to add a dot to text: .text-emphasis ..read more
Visit website
Comparing a value against multiple columns the easy way in Laravel
Amit Merchant
by Amit Merchant
1M ago
When working with Laravel, you might need to compare a value against multiple columns in the database. For instance, you might want to check if a value exists in one of the columns. Typically, you would do something like this with query builder. $users = User::query() ->where('email', 'LIKE', $email) ->orWhere('username', 'LIKE', $email) ->first(); This works, but in a recent release of Laravel, a new method called whereAll and whereAny were introduced. These methods allow you to compare a value against multiple columns more concisely. Here’s how you can rewrite the pre ..read more
Visit website
Efficiently deleting millions of records in Laravel
Amit Merchant
by Amit Merchant
1M ago
When working with large datasets, you might need to delete millions of records from the database at once. Doing so can be quite slow and resource-intensive. And in doing so, you might run into memory issues, timeouts, and other problems. Matt Kingshott recently shared an interesting trick that can help you delete millions of records from the database efficiently. Here’s how you can do it. use App\Models\User; $query = User::where('created_at', '<=', now()->subDays(30)); while ($query->exists()) { $query->limit(5000)->delete(); sleep(3); } Essentially, the code abov ..read more
Visit website
Environment-aware Favicons
Amit Merchant
by Amit Merchant
2M ago
When working on a website, sometimes you can’t distinguish between the environments just by looking at the tabs if you have both the production and local environments opened side by side. And this can lead to confusion. This is where environment-aware favicons come into play. They help you distinguish between the environments by changing the favicon of the website based on the environment. Josh Comeau recently tweeted about this idea and I found it quite interesting. He shared how he implemented this feature in his Next-powered blog with App Router. This is what it looks like. He kept the lig ..read more
Visit website
Building Dynamic Progress Bars using only CSS
Amit Merchant
by Amit Merchant
2M ago
Here’s a full disclaimer upfront: This isn’t something I’ve come up with. Jeffery Way from Laracasts has come up with this technique in one of the videos and I’m just sharing it here for my reference. Essentially, the video explains how you can create a dynamic progress bar purely using conic gradients in CSS. Yep! No JavaScript is needed at all. The end result will look something like this. As you can tell, the blue line around the circle shows the progress of the video which is denoted by the number in the middle. Let’s see how you can create this. First, let’s create a simple HTML structur ..read more
Visit website
Define Observers and Global Scopes using PHP’s Attributes in Laravel
Amit Merchant
by Amit Merchant
2M ago
PHP 8’s Attributes are a great way to add metadata to your code. They are a form of structured, syntactic metadata that can be added to classes, methods, functions, and properties. Attributes are great when you want to attach data to your classes that can be seen “at a glance” while still being able to access them programmatically. You can read more about PHP 8’s Attributes in this article where I explained their inner workings and how you can use them in your code. There are a couple of new features in Laravel 10.x now make use of this feature. These are: To define observers for Eloquent mod ..read more
Visit website
The new “select” method for Laravel Collections
Amit Merchant
by Amit Merchant
2M ago
Do you remember the only method in Laravel Collections that allows you to retrieve a subset of the items from the collection? For instance, if you have an array of data like so. $collection = collect([ 'name' => 'Amit', 'age' => 30, 'city' => 'Surat', 'country' => 'India' ]); You can use the only method to retrieve a subset of the items from the collection like so. $filtered = $collection->only(['name', 'age']); // ['name' => 'Amit', 'age' => 30] Well, there’s a new method called select in Laravel Collections that does the same thing as the only metho ..read more
Visit website

Follow Amit Merchant on FeedSpot

Continue with Google
Continue with Apple
OR