Skip to content

Instantly share code, notes, and snippets.

View goodmartian's full-sized avatar
🏔️

SHEROZ Juraev goodmartian

🏔️
View GitHub Profile
@goodmartian
goodmartian / Index.vue
Created August 17, 2021 14:37 — forked from slovenianGooner/Index.vue
Manually starting an inertia event to trigger the loading screen
<template>
<div>
<button @click="simulateLoading">
Simulate Loading
</button>
</div>
</template>
<script>
import Layout from "../Shared/Layout";
import { fireStartEvent, fireFinishEvent } from "@inertiajs/inertia/src/events";
@goodmartian
goodmartian / tailwind.md
Created July 25, 2021 17:59 — forked from sandren/tailwind.md
Tailwind CSS best practices

Tailwind CSS best practices

Utility classes

  1. When writing a string of multiple utility classes, always do so in an order with meaning. The "Concentric CSS" approach works well with utility classes (i.e,. 1. positioning/visibility 2. box model 3. borders 4. backgrounds 5. typography 6. other visual adjustments). Once you establish a familiar pattern of ordering, parsing through long strings of utility classes will become much, much faster so a little more effort up front goes a long way!

  2. Always use fewer utility classes when possible. For example, use mx-2 instead of ml-2 mr-2 and don't be afraid to use the simpler p-4 lg:pt-8 instead of the longer, more complicated pt-4 lg:pt-8 pr-4 pb-4 pl-4.

  3. Prefix all utility classes that will only apply at a certain breakpoint with that breakpoint's prefix. For example, use block lg:flex lg:flex-col lg:justify-center instead of block lg:flex flex-col justify-center to make it very clear that the flexbox utilities are only applicable at the

@goodmartian
goodmartian / new empty git branch.md
Created July 19, 2021 14:37 — forked from ozh/new empty git branch.md
Create a new empty branch in Git
$ git checkout --orphan NEWBRANCH
$ git rm -rf .

--orphan creates a new branch, but it starts without any commit. After running the above command you are on a new branch "NEWBRANCH", and the first commit you create from this state will start a new history without any ancestry.

You can then start adding files and commit them and they will live in their own branch. If you take a look at the log, you will see that it is isolated from the original log.

@goodmartian
goodmartian / README.md
Created September 25, 2019 05:56 — forked from joseluisq/README.md
Install PHP 7 Xdebug in Arch Linux

Install PHP 7 Xdebug in Arch Linux

"Normally", these instructions should be also valid (in similar way) for other Linux distros.

1.- Install Xdebug using pacman:

sudo pacman -Sy xdebug
@goodmartian
goodmartian / GIT info.md
Created September 15, 2019 07:21 — forked from fomvasss/GIT info.md
GIT info.md

GIT, Composer

Новый проект

- cd sites/
- git clone git@bitbucket.org:webwest/basebest.ru.git
- cd basebest
- git status
- laravel new myapp (or) composer create-project --prefer-dist laravel/laravel myapp
@goodmartian
goodmartian / REST API.md
Created September 5, 2019 18:36 — forked from fomvasss/REST API.md
Best practices Laravel Rest API

Best practices написание REST-API

  • Имена полей в ответе задавать в snake_case (prr_page, created_at, system_name,...)
  • Для времени использовать ISO 8601 (формат: YYYY-MM-DDTHH:MM:SSZ)
  • Отдавать данные (сам контент, поля сущностей, массивы сущностей), помещая их в data

Использование REST методов и примеры url'ов

  • GET: /api/users — получить список пользователей;
  • GET: /api/users/123 — получить указанного пользователя;
  • POST: /api/users — создать нового пользователя;
Аббревиатура REST расшифровывается как representational state transfer — «передача состояния представления» или, лучше сказать, представление данных в удобном для клиента формате. Термин “REST” был введен Роем Филдингом в 2000 г. Основная идея REST в том, что каждое обращение к сервису переводит клиентское приложение в новое состояние. По сути, REST — не протокол и не стандарт, а подход, архитектурный стиль проектирования API.
Любой ресурс имеет ID, по которому можно получить данные.
Сервер не хранит состояние — это значит, сервер не отделяет один вызов от другого, не сохраняет все сессии в памяти.
Методы POST и PUT должны возвращать обратно объект, который они изменили или создали, — это позволит сократить время обращения к сервису вдвое.
Возвращайте соответствующие http коды статуса в каждом ответе. Успешные ответы должны содержать следующие коды:
200 — для GET запроса и для синхронных DETELE и PATCH
201 — для синхронного POST запроса
202 — для асинхронных POST, DELETE и PATCH запросов