Skip to content

Instantly share code, notes, and snippets.

View drakakisgeo's full-sized avatar

Drakakis George drakakisgeo

View GitHub Profile
@drakakisgeo
drakakisgeo / gist:48dcab1539612c82449b9757940ac7ee
Last active August 29, 2022 02:41
Print Access Token from Laravel Passport
<?php
namespace App\Traits;
use App\User;
use DateTime;
use GuzzleHttp\Psr7\Response;
use Illuminate\Events\Dispatcher;
use Laravel\Passport\Bridge\AccessToken;
use Laravel\Passport\Bridge\AccessTokenRepository;
@drakakisgeo
drakakisgeo / select2-remove-border-radius.css
Created November 7, 2017 14:39
Remove 4px border-radius from Select2
.select2 {
border-color:1px solid #cacaca;
box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1);
background-color:#fefefe;
}
.select2-dropdown, .select2-container--default .select2-selection--single ,
.select2-container--default .select2-selection--multiple, .select2-container--default .select2-selection--multiple .select2-selection__choice,
.select2-container--classic .select2-selection--multiple , .select2-container--classic .select2-selection--multiple,
.select2-container--classic .select2-selection--multiple .select2-selection__choice, .select2-dropdown,
@drakakisgeo
drakakisgeo / gist:7571234
Created November 20, 2013 21:19
Change DocumentRoot in cpanel for a Laravel project
1. upload all files to /home/user/public_html
2. edit /var/cpanel/userdata/$username/$domain.com
3. change the document root path from public_html to public_html/public
4. /scripts/rebuildhttpdconf
Done!
@drakakisgeo
drakakisgeo / .htaccess
Created July 5, 2013 15:38
Joomla .htaccess for extra security
###############################################################################
## The Master .htaccess
##
## Version 2.5 (proposed) - May 16th, 2011
##
## ----------
## This file is designed to be the template .htaccess file to put on your new
## sites, increasing your site's security and performance. It is not meant to
## be just dropped in your site, though. You should go through all of its
## sections and modify it to match your site. Most notably, all instances of
@drakakisgeo
drakakisgeo / gist:3bba2a2600b4c554f836
Created May 7, 2015 13:51
Auto trim all input [Laravel 5]
// Step 1. Create this class in the middleware folder.
<?php namespace App\Http\Middleware;
use Closure;
class BeforeAutoTrimmer {
/**
* Handle an incoming request.
1) Show lines when opening files. Add the -C flag
``` nano -C file.txt ```
2) Go to line.
``` CTRL+SHIFT+_ ```
3) Select block of text
@drakakisgeo
drakakisgeo / eagerTrash
Created January 16, 2014 21:13
Eloquent Eager Loading with Trashed [Laravel]
Example
@foreach ($invoice->items->load(['product'=> function($q){$q->withTrashed();}]) as $item){
// do stuff
}
@drakakisgeo
drakakisgeo / gist:3431832d83193465dcd94ac8e53353e9
Created September 27, 2019 09:45
(ISO 3166-1 alpha-2) inline php Array
$countries = array('AF' => 'Afghanistan', 'AX' => 'Aland Islands', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua And Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia And Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', 'CC'
@drakakisgeo
drakakisgeo / Postmarkable.php
Last active April 9, 2019 21:02
Postmark Trait for Laravel Mailable - (Support for Tag and Meta)
<?php
namespace App\Billit\Traits;
trait Postmarkable
{
/**
* @param array $tags
*/
public function setTag(array $tag): void
@drakakisgeo
drakakisgeo / Upgrading phpmyadmin
Created February 6, 2019 13:54
Upgrading phpmyadmin for apache php7.2 - Ubuntu 18.04
cd /usr/share/
sudo mv phpmyadmin/ phpmyadmin-4.8.5/
sudo wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.zip
sudo unzip phpMyAdmin-4.8.5-all-languages.zip
sudo ln -s phpMyAdmin-4.8.5-all-languages phpmyadmin
sudo chown -R www-data:www-data /usr/share/phpmyadmin
sudo chmod -R 755 /usr/share/phpmyadmin
sudo service apache2 restart