Skip to content

Instantly share code, notes, and snippets.

@ianrodrigues
ianrodrigues / responsive-video.css
Created March 16, 2018 19:33 — forked from jaicab/responsive-video.css
Pure CSS solution for embed videos with an aspect ratio of 16:9
.video-container {
position: relative;
padding-bottom: 56.25%; /*16:9*/
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
@ianrodrigues
ianrodrigues / paginate.php
Created December 19, 2017 13:15 — forked from vluzrmos/paginate.php
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator
@ianrodrigues
ianrodrigues / README.md
Created September 11, 2017 12:49 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@ianrodrigues
ianrodrigues / 1.How to easily implement a REST API with oAuth2 presentation.md
Created September 11, 2017 12:45 — 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. :

<?php
namespace Funceme\PCD\Persistence;
use Doctrine\ORM\EntityRepository;
use Illuminate\Support\Collection;
class EstacaoRepository extends EntityRepository
{
/**
@ianrodrigues
ianrodrigues / Application.php
Created May 23, 2017 13:26
Custom Application
<?php
namespace App\Foundation;
use Illuminate\Foundation\Application as LaravelApplication;
class Application extends LaravelApplication
{
/**
* My Custom Version.
<div class="container-fluid">
<div class="board-canvas">
<div class="board-column board-height-full"> <!-- height 100% funciona -->
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Panel primary</h3>
</div>
<div class="panel-body board-height-full board-column-canvas"> <!-- height 100% NÃO funciona -->
Panel content
</div>
@ianrodrigues
ianrodrigues / .gitlab.ci.yml
Created May 2, 2017 10:51 — forked from yannhowe/.gitlab.ci.yml
.gitlab.ci.yml for SSH with private key.
# Image neeeds to have ssh-client
image: docker:git
services:
- docker:dind
stages:
- staging
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
<?php
use Fluent\Node;
use Fluent\Fluent;
class BacklogWidget extends Node
{
private $config;
private $cards;
private $controller;
@ianrodrigues
ianrodrigues / default
Created March 20, 2017 16:31 — forked from ghalusa/default
nginx default configuration file (ubuntu path: /etc/nginx/sites-available/default) with conversions of .htaccess environment variables and mod_rewrite logic, along with parameters supporting a fastcgi-based php setup
server {
listen 80;
root /var/www/YOUR_DIRECTORY;
index index.php index.html index.htm;
###################################################
# Change "yoururl.com" to your host name
server_name yoururl.com;