Skip to content

Instantly share code, notes, and snippets.

View colinbut's full-sized avatar
🎯
Focusing

Colin But colinbut

🎯
Focusing
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<dependencies>
<dependency>
<groupId>com.homeaway.devtools.jenkins</groupId>
<artifactId>jenkins-spock</artifactId>
<version>${jenkins-spock.version}</version>
<scope>test</scope>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- Other code omitted for brevity -->
<repositories>
<repository>
<id>jenkins-releases</id>
<name>Jenkins Releases</name>
<url>http://repo.jenkins-ci.org/releases</url>
import com.mycompany.colinbut.Constants
import com.mycompany.colinbut.DockerEcr
def call(Map args) {
node {
stage("Checkout") {
git credentialsId: Constants.JENKINS_GITHUB_CREDENTIALS_ID, url: "https://github.com/colinbut/${args.repo}.git"
}
stage("Compile") {
package com.mycompany.colinbut
class Git implements Serializable {
private final def script
Git(def script) {
this.script = script
}
package com.mycompany.colinbut
class DockerEcr implements Serializable {
private final def script
static final String awsRegion = "eu-west-2"
static final String dockerUser = "AWS"
static final String dockerRegistryIdentifier = "{AWS_ACCOUNT_ID}.dkr.ecr.eu-west-2.amazonaws.com"
static final String dockerRegistryUrl = "https://${dockerRegistryIdentifier}"
@colinbut
colinbut / PersonModel.java
Created July 13, 2021 21:51
For my MVC Deep Dive blog
package com.mycompany.mvc.examples.button.example1;
import java.util.Observable;
/**
* This is the model of the MVC. It knows nothing of the Views or the Controller.
* It only knows of Observers where it sends them update when anything changes
*
* @author colin
*
public void findWinners(List<Player> players) {
Map<Player, Integer> playersPoints = new HashMap<>();
for (Player player: players){
List<Card> cards = player.getHand();
int totalCount = 0;
for (Card card : cards) {
totalCount += card.getPoint();
}
if (totalCount > 21) {
<dependency>
<groupId>org.fluentlenium</groupId>
<artifactId>fluentlenium-core</artifactId>
<version>${fluentlenium-lib-version}</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</exclusion>
</exclusions>
public class Money {
private BigDecimal price;
private Currency currency;
public Money(BigDecimal price, Currency currency) {
this.price = price;
this.currency = currency;
}
public BigDecimal getPrice() {
FROM openjdk:8
COPY target/app-*-SNAPSHOT.jar /usr/local/bin/app.jar
RUN chmod +x /usr/local/bin/app.jar
CMD ["java", "-jar", "/usr/local/bin/app.jar"]