This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Customize BASH PS1 prompt to show current GIT repository and branch. | |
# by Mike Stewart - http://MediaDoneRight.com | |
# SETUP CONSTANTS | |
# Bunch-o-predefined colors. Makes reading code easier than escape sequences. | |
# I don't remember where I found this. o_O | |
# Reset | |
Color_Off="\[\033[0m\]" # Text Reset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Illuminate\Database\Eloquent\Collection::macro('loadIt', function ($relation) { | |
return $this->load($relation)->reduce(function($relations, $model) use ($relation) { | |
return $relations->merge($model->{$relation}); | |
}, new Illuminate\Database\Eloquent\Collection()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('array2xml')) { | |
/** | |
* Конвертирует массив в xml | |
* | |
* @param $array | |
* @param null|string|SimpleXMLElement $root | |
* @param string $version | |
* @param string $encoding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services\Foundation; | |
use Illuminate\Session\Store; | |
use Illuminate\Support\Collection; | |
/** | |
* Register it in AppServiceProvider (or other): $this->app->singleton('flash', FlashMessageSender::class); | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Support\Http; | |
use Exception; | |
class ConfirmationException extends Exception | |
{ | |
/** | |
* The recommended response to send to the client. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services\Foundation\Log; | |
use Illuminate\Contracts\Auth\Authenticatable; | |
use Illuminate\Contracts\Foundation\Application; | |
use Illuminate\Contracts\Support\Arrayable; | |
use Illuminate\Contracts\Support\Jsonable; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Support; | |
class HigherOrderOptionalProxy | |
{ | |
/** | |
* The target being transformed. | |
* Use _ prefix to avoid namespace conflict on __get() | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('array_sort_by_keys_array')) { | |
/** | |
* Сортировка ассоциативного массива в порядке указанном массивом ключей. | |
* | |
* @param array $array Входной массив. | |
* @param array $sorter Массив ключей в нужном порядке. | |
* | |
* @return bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services\Foundation; | |
use Illuminate\Contracts\Container\Container; | |
use Illuminate\Contracts\Support\Jsonable; | |
use InvalidArgumentException; | |
use JsonSerializable; | |
class JsonFactory |