Skip to content

Instantly share code, notes, and snippets.

View shov's full-sized avatar
🐊
^^

Alexander Shevchenko shov

🐊
^^
View GitHub Profile
@shov
shov / default.conf
Created March 18, 2020 08:41
Nginx to Nodejs proxy with SSL
server {
listen 80;
server_name example.com;
# Redirect all traffic to SSL
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
@shov
shov / array-to-texttable.php
Created April 26, 2017 12:49 — forked from tony-landis/array-to-texttable.php
PHP: Array to Text Table Generation Class
<?php
/**
* Array to Text Table Generation Class
*
* @author Tony Landis <tony@tonylandis.com>
* @link http://www.tonylandis.com/
* @copyright Copyright (C) 2006-2009 Tony Landis
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class ArrayToTextTable
@shov
shov / links.txt
Created January 22, 2019 12:57
XDebug on laradock
@shov
shov / reborn_brew.sh
Created April 1, 2019 12:16
Reborn brew packages after migration
#!/bin/bash
brew list -1 > brew.txt \ # list out all installed packages
&& brew list -1 | xargs brew rm --force \ # remove all installed packages
&& brew install $(cat brew.txt | tr '\n' ' ') \ # install all previously installed packages
&& rm brew.txt
@shov
shov / autoload.php
Last active February 13, 2019 06:28 — forked from holisticnetworking/autoload.php
Autoloading for both WordPress classes and PSR-4
<?php
/**
* Autoload PSR-4 and Wordpress compatible named classes,
* Require it in very begin of your functions.php or plugin
*
* @author Alexandr Shevchenko <ls.shov@gmail.com>
* @author Thomas J Belknap <tbelknap@holisticnetworking.net>
*/
namespace App; //Change it
/** @var string : autoload root $rootDir */
@shov
shov / gitroutine.md
Last active November 6, 2018 09:54
git routine

New empty repository started on github

  1. Go github, create new repo
  2. Copy ssh/https link
  3. Go to your project folder 4.git clone <paste link here> and all project will be downloaded to new folder with same name as project is
  4. Or you can set name of this folder git clone <paste link here> newfolder

New repository from existing project

@shov
shov / TestHelperTrait.php
Created February 26, 2018 08:54
Laravel test migration and seeding helper
<?php declare(strict_types=1);
namespace Tests\Feature;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Contracts\Console\Kernel;
/**
* Some functionality for TestCases
*
@shov
shov / DecoratorWithStatic.php
Last active February 16, 2018 11:00
PHP Decorator trait. For a while not correct (catch any throwable and means it's error of calling undefined static method
/**
* Trait DecoratorTrait
*
* Have to implemented:
* @method getDecoratedObject()
* @static $decoratedClass
*/
trait DecoratorTrait
{
/**
@shov
shov / .env
Created January 29, 2018 14:56
Unit test Laravel 5 packages in context with Travis CI (with MySQL testing database)
APP_ENV=testing
APP_DEBUG=true
APP_KEY=RMme3vqJUaNAxVi5kq33xBgRAxmp7yXU
DB_HOST=localhost
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=array
@shov
shov / Decorator.php
Last active December 7, 2017 09:19
PHP Implementation of the decorator as the Trait
<?php
/**
* Trait Decorator
*
* Required on host
* @method getDecoratedObject()
*/
trait Decorator
{