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
%{ | |
configs: [ | |
%{ | |
name: "default", | |
files: %{ | |
included: ["lib/", "src/", "web/", "apps/"], | |
excluded: [~r"/_build/", ~r"/deps/", "**/config/*.exs"] | |
}, | |
requires: [], | |
strict: false, |
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 Crevalle.Stack do | |
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 YourApp.CRM do | |
def create_user(user) do | |
crm_data = | |
user | |
|> fetch_crm_data() | |
|> parse() | |
user | |
|> YourApp.User.crm_changeset(crm_data) |
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 YourApp.AccountSetupSupervisor do | |
def set_up_user_account(user) do | |
opts = [restart: :transient] | |
Task.Supervisor.start_child(__MODULE__, YourApp.CRM, :create_user, [user], opts) | |
Task.Supervisor.start_child(__MODULE__, YourApp.Fulfillment, :set_nearest_location, [user], opts) | |
end | |
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 App.UserService do | |
def create_user(params) do | |
%App.User{} | |
|> App.User.changeset(params) | |
|> App.Repo.insert() | |
|> case do | |
{:ok, user} -> | |
Task.start(fn -> send_email_to_user(user) end) # 🎉 | |
{:ok, user} |
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 PopularApp.EmailSender do | |
use GenServer | |
def start_link do | |
GenServer.start_link(__MODULE__, :ok, name: __MODULE__) | |
end | |
def init(:ok) do | |
{:ok, %{last_sent: nil, last_data: nil}} | |
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 PopularApp.Application do | |
use Application | |
def start(_type, _args) do | |
import Supervisor.Spec | |
children = [ | |
worker(PopularApp.EmailSender, []) | |
] |
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 CryptoApp.AccountSync do | |
use GenServer | |
@interval 1_000 | |
def start_link do | |
GenServer.start_link(__MODULE__, :ok, name: __MODULE__) | |
end | |
def init(:ok) 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 YourApp.Application do | |
use Application | |
def start(_type, _args) do | |
import Supervisor.Spec | |
children = [ | |
{Task.Supervisor, name: YourApp.AccountSetupSupervisor} | |
] |
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
#!/usr/bin/ruby | |
require 'optparse' | |
FILE_NAME = 'VERSION.txt' | |
options = {} | |
def red(str); "\e[31m#{str}\e[0m"; end | |
def green(str); "\e[32m#{str}\e[0m"; end |
NewerOlder