Skip to content

Instantly share code, notes, and snippets.

@EudesSilva
EudesSilva / gulp-top-tasks.js
Last active May 24, 2017 21:43
various util plugins from gulp
# npm install --save-dev gulp-connect
//LiveReload
var gulp = require('gulp'),
connect = require('gulp-connect');
gulp.task('connect', function() {
connect.server({
root: 'app',
@EudesSilva
EudesSilva / commons-proxy.sh
Last active July 17, 2024 07:33
Config proxy in Git, Yarn, Bower, NPM, Maven, Docker, Gradle, General
#Configuration Proxy
#Git
git config --global http.proxy http://<username>:<password>@<proxy-port>
git config --global https.proxy http://<username>:<password>@<proxy-port>
@EudesSilva
EudesSilva / HelperUpload.java
Created March 17, 2013 20:05
FileUpload, criar um diretório chamando ( upload ) na raiz do sistema, quando o arquivo for salvo será associado um número randomizado ao seu nome para evitar repetições.
package br.com.javamais.helper;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
@EudesSilva
EudesSilva / load_spring_files_configurations_web.xml
Created March 17, 2013 19:55
Define os arquivos de configurações do spring para serem carregados.
<!-- Spring 3 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml,
/WEB-INF/spring-data.xml,
/WEB-INF/spring-mail.xml
</param-value>
</context-param>
@EudesSilva
EudesSilva / define_spring_para_controlar_sessao_web.xml
Created March 17, 2013 19:54
Direciona o controle de sessão para o Spring.
<!-- Controla a sessao -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
@EudesSilva
EudesSilva / erro_404_web.xml
Created March 17, 2013 19:53
Quando ocorrer o erro 404, redireciona para página definida.
<error-page>
<error-code>404</error-code>
<location>/erropage</location>
</error-page>
@EudesSilva
EudesSilva / trata_exception_web.xml
Created March 17, 2013 19:52
Redireciona para uma página defina, quando ocorrer exceção no sistema.
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/erropage/</location>
</error-page>
@EudesSilva
EudesSilva / restrict_acess_in_xhtml_web.xml
Created March 17, 2013 19:51
Bloqueia o acesso as páginas xhtml puras, sem processamento.
<!-- Bloqueia o acesso à arquivos xhtml -->
<security-constraint>
<web-resource-collection>
<web-resource-name>xhtml files</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
@EudesSilva
EudesSilva / theme_primefaces_web.xml
Created March 17, 2013 19:50
Define um tema do primefaces
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>aristo</param-value>
</context-param>
@EudesSilva
EudesSilva / web.xml
Created March 17, 2013 19:49
Enable escaping of form submission contents. Fornece scape para as tags html dentro das páginas xhtml
<!-- Enable escaping of form submission contents -->
<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>true</param-value>
</context-param>