This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function imageToAscii($path, $maxWidth = 100, $maxHeight = 100) | |
{ | |
$contrast = 5; | |
$characters = str_split( | |
str_repeat(' ', $contrast * 10) | |
. '`.-\':_,^=;><+!rc*/z?sLTv)J7(|Fi{C}fI31tlu[neoZ5Yxjya]2ESwqkP6h9d4VpOGbUAKXHm8RD#$Bg0MNWQ%&@' | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Livewire\Attributes; | |
use Attribute; | |
use Livewire\Features\SupportAttributes\Attribute as LivewireAttribute; | |
use function Livewire\store; | |
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Mixins; | |
use Spatie\Async\Pool; | |
class Console | |
{ | |
public function withSpinner() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spotlitt.faces.forEach(face => { | |
const el = document.getElementById(face.el_id) | |
// Make sure we're between 0 and 100 | |
const inRange = (val) => { | |
return Math.min(Math.max(val, 0), 100) | |
} | |
const getXPos = (width, height) => { | |
const imageWidth = (face.width * height) / width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spotlitt.faces = [ | |
{ | |
"el_id": "headshot-bg-3a0GpZdL8q", | |
"width": 2000, | |
"height": 1333, | |
"x": 62, | |
"y": 39, | |
}, | |
{ | |
"el_id": "headshot-bg-6OadVLGM92", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$faces = collect($result->get('FaceDetails') ?: [])->filter(function ($face) { | |
// We want to be fairly confident that we found a face | |
return $face['Confidence'] > 95; | |
}); | |
$box = $faces->first()['BoundingBox']; | |
// Where the center of the face sits in relation to the entire image | |
$center_percentage = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Aws\Rekognition\RekognitionClient; | |
$rekognition = new RekognitionClient([ | |
'version' => 'latest', | |
'region' => 'AWS_REGION', | |
]); | |
$params = [ | |
'Attributes' => ['DEFAULT'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"FaceDetails": [ | |
{ | |
"AgeRange": { | |
"High": 47, | |
"Low": 30 | |
}, | |
"Beard": { | |
"Confidence": 99.16362762451172, | |
"Value": false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Hashids from 'hashids' | |
class HashIds { | |
evaluate() { | |
const hasher = new Hashids(this.salt, this.padding) | |
return hasher.encode(this.id) | |
} | |
} | |
HashIds.identifier = 'shop.sammich.HashIds' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Hashids\Hashids; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
public function register() | |
{ |
NewerOlder