Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Vaughan vaughandroid

View GitHub Profile
View types.markdown

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@swankjesse
swankjesse / HostSelectionInterceptor.java
Last active Oct 27, 2020
This OkHttp application interceptor will replace the destination hostname in the request URL.
View HostSelectionInterceptor.java
import java.io.IOException;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
/** An interceptor that allows runtime changes to the URL hostname. */
public final class HostSelectionInterceptor implements Interceptor {
private volatile String host;
@JakeWharton
JakeWharton / ShampooRule.java
Last active Jan 1, 2020
Got flaky tests? Shampoo them away with a quick JUnit rule. Apache 2.
View ShampooRule.java
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
/** Got flaky tests? Shampoo them away. */
public final class ShampooRule implements TestRule {
private final int iterations;
public ShampooRule(int iterations) {
if (iterations < 1) throw new IllegalArgumentException("iterations < 1: " + iterations);
@sloria
sloria / bobp-python.md
Last active Dec 1, 2020
A "Best of the Best Practices" (BOBP) guide to developing in Python.
View bobp-python.md

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
You can’t perform that action at this time.