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 / 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;
git config --global alias.cowsay '!git commit -m "`fortune | cowsay -f tux`"'
@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();
@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 / People.php
Last active September 22, 2017 14:46
Working with annotations using the doctrine annotation reader
<?php
/**
* @PeopleAnnotation(description="Get all information about a people", type="class")
*/
class People {
/**
* @PeopleAnnotation(description="Use to people name", type="attribute")
*/
@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 / 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 / .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 / 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 / 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() { }
}