Skip to content

Instantly share code, notes, and snippets.

View BrekiTomasson's full-sized avatar
💭
Refactor, refactor, refactor, refactor.

Breki Tomasson BrekiTomasson

💭
Refactor, refactor, refactor, refactor.
View GitHub Profile
@BrekiTomasson
BrekiTomasson / download.sh
Created October 25, 2022 11:21
put.io Download Script.
#!/bin/bash
TARGET=/mnt/user/Media/handbrake/watch/
PUTIO=/mnt/user/Media/PutioTemp/
USERNAME=###REDACTED###
PASSWORD=###REDACTED###
HOST=ftp.put.io
# Exit immediately if Lockfile exists.
@BrekiTomasson
BrekiTomasson / HasCacheTagsById
Last active October 25, 2022 11:33
Laravel Trait to use in your Model classes to offer a $this->taggedCache() shortcut to your Cache
<?php
declare(strict_types = 1);
namespace App\Concerns\Traits\Models;
use Illuminate\Cache\TaggedCache;
use Illuminate\Support\Facades\Cache;
/**
@BrekiTomasson
BrekiTomasson / IsComparable.php
Last active August 22, 2022 16:27
A simple PHP trait that allows you to compare instances of one class to instances of any other class by implementing the getComparisonValue() method.
trait IsComparable
{
abstract public function getComparisonValue() : int|float|string;
/**
* @return int<-1, 1>
*/
public function compareTo($other) : int
{
if (! in_array(self::class, class_uses($other), true)) {

Keybase proof

I hereby claim:

  • I am BrekiTomasson on github.
  • I am breki (https://keybase.io/breki) on keybase.
  • I have a public key whose fingerprint is 9D21 DC2D 157F 95D4 FAB6 A6E9 11A2 7841 3784 D247

To claim this, I am signing this object: