Skip to content

Instantly share code, notes, and snippets.

🌌
Wake up!

Lucas Pires flyingluscas

🌌
Wake up!
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 / 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 / FormsMySQLiPHP.md
Last active Nov 25, 2016
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());
View DIExample.md
public static function getAll(Request $request, Response $response, VehiclesService $service)
{
    $getAllVechiles = $service->getAll();

    $response->write($getAllVechiles);
    return $response;
}
View LaravelLimitPaginationLinks.md
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 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 estados-cidades.json
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@flyingluscas
flyingluscas / MyUbuntuThemeConfigurations.md
Last active Feb 26, 2019
My Ubuntu Theme Configurations
View MyUbuntuThemeConfigurations.md

My Ubuntu Theme Settings

Install Theme

$ sudo add-apt-repository ppa:noobslab/themes
$ sudo apt-get update
$ sudo apt-get install flatabulous-theme

Install Icons Pack

@flyingluscas
flyingluscas / RelationshipsOnSeeder.md
Last active Oct 28, 2016
Laravel - Example of relationships on seeders
View RelationshipsOnSeeder.md
use Illuminate\Database\Seeder;

class ClientTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
@flyingluscas
flyingluscas / UsingFakerInPT-BR.md
Last active Sep 14, 2019
Utilizando Faker em pt-BR
View UsingFakerInPT-BR.md

Utilizando Faker em pt-BR

Acesse o seu arquivo app/Providers/AppServiceProvider.php, e no método register adicione o seguinte :

/**
 * Register any application services.
 *
 * @return void
 */
You can’t perform that action at this time.