Skip to content

Instantly share code, notes, and snippets.

View pastuhov's full-sized avatar
💭
I may be slow to respond.

Pastuhov Kirill pastuhov

💭
I may be slow to respond.
View GitHub Profile
@m8rge
m8rge / WithoutTrait.php
Last active June 8, 2017 04:40
Without yii2 activerecord trait
<?php
namespace common\ActiveRecordTrait;
use yii\db\ActiveQuery;
use yii\db\ActiveRecord;
trait WithoutTrait
{
@pastuhov
pastuhov / MasterTrait.php
Last active August 14, 2023 09:16
Use Master yii2 activerecord trait
<?php
namespace common\models;
trait MasterTrait
{
public static function getDb()
{
$connection = clone \Yii::$app->getDb();
$connection->enableSlaves = false;
return $connection;
@gerlacdt
gerlacdt / gracefulShutdown.js
Created October 25, 2016 07:33
Graceful shutdown of a nodejs server
'use strict';
/*
* Usage:
*
* const gracefulShutdown = require('./app/utils/gracefulShutdown');
*
* const server = app.listen(port, callback)
*
* gracefulShutdown.init(server, logger);