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 / PHPUnitMockInterface.md
Created March 14, 2017 01:58
PHPUnit: Mocking Interface
use PHPUnit\Framework\TestCase;

interface Greeting
{
    public function hello($name);
}

class GreetingTest extends TestCase
{
@flyingluscas
flyingluscas / PHPUnitMockAbstractClass.md
Created March 14, 2017 02:02
PHPUnit: Mock abstract class
use PHPUnit\Framework\TestCase;

abstract class Greeting
{
    public function hello($name)
    {
        return 'Hello '.$name;
    }
}
@flyingluscas
flyingluscas / Handler.php
Created March 19, 2017 05:13
Handling exceptions with JSON responses.
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
@flyingluscas
flyingluscas / AttackOnTitanEpisodes.md
Last active August 15, 2018 13:16
Attack On Titan Episodes

Shingeki no Kyojin - Episódio 20
HD
MQ

Shingeki no Kyojin - Episódio 22
HD
MQ

Shingeki no Kyojin - Episódio 25
HD

@flyingluscas
flyingluscas / CrawlerAnimes.js
Created March 31, 2017 17:48
Crawler Animes
const Crawler = require('crawler')
const baseUrl = 'https://animes.zlx.com.br'
const startUrl = baseUrl+'/exibir/67/6561/shingeki-no-kyojin-01'
const crawler = new Crawler({
maxConnections: 10,
skipDuplicates: true,
callback: (error, response, done) => {
const $ = response.$
const title = $('title').text()
@flyingluscas
flyingluscas / FullmetalAlchemistBrotherhood.md
Last active August 15, 2018 13:16
Fullmetal Alchemist: Brotherhood

Fullmetal Alchemist: Brotherhood - Episódio 4HD - MQFullmetal Alchemist: Brotherhood - Episódio 3HD - MQFullmetal Alchemist: Brotherhood - Episódio 1HD - MQFullmetal Alchem

@flyingluscas
flyingluscas / DragonBallSuper.md
Last active April 1, 2017 06:43
Dragon Ball Super

Dragon Ball Super - Episódio 1

Qualidade HD MQ LQ

@flyingluscas
flyingluscas / LaravelCategoryExample.md
Last active February 23, 2023 13:09
Laravel Category Example

Category Model

namespace App;

use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    /**
@flyingluscas
flyingluscas / docker-compose.yml
Last active April 15, 2017 03:13
Example Docker Compose for Wordpress
version: '2'
services:
wordpress:
image: wordpress:4.7.3-php5.6-apache
container_name: sandbox-wordpress
volumes:
- ./:/var/www/html
ports:
- 8080:80
@flyingluscas
flyingluscas / ArrayReplacementForSwitch.md
Last active April 17, 2017 17:31
Array Replacement for Switch
$subject = 'flying';

switch ($subject) {
    case 'flying':
        $result = 'potato';
        break;

    case 'bacon':
 $result = 'is life';