Skip to content

Instantly share code, notes, and snippets.

View Adizbek's full-sized avatar

Ergashev Adizbek Adizbek

  • Realsoft
  • Tashkent, Uzbekistan
View GitHub Profile
@Adizbek
Adizbek / PermissionSeeder.php
Created December 11, 2021 12:24
Template for permission seeding in Laravel using Spatie/Permission
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
class PermissionSeeder extends Seeder
{
@Adizbek
Adizbek / .gitlab-ci.yml
Created October 2, 2021 06:04
Gitlab CI/CD
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
# Build a Docker image with CI/CD and push to the GitLab registry.
# Docker-in-Docker documentation: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html
#
# This template uses one generic job with conditional builds
# for the default branch and all other (MR) branches.
@Adizbek
Adizbek / Dockerfile
Created October 1, 2021 14:48
General purpose Dockerfile for laravel project
FROM phpswoole/swoole:4.7-php8.0-alpine
# Working directory was set to /var/www
ENV APP_ENV production
RUN apk add --no-cache zip unzip git libxml2-dev oniguruma-dev libpng-dev icu-dev autoconf g++ make nodejs npm yarn && \
pecl install redis && docker-php-ext-enable redis
# Install PHP extensions
@Adizbek
Adizbek / treeToHtml.js
Created August 14, 2020 04:15
Tree structure to html table, automatic colspan, rowspan
class Tree {
/** @type String */
val;
/** @type Tree[] */
children;
/**
* @param {String} val
@Adizbek
Adizbek / get_nearest_birthdays.sql
Created November 22, 2019 05:13
Get nearest birthdays
SELECT * FROM (SELECT * FROM (
SELECT *, 1 as o FROM schoolid.pupils p
WHERE month(now()) < month(p.birth_date) OR (month(now()) = month(p.birth_date) AND dayofmonth(now()) <= dayofmonth(p.birth_date))
ORDER BY
(month(p.birth_date)) asc,
(dayofmonth(p.birth_date)) asc) cx
UNION