Skip to content

Instantly share code, notes, and snippets.

View Shaz3e's full-sized avatar

Shahrukh A. Khan Shaz3e

View GitHub Profile
@Shaz3e
Shaz3e / api.php
Last active July 25, 2024 22:19
Laravel API Versioning
<?php
// routes/api.php
use Illuminate\Support\Facades\Route;
Route::prefix('v1')->group(base_path('routes/api/v1.php'));
Route::prefix('v2')->group(base_path('routes/api/v2.php'));
@Shaz3e
Shaz3e / UserList.php
Created July 21, 2024 15:29
Pagination with Livewire without loosing serial number
// In your livewire blade
@php
// Get the current page number, default to 1 if not set
$currentPage = $dataSet->currentPage();
// Get the number of items per page
$perPage = $dataSet->perPage();
// Calculate the starting index
$i = ($currentPage - 1) * $perPage + 1;
@endphp
@Shaz3e
Shaz3e / AppServiceProvider.php
Last active July 14, 2024 21:06
Rate Limit in Laravel
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@Shaz3e
Shaz3e / readme.md
Last active November 2, 2023 13:19
How to Remove Foreign Key and Index from Database

instructions

  • Go to PHPMyAdmin
  • Select Database
  • Click Query Tab

Insert the following commands one by one make sure to change table_name with actual table name and column name with actual column name

First you need to remove foreign key from table.column

@Shaz3e
Shaz3e / WordPress Migration Update DB
Created October 29, 2023 21:22
After WordPress Migration you need to update wp.config.php and Database
#### Update the following commands in wp-config.php
```
define( 'WP_HOME', 'http://www.yoursitename.com' );
define( 'WP_SITEURL', 'http://www.yoursitename.com' );
```
#### PHPMyAdmin SQL Query
```
@Shaz3e
Shaz3e / Install Composer using MAMP's PHP.md
Created August 17, 2023 21:13 — forked from irazasyed/Install Composer using MAMP's PHP.md
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

@Shaz3e
Shaz3e / readme.md
Last active April 30, 2023 15:01
5 Commands to add an existing project to GitHub

Use the following command to initialize the repository

> git init

Use the following command to index repository

> git add .
@Shaz3e
Shaz3e / loader.css
Created August 29, 2021 19:32
Loading Effect
#overlay{
position:fixed;
z-index:99999;
top:0;
left:0;
bottom:0;
right:0;
background:rgba(255,255,255,1);
transition: 1s 0.4s;
}
@Shaz3e
Shaz3e / scroller-bottom.js
Created March 22, 2016 20:18
Detect Bottom on Scroll
```
$(window).scroll(function(){
if($(window).scrollTop() + $(window).height() > $(document).height() - <?php echo( s3_option('s3cc_fixed_trigger') == '' ? 100 : s3_option('s3cc_fixed_trigger') );?>) {
$('.s3cc-fixed').css('position','static');
}else{
$('.s3cc-fixed').css('position','fixed');
}
});
```
@Shaz3e
Shaz3e / Display number of Facebook fans in full text
Created July 4, 2015 22:18
Display number of Facebook fans in full text
If you have a Facebook page for your website or blog, you might want to display how many fans you have. This snippet will help you to get your Facebook fan count, in full text. Don’t forget to add your page ID on line 2.