Skip to content

Instantly share code, notes, and snippets.

View introqt's full-sized avatar

Nikita Kolotilo introqt

View GitHub Profile
@introqt
introqt / Fresh.php
Created August 27, 2020 15:40
Artisan fresh command
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use Illuminate\Console\Command;
/**
* Class Fresh
<?php
declare(strict_types=1);
namespace Modules\Home\Services;
use App\Core\Enums\BaseEnum;
use Illuminate\Database\Eloquent\Collection;
use Modules\Home\Entities\ArticleOnMain;
<?php
declare(strict_types=1);
namespace Modules\Home\Services;
use Illuminate\Database\Eloquent\Collection;
use Modules\Home\Entities\ArticleOnMain;
use Modules\Home\Entities\SeasonalOffer;
@introqt
introqt / HomeController.php
Created July 29, 2020 09:12
HomeController.php
<?php
declare(strict_types=1);
namespace Modules\Home\Http\Controllers\Front;
use Illuminate\Routing\Controller;
use Modules\Home\Services\HomePageInterface;
<?php
namespace Modules\Product\Http\Requests\Admin\Product;
use App\Core\Requests\Admin\BaseAdminRequest;
use App\Rules\CheckExistsUrlIfNotFillUrl;
use Illuminate\Validation\Rule;
use Modules\Product\Entities\Product;
use Modules\Product\Entities\ProductVariation;
@introqt
introqt / mysql-docker.sh
Created April 29, 2020 19:13 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@introqt
introqt / taskt-example.md
Created December 9, 2019 00:25 — forked from romabelka/taskt-example.md
Kickstart testing example

You have a long piece of text, and you want to send it to your friend as a series of SMS messages. Your text consists of English letters (uppercase and lowercase) and spaces. The text doesn't contain any leading spaces at the beginning or trailing spaces at the end. There are no two consecutive spaces in the text.

One proper SMS can contain at most K characters. If the text is longer, it needs to be split into parts. Each part should be sent in a separate message that fulfills the maximum length requirement. Text may not be split within words. The order of the words and the messages can't change, so that we can later concatenate the resulting messages to retrieve the original text. Spaces at the start and end of all messages are removed, and thus are not accounted for in the overall message length.

The goal is to count the number of SMS messages needed to accommodate the whole text, keeping the length of each message less than or equal to K. The total number of SMS messages must be kept to a minimum, ho