This file contains hidden or 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 util.graphics; | |
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import javax.swing.SwingUtilities; | |
import javax.swing.WindowConstants; |
This file contains hidden or 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.File; | |
import java.io.IOException; | |
import java.io.RandomAccessFile; | |
import java.nio.MappedByteBuffer; | |
import java.nio.channels.FileChannel; | |
import org.junit.Rule; | |
import org.junit.Test; | |
import org.junit.rules.TemporaryFolder; | |
import static org.junit.Assert.assertEquals; |
This file contains hidden or 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
/** Rounds a double value to a specified number of decimal places. */ | |
public static double round(double value, int scale) { | |
return new BigDecimal(value).setScale(scale, RoundingMode.HALF_UP).doubleValue(); | |
} |
This file contains hidden or 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.springframework.boot.CommandLineRunner; | |
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
import org.springframework.context.annotation.ComponentScan; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.FilterType; | |
@Configuration | |
@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = CommandLineRunner.class)) | |
@EnableAutoConfiguration | |
public class TestApplicationConfiguration { |
This file contains hidden or 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.sql.Connection; | |
import java.sql.SQLException; | |
import mockit.Expectations; | |
import mockit.Mocked; | |
import mockit.NonStrictExpectations; | |
import org.junit.Ignore; | |
import org.junit.Test; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.fail; |
This file contains hidden or 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 org.jboss.as.server; | |
import java.util.concurrent.ConcurrentSkipListSet; | |
import org.jboss.as.server.deployment.DeploymentPhaseContext; | |
import org.jboss.as.server.deployment.DeploymentUnit; | |
import org.jboss.as.server.deployment.DeploymentUnitProcessingException; | |
import org.jboss.as.server.deployment.DeploymentUnitProcessor; | |
import org.jboss.as.server.deployment.Phase; | |
import org.jboss.as.server.deployment.SubDeploymentProcessor; | |
import org.jboss.as.server.deployment.annotation.AnnotationIndexProcessor; |
This file contains hidden or 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/env bash | |
# Runs a command in a given directory and preserves the $? of the command | |
# Example: "runin /src/project mvn install" | |
function runin { | |
pushd $1 | |
shift | |
"$@" | |
local STATUS=$? | |
popd |
This file contains hidden or 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
<object type="$obj_type$"> | |
<$tag$/> | |
<property> | |
<$tag2$/> | |
<customtag name="poll"/> | |
<$tag3$/> | |
</property> | |
<$tag4$/> | |
</object> |
This file contains hidden or 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
set incsearch | |
set hlsearch | |
set ignorecase | |
set smartcase | |
set tabstop=4 shiftwidth=4 expandtab | |
set clipboard=unnamed |
This file contains hidden or 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
// Splitting an empty string returns an array with an empty string | |
assert "".split(";") == [""] | |
// Splitting a string consisting of just the delimiter returns an empty array | |
assert ";".split(";") == [] | |
// Trailing delimiters are ignored | |
assert "1;;2;;".split(";") == ["1", "", "2"] | |
// ... but the behavior becomes consistent with a -1 extra argument | |
assert ";".split(";", -1) == ["", ""] | |
assert "1;;2;;".split(";", -1) == ["1", "", "2", "", ""] |