Skip to content

Instantly share code, notes, and snippets.

Avatar

Dennys dennysfredericci

View GitHub Profile
@dennysfredericci
dennysfredericci / Validator.java
Created Jan 12, 2012
Alternativa para o Validator no VRaptor, este incluir um mapa dos erros no request e não uma lista como é feito no DefaultValidator.
View Validator.java
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;
@dennysfredericci
dennysfredericci / gist:2351936
Created Apr 10, 2012
Download de boleto com vraptor e bopepo(jrimum.org)
View gist:2351936
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 / serial.rb
Created Jun 12, 2012
ruby script to serial port
View serial.rb
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 / validator
Created Jul 2, 2012
An easy way to use JQuery Validation with Twitter Bootstrap Popover
View validator
$('form').validate(
{
rules: {
numero: {
required: true
},
descricao: {
minlength: 3,
email: true,
required: true
@dennysfredericci
dennysfredericci / jquery-validation-messages.js
Created Jul 2, 2012
JQuery Validation Messages for pt_BR
View jquery-validation-messages.js
/*
* 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 / change_password.sql
Created Sep 3, 2012
Just change mysql password for any user...
View change_password.sql
USE mysql;
UPDATE user SET password=PASSWORD("root") WHERE user = 'root';
FLUSH PRIVILEGES;
@dennysfredericci
dennysfredericci / PedidoAspect
Created Apr 17, 2013
A simple way to "build" a proxy for aspectj applications
View PedidoAspect
@Aspect
public class PedidoAspect {
public interface Customer {
String getNome();
};
@DeclareParents("br.com.test.Cliente")
public static Customer customer;
@dennysfredericci
dennysfredericci / web.xml
Created Jul 2, 2013
web.xml spec 3.0 sample
View web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0">
       
  <servlet>
   <display-name>Servlet1</display-name>
   <servlet-name>Servlet1</servlet-name>
   <servlet-class>test.Servlet1</servlet-class>
   <init-param>
View XmlFormatter.java
import java.io.File;
import java.io.FileWriter;
import org.jdom2.Document;
import org.jdom2.input.SAXBuilder;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
public class XmlFormatter
@dennysfredericci
dennysfredericci / application.html.erb
Created Apr 21, 2014
A simple html page to read informations from facebook
View application.html.erb
<html>
<head>
<title>Fluid Canvas HTML Example </title>
</head>
<body>
<div id="allContent" class="span12">
<form class="form-horizontal">