- Having IntelliJ Installed
This example uses IntelliJ 2016.1
- File -> Settings -> Plugins
- Search for "Scala" and Install the plugin
- Restart IntelliJ
package hu.stsatlantis.fun.adventofcode2015 | |
/* | |
--- Day 2: I Was Told There Would Be No Math --- | |
The elves are running low on wrapping paper, and so they need to submit an order for more. They have a list of the dimensions (length l, width w, and height h) of each present, and only want to order exactly as much as they need. | |
Fortunately, every present is a box (a perfect right rectangular prism), which makes calculating the required wrapping paper for each gift a little easier: find the surface area of the box, which is 2*l*w + 2*w*h + 2*h*l. The elves also need a little extra paper for each present: the area of the smallest side. | |
For example: |
package hu.stsatlantis.fun.adventofcode2015 | |
/* | |
--- Day 3: Perfectly Spherical Houses in a Vacuum --- | |
Santa is delivering presents to an infinite two-dimensional grid of houses. | |
He begins by delivering a present to the house at his starting location, and then an elf at the North Pole calls him via radio and tells him where to move next. Moves are always exactly one house to the north (^), south (v), east (>), or west (<). After each move, he delivers another present to the house at his new location. |
package hu.stsatlantis.fun.adventofcode2015 | |
/** | |
* Created by Barni on 2015.12.04.. | |
*/ | |
/* --- Day 1: Not Quite Lisp --- | |
Santa was hoping for a white Christmas, but his weather machine's "snow" function is powered by stars, and he's fresh out! To save Christmas, he needs you to collect fifty stars by December 25th. |
package hu.stsatlantis.fun.adventofcode2015 | |
import java.security.MessageDigest | |
import scala.util.matching.Regex | |
/* | |
--- Day 4: The Ideal Stocking Stuffer --- | |
Santa needs help mining some AdventCoins (very similar to bitcoins) to use as gifts for all the economically forward-thinking little girls and boys. |
def task1(str: String): Boolean = { | |
val vowelR = """[a,e,i,o,u]""" | |
@tailrec | |
def processTask1(arr: List[String], prevChar: String, vowelCount: Int, hasDouble: Boolean): Boolean = { | |
arr match { | |
case Nil => vowelCount >= 3 && hasDouble; | |
case "a" :: "b" :: xs => false | |
case "c" :: "d" :: xs => false |
package hu.stsatlantis.fun.adventofcode2015 | |
import scala.annotation.tailrec | |
/** | |
* Created by Barni on 2015.12.06.. | |
*/ | |
case class Coordinate(x: Int, y: Int) |
## HMTL: | |
<span class="label" ng-style="vm.decorateLabel(entity)">{{entity.name}}</span> | |
## JavaScript: | |
vm.decorateLabel = decorateLabel; | |
function decorateLabel(entity) { | |
return { |
package slicks.docs.dao | |
import scala.slick.driver.PostgresDriver.simple._ | |
import scala.slick.driver._ | |
trait Profile { | |
val profile: JdbcProfile | |
} |
private DateTime getDateTime(String time) { | |
DateTime result = null; | |
final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; | |
if (time != null) { | |
try { | |
DateTimeFormatter DATETIME_FORMATTER = DateTimeFormat.forPattern(DATE_FORMAT); | |
DateTimeZone dateTimeZone = DateTimeZone.forID("GMT+0"); | |
DateTime date = DATETIME_FORMATTER.withZone(dateTimeZone).parseDateTime(time); |