Skip to content

Instantly share code, notes, and snippets.

View gpressutto5's full-sized avatar

Guilherme Pressutto gpressutto5

  • Curitiba, Brazil
View GitHub Profile
@gpressutto5
gpressutto5 / LocalValetDriver.php
Created September 1, 2017 21:16
Magento 2 Local Driver for Laravel Valet
<?php
class LocalValetDriver extends LaravelValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
@gpressutto5
gpressutto5 / git-bisect-phpunit.sh
Last active December 9, 2021 18:26 — forked from havvg/git-bisect-phpunit.sh
git bisect phpunit wrapper
#!/bin/bash
lcd artisan migrate
lcd phpunit --testsuite=VMS --filter=testGetPossibleTimeSegmentsForOldestDraftInvoiceWithCrossoverHandlingEnd
EXIT_CODE="$?"
lcd artisan migrate:rollback
[user]
name = Guilherme Pressutto
email = gpressutto5@gmail.com
[core]
pager = diff-so-fancy | less --tabs=4 -R
excludesFile = ~/.gitignore
[color]
ui = true
[color "diff-highlight"]
oldNormal = red bold
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Http\Request;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableCell;
use Symfony\Component\Console\Output\StreamOutput;
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$HOME/.composer/vendor/bin:/usr/local/sbin:$PATH
PROMPT_TITLE='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
export PROMPT_COMMAND="${PROMPT_COMMAND} ${PROMPT_TITLE}; "
# Fix https://github.com/robbyrussell/oh-my-zsh/issues/6835#issuecomment-390
ZSH_DISABLE_COMPFIX=true
# Set CLICOLOR if you want Ansi Colors in iTerm2
export CLICOLOR=1
@gpressutto5
gpressutto5 / impbcopy.m
Last active April 12, 2019 20:13
impbcopy.m mirror
/////////////////////////////////////////////////////////
// Copied from http://www.alecjacobson.com/weblog/?p=3816
/////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <unistd.h>
BOOL copy_to_clipboard(NSString *path)
{
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage
NSImage * image;
@gpressutto5
gpressutto5 / LocalValetDriver.php
Created April 6, 2019 22:51
JavaScript SPA Local Valet Driver
<?php
/**
* JavaScript SPA Local Valet Driver
*/
class LocalValetDriver extends ValetDriver
{
/**
* Serves
* Determine if the driver serves the request by checking for an
<?php
namespace App\Http\Middleware;
use Closure;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\JWTAuth;
class RefreshTokenIfLoggedIn
{
@gpressutto5
gpressutto5 / Foo.php
Created October 11, 2018 06:10
Multiple laravel http client
<?php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
/**
* A facade for the Foo HttpClient service.
*
* @method static \Psr\Http\Message\ResponseInterface get(string|\Psr\Http\Message\UriInterface $uri, array $options = [])
@gpressutto5
gpressutto5 / WithAuth.php
Created April 4, 2018 14:46
Bearer JWT Login for Laravel HTTP Testing
<?php
namespace Tests\Feature;
use App\User;
use Tymon\JWTAuth\Facades\JWTAuth;
/**
* Trait WithAuth
*