Skip to content

Instantly share code, notes, and snippets.

View felixgomez's full-sized avatar
🏠
Working from home

Félix Gómez felixgomez

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python3
import usb.core
dev = usb.core.find(idVendor=0x045e, idProduct=0x028e)
if dev is None:
raise ValueError('Device not found')
else:
dev.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)
@felixgomez
felixgomez / symfony3-rest-api.md
Created August 4, 2019 10:49 — forked from diegonobre/symfony3-rest-api.md
Basic RESTful API with Symfony 3 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 3 + 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 authenticationu
  • 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 3 framework. The following SF2 bundles are used :