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
<!-- Cobertura Classpath --> | |
<path id="cobertura.classpath"> | |
<fileset dir="${basedir}"> | |
<include name="dev_libs/cobertura-1.9.4.1/cobertura.jar" /> | |
<include name="dev_libs/cobertura-1.9.4.1/lib/**/*.jar" /> | |
</fileset> | |
</path> | |
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/> | |
<!-- Cobertura Instrumentations --> | |
<target name="cobertura-instrument" depends="init,compile,compile-test,-pre-test-run"> |
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
$.ajax( { | |
url : action, | |
type : "GET", | |
dataType : "json", | |
data : { | |
dispatch : "tabelaProdutosVinculados", | |
codigoEmpresa : codigoEmpresaVal, | |
codigoProduto : codigoProdutoVal | |
}, | |
timeout : 5000, |
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
#!/usr/bin/sh | |
### Escrever Builder #### | |
function escreverBuilder() { | |
echo "package domain.builder;"; | |
echo ""; | |
echo "import domain.*;"; | |
echo ""; | |
echo "public final class ${POJO}Builder extends Builder<${POJO}> {"; | |
echo ""; |
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 domain.builder; | |
/** | |
* Abstract Builder | |
* | |
* @author Pedro Oliveira | |
*/ | |
public abstract class Builder<T> { | |
protected final T instance; |
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 final class CurrencyFormat { | |
public static String format(String valor) { | |
Currency curr = Currency.getInstance(new Locale("PT", "br")); | |
char[] reversed = new StringBuilder(valor).reverse().toString().toCharArray(); | |
StringBuilder sb = new StringBuilder(); | |
int index = 0; | |
for (char c : reversed) { | |
if (index == curr.getDefaultFractionDigits()) { | |
sb.append(","); | |
} else if (index == curr.getDefaultFractionDigits() + 3) { |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(60); | |
robot.turn(45); |
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
@Override | |
public final void onMessage(final Message message, final Channel channel) throws IOException { | |
try { | |
logger.all().logInfo(String.format("Received Message: %s",message)); | |
Assert.notNull(message, "Unknow message: " + message); | |
if (consumerEnabled()) { | |
T object = getObject(message); | |
this.beforeOnMessage(object); | |
R response = this.onMessage(object); | |
this.afterOnMessage(object); |
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
#!/bin/bash | |
function findClassesToImplementSerializable() { | |
for filename in $(find . -name "*.java"); | |
do | |
echo $filename | /bin/grep -v "test"; | |
if [ "${?}" -eq 0 ] | |
then | |
echo "$filename"; | |
changeline; | |
fi |
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 EuclideanAlgorithm { | |
private final List<Long> numbers; | |
public EuclideanAlgorithm(final List<Long> numbers) { | |
this.numbers = Collections.unmodifiableList(numbers); | |
} | |
public long calculateGCD() { | |
Iterator<Long> it = numbers.iterator(); |
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.io.*; | |
import java.util.*; | |
public class Solution { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int testCases = in.nextInt(); | |
for (int i=0; i< testCases; i++) { | |
if (in.hasNextLong()) { |
OlderNewer