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
defmodule StreamBehaviourTest do | |
use ExUnit.Case, async: true | |
test "will not pull from upstream after halt" do | |
called = fn key, x -> Process.put(key, [x|Process.get(key, [])]) end | |
results = 1..10 | |
|> Stream.each(&called.(:upstream, &1)) | |
|> Stream.take(1) | |
|> Stream.each(&called.(:downstream, &1)) |
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
$elixir stop.exs | |
Asked to stop because :normal | |
1) test stop (Test) | |
stop.exs:28 | |
** (exit) exited in: GenServer.call(#PID<0.68.0>, :stop, 5000) | |
** (EXIT) normal | |
stacktrace: | |
(elixir) lib/gen_server.ex:356: GenServer.call/3 |
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
" autoload the local .vimrc file you need to have | |
" https://github.com/MarcWeber/vim-addon-local-vimrc | |
" plugin installed | |
map <Leader>t :call RunCurrentTest()<CR> | |
map <Leader>o :call OpenCurrentTest()<CR> | |
function! RunCurrentTest() |
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
body { | |
background-color: #eee; | |
} | |
.container { | |
margin-top: 50px; | |
width: 1400px; | |
text-align: center; | |
font-family: sans-serif; | |
height: 75px; |
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
score(Rolls) -> | |
NumberOfFrames = 10, | |
{ Score, _ } = lists:foldl(fun(_, { Score, FramesRolls }) -> | |
{ ScoreInFrame, RemainingFramesRolls } = score_frame(FramesRolls), | |
{ Score + ScoreInFrame, RemainingFramesRolls } | |
end, { 0, Rolls }, lists:seq(1, NumberOfFrames)), | |
Score. | |
score_frame([ 10, FirstNextFrame, SecondNextFrame | Rolls ]) -> | |
{ 10 + FirstNextFrame + SecondNextFrame, [ FirstNextFrame, SecondNextFrame | Rolls ] }; |
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
score(Rolls) -> score(Rolls, 10). | |
score(_Rolls, 0) -> 0; | |
score(Rolls, NumberOfFrame) -> | |
case Rolls of | |
[ 10, FirstOfNextFrame, SecondOfNextFrame | NextRolls ] -> | |
10 + FirstOfNextFrame + SecondOfNextFrame + | |
score([ FirstOfNextFrame, SecondOfNextFrame | NextRolls ], NumberOfFrame - 1); | |
[ FirstOfCurrentFrame, SecondOfCurrentFrame, FirstOfNextFrame | NextRolls ] |
NewerOlder