Skip to content

Instantly share code, notes, and snippets.

@JhowRaul10
JhowRaul10 / HandlePutFormData.php
Last active March 8, 2023 12:58
Laravel: Middleware to support multipart/form-data in PUT, PATH and DELETE requests. Deals with one level of form arrays.
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\ParameterBag;
use Illuminate\Support\Arr;
/**
* @author https://github.com/Stunext
@tallesairan
tallesairan / pagseguro_error.js
Created December 13, 2018 12:19
Tabela de erros pagseguro
function erroPS($eV) {
let $err = '';
switch($eV)
{
case "5003": $err = "Falha de comunicação com a instituição financeira"; break;
case "10000": $err = "Marca de cartão de crédito inválida"; break;
case "10001": $err = "Número do cartão de crédito com comprimento inválido"; break;
case "10002": $err = "Formato da data inválida"; break;
case "10003": $err = "Campo de segurança CVV inválido"; break;
case "10004": $err = "Código de verificação CVV é obrigatório"; break;
@GlauberF
GlauberF / converteEstado.js
Last active June 20, 2020 19:56
Função em javascript que converte a Sigla do estado para o Nome do estado - (padrão americano sem acentos)
/**
* Converter estados - (padrão americano sem acentos) - Glauber Funez
**/
const ConverterEstados = function(val) {
var data;
switch (val.toUpperCase()) {
case "AC" : data = "Acre"; break;
case "AL" : data = "Alagoas"; break;
case "AM" : data = "Amazonas"; break;
@devmycloud
devmycloud / ParseInputStream.php
Last active December 6, 2023 15:22
Process php://input to get multipart/form-data parameters for PATCH API request
<?php
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* stream - Handle raw input stream
*
* LICENSE: This source file is subject to version 3.01 of the GPL license
* that is available through the world-wide-web at the following URI:
@jeffochoa
jeffochoa / Response.php
Last active October 6, 2025 22:11
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;
@matthewzring
matthewzring / markdown-text-101.md
Last active October 27, 2025 02:20
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

What this guide covers:

@DomPizzie
DomPizzie / README-Template.md
Last active October 26, 2025 12:55
A simple README.md template

Project Title

Simple overview of use/purpose.

Description

An in-depth paragraph about your project and overview of use.

Getting Started

@flyingluscas
flyingluscas / UsingFakerInPT-BR.md
Last active October 25, 2025 21:15
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
 */
@vinicius-stutz
vinicius-stutz / README.md
Last active July 23, 2024 16:51
Máscara p/ telefones com 8 ou 9 dígitos (jquery.mask.js)
@guisehn
guisehn / gist:3276302
Last active August 28, 2025 11:43
Validar CNPJ (PHP)
<?php
function validar_cnpj($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj);
// Valida tamanho
if (strlen($cnpj) != 14)
return false;