Skip to content

Instantly share code, notes, and snippets.

bind\((.+?).class\).toProvider\((.)(.+?).class\).in\(com.google.inject.Singleton.class\);
@Singleton\n@Binds\npublic abstract $1 bind$1($2$3 \L$2\E$3);
bind\(new TypeLiteral<(.+?)<(.+?)>>\(\) \{\n \}\).to\((.)(.+?).class\).in\(com.google.inject.Singleton.class\);
@Singleton\n@Binds\npublic abstract $1<$2> bind$1$2($3$4 \L$3\E$4);\n
@Bind for bind(IYourInterface.clas).to(YourImplementation.class) in abstract method
@Provide @Singleton for bind(IYourInterface.clas).toInstance(new YourImplementation())

#Install Symfony and the bundles

Create New Symfony Project

symfony new {project_name} lts

Require Bundles

composer require jms/serializer-bundle
@yusufiga
yusufiga / README.md
Last active May 9, 2016 15:12 — 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 :

@yusufiga
yusufiga / gist:3fed0690e2aee3ca3cf4
Created December 9, 2015 19:16
Get Deployd Collections
var dirTree = require('directory-tree');
console.log(getCollections());
function getCollections (){
var tree = dirTree.directoryTree('resources/',['.json']);
var collections = collections || [];
console.log(tree.children);
for (var i in tree.children) {
@yusufiga
yusufiga / app.js
Last active August 29, 2015 14:21 — forked from fatihky/app.js
var request = require("request");
var express = require('express');
var zlib = require("zlib");
var LRUCache = require('lru-native');
var app = express();
var cache = new LRUCache({ maxElements: 1000 });
var CACHE_TIME = 1 * 60 * 1000; // bir dk
app.get('/doviz-kurlari', function(req, res)
{