Skip to content

Instantly share code, notes, and snippets.

View adam-arold's full-sized avatar
💭
Exploring the n'th dimension.

Adam Arold adam-arold

💭
Exploring the n'th dimension.
View GitHub Profile
@adam-arold
adam-arold / HOWTO.md
Created January 11, 2016 16:41 — forked from kylefrost/HOWTO.md
How-To: Tweet All Commit Messages

Creating the post-commit file

Note: If you want to use your personal Twitter account to post commits, go to Step 2

  1. Create a new Twitter account for your commit messages. Example
  2. Go to http://dev.twitter.com and Sign In with your Twitter account you are posting commit messages to.
  3. Hover over your username in the top-right corner after signing in and select "My Applications"
  4. Create a new application
  5. The name, description, and site can all be whatever you want, but leave Callback URL empty
  6. Under "Application Settings" click "modify app permissions" next to "Access level"
@adam-arold
adam-arold / MockitoHelper.ht
Created May 7, 2017 09:22
Mockito helper to make `any` work in Kotlin
import org.mockito.Mockito
class MockitoHelper {
companion object {
fun <T> any(): T {
Mockito.any<T>()
return uninitialized()
}
private fun <T> uninitialized(): T = null as T
package com.valkryst.VTerminal.samples;
import com.valkryst.VTerminal.Panel;
import com.valkryst.VTerminal.builder.PanelBuilder;
import com.valkryst.VTerminal.font.Font;
import com.valkryst.VTerminal.font.FontLoader;
import java.awt.*;
import java.io.IOException;
import java.net.URISyntaxException;
@adam-arold
adam-arold / java_pojo.java
Created September 11, 2017 16:19
Kotlin is the new Java - Java POJO
/**
* A plain old Java object with all the boilerplate.
*/
public class HexagonValueObject {
private final int x;
private final int y;
private final int z;
public HexagonValueObject(int x, int y, int z) {
@adam-arold
adam-arold / HexagonDataClass.kt
Created September 11, 2017 16:25
Kotlin data class
data class HexagonDataClass(val x: Int, val y: Int, val z: Int)
@adam-arold
adam-arold / JavaUser.java
Created September 11, 2017 16:26
Java user
public class JavaUser {
private final String name;
private final int age;
public String toHumanReadableFormat() {
return "JavaUser{" +
"name='" + name + '\'' +
", age=" + age +
'}';
}
@adam-arold
adam-arold / KotlinUser.kt
Last active September 11, 2017 16:27
Kotlin user
class KotlinUser(val name: String, val age: Int) {
fun toHumanReadableFormat() = "JavaUser{name='$name', age=$age}"
fun toHumanReadableFormatWithMethodCall() =
"JavaUser{name='${name.capitalize()}', age=$age}"
}
@adam-arold
adam-arold / ListPresenterDecorator.java
Created September 11, 2017 16:28
List presenter decorator
public class ListPresenterDecorator<T> extends AbstractList<T> {
private List<T> list;
public ListPresenterDecorator(List<T> list) {
this.list = list;
}
public String present() {
return list.stream()
@adam-arold
adam-arold / ListExtensionsKt.kt
Created September 11, 2017 16:30
List.present
fun <T> List<T>.present() = this.joinToString(", ")
@adam-arold
adam-arold / JavaUser.java
Created September 11, 2017 16:31
Java user
public class JavaUser {
static class Address {
String city;
}
private final String firstName;
private final String lastName;
private final List<Address> addresses;