Skip to content

Instantly share code, notes, and snippets.

View richashworth's full-sized avatar

Richard Ashworth richashworth

View GitHub Profile
case class LCDDigit(val firstRow: String, val secondRow: String, val thirdRow: String) {
def formatDigit(): Unit = {
productIterator.foreach(i => println(i))
}
}
@richashworth
richashworth / LCDDigit.scala
Last active September 19, 2015 11:19
LSUG Dojo September 2015
package lsug
/**
* Created by rich on 17/09/15.
*/
class LCDDigit(val firstRow: String, val secondRow: String, val thirdRow: String) {}
object zero extends LCDDigit(
firstRow = "._.",
secondRow = "|.|",
@richashworth
richashworth / LCDFormatterTest.scala
Last active September 19, 2015 11:19
LSUG Dojo September 2015
package lsug
import org.scalatest.FunSuite
/**
* Created by rich on 17/09/15.
*/
class LCDFormatterTest extends FunSuite {
val formatter = new LCDFormatter
@richashworth
richashworth / LCDFormatter.scala
Last active September 19, 2015 11:19
LSUG Dojo September 2015
package lsug
class LCDFormatter(){
val digitMapping = Map(
0 -> zero,
1 -> one,
2 -> two,
3 -> three,
4 -> four,
5 -> five,
@richashworth
richashworth / pandoc-md-to-docx
Last active July 9, 2018 03:08
pandoc command to convert GitHub markdown (.md) to MS Word (.docx)
pandoc --to=docx -o document.docx wiki.md
$ tmux new -s dev
@richashworth
richashworth / gist:8138799
Created December 26, 2013 21:17
Fix for Jetpack RSS Widget
if ( 'text-image' == $format )
$link_item .= '<p>&nbsp;<a href="' . get_bloginfo($rss_type) . '" title="' . esc_attr( $subscribe_to ) . '"><br/>' . esc_html__('RSS - ' . $type_text, 'jetpack'). '</a></p>';
package com.richashworth.testingutils.mocking;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static junit.framework.Assert.assertEquals;
public class FootballerTest2 {
package com.richashworth.testingutils.mocking;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class FootballerTest {
@Test
public void testGetGameGoalsRatio() {
@richashworth
richashworth / ResultsWriterTest.java
Last active March 1, 2019 18:54
Unit Test used in PowerMock Example
package com.richashworth.powermockexample;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;