Skip to content

Instantly share code, notes, and snippets.

View renepardon's full-sized avatar

Christoph, René Pardon renepardon

View GitHub Profile
@renepardon
renepardon / zsh-setup.md
Created May 20, 2020 12:53
Configure zsh for MacOS with iTerm2 (but works also with Terminal!), antigen and oh-my-zsh with material design colors and agnoster theme

ZSH Setup

Install dependencies

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" && \
cd Downloads && \
curl -O https://raw.githubusercontent.com/MartinSeeler/iterm2-material-design/master/material-design-colors.itermcolors
@renepardon
renepardon / git-pushing-multiple.rst
Created December 10, 2019 07:36 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

# just a default scalar class for now
scalar _Any @scalar(class: "App\\GraphQL\\Scalars\\Any")
type _Service {
sdl: String
}
extend type Query {
_entities(representations: [_Any!]!): [_Entity]! @field(resolver: "App\\GraphQL\\Queries\\Federation")
_service: _Service! @field(resolver: "App\\GraphQL\\Queries\\Federation")
<?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)