Skip to content

Instantly share code, notes, and snippets.

View MMazoni's full-sized avatar
🏀
Always trying to be better

Matheus Mazoni MMazoni

🏀
Always trying to be better
View GitHub Profile
@MMazoni
MMazoni / PSR12-with-tabs.xml
Created January 20, 2022 19:17
A PHPCodesniffer ruleset for using PSR12 with tabs
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PSR12" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
<description>The PSR-12 coding standard.</description>
<arg name="tab-width" value="4"/>
<!-- 2. General -->
<!-- 2.1 Basic Coding Standard -->
<!-- Code MUST follow all rules outlined in PSR-1. -->
@MMazoni
MMazoni / popsql.desktop
Created June 2, 2021 12:44
PopSQL Linux desktop launcher
[Desktop Entry]
Name=PopSQL
Comment=Pop SQL
GenericName=Database Manager
Exec=/home/matheus.andrade/Applications/PopSQL-1.0.48.AppImage
Icon=/home/matheus.andrade/Applications/popsql.png
Type=Application
StartupNotify=true
@MMazoni
MMazoni / app.js
Created February 3, 2021 02:24
ajax vanilla js
const form = document.getElementById('form');
const inputs = {
nome: document.getElementById('nome'),
idade: document.getElementById('idade'),
descricao: document.getElementById('descricao'),
conteudo: document.getElementById('conteudo'),
};
form.addEventListener('submit', (e) => {
e.preventDefault();
@MMazoni
MMazoni / php.md
Last active November 30, 2020 10:01
PHP from source 8.0

PHP from source 8.0

Ubuntu/Debian

sudo apt install -y pkg-config build-essential autoconf bison re2c \
                    libxml2-dev libsqlite3-dev libonig-dev libssl-dev \
                    zlib1g-dev libcurl4-openssl-dev libedit-dev libreadline-dev

@MMazoni
MMazoni / haskel_database.xml
Created November 6, 2020 02:01
DER Library
<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, https://github.com/ondras/wwwsqldesigner/ -->
<!-- Active URL: https://ondras.zarovi.cz/sql/demo/?keyword=default -->
<sql>
<datatypes db="mysql">
<group label="Numeric" color="rgb(238,238,170)">
<type label="Integer" length="0" sql="INTEGER" quote=""/>
<type label="TINYINT" length="0" sql="TINYINT" quote=""/>
<type label="SMALLINT" length="0" sql="SMALLINT" quote=""/>
<type label="MEDIUMINT" length="0" sql="MEDIUMINT" quote=""/>
@MMazoni
MMazoni / Laravel-Docker
Last active July 13, 2020 15:13
Laravel-docker - php7.2, nginx, oci8
FROM php:7.2-fpm
# Copy composer.lock and composer.json
COPY composer.lock composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
@MMazoni
MMazoni / cobol-setup.md
Last active November 10, 2019 22:34
Creating a Cobol environment in Ubuntu 19.04
  1. Install Open-Cobol, the compiler:
sudo apt install open-cobol
  1. Install the vscode extension Cobol for highlighting cobol syntaxe and other things.

  2. Write a program in .cob or .cbl

@MMazoni
MMazoni / autoload.php
Created October 31, 2019 12:33
Autoload php with namespaces (spl_autoload_register)
<?php
function load($namespace) {
$namespace = str_replace("\\"."/", $namespace);
$absolutePath = __DIR__ . "/" . $namespace . ".php";
return require_once $absolutePath;
}
spl_autoload_register(__NAMESPACE__ . "\load");
@MMazoni
MMazoni / set_resolution.sh
Last active October 17, 2019 19:39
bash script para funcionar a resolução correta no desktop do trabalho(Linux Mint 18)
#!/bin/bash
# xrandr funciona apenas com xorg, não com wayland
[ "$XDG_SESSION_TYPE" = x11 ] || exit 0
xrandr --newmode "1360x768_60.00" 84.75 1360 1432 1568 1776 768 771 781 798 -hsync +vsync
xrandr --addmode VGA-1 "1360x768_60.00"
#lembre-se de dar permissões de executar o script e colocar no campo 'comandos' em aplicações de inicialização:
# /bin/bash /path-do-arquivo/set_resolution.sh
@MMazoni
MMazoni / build-php-source.md
Last active December 2, 2019 13:59
PHP 7.4.0 build from source

Primeiramente baixe o código fonte da versão do PHP que quiser, irei usar a mais recente(data que estou escrevendo) 7.4.0.

Baixe o PHP

Extraia e entre na pasta via terminal.

1 - Instalar dependências(usando Ubuntu 19.10)

sudo apt install autoconf automake bison build-essential curl flex \