This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -sh ./node_modules/* | sort -nr | grep '\dM.*' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DB::table('really_long_table_name as short_alias') | |
Model::from('table_name as table_alias') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const messageEl = document.querySelector('.message'); | |
password.addEventListener('keyup', function (e) { | |
if (e.getModifierState('CapsLock')) { | |
messageEl.textContent = 'Caps lock is on'; | |
} else { | |
messageEl.textContent = ''; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Database\Eloquent\Relations\Relation; | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Support\ServiceProvider; | |
class MorphMapServiceProvider extends ServiceProvider | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validator::replacer('required', function ($message, $attribute, $rule, $parameters) { | |
$attributeSanitized = $attribute; | |
if (Str::endsWith($attribute, '_id')) { | |
$attributeSanitized = substr($attribute, 0, -3); | |
} | |
$friendlyAttributeName = str_replace('_', ' ', $attribute); | |
$newAttributeName = Lang::has('fields.' . $attributeSanitized) | |
? __('fields.' . $attributeSanitized) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// plain PHP solution | |
$supportsWebp = strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false; | |
// Laravel solution | |
$supportsWebp = request()->accepts('image/webp'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# installing nginx | |
sudo apt update | |
sudo apt install nginx | |
# firewall: opening appropriate ports | |
sudo ufw app list | |
sudo ufw allow 'Nginx Full' | |
sudo ufw status |