This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public enum Unit { | |
| PIECE, | |
| PINCH, | |
| TABLESPOON, | |
| TEASPOON, | |
| SHOT, | |
| IMP_OUNCE, | |
| US_OUNCE, | |
| IMP_POUND, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "data": { | |
| "type": "recipes", | |
| "attributes": { | |
| "preparationTime": 100 | |
| }, | |
| "relationships": { | |
| "device": { | |
| "data": [{"id": "d5ec6b75-ca0d-4c83-9c6a-85645e11cbcd", "type": "devices"}] | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "data": { | |
| "type": "recipes", | |
| "attributes": { | |
| "totalTime": 200, | |
| "processingTime": 100, | |
| "preparationTime": 100, | |
| "processingMethod": "Raw", | |
| "visibility": "e0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11", | |
| "source": "d0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def tweetRemainingCharsCount(tweetText: Signal[String]): Signal[Int] = { | |
| Signal(MaxTweetLength - tweetLength(tweetText())) | |
| } | |
| def colorForRemainingCharsCount(remainingCharsCount: Signal[Int]): Signal[String] = { | |
| Signal({ | |
| remainingCharsCount() match { | |
| case x if x >= 15 => "green" | |
| case x if x >= 0 => "orange" | |
| case _ => "red" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package patmat | |
| /** | |
| * Assignment 4: Huffman coding | |
| * | |
| */ | |
| object Huffman { | |
| /** | |
| * A huffman code is represented by a binary tree. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package forcomp | |
| import common._ | |
| import scala.annotation.tailrec | |
| import scala.collection.immutable.SortedMap | |
| object Anagrams { | |
| /** A word is simply a `String`. */ |