Skip to content

Instantly share code, notes, and snippets.

View sidigi's full-sized avatar
💭
Code happens

Evgeny Mikulich sidigi

💭
Code happens
View GitHub Profile
@sidigi
sidigi / index.php
Created December 2, 2022 09:58 — forked from yched/index.php
Coroutines Guzzle
<?php
// composer require guzzlehttp/guzzle
include ('./vendor/autoload.php');
use GuzzleHttp\Client;
use GuzzleHttp\Promise;
use GuzzleHttp\Psr7\Request;
$promises = [
@sidigi
sidigi / RetryTest.php
Created October 18, 2022 15:40 — forked from orottier/RetryTest.php
Retry function for PHP with exponential backoff
<?php
class RetryTest extends TestCase
{
public function setUp()
{
parent::setUp();
// abuse superglobal to keep track of state
$_GET['a'] = 0;
}
@sidigi
sidigi / TestResponse.php
Last active September 15, 2021 10:34
Test Api Resource
<?php
TestResponse::macro('fromResource', function(JsonResource $resource, ?Request $request = null){
$request = $request ?? request();
return new static($resource->toResponse($request));
});
<?php
namespace Tests;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\ParameterBag;
use function PHPUnit\Framework\assertFalse;
@sidigi
sidigi / laravel laravel-echo laravel-echo-server private channel authentication problems Common Problems faced while setting up private channels with laravel-echo & laravel-echo-server.
I'll start with the basics and proceed to addressing the common problems
faced while setting up private channels with laravel-echo & laravel-echo-server.
If you are getting these errors while setup; 401, 403, 419 etc, as I did in my experience.
this gist will help you fix these errors.
Although this gist addresses common problems of laravel-echo-server setup, some problems are similar with Pusher setup.
So it might also be useful if you're having problems with setting up Pusher with Echo.
I'll try to cover eveything and try to use appropriate highlighting to single out each common problem.
@sidigi
sidigi / module.js
Created October 26, 2019 19:37
parser
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://fssprus.ru/iss/ip*
// @grant GM_getResourceText
// @resource importFile http://www.sharecsv.com/dl/bc759d3e19f680660a1bdfb721cf13ad/data.csv
// ==/UserScript==
@sidigi
sidigi / axios.js
Created July 10, 2019 14:20
Nuxt Refresh token request
export default function ({$axios, app}) {
$axios.onResponseError(error => {
const code = parseInt(error.response && error.response.status);
let originalRequest = error.config;
if ([401, 403].includes(code)) {
originalRequest.__isRetryRequest = true;
let refresh_token = app.$auth.getRefreshToken(app.$auth.$storage.state.strategy).replace('Bearer ', '');
@sidigi
sidigi / Envoy.blade.php
Created May 21, 2019 17:39
Envoy from spatie
@setup
$server = "";
$userAndServer = 'forge@'. $server;
$repository = "spatie/{$server}";
$baseDir = "/home/forge/{$server}";
$releasesDir = "{$baseDir}/releases";
$currentDir = "{$baseDir}/current";
$newReleaseName = date('Ymd-His');
$newReleaseDir = "{$releasesDir}/{$newReleaseName}";
$user = get_current_user();
@sidigi
sidigi / flexbox-util.css
Created April 18, 2019 16:20
flexbox css helpers
/*
flexbox utility class used globally
*/
.flexbox {
display: flex;
}
.flexdir-row {
flex-direction: row;
@sidigi
sidigi / deployment_guide.md
Created March 26, 2019 16:01 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel

Setting Up Laravel in Ubuntu / DigitalOcean

Getting Started

  • Create droplet with Ubuntu 18.10
  • ssh root@[DROPLET IP ADDRESS]
  • Get password from your email
  • Change password on first login
  • adduser laravel
  • Enter password and other information