Last active
June 3, 2020 01:53
-
-
Save yatender-oktalk/91cecd442008342adc85d0e5c56ed46b to your computer and use it in GitHub Desktop.
Elixir scribble random helpful commands
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 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
# Application related stuff | |
Application.get_all_env(:wallet_node) | |
Application.fetch_env(:wallet_node, :db_host) | |
Application.put_env(:wallet_node, :db_host, "localhost") | |
# starting & Stopping an application | |
Application.start(:wallet_node) | |
Application.stop(:wallet_node) | |
# Pmap | |
defmodule Pmap do | |
def map(collection, func, timeout \\ 5000) do | |
collection | |
|> Enum.map(&Task.async(fn -> func.(&1) end)) | |
|> Enum.map(&Task.await(&1, timeout)) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment