Skip to content

Instantly share code, notes, and snippets.

View vladmeh's full-sized avatar

VladMeh vladmeh

View GitHub Profile
<?php
namespace App\Services\Dto;
abstract class AbstractDto
{
/**
* AbstractRequestDto constructor.
* @param array $data
*/
@GhazanfarMir
GhazanfarMir / Instructions.sh
Last active October 5, 2025 08:00
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@alphaHydro
alphaHydro / ConfigProvider.php
Last active September 27, 2017 14:53
Создание сущностей Doctrine из существующих таблиц базы данных
<?php
namespace Api;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
class ConfigProvider
{
public function __invoke()
{
@zmts
zmts / tokens.md
Last active October 29, 2025 08:59
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@jaamo
jaamo / gist:7e0ca58c19fe390a8ff354f874a5b603
Created November 10, 2016 07:47
Nginx: document root based on client's ip address
# Set the default path
set $root /var/www/html/dist;
# Change the document root path based on user's ip address
if ($remote_addr ~ "^(71\.134\.111\.38)$") {
set $root /var/www/html/dist1;
}
# Set config
root $root;
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active July 17, 2025 02:58
Vanilla JavaScript Quick Reference / Cheatsheet
@mtsahakis
mtsahakis / GridFragment.java
Last active April 25, 2021 22:40
Dynamically set span count in an Android RecyclerView's GridLayoutManager. Implementation is taken from a Fragment.
private RecyclerView mRecyclerView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_view, container, false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
// ommiting other recycler view set up, such as adapter and Layout manager set up ..
ViewTreeObserver viewTreeObserver = mRecyclerView.getViewTreeObserver();
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@FaAway
FaAway / level20.lesson10.bonus03
Created February 11, 2016 01:34
javarush level20.lesson10.bonus03
package com.javarush.test.level20.lesson10.bonus03;
import java.util.ArrayList;
import java.util.List;
/* Кроссворд
1. Дан двумерный массив, который содержит буквы английского алфавита в нижнем регистре.
2. Метод detectAllWords должен найти все слова из words в массиве crossword.
3. Элемент(startX, startY) должен соответствовать первой букве слова, элемент(endX, endY) - последней.
text - это само слово, располагается между начальным и конечным элементами
@mcaskill
mcaskill / Function.Array-Group-By.php
Last active October 21, 2025 08:41
PHP : Groups an array by a given key
<?php
if (!function_exists('array_group_by')) {
/**
* Groups an array by a given key.
*
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
*
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
* This variant allows $key to be closures.
@marcelosomers
marcelosomers / git-php-webhook.php
Last active August 30, 2025 14:19
A basic webhook for deploying updates to repos on Github to your local server
<?php
/**
* This script is for easily deploying updates to Github repos to your local server. It will automatically git clone or
* git pull in your repo directory every time an update is pushed to your $BRANCH (configured below).
*
* Read more about how to use this script at http://behindcompanies.com/2014/01/a-simple-script-for-deploying-code-with-githubs-webhooks/
*
* INSTRUCTIONS:
* 1. Edit the variables below
* 2. Upload this script to your server somewhere it can be publicly accessed