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

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 :

<?php

namespace App\Listeners;
View estados-cidades.json
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
View example.md
$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),
]);
View example.md
$users = factory(App\User::class, mt_rand(2, 10))->create();

factory(App\Order:class, mt_rand(2, 10))->make()->each(function ($order) use ($users) {
    $order->user()->associate($users->random())->save();
});
View LaravelLimitPaginationLinks.md
View DIExample.md
public static function getAll(Request $request, Response $response, VehiclesService $service)
{
    $getAllVechiles = $service->getAll();

    $response->write($getAllVechiles);
    return $response;
}
@flyingluscas
flyingluscas / LaravelOnSharedHost.md
Created Dec 1, 2016
Laravel em servidor compartilhado
View LaravelOnSharedHost.md

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

RewriteEngine on

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

usort($subject, 'desc');

// Ordenação crescente
@flyingluscas
flyingluscas / FFMPEGMergAudioVideo.md
Last active Feb 11, 2017
FFMPEG Merge audio and video
View FFMPEGMergAudioVideo.md
ffmpeg -i video.mkv -i audio.wav -c:v copy -c:a aac -strict experimental output.mkv
View SimpleLaravelAuthExample.md
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.