Skip to content

Instantly share code, notes, and snippets.

@devgnx
devgnx / nginx.conf
Last active August 29, 2016 14:47
How do I enable PHP’s flush() with nginx+PHP-FPM?
# Upgrade your nginx server {} config:
fastcgi_keep_conn on;
fastcgi_buffering off;
proxy_buffering off;
gzip off;
@devgnx
devgnx / convertToObject.php
Created November 23, 2016 12:17
Convert arrays to object, preserving arrays with numeric keys
<?php
function convertToObject($array)
{
reset($array);
if ($isNumericKey = is_numeric(key($array))) {
$object = [];
} else {
@devgnx
devgnx / fb-font-and-colors.txt
Created August 30, 2017 15:56
Fonte e cores card facebook
fonte padrão: Helvetica, sans-serif
cor de fundo: #e9ebee
cord dos links: #365899
borda do card: #e5e6e9 #dfe0e4 #d0d1d5
cor do separador: #e5e5e5, opacidade 48%
@devgnx
devgnx / BaseRequest.php
Created September 30, 2020 04:55
Symfony Request using illuminate/validation
<?php
namespace App\Request;
use Domain\Shared\MagicGetterSetter;
use Illuminate\Translation\ArrayLoader;
use Illuminate\Translation\Translator;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Factory as ValidatorFactory;
use Symfony\Component\HttpFoundation\FileBag;
@devgnx
devgnx / MagicGetterSetter.php
Created September 30, 2020 04:56
Magic Getter and Setter trait
<?php
namespace Domain\Shared;
trait MagicGetterSetter
{
public function __set($name, $value)
{
if (property_exists($this, $value)) {
$name = $this->toCamelCase($name);