Skip to content

Instantly share code, notes, and snippets.

<?php
return [
'default' => env('LOG_CHANNEL', 'stack'),
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
http {
log_format main escape=json '{'
'"timestamp":"$time_local",'
'"remote_addr":"$remote_addr",'
'"request":"$request",'
'"request_method":"$request_method",'
'"request_uri":"$request_uri",'
'"status_code":"$status",'
'"http_user_agent":"$http_user_agent",'
'"http_x_forwarded_for":"$http_x_forwarded_for",'
<?xml version="1.0"?>
<ruleset name="teranex PMD ruleset" xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation=" http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>PMD ruleset</description>
<!-- ************************************************************************** -->
<!-- ============================= Clean Code Rules ========================== -->
<!-- =================== https://phpmd.org/rules/cleancode.html =============== -->
@josemiguelq
josemiguelq / flat and inset
Created July 20, 2018 16:49
mongo flat and insert
var file = cat('path/to/yourFile.txt');
var lastQuery = new Date();
var docs = db.getCollection("sales").aggregate([
{$match : {createdAt : {$gte : lastQuery}} }
{$unwind : '$createdAt'},
{$unwind : '$updatedAt'},
{$unwind : '$services'},
@josemiguelq
josemiguelq / flat.txt
Last active July 19, 2018 19:47
Flat mongo query
var docs = db.getCollection("sales").aggregate([
{$match : {createdAt : {$gte : lastQuery}} }
{$unwind : '$createdAt'},
{$unwind : '$updatedAt'},
{$unwind : '$services'},
{$group : {
_id : {'service' : '$services', 'user' : '$user', 'pointOfSale' : '$pointOfSale', 'createdAt' : '$createdAt', 'updatedAt' : '$updatedAt'}}
},
{$project : {
service : "$_id.service",
@josemiguelq
josemiguelq / mongo_query_group_by_day_and_count.js
Last active May 9, 2018 21:04
mongo query group by day and count
db.sales.aggregate([
{
$group : {
_id : {//Agruppated mandatory field (doesnt mean the ObjectId of document)
'year' : { '$year': "$createdAt"},
'month' : { '$month': "$createdAt"},
'day' : { '$dayOfMonth': "$createdAt"}
},
@josemiguelq
josemiguelq / queries join
Created May 9, 2018 14:15
Query join mongodb
db.sales.aggregate([
{
$lookup : {
from: "services",
localField: "_id",
foreignField: "saleId",
as:"servicesOfSale"
}
},
{
@josemiguelq
josemiguelq / PreviewOfUpcomingPackage.php
Created May 7, 2018 12:13 — forked from calebporzio/PreviewOfUpcomingPackage.php
A model trait that allows child models to use parent table names and relationship keys.
<?php
namespace App\Abilities;
use Illuminate\Support\Str;
use ReflectionClass;
/**
* Note: This is a preview of an upcoming package from Tighten.
**/