Skip to content

Instantly share code, notes, and snippets.

View glaucofox's full-sized avatar
Coding...

Glauco Fox glaucofox

Coding...
View GitHub Profile
@glaucofox
glaucofox / tsconfig.json
Created January 16, 2021 23:51
TypeScript Config JSON file
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"esModuleInterop": true,
"module": "esnext",
@glaucofox
glaucofox / 1_phpunit-api.md
Created October 19, 2020 00:25 — forked from loonies/1_phpunit-api.md
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this->anything()
@glaucofox
glaucofox / api.php
Last active May 21, 2019 18:07
API Routing CRUD with MySQLi
<?php
/**
* Run: http://localhost/api.php/{$table}/{$id}
**/
// get the HTTP method, path and body of the request
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'], '/'));
$input = json_decode(file_get_contents('php://input'), true);
@glaucofox
glaucofox / hibernate.cfg.xml
Created May 13, 2019 17:47
MySQL Hibernate Config XML Example
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- JDBC Database connection settings -->
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
@glaucofox
glaucofox / AppServiceProvider.php
Created May 6, 2019 23:10
Laravel Faker PT-BR
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
@glaucofox
glaucofox / phpunit.xml
Last active December 19, 2018 20:04
SQLite setup for memory tests
<!--
Create a file for sqlite database.
Point the database.php file to it
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('testing.sqlite')),
...
],
@glaucofox
glaucofox / TestCase.php
Created December 19, 2018 18:57 — forked from tuto1902/TestCase.php
Laravel TestCase base class with exception handling helper methods
<?php
namespace Tests;
use Exception;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use App\Exceptions\Handler;
use Illuminate\Contracts\Debug\ExceptionHandler;
abstract class TestCase extends BaseTestCase
@glaucofox
glaucofox / AppServiceProvider.php
Last active October 26, 2021 16:57
Migration Default String Length fix for Laravel >= 5.4 and MySQL =< 5.7.7
<?php
/* App\Providers\AppServiceProvider.php */
use Illuminate\Support\Facades\Schema;
/**
* Bootstrap any application services.
*
* @return void