Skip to content

Instantly share code, notes, and snippets.

Avatar

Dennys dennysfredericci

View GitHub Profile
@dennysfredericci
dennysfredericci / search-ul-li-item.js
Created Jul 22, 2014
A simple jquery code to search a text inside of li tag
View search-ul-li-item.js
//searchText is a input type text
$('#searchText').bind('keyup', function() {
var searchString = $(this).val();
$("ul li").each(function(index, value) {
currentName = $(value).text()
if( currentName.toUpperCase().indexOf(searchString.toUpperCase()) > -1) {
@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 / TibcoListener.java
Created Oct 16, 2014
Tibco Rendezvous Listener Sample
View TibcoListener.java
package br.com.fredericci.test;
import java.util.Date;
import com.tibco.tibrv.Tibrv;
import com.tibco.tibrv.TibrvException;
import com.tibco.tibrv.TibrvListener;
import com.tibco.tibrv.TibrvMsg;
import com.tibco.tibrv.TibrvMsgCallback;
import com.tibco.tibrv.TibrvRvdTransport;
View GenderConverter.java
@Converter
public class GenderConverter implements AttributeConverter<Gender, String> {
@Override
public String convertToDatabaseColumn(Gender gender) {
return gender.getCode();
}
@Override
public Gender convertToEntityAttribute(String code) {
View Person.java
@Entity
public class Person {
@Id
private Long id;
private String firstName;
private String lastName;
@Convert(converter = GenderConverter.class)
private Gender gender;
View Gender.java
public enum Gender {
FEMALE("F"),
MALE("M"),
NOT_AVAILABLE("N");
private final String code;
Gender(String code) {
this.code = code;
View GenderConverter.java
@Converter
public class GenderConverter implements AttributeConverter<Gender, String> {
@Override
public String convertToDatabaseColumn(Gender gender) {
return gender.getCode();
}
@Override
public Gender convertToEntityAttribute(String code) {
View Gender.java
public enum Gender {
FEMALE,
MALE,
NOT_AVAILABLE;
}
View Person.java
@Entity
public class Person {
@Id
private Long id;
private String firstName;
private String lastName;
@Enumerated(EnumType.STRING)
private Gender gender;
View GenderConverter.java
@Converter(autoApply = true)
public class GenderConverter implements AttributeConverter<Gender, String> {
@Override
public String convertToDatabaseColumn(Gender gender) {
return gender.getCode();
}
@Override
public Gender convertToEntityAttribute(String code) {