Skip to content

Instantly share code, notes, and snippets.

🏁
Sprinting

Pierre Bérubé l0gicgate

🏁
Sprinting
Block or report user

Report or block l0gicgate

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
View example.go
type IGenericType interface {
GetName() string
}
type GenericTypeRepository struct {
NativeType IGenericType
}
func (r *GenericTypeRepository) FindAll() (*[]IGenericType, error) {
var types []r.NativeType
View test.go
package main
type Foo interface {
methodA() string
}
type Bar struct {
Foo
}
View instance.yml
version: "3.7"
networks:
load-balancer-network:
external: true
client-network:
name: client-network
services:
View index.php
<?php
$app->add(function ($request, $response, $next) {
$detectedIp = $request->getAttribute('ip_address', null);
$trustedIps = ['1.1.1.1', '2.2.2.2'];
if (!$detectedIp || !in_array($detectedIp, $trustedIps)) {
return $response->withJson(['error' => 'Unauthorized ip address', 401]);
}
View Action.php
<?php
declare(strict_types=1);
namespace Project\Actions;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
/**
* Class Action
View AuthenticationService.php
<?php
namespace Project\Services\Authentication;
// This file should reside in your project root's `src\Services` sub-directory
use Illuminate\Hashing\BcryptHasher;
use Psr\Log\LoggerInterface;
use Project\Repositories\UserRepository;
class AuthenticationService {
View index.php
<?php
use DI\Container;
use DI\ContainerBuilder;
use Slim\App;
use Tuupola\JwtAuthentication;
$containerBuilder = new ContainerBuilder();
$containerBuilder->addDefinitions([
'JwtAuthenticationSettings' => [
'secret' => getenv('jwt_secret'),
@l0gicgate
l0gicgate / errors.txt
Created Feb 18, 2019
Doctrine Coding Standards
View errors.txt
FILE: /mnt/c/Users/l0gicgate/Dropbox/Software/github/Slim/Slim/App.php
-------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------
65 | ERROR | @var annotation of property \Slim\App::$settings does not specify type hint for its items.
78 | ERROR | @param annotation of method \Slim\App::__construct() does not specify type hint for items of its traversable parameter $settings.
140 | ERROR | @return annotation of method \Slim\App::getSettings() does not specify type hint for items of its traversable return value.
162 | ERROR | @param annotation of method \Slim\App::addSettings() does not specify type hint for items of its traversable parameter $settings.
---------------------------------------------------------------------------------------------
@l0gicgate
l0gicgate / createBrowserHistory.js
Created Jul 26, 2018
History.block behavior fix
View createBrowserHistory.js
import { createLocation } from 'history/LocationUtils';
import { addLeadingSlash, stripTrailingSlash, stripBasename, createPath } from 'history/PathUtils';
import { getConfirmation, supportsHistory, supportsPopStateOnHashChange, isExtraneousPopstateEvent } from 'history/DOMUtils';
import createTransitionManager from './createTransitionManager';
const PopStateEvent = 'popstate';
const HashChangeEvent = 'hashchange';
const getHistoryState = () => {
try {
@l0gicgate
l0gicgate / RequestMethodDetector.php
Last active Feb 16, 2018
Determine all allowed request methods for a request outside of slim app
View RequestMethodDetector.php
<?php
use FastRoute\Dispatcher;
use FastRoute\RouteParser;
use FastRoute\RouteParser\Std as StdParser;
use FastRoute\RouteCollector;
use FastRoute\DataGenerator\GroupCountBased as GroupCountBasedDataGenerator;
use Psr\Http\Message\RequestInterface;
use Slim\Route;
use Slim\Router;
You can’t perform that action at this time.