Skip to content

Instantly share code, notes, and snippets.

View luchaos's full-sized avatar

luchaos luchaos

View GitHub Profile

Keybase proof

I hereby claim:

  • I am luchaos on github.
  • I am luchaos (https://keybase.io/luchaos) on keybase.
  • I have a public key whose fingerprint is 0C50 5B34 7556 29A9 0FC3 BB2C ECDA 55D3 2195 BD55

To claim this, I am signing this object:

@luchaos
luchaos / migration.sql
Last active January 6, 2017 22:04
Laravel Spatie Activity Log for PostGRES
-- use case: find activities of a resource and/or within its related resources
-- causes sequential scans and is a tad slower because of the explicit json casting:
SELECT *
FROM activity_log
WHERE (log_name = 'resources' AND subject_id = 351030)
OR (log_name = 'related_resources' AND (properties :: JSON -> 'attributes' ->> 'resource_id') :: INT = 351030)
ORDER BY created_at DESC;
@luchaos
luchaos / StderrColorFormatter.php
Last active October 6, 2021 18:02
Monolog StderrColorFormatter using Collision\ConsoleColor
<?php
namespace Luchaos\MonologFormatter;
use Monolog\Formatter\LineFormatter;
use NunoMaduro\Collision\ConsoleColor;
use Psr\Log\LogLevel;
class StderrColorFormatter extends LineFormatter
{