Skip to content

Instantly share code, notes, and snippets.

View scrubmx's full-sized avatar
🏴‍☠️

Jorge González scrubmx

🏴‍☠️
View GitHub Profile
@scrubmx
scrubmx / MyTest.php
Created March 1, 2022 14:58
Assert exception was reported by Laravel (useful for testing code inside rescue)
<?php
use Tests\TestCase;
class MyTest extends TestCase
{
/**
* Sets up an expectation for an exception to be reported by the code under test.
*/
protected function expectReportedExceptionMessage(string $message): static
@scrubmx
scrubmx / AuthController.php
Last active September 15, 2021 19:45
Laravel Sanctum Authentication
<?php
namespace App\Http\Controllers\Api;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
<?php
namespace App\Models\Traits;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
trait Sluggable
{
/**
@scrubmx
scrubmx / .travis.yml
Last active September 5, 2019 18:51
Solved! Working with postgres (postgresql 11) in travis
language: elixir
dist: bionic
sudo: required
elixir:
- '1.9.0'
otp_release:
- '22.0'
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Auth\Access\AuthorizationException;
class VerifyUserRole
{
/**
@scrubmx
scrubmx / Laravel.xml
Created June 6, 2019 01:42
PhpStorm Laravel Code Style
<code_scheme name="Laravel">
<option name="SOFT_MARGINS" value="120" />
<CssCodeStyleSettings>
<option name="HEX_COLOR_LOWER_CASE" value="true" />
<option name="HEX_COLOR_SHORT_FORMAT" value="true" />
</CssCodeStyleSettings>
<JSCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="FIELD_PREFIX" value="" />
<option name="FILE_NAME_STYLE" value="CAMEL_CASE" />
@scrubmx
scrubmx / hosts.csv
Created May 8, 2019 22:35
Spam domain list
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
host
0-mail.com
001.igg.biz
027168.com
0815.ru
0815.ry
0815.su
0845.ru
0box.eu
0clickemail.com
@scrubmx
scrubmx / requirements.txt
Created April 12, 2019 22:42
Conekta Scraper
pip install selenium
<?php
namespace App\Models\Traits;
use LogicException;
trait Immutables
{
/**
* Set a given attribute on the model.
@scrubmx
scrubmx / fizzbuzz.ex
Created January 3, 2018 08:27
FizzBuzz in Elixir
defmodule FizzBuzz do
def print do
Enum.each(1..100, &FizzBuzz.print/1)
end
def print(n) do
result = cond do
divisible_by_3?(n) && divisible_by_5?(n) -> "FizzBuzz"
divisible_by_3?(n) -> "Fizz"
divisible_by_5?(n) -> "Buzz"