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 Mix.Tasks.Default do | |
| use Mix.Task | |
| @shortdoc "Runs all the tests and the linter" | |
| @moduledoc """ | |
| Runs all the tests and the linter | |
| """ | |
| def project 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
| defmodule Euler.Problem4 do | |
| def parallel do | |
| receive do | |
| {sender, low..high} -> send sender, {:ok, solve_for(low..high)} | |
| end | |
| end | |
| def solve_for(low..high) do | |
| get_list_of_products(low..high) | |
| |> is_palindrome? |
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
| [#HashDict<[{"number", 3400}, {"comments", 14}, | |
| {"title", "Float.round is inconsistent"}, | |
| {"created_at", "2015-06-17T13:04:45Z"}, {"state", "open"}, {"locked", false}, | |
| {"url", "https://api.github.com/repos/elixir-lang/elixir/issues/3400"}, | |
| {"comments_url", | |
| "https://api.github.com/repos/elixir-lang/elixir/issues/3400/comments"}, | |
| {"labels", | |
| [[{"url", | |
| "https://api.github.com/repos/elixir-lang/elixir/labels/App:Elixir"}, | |
| {"name", "App:Elixir"}, {"color", "CCCCCC"}], |
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 Chop do | |
| def guess(n, start..finish) when n > div(finish - start, 2) + start do | |
| IO.puts "Is it #{math(start, finish)}" | |
| guess(n, math(start, finish)..finish) | |
| end | |
| def guess(n, start..finish) when n < div(finish - start, 2) + start do | |
| IO.puts "Is it #{math(start, finish)}" | |
| guess(n, start..math(start, finish)) | |
| 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
| // Model | |
| var Time = function () { | |
| this.time = 0; | |
| } | |
| Time.prototype = { | |
| tick: function (timeElapsed) { | |
| this.time += timeElapsed; | |
| }, |
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
| puts "You awaken inside the clinic. You can basically only go left." | |
| joke_finished = false | |
| while 1 | |
| if joke_finished | |
| puts "Which way do you want to go? N, S, E, W" | |
| direction = gets.chomp | |
| if direction == '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
| fern | |
| nerf | |
| "fern" -> ["nerf", "erfn", ...] | |
| hash = Hash(a..z) = 0 | |
| hash['f'] += 1 | |
| hash['e'] += 1 | |
| hash['r'] += 1 | |
| hash['n'] += 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
| does not work: | |
| def run retries = 2 | |
| formatter.before_script_run path | |
| Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr| | |
| exit_status = formatter.format stdout | |
| return run(retries - 1) if exit_status != 0 and retries != 0 # difference on this line | |
| raise ScriptFailedError.new('Test Script Failed') if exit_status != 0 and !run_all | |
| end | |
| 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
| 2014-02-18T21:54:02.030567+00:00 heroku[web.1]: source=web.1 dyno=heroku.21649698.ca9cbbc4-b480-4a70-bb0f-37a575e74a74 sample#memory_total=380.26MB sample#memory_rss=380.23MB sample#memory_cache=0.00MB sample#memory_swap=0.03MB sample#memory_pgpgin=0pages sample#memory_pgpgout=128062pages | |
| 2014-02-18T21:54:21.888493+00:00 heroku[web.1]: source=web.1 dyno=heroku.21649698.ca9cbbc4-b480-4a70-bb0f-37a575e74a74 sample#memory_total=401.49MB sample#memory_rss=401.43MB sample#memory_cache=0.01MB sample#memory_swap=0.05MB sample#memory_pgpgin=0pages sample#memory_pgpgout=157417pages | |
| 2014-02-18T21:54:41.936531+00:00 heroku[web.1]: source=web.1 dyno=heroku.21649698.ca9cbbc4-b480-4a70-bb0f-37a575e74a74 sample#memory_total=419.76MB sample#memory_rss=419.69MB sample#memory_cache=0.01MB sample#memory_swap=0.07MB sample#memory_pgpgin=0pages sample#memory_pgpgout=175993pages | |
| 2014-02-18T21:55:01.808358+00:00 heroku[web.1]: source=web.1 dyno=heroku.21649698.ca9cbbc4-b480-4a70-bb0f-37a575e74a74 sample#memory_total=419.77MB sample |