Skip to content

Instantly share code, notes, and snippets.

View iammuttaqi's full-sized avatar
🖥️
Coding

Muttaqi iammuttaqi

🖥️
Coding
View GitHub Profile
@MrPunyapal
MrPunyapal / HasLabel.md
Last active January 18, 2024 16:00
Enhance Laravel Enums with Human-Friendly Labels using HasLabel Trait

HasLabel.php Trait

namespace App\Concerns\Enums;
 
trait HasLabel
{
    public function label(): string
    {
        return str($this->name)
@MrPunyapal
MrPunyapal / LivewireTeleportGlitch.md
Last active January 17, 2024 16:04
Solution to pesky @teleport glitch during compilation!

Teleport diractive issue

If you encounter caching issues with your @teleport Livewire/Blade directive after running php artisan view:cache, you may notice problems appearing instead of the expected compilation.

image

To resolve this issue, manually add compilation to the Blade directive.

class AppServiceProvider extends ServiceProvider
@MrPunyapal
MrPunyapal / GenerateUniqueSlug.php
Created November 29, 2023 16:40
Efficient Laravel Slug Generation: Unique, Sleek, and No Looping 🚀
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Blog extends Model
{
@iammuttaqi
iammuttaqi / ImageCropper.php
Last active November 8, 2023 22:14
TALL stack image cropper using CropperJs (daisy ui as tailwind framework)
<?php
namespace App\Http\Livewire\Components;
use Livewire\Attributes\Modelable;
use Livewire\Component;
class ImageCropper extends Component
{
#[Modelable]
@MrPunyapal
MrPunyapal / LaravelWhereLikeMacro.php
Last active July 9, 2024 05:11
Laravel Custom 'whereLike' Macro for Dynamic 'LIKE' Searches including relationships
<?php
namespace App\Providers;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
<script setup>
import { useStorage } from "@/composables/useStorage";
let food = useStorage('food', 'tacos');
</script>
<template>
<main>
<p>
What is your favorite food? <input type="text" v-model="food">
@nagavinodcse
nagavinodcse / alpinejs-carousel-using-swiper-tailwindcss.markdown
Created December 25, 2020 15:59
AlpineJS Carousel using Swiper + Tailwindcss
@theanam
theanam / regex.txt
Created September 4, 2019 10:08
Regular Expression to match Bangladeshi Phone number
/^(?:\+88|88)?(01[3-9]\d{8})$/
@matthewzring
matthewzring / markdown-text-101.md
Last active July 24, 2024 06:37
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

What this guide covers:

@ainsofs
ainsofs / gist:2b80771a5582b7528d9e
Created April 16, 2015 01:50
Clear .gitignore cache
# remove specific file from git cache
git rm --cached filename
# remove all files from git cache
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"