Skip to content

Instantly share code, notes, and snippets.

View dennysfredericci's full-sized avatar

Dennys dennysfredericci

View GitHub Profile
@dennysfredericci
dennysfredericci / PedidoAspect
Created April 17, 2013 02:47
A simple way to "build" a proxy for aspectj applications
@Aspect
public class PedidoAspect {
public interface Customer {
String getNome();
};
@DeclareParents("br.com.test.Cliente")
public static Customer customer;
@dennysfredericci
dennysfredericci / change_password.sql
Created September 3, 2012 02:36
Just change mysql password for any user...
USE mysql;
UPDATE user SET password=PASSWORD("root") WHERE user = 'root';
FLUSH PRIVILEGES;
@dennysfredericci
dennysfredericci / jquery-validation-messages.js
Created July 2, 2012 04:16
JQuery Validation Messages for pt_BR
/*
* Translated default messages for the jQuery validation plugin.
* Locale: PT_BR
*/
jQuery.extend(jQuery.validator.messages, {
required: "Campo obrigatório!",
remote: "Por favor, corrija este campo.",
email: "Por favor, forneça um endereço eletrônico válido.",
url: "Por favor, forneça uma URL válida.",
date: "Por favor, forneça uma data válida.",
@dennysfredericci
dennysfredericci / validator
Created July 2, 2012 03:56
An easy way to use JQuery Validation with Twitter Bootstrap Popover
$('form').validate(
{
rules: {
numero: {
required: true
},
descricao: {
minlength: 3,
email: true,
required: true
@dennysfredericci
dennysfredericci / serial.rb
Created June 12, 2012 13:58
ruby script to serial port
require 'rubygems'
require 'serialport'
begin
parameters = {"baud" => 19200, "data_bits" => 8, "stop_bits"=>1,"parity"=>SerialPort::NONE}
comm_port = '/dev/tty.usbmodem411'
sp = SerialPort.new(comm_port, parameters)
@dennysfredericci
dennysfredericci / gist:2351936
Created April 10, 2012 14:51
Download de boleto com vraptor e bopepo(jrimum.org)
No controller:
@Get("/cobrancas/{cobranca.id}/boleto")
public Download gerarBoleto(@Load Cobranca cobranca) {
Boleto boleto = cobranca.gerarBoleto();
BoletoDownload download = new BoletoDownload(boleto);
return download;
}
Classe para auxiliar o download:
@dennysfredericci
dennysfredericci / Validator.java
Created January 12, 2012 00:05
Alternativa para o Validator no VRaptor, este incluir um mapa dos erros no request e não uma lista como é feito no DefaultValidator.
package br.com.fredericci.validation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;