Skip to content

Instantly share code, notes, and snippets.

View antonarhipov's full-sized avatar
💣

Anton Arhipov antonarhipov

💣
View GitHub Profile
//TestApplicaiton.kt
fun main(args: Array<String>) {
val application = Application.createSpringApplication()
application.addInitializers(AbstractIntegrationTest.Initializer())
application.run(*args)
}
//AbstratIntegrationTest.kt
import org.junit.runner.RunWith
import org.springframework.boot.test.context.SpringBootTest
//lazy singleton
object Singleton {
class Something
val INSTANCE by lazy { Something() }
}
// filtering positive integers
// Initialization-on-demand holder implementation of a lazy singleton
public class Something {
private Something() {}
private static class LazyHolder {
static final Something INSTANCE = new Something();
}
public static Something getInstance() {
@antonarhipov
antonarhipov / settings.kts
Created January 10, 2020 12:33
TeamCity Kotlin DSL - using type inheritance for settings reuse in build configurations
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot
version = "2019.2"
project {
vcsRoot(ProjectVcs)
buildType(BuildA)
@antonarhipov
antonarhipov / settings.kts
Created January 9, 2020 20:47
TeamCity Kotlin DSL - build configuration with template
version = "2019.2"
project {
vcsRoot(ProjectVcs)
buildType(Build)
template(MyTemplate)
}
object Build : BuildType({
// from https://twitter.com/ZacSweers/status/1199224945072623616
typealias NickName = JvmName
typealias MakeDaggerHappy = JvmSuppressWildcards
typealias ConfuseDagger = JvmWildcard
typealias MaybeThreadSafe = Volatile
typealias MaybeThreadSafeButFun = Synchronized
typealias MakeDaggerHappy2 = JvmStatic
typealias AutoConvertedJavaStuff = Throws
typealias NoTouchy = JvmSynthetic
@antonarhipov
antonarhipov / pom.xml
Created September 24, 2018 08:12
blog-component-branch
<properties>
<component.branch/>
</properties>
<dependency>
<groupId>org.arhan</groupId>
<artifactId>component</artifactId>
<version>1.0${component.branch}-SNAPSHOT</version>
</dependency>
@antonarhipov
antonarhipov / pom.xml
Created September 24, 2018 08:12
blog-property-vcs-branch
<properties>
<project.vcs.branch/>
</properties>
@antonarhipov
antonarhipov / pom.xml
Created September 24, 2018 08:09
blog-maven-jar-plugin
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
@antonarhipov
antonarhipov / pom.xml
Created September 24, 2018 08:08
blog-maven-deploy-plugin
<plugin>
<version>2.8.2</version>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>