Skip to content

Instantly share code, notes, and snippets.

View shov's full-sized avatar
🐊
^^

Alexander Shevchenko shov

🐊
^^
View GitHub Profile
@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 / AllowCrossOrigin.php
Last active February 8, 2024 18:29
Laravel middleware to Allow Cross Origin CORS
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\Response;
/**
* The after middleware to allow specific Access-Control-Allow-Origin
*/
@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 / fetchtransactionsbywallet.md
Last active September 6, 2023 04:11
Etherscan public API to fetch transactions by wallet

Etherscan public API

Overview

There is no documentation at the moment, but there are some rumors. And experemental way I've made sure about few end-points are working good:

Common account info

GET: https://www.etherchain.org/api/account/0xAAAsomeADDR00000000000/ Will return something like that:

{
@shov
shov / Dockerfile-part
Created May 12, 2018 12:23
Laradock dockerfile parts for php-fpm and workspace to install zeroMQ zmq
##PHP-FPM
RUN apt-get update -yqq && \
apt-get install -y build-essential libtool autoconf pkg-config libsodium-dev libzmq-dev && \
echo '' | pecl install -o -f zmq-beta && rm -rf /tmp/pear && \
echo "extension=zmq.so" > /usr/local/etc/php/conf.d/zmq.ini \
##WORCKSPACE
RUN apt-get update -yqq && \
apt-get install -y build-essential libtool autoconf pkg-config libsodium-dev libzmq-dev && \
echo '' | pecl install -o -f zmq-beta && rm -rf /tmp/pear && \
@shov
shov / Dockerfile
Created May 21, 2018 09:36
Docker PHP 7.2 fpm with GD jpg, png suppot
FROM php:7.2-fpm
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# make sure apt is up to date
RUN apt-get update --fix-missing
RUN apt-get install -y curl
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev
@shov
shov / Dockerfile
Created May 21, 2018 14:46
Docker file for PHP 7.2 fpm with mcrypt support
FROM php:7.2-fpm
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# make sure apt is up to date
RUN apt-get update --fix-missing
RUN apt-get install -y curl
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev
@shov
shov / git_log.sh
Created October 11, 2018 09:25
Beautiffied git log
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
@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