This file contains 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
-module(aoc). | |
-export([main/1]). | |
main([Path]) -> | |
{ok, Content} = file:read_file(Path), | |
{Nodes, Max} = nodes(Content, 0, 0, {0,0}, #{}), | |
Anti = maps:fold(fun(_, L, S) -> | |
antinodes(L, L, Max, S) | |
end, sets:new(), Nodes), |
This file contains 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
-module(aoc). | |
-export([main/1]). | |
main([Path]) -> | |
{ok, Content} = file:read_file(Path), | |
Data = parse(Content), | |
io:format("Result: ~p~n", [lists:sum(lists:map(fun test/1, Data))]), | |
erlang:halt(0). |
This file contains 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
-module(aoc). | |
-export([main/1]). | |
main([Path]) -> | |
{ok, Content} = file:read_file(Path), | |
{Grid, [Guard]} = parse(Content), | |
Complete = rounds(Grid, Guard), | |
Tests = sets:del_element(element(2, Guard), Complete), | |
io:format("Visited: ~p~n", [sets:size(Complete)]), |
This file contains 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
-module(aoc). | |
-export([main/1]). | |
main([Path]) -> | |
{ok, Content} = file:read_file(Path), | |
{Rules, Edits} = parse(Content), | |
{Correct, Incorrect} = classify_edits(Edits, Rules), | |
Corrected = corrections(Incorrect, Rules), | |
io:format("Originally Correct: ~p~n", [sum_of_middles(Correct)]), |
This file contains 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
-module(aoc). | |
-export([main/1]). | |
main([Path]) -> | |
{ok, Content} = file:read_file(Path), | |
Data = fill(Content), | |
YSize = array:size(Data), | |
XSize = array:size(array:get(0, Data)), | |
persistent_term:put(?MODULE, Data), |
This file contains 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
-module(aoc). | |
-export([main/1]). | |
main([Path]) -> | |
{ok, Data1} = file:read_file(Path, [read, binary]), | |
io:format("Without modes: ~p~n", [read_char(Data1, skip, 0)]), | |
{ok, Data2} = file:read_file(Path, [read, binary]), | |
io:format("With modes: ~p~n", [read_char(Data2, do, 0)]), | |
erlang:halt(0). |
This file contains 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
-module(aoc). | |
-export([main/1]). | |
main([Path]) -> | |
{ok, Data} = parse(Path), | |
io:format("Safe: ~p~n", [lists:sum(lists:map(fun is_safe/1, Data))]), | |
io:format("Dampened: ~p~n", [lists:sum(lists:map(fun is_less_safe/1, Data))]), | |
erlang:halt(0). |
This file contains 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
-module(aoc). | |
-export([main/1]). | |
-import(file, [read_file/1]). | |
-import(lists, [unzip/1, map/2, zip/2, sort/1, foldl/3, filter/2, sum/1]). | |
-import(maps, [get/3, update_with/4]). | |
-import(string, [is_empty/1, split/3, trim/1]). | |
main([Path]) -> |
This file contains 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
Mix.install( | |
[ | |
{:phoenix_playground, "~> 0.1.6"}, | |
{:phoenix_test, "~> 0.3.2"} | |
], | |
config: [ | |
phoenix_test: [endpoint: Demo.Endpoint], | |
phoenix_playground: [ | |
{Demo.Endpoint, | |
[ |
This file contains 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
[@react.component] | |
let make = (~className="", ~onSelect, ~children) => { | |
let fileInputRef: ReactDOMRe.Ref.currentDomRef = | |
React.useRef(None->Js.Nullable.fromOption); | |
let key = React.useRef(1); | |
let handleInputChange = | |
React.useCallback0(event => { | |
let files = ReactEvent.Form.target(event)##files; |
NewerOlder