Skip to content

Instantly share code, notes, and snippets.

View flyingluscas's full-sized avatar
🏠
Working from home

fly flyingluscas

🏠
Working from home
View GitHub Profile
@flyingluscas
flyingluscas / example.md
Created November 5, 2016 19:39
Example
$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),
]);
@flyingluscas
flyingluscas / estados-cidades.json
Created November 3, 2016 16:24 — forked from letanure/estados-cidades.json
JSON estados cidades
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@flyingluscas
flyingluscas / MyUbuntuThemeConfigurations.md
Last active February 26, 2019 13:19
My Ubuntu Theme Configurations

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 October 28, 2016 01:47
Laravel - Example of relationships on seeders
use Illuminate\Database\Seeder;

class ClientTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
 */
@flyingluscas
flyingluscas / UsingFakerInPT-BR.md
Last active April 18, 2024 11:12
Utilizando Faker em pt-BR

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
 */
@flyingluscas
flyingluscas / example.md
Last active October 24, 2016 23:30
Exemplo
// Primeira forma, essa e a mais xerosa
$produto->decrement('quantidade', 3); // isso vai subtrair 3 da quantidade do produto no model

// Segunda forma, nao muito xerosa, mas funciona
$produto->quantidade = $produto->quantidade - 3;
$produto->save();
@flyingluscas
flyingluscas / DockerCompose.md
Last active October 23, 2016 21:13
Docker Compose
version: '2'

services:
  # Source
  source:
    image: tianon/true
    container_name: nomdedoseuappaqui-source
    volumes:
 - ./:/var/www
@flyingluscas
flyingluscas / Searchable.md
Last active August 15, 2018 13:17
TNT Searchable Trait
<?php

use Illuminate\Database\Eloquent\Model;
use TeamTNT\TNTSearch\Facades\TNTSearch;

trait Searchable
{
    /**
     * Auto update search index using model events.
@flyingluscas
flyingluscas / RandomCrap.md
Last active October 3, 2016 14:28
Códigos Marotos da Vida (não é meu, só achei jogado nuns projeto por ae, é importante para mim que você saiba disso)

Compilado de Bosta

	if($id_insert)
        {
			$return['status']   = 'okay';
			$return['redirect'] = base_url('admin/' . $this->module['name'] . '/newsletter');

			$this->template_lib->set_message('Registro criado com sucesso', 'success');
@flyingluscas
flyingluscas / ListenersForJwtEventsOnLaravel.md
Last active October 28, 2016 01:52
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 :

<?php

namespace App\Listeners;