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
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 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 Paco.Collector do | |
@env String.to_atom(System.get_env("MIX_ENV") || "dev") | |
defmacro notify_loaded(text, state), do: call(@env, :do_notify_loaded, [text, state]) | |
defmacro notify_started(parser, state), do: call(@env, :do_notify_started, [parser, state]) | |
defmacro notify_ended(result, state), do: call(@env, :do_notify_ended, [result, state]) | |
defp call(:prod, _, _), do: :ok | |
defp call(_, name, args) do |
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
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 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 ] |
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
body { | |
background-color: #eee; | |
} | |
.container { | |
margin-top: 50px; | |
width: 1400px; | |
text-align: center; | |
font-family: sans-serif; | |
height: 75px; |
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
" 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 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
Verifying that +gabrielelana is my blockchain ID. https://onename.com/gabrielelana |
I hereby claim:
- I am gabrielelana on github.
- I am gabrielelana (https://keybase.io/gabrielelana) on keybase.
- I have a public key whose fingerprint is 181C 039B 8033 4010 66D3 C5E8 F3A4 6AB3 14CA E60E
To claim this, I am signing this object:
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
from evdev import UInput, InputDevice,categorize, ecodes | |
myKey = UInput.from_device('/dev/input/event7', name='MyKeyboard') | |
dev = InputDevice('/dev/input/event7') | |
print(dev) | |
for event in dev.read_loop(): | |
if event.type == ecodes.EV_KEY: | |
print(event) |
OlderNewer