Skip to content

Instantly share code, notes, and snippets.


Heather Miller heathermiller

View GitHub Profile
heathermiller /
Created June 9, 2020 17:44
Say large numbers in text, in Unison

Given a number from 0 to 999,999,999,999, spell out that number in English.

Step 1

Handle the basic case of 0 through 99.

If the input to the program is 22, then the output should be 'twenty-two'.

Your program should complain loudly if given a number outside the blessed range.

heathermiller /
Last active June 10, 2020 14:00
Clock printer in Unison

Implement a clock that handles times without dates.

You should be able to add minutes to it.

Two clocks that represent the same time should be equal to each other.

It's a 24 hour clock going from "00:00" to "23:59".

To complete this exercise you need to define the data type Clock and implement the functions:

heathermiller /
Last active June 8, 2020 18:30
Word count in Unison

Given a phrase, count the occurrences of each word in that phrase.

For the purposes of this exercise you can expect that a word will always be one of:

  1. A number composed of one or more ASCII digits (ie "0" or "1234") OR
  2. A simple word composed of one or more ASCII letters (ie "a" or "they") OR
  3. contraction of two simple words joined by a single apostrophe (ie "it's" or "they're")

When counting words you can assume the following rules:

heathermiller /
Last active June 8, 2020 18:30
Phone number cleanup in Unison

Clean up user-entered phone numbers so that they can be sent SMS messages.

The North American Numbering Plan (NANP) is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: 1.

NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as area code, followed by a seven-digit local number. The first three digits of the local number represent the exchange code, followed by the unique four-digit number which is the subscriber number.

The format is usually represented as

heathermiller /
Created June 3, 2020 19:15
ResistorColors in Unison

If you want to build something using a Raspberry Pi, you'll probably use resistors. For this exercise, you need to know two things about them:

  • Each resistor has a resistance value.
  • Resistors are small - so small in fact that if you printed the resistance value on them, it would be hard to read. To get around this problem, manufacturers print color-coded bands onto the resistors to denote their resistance values. Each band has a position and a numeric value. For example, if they printed a brown band (value 1) followed by a green band (value 5), it would translate to the number 15.

In this exercise you are going to create a helpful program so that you don't have to remember the values of the bands. The program will take color names as input and output a two digit number, even if the input is more than two colors!

The band colors are encoded as follows:

  • Black: 0
heathermiller /
Last active June 3, 2020 18:17
LeapYear in Unison

Given a year, report if it is a leap year.

The tricky thing here is that a leap year in the Gregorian calendar occurs:

on every year that is evenly divisible by 4
  except every year that is evenly divisible by 100
    unless the year is also evenly divisible by 400

Keybase proof

I hereby claim:

  • I am heathermiller on github.
  • I am heathermiller ( on keybase.
  • I have a public key ASALpaTiD166UKSkiDrVKvw4PXxQTuzix94UXFcY-wETBgo

To claim this, I am signing this object:

heathermiller / file-info-results.txt
Created July 6, 2017 08:03
Usage of implicits across files
View file-info-results.txt
Average percent of files using implicits: 23.35670325912466
Total # Scala files: 2760
Total # files using implicits: 163
Percent of files using implicits 5.905797101449275%
Total # Scala files: 404
heathermiller / implicit-usage.txt
Last active July 5, 2017 16:02
Usage of implicits in Scala
View implicit-usage.txt
93.33333333333333% of top 120 Scala GitHub projects make use of implicits.
Only 6.666666666666667% of top 120 Scala GitHub projects don't use implicits at all
83.33333333333334% of top 120 Scala GitHub use implicit defs
Total number of projects: 120
Number of projects not using implicits at all:
Number of projects using only implicit vals:
heathermiller /
Created April 14, 2017 13:05
Time Usage Assignment Instructions