Skip to content

Instantly share code, notes, and snippets.

View shibbirweb's full-sized avatar
💭
Happy Coding

MD. Shibbir Ahmed shibbirweb

💭
Happy Coding
View GitHub Profile
@shibbirweb
shibbirweb / CustomVueSelectComponent.vue
Created April 23, 2020 22:02
Create custom vue component with v-model
<template>
<v-select :options="currencies" label="name" :clearable="false" :searchable="false" v-model="content" @input="updateValue">
<template v-slot:option="option">
<img :src="option.logo"/>
{{ option.name }}
</template>
<template #selected-option="{ logo, name }">
<img :src="logo"/>
{{ name }}
@shibbirweb
shibbirweb / api.js
Created April 22, 2020 11:39
Smart way to use API
import axios from 'axios';
import store from "../store"
// api version 1
const baseAPI = axios.create({
baseURL: `http://yoursite.test/api/v1`
});
// configure api
let api = () => {
// get token
@shibbirweb
shibbirweb / webpack.mix.js
Created April 22, 2020 08:52
Laravel Chunks JS in Seperate Folder
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
@shibbirweb
shibbirweb / EmailVerificationNotification.php
Last active April 22, 2020 08:54
Laravel API Verification Message
<?php
namespace App\Notifications\API\Auth;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Config;
@shibbirweb
shibbirweb / webpack.mix.js
Created April 18, 2020 15:59
Chunk inside JS folder
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
@shibbirweb
shibbirweb / .htaccess
Created April 14, 2020 19:45
Redirect Every URL to index.html
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.html [L]
@shibbirweb
shibbirweb / .htaccess
Last active August 11, 2020 12:13
Laravel Load index from public folder
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
@shibbirweb
shibbirweb / .htaccess
Last active December 28, 2020 09:53
Redirect non-www to www & http to https .htaccess scripts
RewriteEngine On
#redirect non-www to www for all domain
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#redirect non-www to www for specific domain
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
@shibbirweb
shibbirweb / Slug.php
Created May 27, 2019 18:12
Generate unique slug for laravel
<?php
namespace App\Helpers;
use App\Post;
/**
* Unique slug generator
* Created by Shibbir Ahmed
* Source: https://gist.github.com/ericlbarnes/3b5d3c49482f2a190619699de660ee9f
@shibbirweb
shibbirweb / file.blade.php
Last active September 2, 2019 12:22
Generate auto serial number of Laravel Pagination
@php
//get the serial number of pagination
public static function paginateSerial($data)
{
return $data->perPage() * ($data->currentPage() - 1);
}
@endphp
@php