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
# This demonstrates that, when using async/await, a crash in the task will crash the caller | |
defmodule Tasker do | |
def good(message) do | |
IO.puts message | |
end | |
def bad(message) do | |
IO.puts message | |
raise "I'm BAD!" | |
end |
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 Inversion do | |
def run(filename) do | |
{sorted, count} = File.read!(filename) | |
|> String.split("\r\n", trim: true) | |
|> Enum.map(fn(x) -> String.to_integer(x) end) | |
|> devide_and_conquer | |
count | |
end | |
defp devide_and_conquer(data) 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
defmodule Inversion do | |
def run(filename) do | |
{sorted, count} = File.read!(filename) | |
|> String.split("\r\n", trim: true) | |
|> Enum.map(fn(x) -> String.to_integer(x) end) | |
|> devide_and_conquer | |
count | |
end | |
defp devide_and_conquer(data) 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
class SomeModel < ActiveRecord::Base | |
include Notify | |
tracked :on => { | |
:update => [{'publish', proc { |model| model.published? } }, | |
} | |
end | |
class SomeSubscriber | |
include Notify |