Skip to content

Instantly share code, notes, and snippets.

(function () {
'use strict';
angular.module('myApp')
.controller('SomeCtrl', SomeCtrl);
SomeCtrl.$inject = ['$scope', '$http', ' alertService'];
function SomeCtrl($scope, $http, alertService) {
$http.put('http://some.url/user/44', {
@e-kostylov
e-kostylov / 1.How to easily implement a REST API with oAuth2 presentation.md
Created February 9, 2016 09:15 — 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. :

@e-kostylov
e-kostylov / README.md
Created June 1, 2016 12:03 — 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 :

@e-kostylov
e-kostylov / Install-php7.md
Created September 3, 2016 20:08 — forked from hollodotme/Install-php7.md
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@e-kostylov
e-kostylov / bash-cheatsheet.sh
Created October 2, 2016 19:25 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@e-kostylov
e-kostylov / smtp-gmail-send.go
Created November 14, 2016 09:48 — forked from jpillora/smtp-gmail-send.go
Send email using Go (Golang) via GMail with net/smtp
package main
import (
"log"
"net/smtp"
)
func main() {
send("hello there")
}
@e-kostylov
e-kostylov / verify_appstore_in_app.php
Created November 24, 2016 16:29 — forked from menny/verify_appstore_in_app.php
How to verify in-app purchases from AppStore and Market in PHP code (server-side)
function verify_app_store_in_app($receipt, $is_sandbox)
{
//$sandbox should be TRUE if you want to test against itunes sandbox servers
if ($is_sandbox)
$verify_host = "ssl://sandbox.itunes.apple.com";
else
$verify_host = "ssl://buy.itunes.apple.com";
$json='{"receipt-data" : "'.$receipt.'" }';
//opening socket to itunes
@e-kostylov
e-kostylov / InvoiceController.php
Created December 5, 2016 10:29 — forked from cifren/InvoiceController.php
Paginator class for symfony2 Give the possibility to create pagination on symfon2 and with bootstrap3, including Doctrine management
<?php
/*Controller/InvoiceController.php*/
namespace Ruby\CheckbookBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class InvoiceController extends Controller
{
public function listAction($page)
{
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@e-kostylov
e-kostylov / qsort.go
Created March 5, 2017 21:50 — forked from vderyagin/qsort.go
quick sort implementation in Golang
package qsort
import "math/rand"
func QuickSort(slice []int) []int {
length := len(slice)
if length <= 1 {
sliceCopy := make([]int, length)
copy(sliceCopy, slice)