Skip to content

Instantly share code, notes, and snippets.

View adrianuf22's full-sized avatar
🚀

adrianu_f22 adrianuf22

🚀
View GitHub Profile
{
"name": "a"
}
@adrianuf22
adrianuf22 / .nginx
Last active October 10, 2018 18:14
Nginx Load balance + Health check
user root;
worker_processes auto;
worker_rlimit_nofile 1048576;
pid /run/nginx.pid;
events {
worker_connections 1048576;
use epoll;
multi_accept on;
}
@adrianuf22
adrianuf22 / SampleController.php
Last active September 20, 2018 21:10
Middleware Sample
<?php
declare(strict_types = 1);
class SampleController
{
public function sampleAction()
{
$payload = $request->getAttribute('dataObject');
@adrianuf22
adrianuf22 / serial_pdoc.php
Created September 20, 2018 20:04
Symfony Serializer with PhpDoc
<?php
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
$payload = json_decode('{"name":"sample"}', true);
class SampleDto {
/**
@adrianuf22
adrianuf22 / fb.css
Created July 19, 2018 04:47
FB Stylus
@-moz-document domain("facebook.com") {
#u_0_a, #leftCol {
display: none;
}
#leftCol div, #rightCol div {
display: none;
}
#pagelet_composer {
@adrianuf22
adrianuf22 / arvore_prefix.sql
Created April 11, 2018 19:21
Arvore com pais e filhos de um prefix
create table tree (
id INT,
path VARCHAR(255),
name VARCHAR(100)
);
insert into tree VALUES (1, '/', 'Prédio Orozimbo');
insert into tree VALUES (2, '/1', 'Ala a');
insert into tree VALUES (3, '/1', 'Ala b');
insert into tree VALUES (4, '/1/2', 'RH');
@adrianuf22
adrianuf22 / tree_result.sql
Last active April 11, 2018 17:59
Obtem a árvore pai de um resultado de pesquisa
drop table tree;
create table tree (
id INT,
path VARCHAR(255),
name VARCHAR(100)
);
insert into tree VALUES (1, '/', 'Prédio Orozimbo');
insert into tree VALUES (2, '/1', 'Ala a');
@adrianuf22
adrianuf22 / pseudo_strategy.go
Created March 21, 2018 21:06
pseudo_strategy.go
package main
import (
"fmt"
"net/http"
)
func main() {
fakeArg := "fake"
// Example:
JavaScript.load("/javascripts/something.js");
// With callback (that’s the good thing):
JavaScript.load("http://www.someawesomedomain.com/api.js", function() {
API.use(); // or whatever api.js provides ...
});