Skip to content

Instantly share code, notes, and snippets.

Salipro Pham salipro4ever

Block or report user

Report or block salipro4ever

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
salipro4ever / .httpd
Created Nov 12, 2019
Gzip & Cache on Apache24
View .httpd
# Gzip
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
// Remove Administrator role from roles list
add_action( 'editable_roles' , 'hide_adminstrator_editable_roles' );
function hide_adminstrator_editable_roles( $roles ){
    if ( isset( $roles['administrator'] ) && !current_user_can('level_10') ){
        unset( $roles['administrator'] );
    return $roles;
salipro4ever /
Created Sep 21, 2019
Download all image url from string
    $string = file_get_contents(config_path('mapplic.json'));

        $pattern = '~(http:|https:)\/\/[^/\s]+\/\S+\.(jpe?g|png)~i';

        $m = preg_match_all($pattern,$string,$matches);


        foreach ($matches[0] as $i => $url){
salipro4ever /
Created May 6, 2019
subdomain map to subdirectory route in existing Laravel

I serve multiple subdomains with Laravel with this code here:


  protected function mapSubdomainRoutes()
      'namespace' => $this->namespace,
      'domain' => '{subdomain}',
    ], function () {
salipro4ever / paginate-laravel-collection.php
Created Dec 8, 2018
You can add this method as Collection method in AppServiceProvider. just add this in boot method.
View paginate-laravel-collection.php
if (!Collection::hasMacro('AppServiceProvider')) {
function ($perPage = 15, $page = null, $options = []) {
$page = $page ?: (Paginator::resolveCurrentPage() ?: 1);
return (new LengthAwarePaginator(
$this->forPage($page, $perPage), $this->count(), $perPage, $page, $options))
salipro4ever / paginate.php
Created Dec 8, 2018 — forked from ctf0/paginate.php
Laravel Paginate Collection or Array
View paginate.php
* Gera a paginação dos itens de um array ou collection.
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @return LengthAwarePaginator


This package is a Laravel (5.5+) utility which helps you keep and manage your application version, increment version numbers (major, minor, patch, build), and can also use your last commit hash as build number.

class ProjectController extends Controller
     * All of the current user's projects.
    protected $projects;

     * Create a new controller instance.
salipro4ever / MyCheckClientCredentials.php
Created Oct 3, 2018
Get client from Client Credentials Grant - Laravel Passport
View MyCheckClientCredentials.php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Auth\AuthenticationException;
use League\OAuth2\Server\Exception\OAuthServerException;
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
use Laravel\Passport\Http\Middleware\CheckClientCredentials;
class MyCheckClientCredentials extends CheckClientCredentials
salipro4ever /
Last active Sep 24, 2018
English for Inventory/Stock


Tồn kho, nhưng stock chỉ đơn thuần nói về số lượng tồn không bao gôm giá trị như inventory

Purchase Order

Đơn mua hàng gửi đến nhà cung cấp, bao gồm số lượng, giá cả thoả thuận...

Purchase Return

You can’t perform that action at this time.