Skip to content

Instantly share code, notes, and snippets.

View jippi's full-sized avatar

Christian Winther jippi

View GitHub Profile
$this->_controller->Blogs = $this->getMockForModel(
'Blogs',
['save'],
['className' => 'Crud\Test\App\Model\Table\BlogsTable', 'table' => 'blogs']
);
PHP Fatal error: Call to a member function schemaCollection() on a non-object in /var/www/crud3/htdocs/vendor/cakephp/cakephp/src/ORM/Table.php on line 336
{
"size":60,
"sort":[
{
"is_sponsored":"desc"
},
"_score",
{
"is_experience":"desc"
},
-> curl -X GET local.bownty.net:9200/bownty_da/deal/_search?pretty -d '{
"fields" : ["name.raw"],
"query" : {
"match" : { "name": "*forbedret*" }
}
}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
'name' => [
'type' => 'string',
'index' => 'analyzed',
'store' => true,
'fields' => [
'raw' => ['type' => 'string', 'index' => 'not_analyzed'],
'stemmed' => ['type' => 'string', 'analyzer' => 'stemmed'],
]
],
curl -X GET local.bownty.net:9200/bownty_da/deal/_search?pretty -d '{
"query" : {
"wildcard" : { "name.raw": "*forbedret*" }
},
"script_fields": {
"terms" : {
"script": "doc[field].values",
"params": {
"field": "name.stemmed"
}
<?php
namespace App\Controller;
use Cake\Event\Event;
class PostsController extends AppController {
public $paginate = ['limit' => 5];
<?php
namespace App\Controller;
class AppController extends \Cake\Controller\Controller {
use \Crud\Controller\ControllerTrait;
public $viewClass = 'CrudView\View\CrudView';
public $components = [
{
"_index": "logstash-production-2014.05.19",
"_type": "nginx",
"_id": "BxOr_N4lRs-tFAK9sewmag",
"_score": null,
"_source": {
"@timestamp": "2014-05-19T07:33:52.000Z",
"@version": "1",
"type": "nginx",
"source": "da.bownty.com",
<?php
/**
* Class to help work with NewRelic in PHP
*
* @author Christian Winther
* @see https://docs.newrelic.com/docs/php/the-php-api
*/
class NewRelic {
<?php
/**
* Global Locking using Redis
*
*/
class RedisLock {
/**
* How long should the lock be kept active, even if the process dies
*