Skip to content

Instantly share code, notes, and snippets.

@jdmwood
jdmwood / setup-ngrok.py
Last active September 28, 2023 14:37
Script to help setting up Wordpress managed by wp-env for use with ngrok
#! /usr/bin/env python3
"""
Setup ngrok for local development with WordPress when used with wp-env. Follows instructions from
https://ngrok.com/docs/using-ngrok-with/wordpress/
Notes
-----
package com.yourpackage
import java.lang.reflect.Field
import java.lang.reflect.Modifier
import javax.persistence.*
import kotlin.jvm.internal.Reflection
import kotlin.reflect.KCallable
import org.hibernate.annotations.Subselect
import org.junit.Assert.assertFalse
import org.junit.Test
@jdmwood
jdmwood / pom.xml
Last active November 1, 2019 10:25
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration>
<compilerPlugins>
<plugin>all-open</plugin>
<plugin>jpa</plugin>
</compilerPlugins>
@Entity
class Customer(
@Id
var id: Int,
@Basic
var name: String
)
@Entity
class Customer {
@Id
var id: Int = 0
@Basic(optional=false)
var name: String? = null
}
@Entity
public class Customer {
@Id
public int id;
@Basic(optional=false)
public String name;
public Customer() {
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<!-- Generate reports from coverage generated during integration tests. Note that this maven plugin
does NOT generate the coverage - that is done by adding the Jacoco agent to the Docker container -->
<execution>
<goals>
<goal>report-integration</goal>
<!-- Make the jacoco agent Jar available to our test Docker containers by copying it to the
docker shared dir. -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<delete dir="${project.build.directory}/jacoco-it" failonerror="false"/>
<build>
<plugins>
...
<!-- Adds properties containing the path of Jar files -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<dependencies>
...
<!-- Required so we can dynamically inject the Jacoco jar into our container -->
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<classifier>runtime</classifier>
<version>0.8.4</version>
<scope>test</scope>
</dependency>