Skip to content

Instantly share code, notes, and snippets.

View Ellrion's full-sized avatar

Maksim (Ellrion) Platonov Ellrion

View GitHub Profile
<?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(слаг). Вот пара ссылок которые полностью отвечает на все вопросы.

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

<?php declare(strict_types=1);
namespace Adteam\Presenters;
abstract class BasePresenter extends AbstractPresenter
{
/**
* Language file fore this presenter.
*
* @var string
package freeport
import (
"net"
"strconv"
)
func GetFreePort() (string, error) {
l, err := net.Listen("tcp", "127.0.0.1:0")
defer l.Close()
package tunnel
import (
"golang.org/x/crypto/ssh"
"errors"
"io"
"io/ioutil"
"log"
"net"
package progressbar
import (
"strings"
"fmt"
)
type ProgressBar struct {
total float32
curr float32
#include <Bounce2.h>
#define RED_PIN 9
#define GREEN_PIN 10
#define BLUE_PIN 11
#define RED_BUTTON_PIN 5
#define GREEN_BUTTON_PIN 3
#define BLUE_BUTTON_PIN 4
#define REMOVE_BUTTON_PIN 8
<?php
namespace App\Services\Foundation\Routing;
use Illuminate\Routing\ResourceRegistrar;
class ExtendedResourceRegistrar extends ResourceRegistrar
{
/**
<?php
use Illuminate\Support\Collection;
Collection::macro('crossMerge', function (Collection $collection) {
return $this->reduce(function (Collection $result, $item) use ($collection) {
$result->push($item);
if ($collection->isNotEmpty()) {
$result->push($collection->shift());
}
<?php
abstract class BaseModel extends Model
{
/**
* Находит последнюю запись для значений определенного поля.
*
* Т.е. с групировкой по указанному полю.
*