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\Routing\Filter; | |
use Cake\Event\Event; | |
use Cake\Routing\DispatcherFilter; | |
class JsonInputFilter extends DispatcherFilter | |
{ | |
public function beforeDispatch(Event $e) |
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\Controller\Component; | |
use Cake\Controller\Component\PaginatorComponent; | |
use Cake\Datasource\RepositoryInterface; | |
use Cake\Network\Exception\NotFoundException; | |
use Cake\ElasticSearch\Query; | |
class ElasticPaginatorComponent extends PaginatorComponent |
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
var div = document.createElement('div'); | |
var container = document.getElementById('container'); | |
div.className = "chat"; | |
container.insertBefore(div, div.firstChild); | |
var win = Elm.embed(Elm.ChatWindow, div, { | |
url: url, | |
userId: client.id, | |
userName: client.name, | |
operatorName: 'Tester' |
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
port autoScroll : Signal () | |
port autoScroll = Signal.map (always ()) scrollMailbox.signal | |
scrollMailbox : Signal.Mailbox Action | |
scrollMailbox = Signal.mailbox FromEffect | |
{- configuration for the start app -} | |
config : StartApp.Config Model Action | |
config = | |
{ init = (initialModel, initialEffect) |
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 | |
->finder('comment', [ | |
'finder' => 'byComment' | |
]) | |
... | |
public function findByComment($query, $options) { | |
return $query->matching('SomethingHere.Comments', function ($q) use ($options) { |
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\Form; | |
use JsonSerializable; | |
class ErrorBag implements JsonSerializable | |
{ | |
protected $_errors; |
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 | |
Router::addUrlFilter(function ($params, $request) { | |
if (empty($params['controller'])) { | |
return $params; | |
} | |
if ($params['controller'] === 'Languages' && $params['action'] === 'view') { | |
$params['controller'] = 'Locations'; | |
$params['action'] = 'index'; |
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 | |
function unsafeIN($field, $values) | |
{ | |
return function ($expression) use ($field,$values) { | |
if (empty($values)) { | |
return $expression->add(['1 != 1']); | |
} | |
return $expression->in($field, $values); | |
}; | |
} |
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 | |
$values = [ | |
['title' => 'foo', 'body' => 'bar'], | |
['title' => 'foo 2', 'body' => 'bar 2'], | |
]; | |
$query = $table->query(); | |
$query | |
->insert(['title', 'body']) | |
->clause('values') | |
->values($values); |
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 | |
function isContained($normalized, $ImLookingForYou) { | |
foreach ($normalized as $alias => $meta) { | |
$exists = $alias === $ImLookingForYou; | |
return $exists || $this->isContained($meta->associations(), $ImLookingForYou); | |
} | |
return false; | |
}; |