Skip to content

Instantly share code, notes, and snippets.

Christoph, René Pardon renepardon

Block or report user

Report or block renepardon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@renepardon
renepardon / git-pushing-multiple.rst
Created Dec 10, 2019 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.
View git-pushing-multiple.rst

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

View federation.graphql
# 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")
View Federation.php
<?php
namespace App\GraphQL\Queries;
use App\GraphQL\SchemaPrinter;
use GraphQL\Type\Definition\ResolveInfo;
use Nuwave\Lighthouse\GraphQL;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;
/**
View KeyDirective.php
<?php
namespace App\Graphql\Directives;
use Nuwave\Lighthouse\Schema\Directives\BaseDirective;
use Nuwave\Lighthouse\Support\Contracts\DefinedDirective;
/**
* Class KeyDirective
*
View KeyDirective.php
<?php
namespace App\Graphql\Directives;
use Nuwave\Lighthouse\Schema\Directives\FieldDirective;
class KeyDirective extends FieldDirective
{
public function name(): string
{
View SchemaPrinter.php
<?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 Dec 20, 2018
Create CI/CD setup with Jenkins and worker nodes
View docker-compose.yml
version: '3.2'
services:
jenkins:
build: ./jenkins
container_name: jenkins
ports:
- "50000:50000"
expose:
- 8080
restart: always
View AuthenticatesUsers.php
<?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 Nov 21, 2018
Annoying bool to string cast
View php-implicit-type-cast.php
function foo(?string $val)
{
echo (string) $val;
}
foo('test')
foo(true)
foo(false)
foo(null)
@renepardon
renepardon / in_array.php
Created Nov 21, 2018
PHP in_array() strange results for different types
View in_array.php
<?php
// PHP 7.2.10
$value = "test";
var_dump(
$value,
in_array($value, [1]),
in_array($value, [true]),
in_array($value, ['true']),
You can’t perform that action at this time.