Skip to content

Instantly share code, notes, and snippets.

$ find .
.
./classes
./source
./source/local
./source/local/User1.java
./source/foreign
./source/foreign/User2.java
$
$ javac -d ./classes source/local/*.java source/foreign/*.java
@nhojpatrick
nhojpatrick / Example.java
Last active February 27, 2018 11:42
Method Chaining Example
package tld.examples;
public class Example {
protected String mandatory;
protected String optional;
protected String mandatoryIfOptionalExists;
private Example() {
}
@nhojpatrick
nhojpatrick / Example.java
Created March 5, 2018 13:34
JUnit 5 assertAll as Executable
package tld.example;
import org.junit.jupiter.api.function.Executable;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Example {
@Test
public void example() {
assertAll("parent",
() -> assertEquals("1", "2"),
@nhojpatrick
nhojpatrick / ExampleNoPackagePackagePrivateAbstract.java
Created March 24, 2018 11:18
Java files can start with these...
abstract class ExampleNoPackagePackagePrivateAbstract {}
@nhojpatrick
nhojpatrick / example.json
Created June 18, 2018 17:28
example json
{
"id": 1234,
"name": "a name",
"dynamicsection": {
"key1": 1,
"key2": false,
"key3": "a string"
}
}
@nhojpatrick
nhojpatrick / indent.py
Last active June 21, 2018 21:23
Python indentation demo
#!/usr/bin/env python
def indent():
logic1 = True
logic2 = True
if logic1 :
print("A")
if not logic2 :
print("B")
else :
@nhojpatrick
nhojpatrick / ansible-apt-issue.artful64.log
Last active June 23, 2018 12:11
ansible-apt-issue.artful64.log
loki:ansible-apt-issue john$ vagrant up ansible-apt-module
Bringing machine 'ansible-apt-module' up with 'virtualbox' provider...
==> ansible-apt-module: Importing base box 'ubuntu/artful64'...
==> ansible-apt-module: Matching MAC address for NAT networking...
==> ansible-apt-module: Checking if box 'ubuntu/artful64' is up to date...
==> ansible-apt-module: Setting the name of the VM: ansible-apt-issue_ansible-apt-module_1529753061622_14729
==> ansible-apt-module: Fixed port collision for 22 => 2222. Now on port 2200.
==> ansible-apt-module: Clearing any previously set network interfaces...
==> ansible-apt-module: Preparing network interfaces based on configuration...
ansible-apt-module: Adapter 1: nat
@nhojpatrick
nhojpatrick / ansible-apt-issue.bionic64.log
Last active June 23, 2018 12:11
ansible-apt-issue.bionic64.log
loki:ansible-apt-issue john$ vagrant up ansible-apt-module
Bringing machine 'ansible-apt-module' up with 'virtualbox' provider...
==> ansible-apt-module: Importing base box 'ubuntu/bionic64'...
==> ansible-apt-module: Matching MAC address for NAT networking...
==> ansible-apt-module: Checking if box 'ubuntu/bionic64' is up to date...
==> ansible-apt-module: Setting the name of the VM: ansible-apt-issue_ansible-apt-module_1529754013294_58923
==> ansible-apt-module: Fixed port collision for 22 => 2222. Now on port 2200.
==> ansible-apt-module: Clearing any previously set network interfaces...
==> ansible-apt-module: Preparing network interfaces based on configuration...
ansible-apt-module: Adapter 1: nat
@nhojpatrick
nhojpatrick / Employee.java
Created July 22, 2018 12:47
Employee Builder example
public class Employee {
public static class Builder<T extends Employee> {
private T entity;
public Builder() {
this.entity = new Employee();
}
@nhojpatrick
nhojpatrick / RajR.java
Last active September 1, 2018 13:11
RajR.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class RajR {
public static class Person {
private final String firstname;
private final String surname;