Skip to content

Instantly share code, notes, and snippets.

<?php
declare(strict_types = 1);
function generateRange(int $from, int $to): \Generator
{
while($to >= $from)
{
yield ['qwerty', 'root', 'abube'];
# Installing Packages in Sublime Text 2
Installing packages in Sublime Text 2 is a great way to take advantage of plethora of pre-built tools developed by the community, ranging from themes that customize the look of your editor to support for different language styles, such as for Jade.
In order to take advantage of all of the wonderful packages out there, the first step is to install Package Control. So let's do that now.
1. Open the console in Sublime by clicking *View* in the menu bar, then *Show Console*.
![Imgur](http://i.imgur.com/vbAG7k2.png?1)
@AndreTeros
AndreTeros / User.php
Created November 29, 2019 10:16 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
<?php declare(strict_types=1);
namespace Common\ArgumentResolver;
use Common\Exception\ValidationErrorException;
use Common\Request\RequestData;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
@AndreTeros
AndreTeros / tokens.md
Created July 24, 2019 08:57 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с данными сохранёнными в базе данных.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

Например после аутентификации юзер sasha получает право обращатся и получать от ресурса "super.com/vip" некие данные. Во время обращения юзера sasha к ресурсу vip система авторизации проверит имеет ли право юзер обращатся к этому ресурсу (проще говоря переходить по неким разрешенным ссылкам)

function min(a, b) {
if (Number(a) < Number(b)) {
return a;
}
return b;
}
var a = prompt("Enter a" , "");
var b = prompt("Enter b" , "");
AND workers.login IS NOT NULL