scph5500.bin 26-Aug-2018 20:47 512.0K
scph5501.bin 26-Aug-2018 20:47 512.0K
scph5502.bin 26-Aug-2018 20:47 512.0K
| @default_timeout 100 | |
| @check_interval 10 | |
| # Test Helpers | |
| defp wait_for(fun, timeout \\ @default_timeout) do | |
| start_time = System.monotonic_time(:millisecond) | |
| ref = make_ref() | |
| try do |
| You are an expert building REST APIs in Elixir, Phoenix, PostgreSQL, Kafka, AWS Services, Oban and Redis. | |
| Always use the latest stable version of Elixir, Phoenix and other dependancies. | |
| Always think through any considerations or requirements to make sure we've thought of everything, think step-by-step, think about endpoints, think about data flow, think about security, think about performance, think about scalability, think about maintainability, then write the code. | |
| Code Style and Structure | |
| - Write concise, idiomatic Elixir code with accurate examples. | |
| - Follow Phoenix conventions and best practices. | |
| - Use functional programming patterns and leverage immutability. |
| defmodule MyWeb.UploadFileTest do | |
| use MyWeb.ConnCase | |
| @email_suppressions_mutation """ | |
| mutation UploadFile($file: Upload!) { | |
| uploadFile (file: $file) { | |
| success | |
| message | |
| } | |
| } |
scph5500.bin 26-Aug-2018 20:47 512.0K
scph5501.bin 26-Aug-2018 20:47 512.0K
scph5502.bin 26-Aug-2018 20:47 512.0K
| -module(dstore). | |
| % internal operations | |
| -export([init/0, loop/1, write/3]). | |
| % public system operations | |
| -export([start_link/0, stop/0, sync/2, replicate/1, pid/0]). | |
| % public k/v operations | |
| -export([lookup/1, write/2]). | |
| -define(TIMEOUT, 30000). |
| defmodule CustomUploadS3 do | |
| @moduledoc """ | |
| Represents an AWS S3 Multipart Upload operation | |
| ## Examples | |
| ``` | |
| "path/to/big/file" | |
| |> S3.Upload.stream_file | |
| |> S3.upload("my-bucket", "path/on/s3") | |
| |> CustomUploadS3.to_custom_upload_s3() | |
| |> ExAws.request!() #=> :done |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <input type="file" id="input" onchange="handle_csv(this.files)" /> |
| defmodule PortRunner do | |
| use GenServer, restart: :temporary | |
| defmodule State do | |
| defstruct [:command, :exit_status, :port, arguments: []] | |
| end | |
| @spec start_link(State.t() | map() | keyword()) :: GenServer.on_start() | |
| def start_link(args) do | |
| GenServer.start_link(__MODULE__, args) |
Inspired by Stuff Goes Bad - Erlang in Anger
Is the global process count indicative of a leak? If so, you may need to investigate unlinked processes, or peek inside supervisors’ children lists to see what may be weird-looking.
defmodule Diags do
@doc """| fun = | |
| Gobgpapi.StartBgpRequest | |
| |> to_string() | |
| |> String.split(".") | |
| |> List.last() | |
| |> String.replace("Request", "") | |
| |> Macro.underscore() | |
| |> String.to_atom() | |
| apply(MyModule, fun, args) |