Skip to content

Instantly share code, notes, and snippets.

View kdes70's full-sized avatar
🏠
Working from home

Dmitriy Krivoshein kdes70

🏠
Working from home
View GitHub Profile
@designervoid
designervoid / Dockerfile
Last active October 7, 2022 10:47
Web app with HTTPS, based on proxy Traefik and Nuxt.js
# my_frontend/Dockerfile
### STAGE 1: Build ###
FROM node:latest as build
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY package.json /usr/src/app/package.json
RUN npm install --silent
COPY . /usr/src/app
@siamkreative
siamkreative / fedora-31-install-webstorm.md
Created February 14, 2020 04:21
Installing WebStorm on Fedora 31
@jlmaners
jlmaners / MockSocialite.php
Last active January 1, 2024 21:15
Mocking Socialite
<?php
$mockSocialite = \Mockery::mock('Laravel\Socialite\Contracts\Factory');
$this->app['Laravel\Socialite\Contracts\Factory'] = $mockSocialite;
$abstractUser = Mockery::mock('Laravel\Socialite\Two\User');
$abstractUser
->shouldReceive('getId')
->andReturn(rand())
->shouldReceive('getName')
@azhe403
azhe403 / Sublime Text Licence Key Build 3156
Created March 24, 2018 04:31 — forked from whour/Sublime Text Licence Key Build 3156
Sublime Text Dev Build 3156 Serial Key
----- BEGIN LICENSE -----
eldon
Single User License
EA7E-1122628
C0360740 20724B8A 30420C09 6D7E046F
3F5D5FBB 17EF95DA 2BA7BB27 CCB14947
27A316BE 8BCF4BC0 252FB8FF FD97DF71
B11A1DA9 F7119CA0 31984BB9 7D71700C
2C728BF8 B952E5F5 B941FF64 6D7979DA
B8EB32F8 8D415F8E F16FE657 A35381CC
@carousel
carousel / snake-to-camel.php
Last active May 8, 2024 15:42
Convert snake to camel case and back with PHP
<?php
function camel_to_snake($input)
{
return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
}
function snakeToCamel($input)
{
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $input))));
}

GitHub Gist - настройка и установка в JetBrains PhpStorm

  1. Установка плагина Get Gist Beta в PhpStorm
  1. В настройках плагина вводим пароль или генерируем токен на GitHub

P.S. К сожалению в Windows плагин работает не корректно c кодировкой Win-1251. Проблема до сих пор актуальна.

@zmts
zmts / tokens.md
Last active May 24, 2024 18:51
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@iben12
iben12 / 1_Laravel_state-machine.md
Last active August 12, 2023 08:36
Laravel: State-machine on Eloquent Model

Implementing State Machine On Eloquent Model*

* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.

Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.

Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.

That's the theory, let's get to the work.

@reg2005
reg2005 / YandexMap.vue
Created January 15, 2017 08:28
YandexMap wrapper for VueJS 2
<template>
<div class="col-xs-12" style="padding:0;">
<div class="panel panel-default" style="margin:0;">
<div class="panel-body" style="padding:0;">
<div v-if="maps.length" :style="{height: height + 'px'}" id="map"></div>
<h3 v-else class="text-center">Нет точек</h3>
</div>
</div>
</div>
</template>
@icqparty
icqparty / README.md
Last active October 31, 2017 14:11 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Отладка PHP-приложение c Xdebug в Docker-контейнере через редактор Intellij/PHPStorm

  1. Создайте в локальной дирриктори вашего проекта файл сборки Dockerfile со следующим содержанием:
FROM php:5

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&amp;&amp; echo "xdebug.remote_enable=on" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \