Skip to content

Instantly share code, notes, and snippets.

View lloricode's full-sized avatar
πŸ’»

Lloric Mayuga Garcia lloricode

πŸ’»
View GitHub Profile
@lloricode
lloricode / gist:25c962582fe76acb9b21b87c0ce387d1
Created October 31, 2019 06:08 — forked from LuenCC/gist:e8dcf4a38096617799f3002644012af6
Laravel find nearest location in km from lat, long database
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')
  • 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:d2b56b6b2ae13c9227d839ad336b6fc4
Created July 30, 2020 02:34 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

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:
<?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 / AppServiceProvider.php
Created November 15, 2021 00:25 — forked from themsaid/AppServiceProvider.php
Re-encryption after APP_KEY rotation
<?php
namespace App\Providers;
use App\Encrypter;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
@lloricode
lloricode / pint.json
Last active July 4, 2025 14:34
Optimal Laravel Pint Configuration
{
"preset": "psr12",
"exclude": [
"config",
"build"
],
"notPath": [
"ray.php"
],
"rules": {
@lloricode
lloricode / quotes-api.js
Created April 27, 2025 02:25 — forked from awran5/quotes-api.js
categorized famous quotes array
[
{
"quote": "Be yourself; everyone else is already taken.",
"author": "Oscar Wilde",
"profession": "Irish poet",
"topics": [
"Inspirational",
"Advice",
"Humor"
]