Skip to content

Instantly share code, notes, and snippets.

View renepardon's full-sized avatar

Christoph, René Pardon renepardon

View GitHub Profile
<?php
namespace App\GraphQL\Queries;
use App\GraphQL\SchemaPrinter;
use GraphQL\Type\Definition\ResolveInfo;
use Nuwave\Lighthouse\GraphQL;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;
/**
<?php
namespace App\Graphql\Directives;
use Nuwave\Lighthouse\Schema\Directives\BaseDirective;
use Nuwave\Lighthouse\Support\Contracts\DefinedDirective;
/**
* Class KeyDirective
*
<?php
namespace App\Graphql\Directives;
use Nuwave\Lighthouse\Schema\Directives\FieldDirective;
class KeyDirective extends FieldDirective
{
public function name(): string
{
<?php
class SchemaPrinter {
/**
* @param Schema $schema
* @param array $options
*
* @return string
*/
public static function printFederatedSchema(Schema $schema, array $options = []): string
{
@renepardon
renepardon / docker-compose.yml
Created December 20, 2018 09:15
Create CI/CD setup with Jenkins and worker nodes
version: '3.2'
services:
jenkins:
build: ./jenkins
container_name: jenkins
ports:
- "50000:50000"
expose:
- 8080
restart: always
<?php
protected function attemptLogin(Request $request)
{
$guards = array_keys(config('auth.guards'));
$attempts = [];
foreach ($guards as $guard) {
$guardInstance = Auth::guard($guard);
@renepardon
renepardon / php-implicit-type-cast.php
Created November 21, 2018 09:07
Annoying bool to string cast
function foo(?string $val)
{
echo (string) $val;
}
foo('test')
foo(true)
foo(false)
foo(null)
@renepardon
renepardon / in_array.php
Created November 21, 2018 08:32
PHP in_array() strange results for different types
<?php
// PHP 7.2.10
$value = "test";
var_dump(
$value,
in_array($value, [1]),
in_array($value, [true]),
in_array($value, ['true']),
@renepardon
renepardon / docker-compose.yml
Last active October 25, 2018 09:35
404 of /js/app.js when running behind traefik proxy within docker-compose
auth:
build:
context: ./docker/auth
dockerfile: Dockerfile${DOCKERFILE_POSTFIX}
expose:
- 9000
environment:
- SERVICE_NAME=auth
labels:
- "traefik.enable=true"
#!/bin/bash
# Usage example:
# /usr/local/bin/ffmpeg -i test.mp4 -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -preset slow -f mp4 -s 640x480 test-out.mp4
mkdir -p ~/ffmpeg_sources ~/bin
rm -rf ~/ffmpeg_build ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,x264,x265
apt-get update -qq && apt-get -y install \
autoconf \