Skip to content

Instantly share code, notes, and snippets.

Avatar
🤗

Alexander Karlstad carestad

🤗
View GitHub Profile
@carestad
carestad / FooRequest.php
Last active Dec 8, 2020
[Laravel] Return validation errors as proper object/arrays
View FooRequest.php
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class FooRequest extends FormRequest
{
public function authorize()
{
@carestad
carestad / Timestamp.php
Last active May 26, 2021
Doctrine DBAL Timestamp type for use with Laravel
View Timestamp.php
<?php
namespace Database\Migrations\Types;
use DateTime;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\PhpDateTimeMappingType;
use Doctrine\DBAL\Types\Type;
@carestad
carestad / TimedTrait.php
Created Aug 18, 2021
Laravel console command timed trait. This will always output how long the execution of a Laravel command takes.
View TimedTrait.php
<?php
namespace App\Console\Commands\Traits;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
trait TimedTrait
{
/**
@carestad
carestad / LogTrait.php
Created Aug 18, 2021
Laravel console command log trait. This adds a few logXX() methods which will append a timestamp in front of the logged text + take verbosity level into account so -vvv can log more than -v
View LogTrait.php
<?php
namespace App\Console\Commands\Traits;
trait LogTrait
{
public function logDebug(string $text, ?string $dateFormat = 'Y-m-d H:i:s'): void
{
/** @var \Illuminate\Console\Command $this */
if (! $this->output->isDebug()) {
@carestad
carestad / display-link-manual-build-guide.md
Last active Dec 16, 2021
Build DisplayLink docking driver for newer kernel verions
View display-link-manual-build-guide.md
@carestad
carestad / vuejs.amsterdam.2019.slides.md
Last active Mar 3, 2022
Collection of slides from #vuejsamsterdam 2019
View vuejs.amsterdam.2019.slides.md

Day 1

Time Speaker(s) Title
08:45 Evan You State of the Vuenion (Founder of Vue.js)
09:00 Sarah Drasner
Guillaume Chau
Advanced Animations with Vue.JS (Vue.js Core Team)
SSR revolution with Vue 2.6
09:35 Tim Benniks Vue.js for L'oreal, a case study (Director of Frontend @Valtech Paris)
10:45 Jen Looper NativeScript-Vue + ML = The Great MiniBar Challenge: MixoLogy (Developer Advocate at Progress)
11:15 Filip Rakowski Modern Web Apps Performance Tricks with PWA and Vue.js (Founder Vue Storefront)
11:50 Sara Vieira [GraphQL + Apollo + Vue.js =
@carestad
carestad / github-app-jwt.sh
Last active Mar 25, 2022
Script to generate JWT for use with Github apps
View github-app-jwt.sh
#!/usr/bin/env bash
# Generate JWT for Github App
#
# Inspired by implementation by Will Haley at:
# http://willhaley.com/blog/generate-jwt-with-bash/
# From:
# https://stackoverflow.com/questions/46657001/how-do-you-create-an-rs256-jwt-assertion-with-bash-shell-scripting
thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"