Skip to content

Instantly share code, notes, and snippets.

View danpalmieri's full-sized avatar
🦾
Focusing

DP danpalmieri

🦾
Focusing
View GitHub Profile
@danpalmieri
danpalmieri / hmac_validate.php
Last active September 27, 2023 09:22
PHP: Verificar se a Signature do Webhook da Svelve é válida
<?php
/**
* Verify the signature of a signed request.
*
* @param string $signature The signature parameter from the request.
* @param string $payload The payload to verify.
* @param string $token The signing token.
* @return boolean
*/
@danpalmieri
danpalmieri / HasSlugToken.php
Last active June 6, 2023 15:01
Enhanced Laravel Trait for Auto-populating the 'slug_token' Column
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Model;
trait HasSlugToken
{
/**
* The length of the slug.
@danpalmieri
danpalmieri / thermometer.blade.php
Created April 5, 2021 20:11
A thermometer component for Laravel Blade using TailwindCSS.
@props([
'engagementRate' => 5, // 0 - 10
'size' => 'md', // sm, md, lg
])
<div class="w-full -mt-3">
<div class="flex w-full">
<div class="flex flex-col items-center -ml-5"
style="margin-left: {{ $engagementRate >= 10 ? $engagementRate * 9.6 : $engagementRate * 9 }}%;">
<div class="flex items-center justify-center text-sm font-medium text-gray-600 bg-white border border-gray-200 rounded-full shadow-sm bg-opacity-90
@danpalmieri
danpalmieri / home.blade.php
Last active July 5, 2020 20:17
A Laravel (7.x) Blade component to easy load any Bootstrap SVG icon (v1.0.0-alpha5). See all icons: https://icons.getbootstrap.com
{{-- views/home.blade.php --}}
<x-icon name="alarm" class="w-4 h-4" />
<x-icon name="calendar-plus" class="w-4 text-red-200 h-4" />
@danpalmieri
danpalmieri / CanIgnoreTimestamps.php
Last active July 1, 2020 17:07
A Laravel Trait to Allow temporarily disable timestamps update's.
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Model;
trait CanIgnoreTimestamps
{
protected static $ignoreTimestamps = false;