Skip to content

Instantly share code, notes, and snippets.

@joydeep-bhowmik
joydeep-bhowmik / Index.js
Last active January 30, 2023 08:44
Chrome mobile inspector
javascript:(function () {var script=document.createElement('script');script.src="//cdn.jsdelivr.net/npm/eruda";document.body.appendChild(script); script.onload = function () { eruda.init() } })();
@joydeep-bhowmik
joydeep-bhowmik / Run laravel from root directory in your cpanel or xampp.md
Last active May 18, 2024 11:18
Steps for how to run laravel from root directory in your cpanel or xampp

Run laravel from root directory in your cpanel or xampp

Create an .htaccess file in public_html folder of your shared hosting Put this code in the htaccess file. And done

method 1

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]
@joydeep-bhowmik
joydeep-bhowmik / Laravel Scout egar loading.md
Last active May 16, 2024 09:56
Laravel Egarloading with scout search

Laravel Egarloading with scout search

Suppose this is your category model

class Category extends Model
{
    use HasFactory, Searchable;

    public function toSearchableArray(): array
 {
@joydeep-bhowmik
joydeep-bhowmik / Datatable.tsx
Last active May 13, 2024 09:39
Laravel react datatabe component
import Section from "@/Components/Section";
import axios from "axios";
import { ReactNode, useState } from "react";
import DataTable from "react-data-table-component";
import { useQuery } from "react-query";
import { debounce } from "lodash";
import TextInput from "@/Components/TextInput";
import { useQueryClient } from "react-query";
import { $on } from "@/lib/utils";
import {
ChangeEvent,
HTMLInputTypeAttribute,
useState,
useRef,
useId,
HTMLProps,
} from "react";
import { mediaUrl } from "@/lib/utils";
@joydeep-bhowmik
joydeep-bhowmik / index.md
Last active June 15, 2024 11:24
composer dump-autoload is slow

composer dump-autoload is slow

View original post

For anybody new coming across this. the fix for me was a combination of things, before which the generating optimised autoload files took over 260s.

First adding : "https://packagist.org" to repositories in composer.json.

"repositories": [ { "type": "composer", "url": "https://packagist.org" } ]
@joydeep-bhowmik
joydeep-bhowmik / index.md
Last active June 25, 2024 08:17
WordPress showing old page even after upated

WordPress showing old page even after upated

This thing happends mainly due to browser or server cache

If this problem is because of browser cache then we can hardreload the browser (ctrl + f5)

if this is because of server cache then you can replace default htaccess with the htaccess provided in wordpress documentation

RewriteEngine On
$updateOrder = function ($items) {
    $ids = collect($items)->pluck('value')->toArray();

    Photo::whereIn('id', $ids)
        ->get()
        ->each(function ($item) use ($ids) {
            $item->update(['ordering' => array_search($item->id, $ids)]);
        });