This file contains hidden or 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 | |
//-------------------------------------- | |
/** | |
* @param string $query | |
* | |
* @return string | |
*/ | |
public function prepareQuery(string $query):string | |
{ | |
$query = array_filter(explode(' ', mb_strtolower($query)), 'trim'); |
This file contains hidden or 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 common\tests; | |
use Codeception\Util\Debug; | |
use yii\console\Application; | |
use yii\db\ActiveQuery; | |
use yii\db\Connection; | |
use yii\helpers\ArrayHelper; | |
use yii\helpers\Console; | |
use yii\helpers\VarDumper; |
This file contains hidden or 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
import sys | |
from gi.repository import Gtk, Gdk, WebKit | |
class BrowserTab(Gtk.VBox): | |
def __init__(self, *args, **kwargs): | |
super(BrowserTab, self).__init__(*args, **kwargs) | |
go_button = Gtk.Button("go to...") | |
go_button.connect("clicked", self._load_url) | |
self.url_bar = Gtk.Entry() |
This file contains hidden or 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 console\components\queue; | |
use yii\base\Object; | |
use zhuravljov\yii\queue\Job; | |
/** | |
* Class ComplexJob | |
* | |
* @package console\components |
This file contains hidden or 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
'view'=>[ | |
'class'=>\yii\web\View::class, | |
'defaultExtension' => 'twig', | |
'renderers' => [ | |
'twig'=>[ | |
'class'=>\yii\twig\ViewRenderer::class, | |
'cachePath' => '@app/runtime/Twig/cache', | |
'options' => [ | |
'auto_reload' => true, | |
], |
This file contains hidden or 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 | |
/**BaseRequest class for grid request **/ | |
class BaseFilterRequest extends FormRequest | |
{ | |
const SORT_ASC = 'asc'; | |
const SORT_DESC = 'desc'; | |
public static $sortable | |
= [ | |
'id', |
This file contains hidden or 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
mind=d=>{S=storage,T=d.infection,U=d.john.position,V=d.nexa.position,S.f=S.f||0,S.n=S.n||0,l='left',r='right',u='up',w='down';A=v=>Math.abs(v);B=v=>v.length;C=v=>(U.x==v.x&&D(v))||(U.y==v.y&&E(v));D=v=>A(U.y-v.y)==1;E=v=>A(U.x-v.x)==1;F=(x,y)=>U.x!=x?(U.x>x?l:r):(U.y>y?u:w);G=(x,y)=>U.y!=y?(U.y>y?u:w):(U.x>x?l:r);H=()=>T.some(v=>U.x==v.x&&U.y==v.y);I=(x,y)=>(!J()&&!S.f)?G(x,y):F(x,y);J=()=>{if(U.x==V.x&&U.y==V.y){S.n+=1;}return(S.n>0);};K=()=>U.x==V.x;L=v=>v.reduce((r,t)=>(!B(r)?(r=T.filter(t), r):r),[]);M=v=>B(v)?v[0]:[];N=()=>T.reduce((m,t)=>{d=O(V,t);if(m.d<d){m.d=d;m.c=t;}return m;},{'d':0,'c':S.t});O=(v,t)=>A(v.x-t.x)+A(v.y-t.y);P=()=>{S.t=(!S.f?T[0]:(S.f&&!J()?V:(S.t&&V.y!=1?N().c:(Z=L([C,(v)=>(U.y==v.y),D]),B(Z)?M(Z):N().c))));return I(S.t.x,S.t.y)};Q=()=>H()&&!(!J()&&K())?(S.t=null,S.f=1,1):0;return Q()?'cure':P()} |
This file contains hidden or 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
let mind=(D)=>{ | |
let my = D.john.position,nx = D.nexa.position,inf=D.infection; | |
storage.firstGoal = storage.firstGoal||0; | |
storage.nexa_catch=storage.nexa_catch||0; | |
let A = v => Math.abs(v); | |
let B = v => v.length; | |
let nearOneStep = (it) =>((my.x === it.x && nearNextRowY(it)) || (my.y === it.y && nearNextRowX(it))); | |
let nearNextRowY = (it) => (A(my.y-it.y)===1); | |
let nearNextRowX = (it) => (A(my.x-it.x)===1); | |
let directionByX = (x, y)=> (my.x !== x)? (my.x > x ? 'left' : 'right') :(my.y > y ? 'up' : 'down'); |
This file contains hidden or 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
@servers([ 'remote' => 'server.example.com', ]) | |
@setup | |
if ( ! isset($repo) ) | |
{ | |
throw new Exception('--repo must be specified'); | |
} | |
if ( ! isset($base_dir) ) | |
{ |
This file contains hidden or 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\Jobs; | |
class DummyJob implements ShouldQueue | |
{ | |
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | |
private $params; | |
public function __construct(array $params = []) | |
{ | |
$this->params = $params; |