Skip to content

Instantly share code, notes, and snippets.

View prule's full-sized avatar

Paul Rule prule

  • Sydney, Australia
View GitHub Profile
@prule
prule / IntellijJunit5SpringBootTestTemplate.java
Created July 11, 2019 12:00
Intellij IDEA Template for a JUnit 5 / Spring boot integration test
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
@prule
prule / Junit5SpringBootTestTemplate.java
Created July 11, 2019 11:59
Template for a JUnit 5 / Spring boot integration test
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
@prule
prule / build.gradle
Created April 20, 2017 10:45
Serenity gradle build file
buildscript {
ext {
cucumberVersion = '1.2.5'
junitVersion = '4.12'
seleniumVersion = '2.53.1'
serenityVersion = '1.2.5-rc.6'
serenityCucumberVersion = '1.1.28'
}
repositories {
@prule
prule / SpikeGoogleTranslate.java
Last active April 9, 2017 23:27
An example use of the Google Translate API via the google-api-services-translate java classes.
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.translate.Translate;
import com.google.api.services.translate.TranslateRequestInitializer;
import com.google.common.collect.ImmutableList;
/**
* Date: 15/02/2016
@prule
prule / Disk speed benchmark
Created December 29, 2014 21:58
Disk speed benchmark script copied from http://www.amsys.co.uk/2013/blog/using-command-line-to-benchmark-disks/#.VKDxQsAGA - added sudo for the purge command.
#!/bin/bash
echo "---------------------"
echo "Write Test Running. Please Wait..."
write=$(dd if=/dev/zero bs=2048k of=tstfile count=1024 2>&1 | grep sec | awk '{print $1 / 1024 / 1024 / $5, "MB/sec" }')
sudo purge
echo ""
echo "Read Test Running. Please Wait..."
read=$(dd if=tstfile bs=2048k of=/dev/null count=1024 2>&1 | grep sec | awk '{print $1 / 1024 / 1024 / $5, "MB/sec" }')
clear
echo ""
@prule
prule / bower.json
Last active August 29, 2015 14:12
Override which files get included from your bower dependency
{
"name": "test-project-1",
"dependencies": {
"moment": "2.8.2"
},
"overrides": {
"moment": {
"main": [
"min/moment.min.js",
"locale/fr.js",
{
"name": "moment",
"version": "2.8.4",
"main": "moment.js",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
@prule
prule / gist:df358a06b6a5847a33e5
Created October 5, 2014 10:23
SequelizeJS many to many - part 2
/**
* create database spike;
* grant all privileges on spike.* to 'anon'@'localhost' identified by 'password';
* flush privileges;
*/
var async = require('async');
// set up sequelize
var Sequelize = require("sequelize");
@prule
prule / gist:be3bafe8903d6b18f4ef
Created October 5, 2014 09:32
SequelizeJS many to many
// connect
var Sequelize = require("sequelize")
var sequelize = new Sequelize('spike', 'anon', 'password', {
logging: console.log
});
// models
var User = sequelize.define('User', {
name: Sequelize.STRING
});
@prule
prule / gist:ab5db506ee42926a42db
Created September 10, 2014 23:33
Create spike database with Projects table and test data
create database spike;
grant all privileges on spike.* to 'anon'@'localhost' identified by 'password';
flush privileges;
use spike;
CREATE TABLE `projects` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`status` varchar(255) DEFAULT NULL,
`createdAt` datetime DEFAULT NULL,