Skip to content

Instantly share code, notes, and snippets.

View MarceloHoffmeister's full-sized avatar
👨‍💻
light attracts more bugs

Marcelo Hoffmeister MarceloHoffmeister

👨‍💻
light attracts more bugs
View GitHub Profile
@MarceloHoffmeister
MarceloHoffmeister / tuto.txt
Created June 25, 2024 02:23
Ajeitando o cedilha errado (ć) no Ubuntu Linux
Confirme que o layout (Fonte de entrada) do seu teclado possui “intern.” ou “intl.” no nome
Exemplos: Ingês (EUA, intern. alt.) e English (US, intl., with dead keys). Esta informação está na tela de configuração do teclado do sistema.
Edite o arquivo /etc/environment
A maneira mais fácil para editar este arquivo é abrir um terminal e digitar:
sudo gnome-text-editor /etc/environment
OU
sudo gedit /etc/environment
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null]
#!/bin/bash
# name of PHP container
CONTAINER_PHP="some-container"
# PHP version
PHP_VERSAO=7.4
PARAMS=$@
@MarceloHoffmeister
MarceloHoffmeister / postgres_utils.txt
Last active August 24, 2021 12:53
Postgres utils
### find sequence
SELECT c.relname FROM pg_class c WHERE c.relkind = 'S' and relname ilike '%db_usuarios%';
### set next sequence
select nextval('db_usuarios_id_usuario_seq');
### show current sequence
select last_value from db_usuarios_id_usuario_seq;
select currval('db_usuarios_id_usuario_seq');
<TaskOptions>
<TaskOptions>
<option name="arguments" value="fix -v --config .php_cs.dist --path-mode=intersection -- $FilePath$" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="php" />
<option name="immediateSync" value="false" />
<option name="name" value="PHP CS Fixer" />
<option name="output" value="" />
@MarceloHoffmeister
MarceloHoffmeister / Response.php
Created December 4, 2020 14:28 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@MarceloHoffmeister
MarceloHoffmeister / latin-iso_db_config
Last active January 27, 2021 05:57
Configure Linux OS with LATIN1 encode on Postgres
// add support to desire language/locale
sudo echo "pt_BR.ISO-8859-1 ISO-8859-1" >> /var/lib/locales/supported.d/local
// recompile locales to add support for OS
sudo dpkg-reconfigure locales
// before create DB, restart Postgres service
sudo service postgresql restart
// login in your postgres client
@MarceloHoffmeister
MarceloHoffmeister / .eslintrc.json
Created November 2, 2020 10:36
JSON de configuração do ESLint
{
"env": {
"es6": true,
"node": true,
"jest": true
},
"extends": [
"standard",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
@MarceloHoffmeister
MarceloHoffmeister / README.md
Last active September 11, 2020 18:52 — forked from Alymosul/README.md
[Laravel] Seeding data in testing as part of the application build | Semeando dados em testes como parte da construção do aplicativo

A trait SeedDatabase junto com a classe SeedDatabaseState dá ao seu projeto Laravel a habilidade de fazer a seed do banco de dados antes de rodar as test suites, o que melhora a velocidade e tona-se melhor do que executar as seeds do banco de dados antes de cada teste.

Além disso, tem a opção de executar seeds personalizadas em vez dos seeds que são chamados no método run() da classe DatabaseSeeder. Você pode conseguir isso da seguinte forma:

SeedDatabase trait along with SeedDatabaseState class gives your Laravel project the ability to seed the testing database once before running the full suite tests, which improves the speed of the tests than seeding the testing database before each test.

Also, it has the option to run custom seeders instead of the seeders that are called in the run() method of the DatabaseSeeder class you can achieve that as follows:

Testcase.php

@MarceloHoffmeister
MarceloHoffmeister / config-linux.sh
Last active September 17, 2021 12:53
Configuração de máquinas Linux ubuntu-based
# Desktop updating
sudo apt update && sudo apt upgrade -y
# PostgreSQL
sudo apt-get install postgresql
# PGAdmin
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
sudo apt install pgadmin4