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
<?php | |
namespace ExampleBundle\Form; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilder; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
use Edge5\TestProjectBundle\Form\addTranslatedFieldSubscriber; |
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
params: | |
model: Admingenerator\PropelDemoBundle\Model\Movie | |
namespace_prefix: Admingenerator | |
bundle_name: PropelDemoBundle | |
fields: | |
movieI18ns: | |
label: Translations | |
dbType: collection | |
formType: translatable_collection | |
addFormOptions: |
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
if([topController respondsToSelector:@selector(presentViewController:animated:completion:)]) | |
{ | |
[topController presentViewController:controller animated:YES completion:nil]; | |
} | |
else | |
{ | |
[topController presentViewController:controller animated:YES completion:nil]; | |
} |
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
object Day1 extends Challenge { | |
override def runFirst(): Unit = { | |
val startPosition = Position.start | |
val endPosition = loadInput().foldLeft(startPosition) { | |
case (p, ("R", l)) => | |
p.turnRight().walk(l.toLong) | |
case (p, ("L", l)) => | |
p.turnLeft().walk(l.toLong) | |
} |
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
object Day5 extends Challenge { | |
val doorId = "abbhdwsy" | |
override def runFirst(): Unit = { | |
val password = hashes().filter(_.startsWith("00000")).take(8).map(_.charAt(5)).mkString | |
println(password) | |
} | |
def hashes(): Iterator[String] = { | |
Iterator.iterate(("", 0)) { |
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
object Day6 extends Challenge { | |
val lines = loadFile("day6.txt").getLines().toList.transpose.map(groupByChars) | |
override def runFirst(): Unit = { | |
println(lines.map(_.maxBy(_._2)._1).mkString) | |
} | |
override def runSecond(): Unit = { | |
println(lines.map(_.minBy(_._2)._1).mkString) | |
} |
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
object Day7 extends Challenge { | |
val ips = loadFile("day7.txt").getLines().toList | |
override def runFirst(): Unit = { | |
println(ips.count(supportsTLS)) | |
} | |
override def runSecond(): Unit = { | |
println(ips.count(supportsSSL)) | |
} |
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
object Day9 extends Challenge { | |
override def runFirst(): Unit = { | |
val compressed = loadFile("day9.txt").mkString | |
println(decompress(compressed)) | |
} | |
override def runSecond(): Unit = { | |
val compressed = loadFile("day9.txt").mkString | |
println(decompress(compressed, v2 = true)) | |
} |
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
object Day21 extends Challenge { | |
override def runFirst(): Unit = { | |
val instructions = parseInstructions(loadFile("day21.txt").getLines().toSeq).toList | |
val scrambled = instructions.foldLeft("abcdefgh") { (pw, instruction) => | |
instruction match { | |
case SwapPosition(from, to) => | |
pw.updated(to, pw(from)).updated(from, pw(to)) | |
case SwapLetter(char1, char2) => | |
pw.replace(char1, '_').replace(char2, char1).replace('_', char2) |
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
object Day24 extends Challenge { | |
override def runFirst(): Unit = { | |
val map = createMap(loadFile("day24.txt").getLines().toSeq) | |
val destinations = map.filter(_._2 >= 2).keys | |
val start = map.find(_._2 == 2).get._1 | |
val lengths = destinations.flatMap { destination => | |
val others = destinations.filterNot(_ == destination) | |
others.map(o => (destination, o) -> findShortestPath(destination, o, map)) |
OlderNewer