Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Sebastiaan Luca sebastiaanluca

👋
View GitHub Profile
@sebastiaanluca
sebastiaanluca / CarbonImmutableCaster.php
Last active Sep 20, 2021
Lazy Laravel Harvest API service
View CarbonImmutableCaster.php
<?php
declare(strict_types=1);
namespace App\DataTransferObjects;
use Carbon\CarbonImmutable;
use Spatie\DataTransferObject\Caster;
class CarbonImmutableCaster implements Caster
View config.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>#AddProperties</key>
<array>
<dict>
<key>Device</key>
<string>NVidia</string>
<key>Disabled</key>
View config.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ACPI</key>
<dict>
<key>DSDT</key>
<dict>
<key>Fixes</key>
<dict>
@sebastiaanluca
sebastiaanluca / Controller.php
Last active May 31, 2021
A HasMany relation sync method implementation using macros
View Controller.php
<?php
$business->locations()->sync([1, 42, 16, 8]);
View Client.php
<?php
declare(strict_types=1);
namespace Passport\Models;
use Closure;
use Laravel\Passport\Client as PassportClient;
use Ramsey\Uuid\Uuid;
View PreventsLazyLoading.php
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
use Illuminate\Database\Eloquent\Relations\Relation;
View .bash_aliases
alias git-last-release='git describe --tags $(git rev-list --tags="[0-9]*.[0-9]*.[0-9]*" --max-count=1)'
confirm() {
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case "$response" in
[yY][eE][sS]|[yY])
true
;;
*)
View Homestead.yaml
provider: virtualbox
memory: 8192
cpus: 4
name: project
hostname: local1.project.com.test
ip: 192.168.116.20
authorize: ~/.ssh/id_rsa.pub
keys:
View activeLink-1.blade.php
View gist:f4b15e9f1a363108e60c748dc7111c3b
{{--myRandomView.blade.php--}}
<active-link :href="route('my-route')" class="tag1 tag2 tag3" target="_blank">Much random</active-link>
{{--activeLink.blade.php option 1--}}
{{--Parent div inherits all unhandled attributes like class, target, … once rendered (so no work for the user)--}}
{{--<div class="tag1 tag2 tag3" target="_blank">--}}
<div>
{{--Variable attributes are to be assigned manually--}}
<a href="{{ $href }}">
{{ $slot }}