Skip to content

Instantly share code, notes, and snippets.

View tabuna's full-sized avatar

Alexandr Chernyaev tabuna

View GitHub Profile
@tabuna
tabuna / readme.md
Created July 20, 2020 18:05
It is not necessary to declare all fields every time

It is not necessary to declare all fields every time

Sometimes it bothers me to point out many fields to fill out, especially when the same fields are repeated (and this happens quite often), Collections can come to our aid.

Let's try to consider an example:

namespace App\Orchid\Layouts\Client;
@tabuna
tabuna / sajya-json-rpc.md
Last active May 8, 2020 19:19
Maybe an RPC-like API is better for your project?

JSON-RPC 2.0 this is a simple stateless protocol for creating an RPC (Remote Procedure Call) style API. It usually looks as follows:

You have one single endpoint on the server that accepts requests with a body of the form:

{"jsonrpc": "2.0", "method": "post.like", "params": {"post": "12345"}, "id": 1}

And it returns answers of the view:

@tabuna
tabuna / authInterceptorConfig.config.js
Created June 25, 2019 13:47 — forked from ygotthilf/authInterceptorConfig.config.js
AngularJS 1.x : send JWT and expired refresh token
// module is your angular module
module.config(authInterceptorConfig);
/* @ngInject*/
function authInterceptorConfig($httpProvider) {
$httpProvider.interceptors.push('authInterceptor');
}
module.factory('authInterceptor', authInterceptor);
@tabuna
tabuna / User.php
Created January 14, 2019 19:28
User.php
<?php
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Notifications\Notifiable;
use Orchid\Platform\Models\User as Authenticatable;
use Orchid\Screen\Fields\InputField;
class User extends Authenticatable implements MustVerifyEmail
@tabuna
tabuna / UserEditLayout.php
Created January 14, 2019 19:23
UserEditLayout.php
<?php
declare(strict_types=1);
namespace App\Orchid\Layouts\User;
use Orchid\Screen\Layouts\Rows;
use Orchid\Screen\Fields\InputField;
class UserEditLayout extends Rows
@tabuna
tabuna / SimpleSearchTrait.php
Created October 1, 2018 08:05
SimpleSearchTrait
<?php
declare(strict_types=1);
namespace Orchid\Platform\Traits;
use Illuminate\Database\PostgresConnection;
trait SimpleSearchTrait
{
@tabuna
tabuna / example.php
Created August 7, 2018 12:56
PHP Bing
<?php
declare(ticks=1);
/**
* Class Bind
*/
class Bind
{
/**
@tabuna
tabuna / DiffXLF
Created April 24, 2018 11:22
Сравнение XLF
<?php
/**
* Class DiffXLF
*/
class DiffXLF
{
/**
* @var array
*/
@tabuna
tabuna / pre-commit-hook.sh
Last active May 28, 2018 07:57
php-cs-fixer pre commit hook
#!/usr/bin/env bash
echo "php-cs-fixer pre commit hook start"
PHP_CS_FIXER="vendor/bin/php-cs-fixer"
HAS_PHP_CS_FIXER=false
if [ -x vendor/bin/php-cs-fixer ]; then
HAS_PHP_CS_FIXER=true
fi