Skip to content

Instantly share code, notes, and snippets.

View leonardorifeli's full-sized avatar
🏡
Working from home

Leonardo Rifeli leonardorifeli

🏡
Working from home
View GitHub Profile
@leonardorifeli
leonardorifeli / asyncAwait.js
Last active July 11, 2017 15:08
Apresentação Node.js
async function sendAsync(userId) {
let user = await getUser(userId);
let profile = await getProfile(user);
let account = await getAccount(profile);
let report = await getReport(account);
let send = sendStatistic(report);
console.log(send);
}
@leonardorifeli
leonardorifeli / GenerateReport.java
Last active March 20, 2017 04:41
SOLID - SRP - PopulationStandardDeviation
package com.leonardorifeli.article;
public class GenerateReport {
public ArrayList<String> find() { }
public ArrayList<String> proccess() { }
public void print() { }
}
@leonardorifeli
leonardorifeli / 1.How to easily implement a REST API with oAuth2 presentation.md
Created February 14, 2017 01:24 — forked from lologhi/1.How to easily implement a REST API with oAuth2 presentation.md
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@leonardorifeli
leonardorifeli / .travis.yml
Created November 11, 2016 03:15
Post about structure of blog
language: ruby
rvm:
- 2.2.2
before_script:
- chmod +x build.sh
script: ./build.sh
branches:
@leonardorifeli
leonardorifeli / Automobile.java
Last active August 20, 2016 14:51
Inheritance or composition article
package com.leonardorifeli.article.inheritance.model;
public class Automobile {
private String color;
private Integer quantityPort;
public String getColor() {
return color;
}
@leonardorifeli
leonardorifeli / ConnectionInformationService.php
Last active August 19, 2016 18:04
Implemented the Ratchet socket using PHP
<?php
namespace Hermes\Business\Service;
use Ratchet\ConnectionInterface;
abstract class ConnectionInformationService
{
static public function checkInformations(ConnectionInterface $connection)
@leonardorifeli
leonardorifeli / tagcloud.sh
Created January 17, 2016 20:57 — forked from karmi/tagcloud.sh
Simple tag cloud with ElasticSearch `terms` facet
# (Re)create the index
curl -X DELETE "http://localhost:9200/tagcloud"
curl -X PUT "http://localhost:9200/tagcloud"-d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'
@leonardorifeli
leonardorifeli / generator.php
Created October 15, 2015 14:08 — forked from tawfekov/generator.php
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
git config --global alias.cowsay '!git commit -m "`fortune | cowsay -f tux`"'
@leonardorifeli
leonardorifeli / Users.class.php
Created June 21, 2014 17:51
88bit - Classe de usuários
<?php
class Users extends DataBase {
public $id;
public $email;
public $birthDate;
public $fullName;
public $city;
public $state;