Skip to content

Instantly share code, notes, and snippets.

View silasrm's full-sized avatar

Silas Ribas Martins silasrm

View GitHub Profile
@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 / explicação
Last active June 22, 2016 12:25
AngularJS
AngularACL
Criar as classes:
UserObj, onde é obrigatório ter a as propriedades:
- isLogged: true|false
- roles: array
- name: string
Security, onde irá ter métodos para checagem de permissão, recebendo o usuário (instância de UserObj)
e o nome da rota, onde irá checar se a rota existe, e se existir, checa se o usuário possui alguma das
roles que a rota necessita.
Delivered-To: [email protected]
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: <[email protected]>
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 <[email protected]>;
@silasrm
silasrm / phpstorm-vs-sublimetext-shortcuts.md
Last active March 27, 2025 15:23
Teclas de atalhos do PHPStorm com funções semelhantes ao Sublime Text, e outras interessantes.

#Teclas de atalhos do PHPStorm com funções semelhantes ao Sublime Text, e outras interessantes.

Sublime Text PHPStorm Função
CMD+P CMD+Shift+O Busca por arquivos no projeto
CMD+R CMD+F12 (1) Lista os métodos da classe e outros símbolos
CMD+F CMD+F Busca no arquivo
CMD+Option+F CMD+R Busca e troca os valores no arquivo
CMD+Shift+F CMD+Shift+F Busca, busca e troca e outros em um determinado caminho com várias regras.
CMD+D (2) Option+Up (2) Seleciona palavra

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.
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 "*"

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:

#############################################################################
## data source definitions
#############################################################################
source users
{
# data source type. mandatory, no default value
# known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc
type = mysql
@silasrm
silasrm / gist:7878113
Last active December 30, 2015 19:59 — forked from anonymous/gist:7875399
$(function () {
var contadorCamposAdicionar = 1;
removeCampo('box-pedido-produto-1');
function removeCampo(idNovoCampo) {
var novoCampo = $('#'+idNovoCampo+' a.removerCampo');
novoCampo.unbind("click");
@silasrm
silasrm / gist:7878049
Last active December 30, 2015 19:59 — forked from anonymous/gist:7875395
<div id="box-pedido-produto-1" class="linhas">
<span>
Produto
<a href="#" class="removerCampo" data-id="box-pedido-produto-1"><img src="ico/no.png" class=" pedido-no" /></a>
</span>
<input type="text" class="produto_autocomplete produto" name="produto[]" data-count="1" />
<div id="produto_qv-1"></div>
</div>