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
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 / FormsMySQLiPHP.md
Last active Nov 9, 2019
Formulários e MySQLi no PHP
View FormsMySQLiPHP.md

MySQLi Exemplos

1. Conexão

Vamos criar um arquivo chamado connection.php, neste arquivo vamos abrir uma conexão com nosso banco de dados.

Dessa forma, quando precisarmos de uma conexão com o banco de dados para executar uma query, só precisamos incluir o arquivo connection.php.

$link = mysqli_connect('localhost', 'username', 'password', 'database_name') or die(mysqli_connect_error());
@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 / FFMPEGYouTube.md
Last active Aug 15, 2018
FFMPEG Optimize videos for YouTube
View FFMPEGYouTube.md

Command

$ ffmpeg -i <input file> -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart <output_name>.mp4

Function

function youtube () {
@flyingluscas
flyingluscas / InstallPopcornTime.md
Last active Jul 25, 2019
Installing Popcorn Time on Ubuntu 16.x
View InstallPopcornTime.md

1. Downloading

32 bits version

$ wget https://get.popcorntime.sh/build/Popcorn-Time-0.3.10-Linux-32.tar.xz -O popcorntime.tar.xz

64 bits version

@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!';
@flyingluscas
flyingluscas / PHPUnitMockTrait.md
Last active Mar 14, 2017
PHPUnit: Mocking Trait
View PHPUnitMockTrait.md
use PHPUnit\Framework\TestCase;

trait Greeting
{
    public function hello($name)
    {
        return 'Hello '.$name;
    }
}
You can’t perform that action at this time.