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 SomeProtocol do | |
| @on_load :start_agent | |
| def start_actor() do | |
| {result, pid} = Agent.start_link(fn -> 0 end) | |
| result | |
| end | |
| def __using__() do | |
| quote do |
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
| module.exports.aliasImportRegex = /???/ | |
| module.exports.iterate = (match) -> |
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
| # Use reattach-to-user-namespace so pbcopy/pbpaste work again. | |
| # Use 256 color terminal | |
| set-option -g default-terminal screen-256color | |
| # Use C-t as my tmux prefix key | |
| # set-option -g prefix C-t | |
| # Other keybindings. | |
| bind-key k kill-pane |
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
| Enum.take_while( IO.stream(:stdio, :line), fn | |
| "\n" -> false | |
| _ -> true | |
| end) | |
| |> Enum.map(fn line -> | |
| String.split(line, "x") | |
| |> Enum.map(&Integer.parse/1) | |
| |> (fn [{a,_},{b,_},{c,_}] -> |
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
| mkdir Backup | |
| cd $1 | |
| pwd | |
| ls > $3 | |
| wc < $3 -w | |
| cp $3 ../Backup/test | |
| cd .. | |
| mv $1 Backup |
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
| let pgen (p:xs) = p : pgen [x|x <- xs, x `mod` p > 0] | |
| let nPrimes x = x `take` pgen [2..] |
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
| =ERROR REPORT==== 25-Sep-2015::15:46:40 === | |
| Error in process <0.1104.0> on node 'test@krzysztof-SVT13' with exit value: {{badmatch,{error,enoent}},[{katt_blueprint,file,1,[{file,"src/katt_blueprint.erl"},{line,25}]},{katt_blueprint_parse,file,1,[{file,"src/katt_blueprint_parse.erl"},{line,56}]},{katt,run,4,[{file,"src/katt.erl"},{line,77}]}]} | |
| *** CT Error Notification 2015-09-25 13:46:40.629 *** | |
| Error detected: {badmatch,{error,enoent}} | |
| Full error description and stacktrace |
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
| def sum_list([], acc), do: acc | |
| def sum_list([head | tail], acc // 0) do | |
| sum_list(tail, head + acc) | |
| end |
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
| def is_prime(x), do: (2..x |> Enum.filter(fn a -> rem(x, a) == 0) |> length()) == 1 | |
| def prime(n), do: Stream.interval(1) |> Stream.drop(2) |> Stream.filter(&is_prime/1) |> Enum.take(n) |
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
| def n_primes(n), do: prime(n, 2) | |
| def is_prime(x), do: (2..x |> Enum.filter(fn a -> rem(x, a) == 0 end) |> length()) == 1 | |
| def prime(n, n), do: [] | |
| def prime(n, acc) do | |
| case is_prime(acc) do | |
| true -> [acc | prime(n, acc + 1)] | |
| false -> prime(n, acc + 1) | |
| end | |
| end |