Skip to content

Instantly share code, notes, and snippets.

View outofcoffee's full-sized avatar

Pete Cornish outofcoffee

View GitHub Profile
public class RoboActionBarActivity extends ActionBarActivity implements RoboContext {
protected EventManager eventManager;
protected HashMap<Key<?>, Object> scopedObjects = new HashMap<Key<?>, Object>();
@Inject
ContentViewListener ignored; // BUG find a better place to put this
@Override
protected void onCreate(Bundle savedInstanceState) {
public class RoboActionBarActivity extends ActionBarActivity implements RoboContext {
protected EventManager eventManager;
protected HashMap<Key<?>, Object> scopedObjects = new HashMap<Key<?>, Object>();
@Inject
ContentViewListener ignored; // BUG find a better place to put this
@Override
protected void onCreate(Bundle savedInstanceState) {
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="schwiz.net.weartest" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
import org.jboss.aesh.cl.CommandDefinition;
import org.jboss.aesh.cl.GroupCommandDefinition;
import org.jboss.aesh.cl.Option;
import org.jboss.aesh.console.AeshConsole;
import org.jboss.aesh.console.AeshConsoleBuilder;
import org.jboss.aesh.console.Prompt;
import org.jboss.aesh.console.command.Command;
import org.jboss.aesh.console.command.CommandResult;
import org.jboss.aesh.console.command.invocation.CommandInvocation;
import org.jboss.aesh.console.command.registry.AeshCommandRegistryBuilder;
@outofcoffee
outofcoffee / gradle-kotlin-publish-s3-maven-repo.gradle
Last active March 4, 2019 11:40
Publish a Kotlin module to an S3 Maven repository, using Gradle.
/*
* Publish a Kotlin module to an S3 Maven repository, using Gradle.
* This assumes that the AWS/IAM credentials have 'bucket list' as well as 'object put' and 'object get' permissions.
*/
ext.version_kotlin = '1.0.5-2'
buildscript {
repositories {
mavenCentral()
@outofcoffee
outofcoffee / build.gradle
Created June 11, 2017 11:44
Load project version from properties file
def projectVersion = new File("${project.rootDir}/version.properties").withInputStream { is ->
new Properties().with { load((InputStream) is); delegate }
}['version']
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
public class ChildFirstClassLoader extends URLClassLoader {
Edit your $GROOVY_HOME/conf/groovy-start.conf and add the following line:
load !{user.home}/.groovy/grapes/**.jar
After that your @Grab will work as advertised:
#!/usr/bin/env groovy
@Grab(group='mysql', module='mysql-connector-java', version='5.1.12')
import groovy.sql.Sql
@outofcoffee
outofcoffee / RestAssuredKotlin.md
Created July 25, 2017 20:07
DSL for using RestAssured with Kotlin

DSL for using RestAssured with Kotlin

Example

        given {
            on {
                get("/orders/123") itHas {
                    statusCode(404)
                }
@outofcoffee
outofcoffee / containers.groovy
Created August 26, 2017 20:34
Build, tag and push containers (with AWS ECR support)
#!/usr/bin/env groovy
import groovy.json.JsonSlurper
class Constants {
final static def REPOSITORY_PREFIX = ""
final static def REGISTRY_PREFIX = "your-docker-hub-id/"
final static def ECR_REGION = "eu-west-1"
}
final imageConfig = new JsonSlurper().parseText(new File("./containers.json").text)