Skip to content

Instantly share code, notes, and snippets.

View Sharifur's full-sized avatar
🎯
Focusing

Sharifur Rahman Sharifur

🎯
Focusing
View GitHub Profile
@Sharifur
Sharifur / canonical-url-generate-for-laravel.php
Created May 8, 2022 03:53
canonical url generate for laravel
function canonical_url()
{
if (\Illuminate\Support\Str::startsWith($current = url()->current(), 'https://www')) {
return str_replace('https://www.', 'https://', $current);
}
return str_replace('https://', 'https://www.', $current);
}
@Sharifur
Sharifur / dropzonejs.js
Created April 10, 2022 16:14
dropzone js with chunk file support with php laravel
Dropzone.options.placeholderfForm = {
dictDefaultMessage: "{{__('Drag or Select Your Image')}}",
maxFiles: 50,
maxFilesize: 30720, //MB
chunking: true,
chunkSize: 10000000, // 10MB
acceptedFiles: 'image/*,video/*,.mp4,.avi,.flv,.mov',
success: function (file, response) {
if (file.previewElement) {
return file.previewElement.classList.add("dz-success");
@Sharifur
Sharifur / convert-text-to-slug.js
Created April 8, 2022 05:41
make any text ,description, title to slug
function converToSlug(slug){
let finalSlug = slug.replace(/[^a-zA-Z0-9]/g, ' ');
//remove multiple space to single
finalSlug = slug.replace(/ +/g, ' ');
// remove all white spaces single or multiple spaces
finalSlug = slug.replace(/\s/g, '-').toLowerCase().replace(/[^\w-]+/g, '-');
return finalSlug;
}
console.log(makeSlug("Car Cleaning Service From Best Cleaner [] () !@#$%^&*()_+))
@Sharifur
Sharifur / meta-tag-for-upgrade-insecure-requests.html
Created April 4, 2022 12:41
meta-tag-for-upgrade-insecure-requests.html
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
@Sharifur
Sharifur / thai-font-support-for-dom-pdf.php
Created April 1, 2022 06:36
Can't Use Thai Language in DOMPDF
<style>
@font-face {
font-family: 'THSarabunNew';
font-style: normal;
font-weight: normal;
src: url("{{ asset('assets/frontend/fonts/THSarabunNew.ttf') }}") format('truetype');
}
body {
font-family: "THSarabunNew";
}
@Sharifur
Sharifur / make-links.php
Created March 27, 2022 05:56
parse link from string and replace them as anchor tag
@Sharifur
Sharifur / delete-all-file-with-folder-inphp.php
Last active February 21, 2022 03:55
delete all folder with file in php
function rmdir_recursive($dir) {
foreach(scandir($dir) as $file) {
if ('.' === $file || '..' === $file) continue;
if (is_dir("$dir/$file")) rmdir_recursive("$dir/$file");
else unlink("$dir/$file");
}
rmdir($dir);
}
@Sharifur
Sharifur / .htaccess
Created December 16, 2021 10:35
Routes not working without index.php
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
#makrup
<div class="volunteer-area m-top-02">
<div class="container">
<div class="row no-gutters">
<div class="col-lg-12">
<ul class="volunteer-single-item-list">
<li class="volunteer-single-item">
<div class="content less-padding style-01">
<div class="icon">
@Sharifur
Sharifur / CorsMiddleware.php
Created July 25, 2020 08:53
CORS middleware for laravel
<?php
namespace App\Http\Middleware;
use Closure;
class CorsMiddleware
{
/**
* Handle an incoming request.
*