Skip to content

Instantly share code, notes, and snippets.

@edefiez
edefiez / .gitconfig
Created September 30, 2016 13:17
Git global config
[user]
name = Your Name
email = Your Mail
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
@edefiez
edefiez / Symfony.icls
Last active September 29, 2016 18:51
PhpStorm Symfony Theme
<scheme name="Symfony" version="142" parent_scheme="Darcula">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="15" />
<option name="EDITOR_FONT_NAME" value="Monaco" />
<colors>
<option name="CARET_ROW_COLOR" value="2b2b2b" />
</colors>
<attributes>
<option name="CSS.IMPORTANT">
<value>
@edefiez
edefiez / keymap.cson
Last active January 15, 2016 07:48
atom config
'.editor':
'cmd-alt-l': 'editor:auto-indent'
# EMMET PLUGIN
'.editor:not(.mini)':
'ctrl-e': 'unset!' # remove all bindings
'ctrl-e': 'editor:move-to-end-of-line' # remap core binding
'alt-cmd-e' : 'emmet:expand-abbreviation' # alternate binding for emmet
'atom-text-editor.vim-mode.autocomplete-active':

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@edefiez
edefiez / AcmeI18nExtension.php
Created June 17, 2014 09:34
Symfony2 : i18n Routing ( Src: Garfield-FR)
<?php
namespace Acme\I18nBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
class AcmeI18nExtension extends Extension
@edefiez
edefiez / Passportjs-secure.js
Last active August 29, 2015 14:00
Passportjs protect site if user not logged
function ensureAuthenticated(req, res, next) {
if (req.isAuthenticated()) { return next(); }
res.redirect('/login')
}
app.all('*', function(req,res,next){
if (req.params === '/' || req.params === '/login')
next();
else
ensureAuthenticated(req,res,next);
@edefiez
edefiez / docpad.js
Last active May 9, 2016 14:46
docpad.js instead of docpad.coffee
var docpadConfig,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
docpadConfig = {
templateData: {
site: {
url: "http://website.com",
oldUrls: ['www.website.com', 'website.herokuapp.com'],
title: "Your Website",
description: "When your website appears in search results in say Google, the text here will be shown underneath your website's title.",