Skip to content

Instantly share code, notes, and snippets.

View richashworth's full-sized avatar

Richard Ashworth richashworth

View GitHub Profile
abstract sealed class Beat
case object Rest extends Beat
case object Note extends Beat
case class Note(pitch: Int, duration: Int) extends Beat
case class Pattern(beats: Seq[Beat])
def formatBeat(b: Beat): String = b match {
case Rest => " _ "
case Note => " X "
class LCDDigit(val firstRow: String, val secondRow: String, val thirdRow: String)
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 {