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
const Cell = ({ className, cellData, column }) => { | |
const { dataKey } = column; | |
switch(dataKey){ | |
case 'thumbnail': | |
return <Thumbnail src={cellData} /> | |
case 'type': | |
return <Types types={cellData} /> | |
default: | |
return <div className={className}>{cellData}</div>; | |
} |
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
iex> pid = self() # pega o pid atual do processo | |
#PID<0.105.0> | |
iex> send pid,{:ok, "mensagem com padrão 1"} | |
iex> send pid,{:ok, "mensagem com padrão 2"} | |
iex> Process.info pid, :messages # mostra as mensagens salvas na mailbox | |
{:messages, [ok: "mensagem com padrão 1", ok: "mensagem com padrão 2"]} | |
iex> receive do {:ok, msg} -> IO.puts msg end # macro que lida com as mensagens | |
mensagem com padrão 1 | |
:ok | |
iex> Process.info pid, :messages |
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
iex> receive do | |
...> msm -> msm | |
...> after | |
...> 1000 -> "nada aconteceu depois de 1s" | |
...> end | |
"nada aconteceu depois de 1s" |
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
iex> pid = spawn fn -> 5 + 5 end | |
iex> Process.alive? pid | |
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 ProcessInElixir.StackNormal do | |
def start_link(initialStack \\ []) do | |
pid = spawn_link __MODULE__, :loop, [initialStack] | |
{:ok, pid} | |
end | |
def child_spec(opts) do | |
%{ | |
id: __MODULE__, | |
start: {__MODULE__, :start_link, [opts]}, | |
type: :worker, |
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
iex> alias ProcessInElixir.StackNormal | |
ProcessInElixir.StackNormal | |
iex> {:ok, pid} = StackNormal.start_link | |
{:ok, #PID<0.326.0>} | |
iex> StackNormal.push pid, "Japão" | |
{:push, "Japão"} | |
iex> StackNormal.push pid, "Alemanha" | |
{:push, "Alemanha"} | |
iex> StackNormal.push pid, "Brasil" | |
{:push, "Brasil"} |
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 StackSupervisor do | |
use Supervisor | |
def start_link(_arg \\ []) do | |
Supervisor.start_link __MODULE__, :ok, name: __MODULE__ | |
end | |
def init(:ok) do | |
children = [ProcessInElixir.StackNormal] | |
Supervisor.init(children, strategy: :one_for_one) | |
end | |
def which_children(), do: Supervisor.which_children __MODULE__ |
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
iex> StackSupervisor.start_link | |
{:ok, #PID<0.230.0>} | |
iex> StackSupervisor.which_children | |
[ | |
{ProcessInElixir.StackNormal, #PID<0.231.0>, :worker, | |
[ProcessInElixir.StackNormal]} | |
] | |
iex> ProcessInElixir.StackNormal.push pid(0,231,0), "Japão" | |
{:push, "Japão"} | |
iex> ProcessInElixir.StackNormal.show pid(0,231,0) |
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 TodoList extends HTMLElement { | |
private root: ShadowRoot; | |
private $form: HTMLFormElement | null = null; | |
private $input: HTMLInputElement | null = null; | |
private $ul: HTMLUListElement | null = null; | |
constructor() { | |
super(); | |
this.root = this.attachShadow({ mode: 'open' }); | |
} |
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
using UnityEngine; | |
/// <summary> | |
/// A class that allows to visualize the Physics2D.BoxCast() method. | |
/// </summary> | |
/// <remarks> | |
/// Use Draw() to visualize an already cast box, | |
/// and BoxCastAndDraw() to cast a box AND visualize it at the same time. | |
/// </remarks> |
OlderNewer