Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Ruckwood jon-ruckwood

View GitHub Profile
@jon-ruckwood
jon-ruckwood / Java14RecordExample.java
Created Apr 25, 2020
Compile with `--enable-preview`
View Java14RecordExample.java
public class Java14RecordExample {
public static void main(String[] args) {
var p = new Person("Boz", "Scaggs");
System.out.println("toString(): " + p);
System.out.println("---");
System.out.println("Howdy " + p.name() + "!");
}
}
@jon-ruckwood
jon-ruckwood / RecordExample.java
Created Jan 17, 2020
Java 14 record example, compile and run with `--enable-preview`
View RecordExample.java
public class RecordExample {
public static void main(String[] args) {
Interval i = new Interval(1, 2);
System.out.println("interval: " + i);
}
record Interval(int begin, int end) {
}
View keybase.md

Keybase proof

I hereby claim:

  • I am jon-ruckwood on github.
  • I am jonruckwood (https://keybase.io/jonruckwood) on keybase.
  • I have a public key ASD48-tGDeaPKLmIraDUETGDE-w5eHJnNvkHlpRX1w377go

To claim this, I am signing this object:

View word_count.go
package main
import (
"strings"
"golang.org/x/tour/wc"
)
func WordCount(s string) map[string]int {
counts := make(map[string]int)
View dashboard-adminuser.yaml
# refer to - https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
View brave.md

Dependencies

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.zipkin.brave</groupId>
                <artifactId>brave-bom</artifactId>
                <version>5.6.0</version>
                <type>pom</type>
                <scope>import</scope>
@jon-ruckwood
jon-ruckwood / JUnit5IgnoreException.java
Created May 16, 2018
Mini JUnit5 extension simulating the useful expected exception functionality of JUnit4
View JUnit5IgnoreException.java
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface IgnoreException {
Class<? extends Throwable>[] value();
}
public class IgnoreExceptionExtension implements TestExecutionExceptionHandler {
@Override
public void handleTestExecutionException(ExtensionContext context, Throwable throwable) throws Throwable {
IgnoreException annotation = context.getRequiredTestMethod().getAnnotation(IgnoreException.class);
@jon-ruckwood
jon-ruckwood / Java9AndJava10TheKeyPartsNotes.java
Last active May 9, 2018
Notes on Venkat Subramaniam's Java 9 and Java 10: The Key Parts
View Java9AndJava10TheKeyPartsNotes.java
// Java 9
// JDK improvements
Stream#takeWhile // `limit` using a predicate, i.e. `break`
Stream#dropWhile // `skip` using a predicate, i.e. `continue`
Stream#iterate // emulate a for-loop with a stream, e.g. (not previously possible)
View zaw.zsh
zstyle ':prezto:module:zaw' default-history-search 'yes'
zstyle ':filter-select:highlight' matched fg=green
zstyle ':filter-select' max-lines 3
zstyle ':filter-select' case-insensitive yes # enable case-insensitive
zstyle ':filter-select' extended-search yes # see below
@jon-ruckwood
jon-ruckwood / intellij.md
Last active Feb 1, 2018
Intellij bits and pieces
View intellij.md

Live Templates

ee – JUnit ExpectedException rule
@org.junit.Rule
public org.junit.rules.ExpectedException expectedException = org.junit.rules.ExpectedException.none();$CURSOR$
mk – JUnit Mockito rule
You can’t perform that action at this time.