Skip to content

Instantly share code, notes, and snippets.

Avatar

Juan Pablo Barreto juampi92

  • Amsterdam
View GitHub Profile
@juampi92
juampi92 / RequestBuilder.php
Created Nov 7, 2019
Build Requests with routes on Laravel for testing.
View RequestBuilder.php
<?php
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Support\Facades\Route as Router;
class RequestBuilder
{
/**
* Will create a request with the correct fullUrl, route parameters and input parameters.
@juampi92
juampi92 / SafeQueryServiceProvider.php
Last active Jul 1, 2019
Database master-slave replication delay in Laravel
View SafeQueryServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\ServiceProvider;
class SafeQueryServiceProvider extends ServiceProvider
{
View BaseRule.php
<?php
namespace App\Rules;
use Illuminate\Support\Facades\Validator;
use Illuminate\Contracts\Validation\Rule;
class BaseRule
{
protected $validator = null;
View controllers - app - auth.controller.js
import joi from 'joi'
import validate from 'express-validation'
import middleware from 'middleware'
import AuthService from 'auth.service'
/**
* Controller's generic middleware
*/
export const middleware = [middleware.authenticate('token')]
@juampi92
juampi92 / createSpotifySymLink.bat
Last active Mar 9, 2018
Store Spotify downloads in a custom folder using Symbolic Links (Win)
View createSpotifySymLink.bat
View .jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
You can’t perform that action at this time.