Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
| <?php | |
| namespace App\Controller; | |
| use App\Utils\Paginator; | |
| use Doctrine\ORM\EntityManagerInterface; | |
| use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
| use Symfony\Component\HttpFoundation\Request; | |
| use Symfony\Component\HttpFoundation\Response; |
| public class DeclensionGenerator | |
| { | |
| /// <summary> | |
| /// Возвращает слова в падеже, зависимом от заданного числа | |
| /// </summary> | |
| /// <param name="number">Число от которого зависит выбранное слово</param> | |
| /// <param name="nominativ">Именительный падеж слова. Например "день"</param> | |
| /// <param name="genetiv">Родительный падеж слова. Например "дня"</param> | |
| /// <param name="plural">Множественное число слова. Например "дней"</param> | |
| /// <returns></returns> |
| # Cache, temp and personal files | |
| /.htaccess | |
| *.log | |
| npm-debug.log.* | |
| .sass-cache/ | |
| /cache/* | |
| download/* | |
| /img/* | |
| /log/* |
| <?php | |
| // Converts a number into a short version, eg: 1000 -> 1k | |
| // Based on: http://stackoverflow.com/a/4371114 | |
| function number_format_short( $n, $precision = 1 ) { | |
| if ($n < 900) { | |
| // 0 - 900 | |
| $n_format = number_format($n, $precision); | |
| $suffix = ''; | |
| } else if ($n < 900000) { |
| // JS array equivalents to C# LINQ methods - by Dan B. | |
| // First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version): | |
| // Here's a simple array of "person" objects | |
| var people = [ | |
| { name: "John", age: 20 }, | |
| { name: "Mary", age: 35 }, | |
| { name: "Arthur", age: 78 }, | |
| { name: "Mike", age: 27 }, |
REGEX remove blank lines:
FROM: http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/remove_blank_lines.html
FIND:
^(?:[\t ]*(?:\r?\n|\r))+
| <?php | |
| namespace Foo; | |
| /** | |
| * Methods for safe LIKE querying. | |
| */ | |
| trait LikeQueryHelpers | |
| { | |
| /** |
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
| /*! = $rembase: 14px | |
| -------------------------------------------------------------- | |
| * hmtl { font-size: 87.5%; } | |
| * body { font-size: 14px; font-size: 1rem; line-height: 1; } | |
| * 4px 0.28571429rem | |
| * 8px 0.571428571rem | |
| * 12px 0.857142857rem | |
| * 13px 0.928571429rem | |
| * 14px 1rem | |
| * 16px 1.142857143rem |