# 6371 number is radius of earth in Km so we can use it to get distance in KM and 3959 to get distance in miles.
# Search Part: 6371 * acos( cos( radians($lat) ) * cos( radians( stores.latitude ) ) * cos( radians( stores.longitude ) - radians($long) ) + sin( radians($lat) ) * sin( radians( stores.latitude ) ) );
# SQL Ex: get all nearest places by KM
SELECT id, ( 6371 * acos( cos( radians($lat) ) * cos( radians( stores.latitude ) ) * cos( radians( stores.longitude ) - radians($long) ) + sin( radians($lat) ) * sin( radians( stores.latitude ) ) ) ) AS distance FROM stores ORDER BY distance;
# SQL Ex: get all nearest places by MilesTranslations: Korean (by Yongwoo Lee)
Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.
I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).
| input.addEventListener('keydown', stopNumbersInInput); | |
| input2.addEventListener('keydown', allowNumbersInInput); | |
| function stopNumbersInInput(e) { | |
| let keyCode = (e.keyCode ? e.keyCode : e.which); | |
| if (keyCode > 47 && keyCode < 58) { | |
| e.preventDefault(); | |
| } | |
| } |
| yum -y install ImageMagick-devel ImageMagick-c++-devel ImageMagick-perl |
| <div class="step" data-target="#basic-info"> | |
| <button data-tab-hash="basic-tab" type="button" class="step-trigger" role="tab" aria-controls="basic-info" id="basic-info-trigger" > | |
| basic info | |
| </button> | |
| </div> | |
| <div class="line"></div> | |
| <div class="step" data-target="#comments-info"> | |
| <button data-tab-hash="comments-tab" type="button" class="step-trigger" role="tab" aria-controls="comments-info" id="comments-info-trigger"> |
| SELECT full_name, phone, COUNT(phone) FROM users GROUP BY full_name, phone HAVING COUNT(phone) > 1 |
| # Node Js | |
| # Centos7 | |
| curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash - | |
| sudo yum install nodejs | |
| # Ubuntu 20.04 | |
| curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - | |
| sudo apt install nodejs |
| <?php | |
| namespace MixCode\Providers; | |
| use Illuminate\Support\ServiceProvider; | |
| use Illuminate\Support\Facades\Broadcast; | |
| class BroadcastServiceProvider extends ServiceProvider | |
| { | |
| /** |
Create a new repository, or reuse an existing one.
Generate a new SSH key:
ssh-keygen -t rsa -C "your_email@example.com"
Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).
Test SSH key: