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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp2.2</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<Compile Include="Program.fs" /> | |
</ItemGroup> |
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
namespace Macaw.Server.Internal | |
open System | |
open System.Threading | |
open System.Collections.Generic | |
open System.Net.Sockets | |
open System.Net | |
module SocketConnectionListener2 = | |
let internal createSocket (endpoint : IPEndPoint) = |
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
defp refresh_graph(%{graph: g}) do | |
g = | |
if is_nil(g) do | |
:digraph.new() | |
else | |
:digraph.delete(g) | |
:digraph.new() | |
end | |
GraphDocument |
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
# Elastic Search | |
docker run --rm -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.0.1 |
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
case DateTime.from_iso8601(Map.get(element, "createdTime")) do | |
{:error, reason} -> | |
IO.inspect(reason) | |
{:ok, parsed_datetime, 0} -> | |
IO.inspect(parsed_datetime) # Verifica o resultado daqui | |
# Manda pro ElasticSearch... | |
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.AccountCtx do | |
alias __MODULE__.User | |
alias Ecto.Multi | |
def create_account(params) do | |
user_changeset = User.changeset(%User{}, params) | |
Multi.new() | |
|> Multi.insert(:create_account_on_acc_ctx, user_changeset) | |
|> Multi.run(:send_email, &App.Emailer.send_mail/1) # Logic to send e-mail | |
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
with | |
{:ok, width} <- Map.fetch(opts, :width), | |
{:ok, height} <- Map.fetch(opts, :height) | |
do | |
{:ok, width * height} | |
else | |
{:error, :wrong_data} -> ... | |
{:error, :wrong_data_2} -> ... | |
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
module FunPizzas | |
type Pizza = Calabreza | Chicken | |
// Pizza -> int -> int | |
let timeToReady pizza deliveryDelay = | |
let pizzaDelay = | |
match pizza with | |
| Calabreza -> 30 | |
| Chicken -> 25 |
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
def is_empty(state) do | |
result = :queue.is_empty(state.queue) | |
Logger.debug "#{inspect __MODULE__}: Empty? #{inspect result}." | |
{result, state} | |
end | |
def delete(state) do | |
Logger.debug "#{inspect __MODULE__}: Deleting #{inspect state}." | |
{:ok, state} | |
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
module MetroUi exposing (..) | |
import Html exposing (Html, text, div, h1) | |
import Html.App as App | |
import MetroUi.Widgets.Accordion as Accordion | |
import MetroUi.Widgets.Frame as Frame | |
type alias MetroUiModel = | |
{ accordion : Accordion.Model | |
, bigAccordion : Accordion.Model } |
NewerOlder