Skip to content

Instantly share code, notes, and snippets.

View silasrm's full-sized avatar

Silas Ribas Martins silasrm

View GitHub Profile

Keybase proof

I hereby claim:

  • I am silasrm on github.
  • I am silasrm (https://keybase.io/silasrm) on keybase.
  • I have a public key whose fingerprint is 5A02 6B0D 749F 6E2F 7342 A708 72E2 3594 0EF4 5BFE

To claim this, I am signing this object:

AddType application/vnd.ms-fontobject .eot
AddType font/truetype .ttf
AddType font/opentype .otf
AddType font/opentype .woff
AddType image/svg+xml .svg .svgz
AddEncoding gzip .svgz
<FilesMatch "\.(ttf|otf|eot|woff|svg)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"

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.
Delivered-To: silasrm@gmail.com
Received: by 10.194.200.9 with SMTP id jo9csp116079wjc;
Wed, 4 Jun 2014 05:57:13 -0700 (PDT)
X-Received: by 10.68.170.66 with SMTP id ak2mr62431106pbc.5.1401886633031;
Wed, 04 Jun 2014 05:57:13 -0700 (PDT)
Return-Path: <bb@evdensiparis.com>
Received: from p3nlsmtp19.shr.prod.phx3.secureserver.net (p3nlsmtp19.shr.prod.phx3.secureserver.net. [72.167.234.244])
by mx.google.com with ESMTP id ez5si5552891pbc.174.2014.06.04.05.57.12
for <silasrm@gmail.com>;
@silasrm
silasrm / dateRange.filter.js
Last active August 29, 2015 14:04
Filtro de período para ngRepeat do AngularJS
// ########################################################################### //
// ########################################################################### //
// - DateRange - //
// ########################################################################### //
// #### Adaptado de http://stackoverflow.com/a/21176675/2417962 ##### //
// ########################################################################### //
// #### Exemplos: ##### //
// #### 1. Filtra os registros até data de hoje, usando a ##### //
// #### propriedade 'data_ocorrencia' (sem aspas) do objeto, ##### //
// #### sem incluir a data de hoje ##### //
@silasrm
silasrm / html2plaintext.filter.js
Last active August 29, 2015 14:04
Filtra códigos html e deixa somente texto
// ########################################################################### //
// ########################################################################### //
// - Html2Plaintext - //
// ########################################################################### //
// ########################################################################### //
define(
[
'app',
],
function(app) {
@silasrm
silasrm / truncate.filter.js
Last active August 29, 2015 14:04
Filtro que trunca uma string e adiciona uma string no final (por default sendo '...')
// ########################################################################### //
// ########################################################################### //
// - Truncate - //
// ########################################################################### //
// ########################################################################### //
/**
* Truncate Filter
* @Param text
* @Param length, default is 10
* @Param end, default is "..."
@silasrm
silasrm / Form.php
Last active August 29, 2015 14:24 — forked from jgornick/Form.php
<?php
// ...
$this->addElementPrefixPath('My_Validate', 'My/Validate/', 'validate');
$this->addElement('text', 'start_time', array(
'label' => 'Start Time (GMT)',
'class' => 'datetime',
'required' => true,
'validators' => array(
@silasrm
silasrm / CpfCnpj.php
Last active August 29, 2015 14:24 — forked from afranioce/CpfCnpj.php
<?php
namespace Obras\Bundle\CadastroBundle\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
/**
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*
@silasrm
silasrm / redis_
Last active August 29, 2015 14:27 — forked from colinmollenhour/redis_
Munin plugin for Redis with added options
#!/usr/bin/perl -w
#
## Copyright (C) 2011 Colin Mollenhour <http://colin.mollenhour.com/>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; version 2 dated June,
## 1991.
##