Skip to content

Instantly share code, notes, and snippets.

Avatar
🔍
Learning something

Lloric Mayuga Garcia lloricode

🔍
Learning something
View GitHub Profile
@lloricode
lloricode / pint.json
Created Aug 9, 2022
Optimal Laravel Pint Configuration
View pint.json
{
"preset": "psr12",
"exclude": [
"config"
],
"notPath": [
"ray.php"
],
"rules": {
"align_multiline_comment": true,
@lloricode
lloricode / AppServiceProvider.php
Created Nov 15, 2021 — forked from themsaid/AppServiceProvider.php
Re-encryption after APP_KEY rotation
View AppServiceProvider.php
<?php
namespace App\Providers;
use App\Encrypter;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
View TestFormRequest.php
<?php
namespace Tests;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\ParameterBag;
use function PHPUnit\Framework\assertFalse;
@lloricode
lloricode / gist:d2b56b6b2ae13c9227d839ad336b6fc4
Created Jul 30, 2020 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:d2b56b6b2ae13c9227d839ad336b6fc4

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
View One Liner to Download the Latest Release from Github Repo.md
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@lloricode
lloricode / gist:25c962582fe76acb9b21b87c0ce387d1
Created Oct 31, 2019 — forked from LuenCC/gist:e8dcf4a38096617799f3002644012af6
Laravel find nearest location in km from lat, long database
View gist:25c962582fe76acb9b21b87c0ce387d1
private function findNearestLocation(Request $request)
{
$location = DB::table('locations')
->select('name', 'latitude', 'longitude', 'region', DB::raw(sprintf(
'(6371 * acos(cos(radians(%1$.7f)) * cos(radians(latitude)) * cos(radians(longitude) - radians(%2$.7f)) + sin(radians(%1$.7f)) * sin(radians(latitude)))) AS distance',
$request->input('latitude'),
$request->input('longitude')
)))
->having('distance', '<', 50)
->orderBy('distance', 'asc')
@lloricode
lloricode / homestead_sqlsrv_driver_installer.sh
Created Jul 29, 2019 — forked from jeremykenedy/homestead_sqlsrv_driver_installer.sh
SQL Server Driver Installer for Laravel Homestead
View homestead_sqlsrv_driver_installer.sh
#!/bin/bash
# SQL Server Driver Installer for Laravel Homestead
#
# This script downloads, compiles, and installs the PHP 7 extension
# files for both the native sqlsrv and the PDO pdo_sqlsrv drivers.
# Get the Microsoft Driver Source Code from Github
cd ~
git clone https://github.com/Microsoft/msphpsql.git
cd msphpsql
@lloricode
lloricode / sqlsrv-php7.2.sh
Created Jul 29, 2019 — forked from LegitDongo/sqlsrv-php.sh
SQLSRV PHP 7.2 Drivers that work for Laravel Homestead
View sqlsrv-php7.2.sh
# Best if added to `after.sh` so that this gets run every time the box is provisioned
# composer won't be able to download updates with an active proxy, and will hang trying to get the newest file
# You may want to comment this out based on your network configuration
sudo bash -c 'echo "export NO_PROXY=*" >> ~/.profile'
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install php7.2-dev php7.2-xml mcrypt php-pear php-mbstring unixodbc unixodbc-dev -y --allow-unauthenticated
View composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
1/131: https://codeload.github.com/doctrine/instantiator/legacy.zip/a2c590166b2133a4633738648b6b064edae0814a
2/131: https://codeload.github.com/sebastianbergmann/code-unit-reverse-lookup/legacy.zip/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18
3/131: https://codeload.github.com/sebastianbergmann/php-file-iterator/legacy.zip/050bedf145a257b1ff02746c31894800e5122946
4/131: https://codeload.github.com/phar-io/version/legacy.zip/45a2ec53a73c70ce41d55cedef9063630abaf1b6
5/131: https://codeload.github.com/theseer/tokenizer/legacy.zip/11336f6f84e16a720dae9d8e6ed5019efa85a0f9
6/131: https://codeload.github.com/phar-io/manifest/legacy.zip/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4
7/131: https://codeload.github.com/phpspec/prophecy/legacy.zip/1927e75f4ed19131ec9bcc3b002e07fb1173ee76
8/131: https://codeload.github.com/sebastianbergmann/php
View sudo apt install php7.2-imagick
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php-imagick' instead of 'php7.2-imagick'
The following additional packages will be installed:
fonts-droid-fallback fonts-noto-mono ghostscript gsfonts imagemagick-6-common libcupsfilters1 libcupsimage2 libfftw3-double3 libgs9 libgs9-common libijs-0.35 libjbig2dec0
liblqr-1-0 libmagickcore-6.q16-3 libmagickwand-6.q16-3 libpaper-utils libpaper1 poppler-data ttf-dejavu-core
Suggested packages:
fonts-noto ghostscript-x libfftw3-bin libfftw3-dev libmagickcore-6.q16-3-extra poppler-utils fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic
| fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum