This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Calendar; | |
public final class Periodo { | |
private final Calendar inicio; | |
private final Calendar fim; | |
public Periodo(Calendar inicio, Calendar fim) { | |
this((Calendar) inicio.clone(), (Calendar) fim.clone(), false); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Calculadora { | |
private static final Prova _ = of(Prova.class); | |
public double mediaDeProvas(List<Prova> provas) { | |
return mediaPonderada(provas, function(_.getNota()), function(_.getPeso())); | |
} | |
public <T> double mediaPonderada(List<T> lista, Function<T, Double> valor, Function<T, Double> peso) { | |
double soma = 0.0; | |
double somaPesos = 0.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
${e:import(org.apache.commons.lang3.builder.EqualsBuilder)} | |
${h:import(org.apache.commons.lang3.builder.HashCodeBuilder)} | |
@Override | |
public boolean equals(Object object) { | |
if (object instanceof ${enclosing_type}) { | |
${enclosing_type} another = (${enclosing_type}) object; | |
return new EqualsBuilder().append(${replaceWithFieldName}, another.${replaceWithFieldName}).isEquals(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.activemq.camel.component.ActiveMQComponent | |
import org.apache.camel.CamelContext | |
import org.apache.camel.builder.RouteBuilder | |
import org.apache.camel.impl.DefaultCamelContext | |
class CopyFromOneServerToAnother extends RouteBuilder{ | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page language="java" contentType="text/html;charset=UTF-8" %> | |
<%@ page import="org.apache.log4j.Level" %> | |
<%@ page import="org.apache.log4j.LogManager" %> | |
<%@ page import="org.apache.log4j.Logger" %> | |
<%@ page import="java.util.HashMap" %> | |
<%@ page import="java.util.Enumeration" %> | |
<%@ page import="java.util.Set" %> | |
<%@ page import="java.util.Arrays" %> | |
<% long beginPageLoadTime = System.currentTimeMillis();%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
* New-iTerm-Window.scpt | |
* | |
* Intended for use with QuickSilver | |
* I mapped option-y to running this script to create | |
* a new iTerm window on the current workspace | |
* | |
* Based on much Googling - very little "original" code here | |
* Comments/Suggestions to brad.lhotsky@gmail.com | |
*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" | |
jaxb:extensionBindingPrefixes="xjc"> | |
<jaxb:globalBindings | |
fixedAttributeAsConstantProperty="true" | |
typesafeEnumBase="xs:string" | |
typesafeEnumMemberName="generateName" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package xml.adapters.jodatime; | |
import javax.xml.bind.annotation.adapters.XmlAdapter; | |
import org.joda.time.LocalDateTime; | |
/** | |
* LocalDateTimeAdapter, useful to convert String to Joda Time's LocalDateTime and conversely, for use with JAXB 2.0. | |
* <br> | |
* Can be used when customizing XML Schema to Java Representation Binding (XJC). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gabrielbauman.gist; | |
import java.util.regex.Pattern; | |
public enum CardType { | |
UNKNOWN, | |
VISA("^4[0-9]{12}(?:[0-9]{3}){0,2}$"), | |
MASTERCARD("^(?:5[1-5]|2(?!2([01]|20)|7(2[1-9]|3))[2-7])\\d{14}$"), | |
AMERICAN_EXPRESS("^3[47][0-9]{13}$"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.syspdv.nfe.utils; | |
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.net.URL; | |
import java.security.Security; | |
import javax.xml.soap.MessageFactory; | |
import javax.xml.soap.MimeHeaders; | |
import javax.xml.soap.SOAPConnection; |
OlderNewer