Skip to content

Instantly share code, notes, and snippets.

View zhd4n's full-sized avatar

Zhdan Zhulanov zhd4n

View GitHub Profile
@zhd4n
zhd4n / galsen-test.md
Last active April 4, 2022 06:40
Тестовое задание PHP/Laravel/VueJS SPA

Тестовое задание

Необходимо сделать SPA на VueJS и Laravel. Внешний вид значения не имеет, можно использовать любой UI framework или не использовать вовсе.

На странице должны быть реализованы фичи:

  • Добавление записи в БД, поля: Дата, Значение (целое число)
  • Список записей из БД с возможностью удаления и редактирования
  • График построенный по записям из БД: ось X - дата в формате d.m.Y, ось Y - значение. Для вывода графика можно использовать любую удобную библиотеку.

Другие требования:

  • Использовать Laravel migrations, API resources, Form Requests + validation, Models
@zhd4n
zhd4n / gist:637c6c0ee2a2733673e3e09a38ed3b35
Created April 30, 2021 10:47
docker run mysql ram disk
--tmpfs /var/lib/mysql
@zhd4n
zhd4n / string_to_hsl.js
Created April 22, 2021 17:53
JS get HSL color from string
getColor(initials: string) {
let hash = 0;
for (let i = 0; i < initials.length; i++) {
hash = initials.charCodeAt(i) + ((hash << 5) - hash);
}
const h = hash % 360;
return `hsl(${h}, 30%, 65%)`;
}
@zhd4n
zhd4n / pre-commit
Last active March 3, 2021 09:18
php-cs-fixer pre-commit hook
#!/usr/bin/env bash
echo "php-cs-fixer pre commit hook start."
PHP_CS_FIXER="vendor/bin/php-cs-fixer"
PHP_CS_CONFIG=".php_cs"
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM -- '*.php')
if [ -n "$CHANGED_FILES" ]; then
$PHP_CS_FIXER fix --path-mode=intersection --config "$PHP_CS_CONFIG" $CHANGED_FILES;
@zhd4n
zhd4n / win_git_lf_fix.txt
Last active October 23, 2019 12:37
Windows GIT line endings fix
git config --global core.autocrlf input
git config --global core.eol lf
<?php
if (!function_exists('rus_ending')) {
/**
* @param $n число
* @param $n1 1
* @param $n2 2
* @param $n5 5
* @return string
*/
function rus_ending($n, $n1, $n2, $n5)
@zhd4n
zhd4n / terminal_most_used.text
Created May 15, 2019 10:37
Shows the most used terminal commands
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
@zhd4n
zhd4n / laravel_perms.txt
Last active June 25, 2019 07:50
Securely set file permissions for Laravel
sudo chown -R $USER:www-data /path/to/your/laravel/root/directory
sudo find /path/to/your/laravel/root/directory -type f -exec chmod 664 {} \;
sudo find /path/to/your/laravel/root/directory -type d -exec chmod 775 {} \;
sudo chmod -R ug+rwx storage bootstrap/cache