Skip to content

Instantly share code, notes, and snippets.

View a-h-abid's full-sized avatar
💭
So much work at office...

Ahmedul Haque Abid a-h-abid

💭
So much work at office...
View GitHub Profile
@a-h-abid
a-h-abid / regex-html-removal.txt
Last active March 1, 2017 07:52
Regex: Removing tags only, inside text stays
//Regex for removing tags only.. inside contents stays
<[!\/]?(DOCTYPE|head|form|body|html|title|input[^<>]*value="rad2") *[^<>]*>
@a-h-abid
a-h-abid / text-reflect.css
Created September 14, 2014 09:22
A pure text reflection done in CSS3 by Yichuan Shen, only mention the classname and you are done.
/**
* CSS3 Snippet By Yichuan Shen
*
* Places a reflected mirror text vertically.
*
* Requires CSS3 support with gradient and transform properties,
* along with psudo-elements :before and :after.
*
* Usage: <h1 class="text-reflect" data-text="Reflect">Reflect</h1>;
* URL : yichuanshen.de/blog/2011/01/08/reflecting-text-with-pure-css3/
@a-h-abid
a-h-abid / a-Laravel-5-Structure.md
Last active November 30, 2017 04:12
A proper directory structure for Laravel 5 to be used in many kind of servers, VPS and Shared Hosting included. While you can set Document Root to your project, this also gives you the advantage of putting the whole project in a sub-folder / sub-directory.

Laravel 5 Structure for document root, public_html and sub-folder/sub-directory based access on VPS and Shared Hosting

Date: 2017-Nov-20

It becomes really annoying when you have to deal with these age old shared hosting servers. Yeah they might have PHP 7, but that doesn't do any justice if we can't change the Document Root to the one needed by our project.

Learning through various places guides us to only put public files in the web/public folder. Which means setting the Document Root. But many of our ugly old shared hosting sites like godaddy, hostgator etc. do not let us set this simple document root for our primary domain, yet they allow when you add sub-domains (??? confused :S). I wish we could simply change these hostings to some VPS like digitalocean, but alas, your company boss not interested to change hosting. So, yeah, dealing with this problem for ages. And I HATE IT!!

Many of us Laravel developers have somehow managed to run laravel in these shared hosting sites, but what we usually

Alias /example "C:/xampp/htdocs/example/public/"
<Directory "C:/xampp/htdocs/example/public/">
AllowOverride all
Require local
</Directory>
@a-h-abid
a-h-abid / env_helper.php
Created June 16, 2019 10:10
Enhanced ENV function mixing both Laravel & CakePHP's env()
<?php
if (!function_exists('eenv')) {
/**
* Enhanced ENV()
*
* Gets the value of an environment variable.
*
* @param string $key
* @param mixed $default
@a-h-abid
a-h-abid / ValidationResponseWithRuleName.php
Last active March 17, 2023 08:19
Laravel Validation Response for API with Rule Key
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class ValidationResponseWithRuleName
{
/**
@a-h-abid
a-h-abid / example.lifecycle.json
Last active October 21, 2021 10:04
MinIO MC Commands Quick Sheet
{
"Rules": [
{
"Expiration": {
"Days": 1
},
"ID": "PublicTempUploads",
"Filter": {
"Prefix": "path/"
},
@a-h-abid
a-h-abid / ScheduleListCommand.php
Last active February 14, 2022 18:27
To get scheduled tasks in system. Tested in Laravel 6+.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\Scheduling\Schedule;
class ScheduleListCommand extends Command
{
/**
@a-h-abid
a-h-abid / DropAllTablesState.php
Created April 8, 2022 06:00
refresh module db
<?php
namespace Tests\Database;
class DropAllTablesState
{
/**
* Indicates if all tables have been dropped
*
* @var bool
@a-h-abid
a-h-abid / AppExceptionHandler.php
Created October 13, 2023 18:44
Laravel 10+ Validator Response with Rule Names
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Validation\ValidationException;
class Handler extends ExceptionHandler
{
// ...