Skip to content

Instantly share code, notes, and snippets.

<project name="SimpleProject">
<property name="build.dir" value="build"/>
<property name="build.prod.dir" value="${build.dir}/prod"/>
<property name="build.test.dir" value="${build.dir}/test"/>
<property name="build.jar.dir" value="${build.dir}/jar"/>
<property name="src.dir" value="src"/>
<property name="unit.test.dir" value="unit-test"/>
<property name="system.test.dir" value="system-test"/>
@rchatley
rchatley / pom.xml
Last active October 6, 2015 16:48
Complete pom file for CD exercise
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.develogical</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>aepfacts</artifactId>
<dependencies>
<dependency>
@rchatley
rchatley / encoder.rb
Created October 23, 2012 09:22
Ruby Encoder - Strategy Pattern
class Encoder
def initialize(algorithm)
@algorithm = algorithm
end
def encode(line)
tokens = line.split(" ")
results = []
for word in tokens do
@rchatley
rchatley / TestCamera.java
Last active December 19, 2015 14:59
CameraControl Exercise
package com.develogical.camera;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.integration.junit4.JMock;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(value = JMock.class)
public class TestCamera {
class Bottles
def initialize
@verses = Hash.new { |h, num_bottles| Verse.new(num_bottles) }
@verses[6] = SixPackVerse.new(6)
@verses[7] = SixPackVerse.new(7)
end
def song
verses(99,0)
svn co https://repo.dev.bbc.co.uk/libraries/python/AWS-CloudFormation/trunk AWS-CloudFormation
svn co https://repo.dev.bbc.co.uk/tools/BBC-CloudFormation/Common/trunk/src/BBC/AWS/CloudFormation/Common/ AWS-CloudFormation/src/BBC/AWS/CloudFormation/Common
export PYTHONPATH=`pwd`/AWS-CloudFormation/src/
@rchatley
rchatley / gist:b2e323ad87f9def44c77
Created April 21, 2015 14:02
Cloudformation Common checkout
svn co https://repo.dev.bbc.co.uk/libraries/python/AWS-CloudFormation/trunk AWS-CloudFormation
svn co https://repo.dev.bbc.co.uk/tools/BBC-CloudFormation/Common/trunk/src/BBC/AWS/CloudFormation/Common/ AWS-CloudFormation/src/BBC/AWS/CloudFormation/Common
export PYTHONPATH=`pwd`/AWS-CloudFormation/src/
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.fail;
public class WimbledonScoreCalcTest {
private WimbledonScoreCalc scoreCalc= new WimbledonScoreCalc();
from unittest.mock import Mock
from order import Order
ROAST_CHICKEN = Order("roast chicken")
APPLE_TART = Order("apple tart")
class HeadChef:
def __init__(self, pastrychef, waiter):
object PigLatin {
fun translate(phrase: String): String = phrase.split(" ").joinToString(" ", transform = ::translateWord)
private fun translateWord(word: String): String =
when {
word.startsWith(vowel) -> word + "ay"
word.startsWith("xr") -> word + "ay"
word.startsWith("yt") -> word + "ay"
word.startsWith("ch") -> word.drop(2) + "chay"