Skip to content

Instantly share code, notes, and snippets.

Lucas Pires flyingluscas

Block or report user

Report or block flyingluscas

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
flyingluscas /
Last active Oct 28, 2016
Listeners for JWT events on Laravel 5

Listeners for JWT events on Laravel 5

1. Criando Listener

Dentro da pasta app\Listeners crie um arquivo com o seguinte nome JWTAbsentTokenListener.php, e adicione o seguinte conteúdo :


namespace App\Listeners;
View estados-cidades.json
"estados": [
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Assis Brasil",
$text = '10,15,20,25,30,22,14,33';

$sets = array_map(function ($values) {
    return sprintf('/(%s)/', implode('|', $values));
}, [
    range(10, 15),
    range(20, 25),
    range(30, 35),
$users = factory(App\User::class, mt_rand(2, 10))->create();

factory(App\Order:class, mt_rand(2, 10))->make()->each(function ($order) use ($users) {
public static function getAll(Request $request, Response $response, VehiclesService $service)
    $getAllVechiles = $service->getAll();

    return $response;
flyingluscas /
Created Dec 1, 2016
Laravel em servidor compartilhado

Dentro da sua pasta public_html ou www, crie um arquivo .htaccess com o seguinte conteúdo:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^$ [NC,OR]
RewriteCond %{HTTP_HOST} ^$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
flyingluscas /
Last active Dec 20, 2016
PHP Array Sort Example
$subject = [
  ['someValue' => 1],
  ['someValue' => 2],
  ['someValue' => 3],

usort($subject, 'desc');

// Ordenação crescente
flyingluscas /
Last active Feb 11, 2017
FFMPEG Merge audio and video
ffmpeg -i video.mkv -i audio.wav -c:v copy -c:a aac -strict experimental output.mkv
public function login(Request $request)
    $email = $request->email;
    $password = $request->password;

    $user = User::where('email', $email)->first();

    if (! $user || ! Hash::check($password, $user->password)) {
        return 'You shall not pass!';
You can’t perform that action at this time.