Skip to content

Instantly share code, notes, and snippets.

@thepsion5
thepsion5 / RendersTemplates.php
Created February 1, 2022 17:50
Example of Using Composition via Traits to Remove Duplicate Controller Logic
<?php
declare(strict_types=1);
namespace Personly\Http\Traits;
use Personly\Framework\Rendering\TemplateRenderer;
use Symfony\Component\HttpFoundation\{JsonResponse, Response};
trait RendersTemplates
@thepsion5
thepsion5 / SlowQueryLogDecorator.php
Created December 21, 2022 20:06
Using Aura\SQL to Log Slow Queries via a simple Decorator Class
<?php
declare(strict_types=1);
namespace YourApp\Infrastructure\Logging;
use Psr\Log\{LoggerInterface, LoggerTrait};
class SlowQueryLogDecorator implements LoggerInterface
{
use LoggerTrait;
@thepsion5
thepsion5 / fallout_mod_table.js
Created August 29, 2024 22:01
Converts the data on Fallout 76 legendary rewards
// Data Source: https://nukaknights.com/articles/legendary-mods-all-descriptions-and-usages.html
const modWrapperSelector = '.mod_fallout76rewards_legendarymods';
const modData = [];
const containers = $(modWrapperSelector);
getRankFromRow = function(row) {
let parent = $(row).parents(modWrapperSelector)[0];
for (let index = 0; index < containers.length; index++) {
if (containers[index] == parent) {
return index+1;