Skip to content

Instantly share code, notes, and snippets.

View Ellrion's full-sized avatar

Maksim (Ellrion) Platonov Ellrion

View GitHub Profile
@Ellrion
Ellrion / php-restrictions.nginxconf
Last active March 20, 2024 01:26
Nginx + Php-fpm config for Laravel app
# /etc/nginx/global/php-restrictions.conf
# Don't throw any errors for missing favicons and don't display them in the logs
location = /favicon.ico {
log_not_found off;
access_log off;
}
# Don't log missing robots or show them in the nginx logs
location = /robots.txt {
allow all;
@Ellrion
Ellrion / BaseModel.php
Last active December 4, 2022 23:33
Additional helper scopes for Laravel Eloquent Models: `->orderByRelation('author', 'name')`; `->orderByRelationCount('posts')`; `->withJoinnedRelated('author', 'name')`;
<?php
namespace App;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression;
abstract class BaseModel extends Model
@Ellrion
Ellrion / helper.php
Last active December 1, 2021 17:40
reverse function for parse_url (http://php.net/manual/en/function.parse-url.php)
<?php
if ( ! function_exists('build_url'))
{
/**
* @param array $parts
* @return string
*/
function build_url(array $parts)
{
<?php
namespace App\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class BaseCommand extends Command
{
@Ellrion
Ellrion / AbstractPresenter.php
Last active September 23, 2021 00:02
Презентеры в Laravel.
<?php
namespace App\Presenters;
abstract class AbstractPresenter
{
/**
* The resource that is the object that was decorated.
*
* @var mixed
@Ellrion
Ellrion / cmd_cheat_sheet.md
Last active April 21, 2021 02:26
CMD cheat sheet

Файловые команды

  • ls – список файлов и каталогов
  • ls -al – форматированный список со скрытыми каталогами и файлами
  • cd dir – сменить директорию на dir
  • cd – сменить на домашний каталог
  • pwd – показать текущий каталог
  • mkdir dir – создать каталог dir
  • rm file – удалить file
  • rm -r dir – удалить каталог dir
  • rm -f file – удалить форсированно file
@Ellrion
Ellrion / jquery.simpleplugin.js
Last active February 29, 2020 15:42
Jquery plugin template
/**
* JQuery plugin SimplePlugin v 1.0 [26.05.14 10:59]
* TODO: DESCRIPTION
* Created by ...
* Contacts: ...
*/
// don't declare anything out here in the global namespace
(function($) { // create private scope (inside you can use $ instead of jQuery)
@Ellrion
Ellrion / helper.php
Last active February 29, 2020 12:38
<?php
if (! function_exists('dqd')) {
/**
* Dump info about query in builder and end the script.
*
* @param $query
* @param bool $short
*/
function dqd($query, $short = false)
@Ellrion
Ellrion / BaseCommand.php
Created September 14, 2016 12:36
Консольная команда с блокировкой.
<?php
namespace App\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class BaseCommand extends Command
{
@Ellrion
Ellrion / slug.md
Last active October 8, 2019 07:17

Стала интересна этимология термина slug(слаг). Вот пара ссылок которые полностью отвечает на все вопросы.

Если коротко то слаг в разработке это термин непосредственно связанный с семантическим урл (ЧПУ/юзер френдли урл и т.п.). Собственно часть урла которая определяет страницу в человекопонятных ключевых словах.