Skip to content

Instantly share code, notes, and snippets.

View mishajib's full-sized avatar
👌
SOFTWARE ENGINEER

MI SHAJIB mishajib

👌
SOFTWARE ENGINEER
View GitHub Profile
@mishajib
mishajib / remove_email_and_phone_number_from_string.php
Last active August 29, 2022 18:00
This helper helps to remove email & phone number from string/text.
<?php
function removeEmailAndPhoneFromString($string) {
// remove email
$string = preg_replace('/([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)/', '*****', $string);
// remove phone
$string = preg_replace('/([0-9]+[\- ]?[0-9]+){4,}/', '*****', $string);
return $string;
@mishajib
mishajib / image_upload_helper_for_s3_and_anyone_with_laravel.php
Created August 29, 2022 16:49
This helper helps to upload file into local server or AWS S3 by using laravel.
<?php
function imageUploadHandler($file, $fileName = null, $request_path = 'default', $disk = 'public', $size = null, $old_file = null)
{
// If old file exist then delete it
if (!is_null($old_file)) {
if (Storage::disk($disk)->exists($old_file)) {
Storage::disk($disk)->delete($old_file);
}
}
@mishajib
mishajib / storageLink_helper_for_s3_and_anyone.php
Created August 29, 2022 16:46
This helper helps to get image from public disk or AWS S3.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div id="google-reviews"></div>
@mishajib
mishajib / Image_uploader.php
Created August 14, 2021 19:46
Larave helper for image upload
function imageUploadHandler($image, $request_path = 'default', $size = null, $old_image = null)
{
if (isset($old_image)) {
if (Storage::disk('public')->exists($old_image)) {
Storage::disk('public')->delete($old_image);
}
}
$path = $image->store($request_path, 'public');
<template>
<nav aria-label="...">
<ul class="pagination justify-content-center">
<li style="cursor: pointer;" class="page-item" :class="{ disabled: pagination.current_page <= 1 }">
<a class="page-link" @click.prevent="changePage(1)" >First page</a>
</li>
<li style="cursor: pointer;" class="page-item" :class="{ disabled: pagination.current_page <= 1 }">
<a class="page-link" @click.prevent="changePage(pagination.current_page - 1)">Previous</a>
</li>
<template>
<div class="customer">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Customers</h3>
<div class="card-tools" style="position: absolute;right:1rem;top:.5rem;">
<button @click="create" type="button" class="btn btn-info">
Add New <i class="fas fa-plus"></i>
@mishajib
mishajib / vuedataviewer-api-routes.txt
Created August 11, 2021 15:55
laravel crud api routes for vue dataviewer
Domain Url - https://vuedataviewer.mishajib.me
Get Data url (get) - /api/customers?page=1
Search Data url (get) - /api/search/customers/{fieldname}/{query}?page=1
Store data url (post) - /api/customers
Update data url (put) - /api/customers/{customer}
Destroy / Remove data url (delete) - /api/customers/{customer}
@mishajib
mishajib / bd_number_regex.txt
Created April 25, 2021 09:49
Bangladesh number regex
/^(?:\+88|88)?(01[3-9]\d{8})$/
@mishajib
mishajib / code_spliting_or_file_chunks_babel.txt
Created April 4, 2021 07:03
code spliting or file chunks by babel
1. First Install @babel/plugin-syntax-dynamic-import plugin - npm install --save-dev @babel/plugin-syntax-dynamic-import .
2. Create .babelrc file into root folder.
3. Placed this code into .babelrc file -
{
"plugins": [
"@babel/plugin-syntax-dynamic-import"
]
}
4. In the mix file replace previous code by this code -
mix.js('resources/js/app.js', 'public/js').webpackConfig({