Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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,
version: '3'
services:
app:
build: .
image: symfony-fargate
ports:
- 8080:80
volumes:
- .:/var/www/html
@ianrodrigues
ianrodrigues / Schema.graphql
Created April 24, 2020 19:30 — forked from ThisIsMissEm/Schema.graphql
Form Validation as a Result Union
mutation updateUser(
details: UpdateUserInput!
): UpdateUserResult
union UpdateUserResult =
UpdateUserSuccess |
FormValidationError
type UpdateUserSuccess {}
public function addPhoneNumber(string $phone): void {}
@ianrodrigues
ianrodrigues / bash_curl_loop
Created June 22, 2020 16:04 — forked from ceme/bash_curl_loop
bash curl loop
while true; do sleep 1; curl http://www.google.com; echo -e '\n\n\n\n'$(date);done

Keybase proof

I hereby claim:

  • I am ianrodrigues on github.
  • I am ianrodrigues (https://keybase.io/ianrodrigues) on keybase.
  • I have a public key whose fingerprint is 8FB9 336F D179 D31B 796E 53A4 7A15 777D 1BC4 F883

To claim this, I am signing this object:

@ianrodrigues
ianrodrigues / cf_create_or_update.py
Created November 19, 2020 01:17 — forked from svrist/cf_create_or_update.py
Update or create a CloudFormation stack given a name and template + params'
'Update or create a stack given a name and template + params'
from __future__ import division, print_function, unicode_literals
from datetime import datetime
import logging
import json
import sys
import boto3
import botocore
@ianrodrigues
ianrodrigues / jwtRS256.sh
Created January 1, 2021 13:35 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub