content_id
large_stringlengths
40
40
size_bytes
int64
1.5k
25k
repo_ids
large listlengths
1
410
tags
large listlengths
0
7
content
large_stringlengths
681
25k
03e1535f65027c942a42dd884761eaeb097bb865
3,976
[ 358111032 ]
[ "liveview" ]
defmodule GameoflifeWeb.Components.App do use Surface.LiveComponent alias Gameoflife.Game.BoardAgent alias Gameoflife.Game.Board, as: BoardStruct alias GameoflifeWeb.Components.Board alias GameoflifeWeb.Components.CommandPanel alias GameoflifeWeb.Components.InfoPanel alias(GameoflifeWeb.Components.Butt...
03e1cf0bafb80f35cd1ece89525a5f89589bbc5d
2,462
[ 101745570, 643670027 ]
[ "test" ]
defmodule YummyWeb.Integrations.CreateRecipeTest do # Turn async to false to avoid disruption between tests because of subscription to new recipe use YummyWeb.IntegrationCase, async: false setup do user = insert(:user) {:ok, %{user: user}} end describe "when user create a recipe" do test "with s...
03e220e25da212c0a5f4d75e5b40c5de29cd0ced
3,814
[ 721711154 ]
[ "liveview" ]
defmodule PeekChallengeWeb.Header do use Phoenix.Component slot :nav_items, required: true slot :toggle_items, required: true def header(assigns) do ~H""" <header class="pointer-events-none relative z-50 flex flex-col" style="height:var(--header-height);margin-bottom:var(--header-mb)" ...
03e2fddcd4449ac0512730fdfd26d019826e0442
2,326
[ 641177314 ]
[ "liveview" ]
defmodule WavyBirdWeb.ToolsLive.EncodingComponent do use WavyBirdWeb, :live_component @impl true def render(assigns) do ~H""" <div> <.simple_form for={%{}} id="encoding-form" phx-target={@myself} phx-change="convert"> <.input type="select" name="operation" opti...
03e371967c6b4c3eda0a1095273eb65fefb4177d
2,202
[ 259472494 ]
[ "phoenix" ]
defmodule NabooWeb.PasswordController do use NabooWeb, :controller alias Naboo.Accounts alias Naboo.Accounts.User alias Naboo.Auth.Authenticator alias NabooWeb.Email alias NabooWeb.Mailer alias NabooWeb.Token alias NabooWeb.Router.Helpers, as: Routes action_fallback NabooWeb.FallbackController # ...
03e384d007395e584973ab26f855558cef73d0e9
2,531
[ 367278931 ]
[ "documented" ]
defmodule Google.Devtools.Artifactregistry.V1.AptArtifact.PackageType do @moduledoc false use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :PACKAGE_TYPE_UNSPECIFIED, 0 field :BINARY, 1 field :SOURCE, 2 end defmodule Google.Devtools.Artifactregistry.V1.AptArtifact do @m...
03e3a3917c50a7d6dee120efb9c6d2cabe7a7a50
2,552
[ 542604765 ]
[ "genserver" ]
defmodule Demo.Part2.ChatRoomV2 do use GenServer @me __MODULE__ alias Demo.Part2.ChatRoomRegistry @enforce_keys [:chat_room] defstruct messages: [], participants: [], chat_room: nil # API def start_link(nil) do {:error, {:missing_arg, :room_name}} end def start_link(room_name) do GenServe...
03e3ae853517eb7cf4185a206c5f90fbb183edd8
8,879
[ 248352621 ]
[ "typespec", "documented" ]
defmodule Chronex.V4.Clinical.Patient do @moduledoc "Patient schema according to https://rdecicca.drchrono.com/openapi-schema and https://rdecicca.drchrono.com/api-docs-old/v4/documentation#apipatients" use Chronex.Schema alias Chronex.V4.Administrative.Doctor alias Chronex.V4.Clinical.Customs.CustomDemograph...
03e3e8220dd533173612fc5ae9306256d327fc3e
1,720
[ 280929409 ]
[]
defmodule Mjml.MixProject do use Mix.Project @source_url "https://github.com/adoptoposs/mjml_nif" @version "5.1.1" def project do [ app: :mjml, version: @version, elixir: "~> 1.13", start_permanent: Mix.env() == :prod, compilers: Mix.compilers(), name: "mjml", pac...
03e3ea47a7e8fc315e7f4c2d01ef3d4b6c06c828
5,461
[ 416214383 ]
[]
defmodule Exibee.Combo do alias Exibee.Elib, as: E @common Application.get_env(:exibee, :common) @dout Application.get_env(:exibee, :dout) def get_all_dis do {function_name, _} = __ENV__.function {:ok, ref} = Circuits.I2C.open(@common[:i2c_bus]) # 入出力ピン設定 Circuits.I2C.write(ref, @common[:devi...
03e3f6c301fc2317c95948239b8113d6c2218d92
4,177
[ 671949808 ]
[ "test" ]
defmodule TaxLotTest do use ExUnit.Case alias Decimal, as: D setup do {:ok, state: LotManager.new()} end describe "parse_line/1" do test "creates a TaxLot struct with id of nil" do lot = %TaxLot{ id: nil, date: "2021-01-01", action: "buy", price: D.new("10000.00...
03e415a04048e75e66d0e2ae5639dad67551d1c2
8,320
[ 942468823 ]
[ "typespec", "documented", "ecto" ]
defmodule GameBot.Infrastructure.ErrorHelpers do @moduledoc """ Helper functions for error handling and transformation. This module provides utility functions to handle common error scenarios, transform errors between different formats, and wrap operations with consistent error handling. """ alias GameB...
03e50d377e9ca6abcc7a44adbe27c2028b938438
2,304
[ 342795038 ]
[ "phoenix" ]
import Config if System.get_env("RELEASE_MODE") do # For production, don't forget to configure the url host # to something meaningful, Phoenix uses this information # when generating URLs. # # Note we also include the path to a cache manifest # containing the digested version of static files. This # mani...
03e532986aa8818e38df6dac20de98d3c87529c7
16,858
[ 768000680 ]
[ "test", "documented" ]
defmodule RPCProtoGenHelpers.CLITest do use ExUnit.Case describe "generates Elixir helper modules" do setup :tmp_dir test "legacy style package - impl and behaviour modules are generated correctly", %{ tmp_dir: tmp_dir } do rpc_path = Path.join(tmp_dir, "rpc/gift_cards/v1") File.mkdi...
03e550ec880806b0256a3d726cdb85f0ff069c30
2,065
[ 65258839 ]
[]
defmodule CentralGPS.Repo.Checkpoint.Client.Commands do #DB Definition: checkpoint.fn_api_client_create (_auth_token, _auth_type, _the_app_name, _the_ip_port, _xtra_info, client_configuration_id, client_name, client_description, client_xtra_info) RETURNS common.return_type_generic #Input JSON: [ client_configuratio...
03e5af561559e76dc9aba670b638cde6fcb84748
4,220
[ 758651729 ]
[ "genserver", "phoenix" ]
defmodule Questify.TextHandler do use GenServer @topic "generations" @done "[DONE]" def start_link(_opts \\ []) do GenServer.start_link(__MODULE__, :ok, name: __MODULE__) end @impl true def init(_) do {:ok, nil} end def get_completion(text) do text_model = "gpt-3.5-turbo" openai_ap...
03e5c566460b4374be960d06a5472a84ac0b6f11
2,999
[ 91915904 ]
[ "test" ]
defmodule Backend.ServiceProviderControllerTest do use Backend.ConnCase alias Backend.ServiceProvider @valid_attrs %{contact_name: "some content", contact_phone: "some content", email: "some content", hotline_phone: "some content", languages: [], organization_name: "some content", website: "some content"} @inv...
03e5c886152acdd8c85e8acbe7ac03249bdb14f7
3,973
[ 520217048 ]
[ "genserver", "documented" ]
defmodule Ockam.Transport.UDP.Listener do @moduledoc false use GenServer alias Ockam.Message alias Ockam.Router alias Ockam.Telemetry alias Ockam.Transport.UDPAddress alias Ockam.Wire alias Ockam.Worker require Logger def start_link(options) do GenServer.start_link(__MODULE__, options) end...
03e5f68efa0f619f0a30ea9296f63e9866a68165
2,586
[ 196256449 ]
[ "phoenix", "ecto", "documented" ]
defmodule ReorderModuleWeb.ProductController do use ReorderModuleWeb, :controller alias ReorderModule.Products alias ReorderModule.Products.Product alias ReorderModule.Reorders alias ReorderModule.Reorders.Reorder #ReorderModule.{Products.Product, Reorders.Reorder} alias ReorderModule.Repo import Ect...
03e633410ab4bea1008f9a34a06ba936e6eac0ec
1,758
[ 154275648, 73547679 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule RavioliShop.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use RavioliShop.Web, :controller use RavioliShop.Web, :view The definitions below will be executed for every view, controller, etc, so k...
03e6617e3305e015f8d48f8c7db1ecd88b80fff4
1,822
[ 668360015 ]
[ "documented", "ecto" ]
defmodule LiveViewMaskingExample.Catalog do @moduledoc """ The Catalog context. """ import Ecto.Query, warn: false alias LiveViewMaskingExample.Repo alias LiveViewMaskingExample.Catalog.Poduct @doc """ Returns the list of products. ## Examples iex> list_products() [%Poduct{}, ...] ...
03e6aab2a8a187753feea03d95397457e8bc8068
3,750
[ 929037144 ]
[ "liveview", "documented" ]
defmodule SaladUI.Tabs do @moduledoc """ Implementation of tabs components from https://ui.shadcn.com/docs/components/tabs ## Example: <.tabs default="account" id="settings" :let={builder} class="w-[400px]"> <.tabs_list class="grid w-full grid-cols-2"> <.tabs_trigger builder={builder} va...
03e6ea1f4e9b6670d9fe210691352fd640ed6f3c
5,241
[ 115270682 ]
[ "test" ]
defmodule ProxyProtocol.V1.ParserTest do use ExUnit.Case, async: true describe "PROXY TCP4 SUCCESS" do setup do packet = """ PROXY TCP4 <IP_ADDRESS> <IP_ADDRESS> 56324 443\r GET / HTTP/1.1\r Host: <IP_ADDRESS>\r \r """ {:ok, packet: packet} end test "returns ...
03e7617fdd3d0eb3c28301bad72879565c9f0c97
1,971
[ 571959815 ]
[ "test", "ecto" ]
defmodule Portfolio.WalletsTest do use Portfolio.DataCase alias Portfolio.Wallets describe "wallets" do alias Portfolio.Wallets.Wallet import Portfolio.WalletsFixtures @invalid_attrs %{name: nil, type: nil} test "list_wallets/0 returns all wallets" do wallet = wallet_fixture() ass...
03e7b4cb93ba155bc4d3c119b9436188743009f2
8,048
[ 159954960 ]
[ "test" ]
defmodule Advent2018.Day1BTest do use ExUnit.Case, async: true test "example 1" do input = """ +2 -1 +2 -1 """ assert Day1B.first_duplicate(input) == 2 end test "example 2" do input = """ +3 +3 +4 -2 -4 """ assert Day1B.first_duplicate(input) == 10...
03e7f5038d02cf30bccf8c5d69ad934de9f12adc
1,774
[ 119051773, 185621118 ]
[]
defmodule Tictactoe.Game.Logic.GameEnding do alias Tictactoe.Game.State.{Board, BoardField} @vertical_winning_lines [ [[0, 0], [0, 1], [0, 2]], [[1, 0], [1, 1], [1, 2]], [[2, 0], [2, 1], [2, 2]] ] @horizontal_winning_lines [ [[0, 0], [1, 0], [2, 0]], [[0, 1], [1, 1], [2, 1]], [[0, 2], ...
03e874f94ec71613a3f2cb0b1f20da7c130ac30c
4,392
[ 737827999 ]
[ "genserver", "macro", "documented" ]
defmodule AppAnimal.StructServer do @moduledoc "might make how a GenServer works more clear to reader" import AppAnimal.Extras.Nesting defmacro __using__(_opts) do quote do use GenServer require AppAnimal.StructServer import AppAnimal.StructServer alias AppAnimal.Cluster def s...
03e8d1ea5be13997f5f1ab974637e46025e80b03
3,165
[ 704644186 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule PartyWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, components, channels, and so on. This can be used in your application as: use PartyWeb, :controller use PartyWeb, :html The definitions below will be executed for every controller, compon...
03e8e7226710ac3265391aea99b58c6b4d2646f3
4,915
[ 583189409 ]
[ "documented", "ecto" ]
defmodule Moriawase.Accounts.Member do use Moriawase.Schema import Ecto.Changeset schema "members" do field :email, :string field :password, :string, virtual: true, redact: true field :hashed_password, :string, redact: true field :username, :string field :display_name, :string field :conf...
03e91b54686054c42145748df81ffc707ef1bf6e
2,119
[ 53426794 ]
[ "genserver" ]
require Logger defmodule CBMQWriter.Filesrv.Worker do use GenServer def recv_event(eventtype, sensorid, timestamp, binary) do sendingpid = case Process.get(sensorid) do nil -> {:ok, pid} = Supervisor.start_child(CBMQWriter.Filesrv.Supervisor, [sensorid]) Process.put(sensorid, pid) ...
03e93db9092200e83e982a85592fdc9e2838a3a1
3,151
[ 47724382 ]
[ "genserver", "documented" ]
defmodule SIP.ICT do @moduledoc "SIP INVITE client transaction" use GenServer import SIP.Trans.Timer import SIP.Transac.Common require SIP.Msg.Ops require Logger # Callbacks @impl true def init({ sipmsg, app_pid, ring_timeout }) do t_mod = sipmsg.ruri.tp_module t_pid = sipmsg.ruri.tp_pid ...
03e95a90979714718d14d3f8b969abfad8bce504
13,107
[ 367278931 ]
[ "documented", "phoenix" ]
defmodule Google.Cloud.Aiplatform.V1beta1.NotebookExecutionJobView do @moduledoc false use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :NOTEBOOK_EXECUTION_JOB_VIEW_UNSPECIFIED, 0 field :NOTEBOOK_EXECUTION_JOB_VIEW_BASIC, 1 field :NOTEBOOK_EXECUTION_JOB_VIEW_FULL, 2 end ...
03ea0627567409d757287044c7eacdb3ecb354a2
5,066
[ 284204402 ]
[ "test" ]
defmodule Monet.Tests.Monet do use Monet.Tests.Base alias Monet.Tests.Generator @fuzz_count 100 @sql_types [ char1_col: [sql: "char(1)", type: :utf8, args: 1], char5_col: [sql: "char(5)", type: :utf8, args: 5], char100_col: [sql: "char(100)", type: :utf8, args: 100], varchar_col: [sql: "varchar(100)", ty...
03ea1cff81c598c3963976dc0c33bf2d7b1ebc46
2,384
[ 738378647 ]
[ "liveview", "test" ]
defmodule SentinelWeb.SessionLive.ConfirmationTest do use SentinelWeb.ConnCase import Phoenix.LiveViewTest import Sentinel.AccountsFixtures alias Sentinel.Accounts alias Sentinel.Repo setup do %{user: user_fixture()} end describe "Confirm user" do test "renders confirmation page", %{conn: co...
03ea8b8630dc6cb09684aed6ae415f1cc5e28476
1,847
[ 335441824 ]
[ "test" ]
defmodule CourseHub.Financials.OfferTest do use CourseHub.DataCase, async: true alias CourseHub.Financials.Offer setup do university = insert(:university) campus = insert(:campus, university: university) course = insert(:course, campus: campus, university: university) %{course: course} end ...
03eaa0ac8fb376162b4f22c2835a74c6efea28e0
2,868
[ 637570524 ]
[ "typespec", "documented" ]
####################################################### # This file was auto-generated by elixir_bindings.zig # # Do not manually modify. # ####################################################### defmodule TigerBeetlex.TransferFlags do @moduledoc """ See [TransferFlags](https://docs.tig...
03eb24b7db2f4939311423d811500dd3bd3183dd
10,594
[ 284503855 ]
[ "genserver", "test", "supervisor" ]
defmodule Ark.PubSubTest do use ExUnit.Case, async: true alias Ark.PubSub alias Ark.PubSub.Group test "can subscribe, publish and receive a message" do {:ok, ps} = PubSub.start_link() assert :ok = PubSub.subscribe(ps, :topic_1) assert :ok = PubSub.publish(ps, :topic_1, :hello) assert_receive {P...
03ec0a09661f7272113c4e68c19533fc002fe87e
16,725
[ 104223581 ]
[]
defmodule IcdCode.ICDCode.Codes_O43 do alias IcdCode.ICDCode def _O43011 do %ICDCode{full_code: "O43011", category_code: "O43", short_code: "011", full_name: "Fetomaternal placental transfusion syndrome, first trimester", short_name: "Fetomaternal placental transfusion syn...
03ec16b0b93d04f1158a8fbfa9edd18af61c8ba3
2,342
[ 308664626 ]
[ "phoenix", "ecto" ]
defmodule PollerPhxWeb.QuestionController do use PollerPhxWeb, :controller alias PollerDal.{ Questions, Districts } alias PollerDal.Questions.Question def index(conn, %{"district_id" => district_id}) do district = Districts.get_district!(district_id) questions = Questions.list_questions_by_district_id...
03ec231522dac5f8807fd39ed9a616ed8d8a224b
2,357
[ 104670403 ]
[ "typespec" ]
defmodule TrashDuty.Cycle do require Logger @spec empty() :: [%{} | <<>>] def empty(), do: [%{}, ""] # default data type @spec add_users([String], %{required(String) => %{}}, %{} ) :: %{} def add_users(users, %{"members" => profiles_available}, current_users) do # find the user profile in `profiles_...
03ec6ec91a0b07675cbfae8b1fdd9336dced0bd8
13,160
[ 188357633 ]
[]
%{ "cachex": {:hex, :cachex, "3.2.0", "a596476c781b0646e6cb5cd9751af2e2974c3e0d5498a8cab71807618b74fe2f", [:mix], [{:eternal, "~> 1.2", [hex: :eternal, repo: "hexpm", optional: false]}, {:jumper, "~> 1.0", [hex: :jumper, repo: "hexpm", optional: false]}, {:sleeplocks, "~> 1.1", [hex: :sleeplocks, repo: "hexpm", optio...
03eccb59c19727a80112e42fa1e13afb382450c6
1,694
[ 112866775 ]
[ "test" ]
defmodule IRC.Commands.NickTest do use ExUnit.Case alias IRC.{Commands.Nick, Support.Factory} setup_all do {:ok, _} = Registry.start_link(keys: :unique, name: UserRegistry) :ok end setup do on_exit fn -> IRC.UserRegistry.reset_meta() end end describe "run/3" do def subject(user, nick) ...
03ece1194a0a9feeefeb68dd043627b22e051d9e
15,865
[ 1019126840 ]
[ "test", "documented" ]
defmodule DSPex.PythonBridge.StatelessWorkerIntegrationTest do @moduledoc """ Integration tests for stateless worker architecture. These tests verify that workers can operate in a stateless manner, fetching session data from the centralized SessionStore on demand. """ use ExUnit.Case, async: false a...
03ed4aa0b384a0efc74b06be80ca0f045c442e4c
1,876
[ 248893165 ]
[ "test" ]
defmodule TablexServer.GameTest do use TablexServer.GameCase, async: true alias TablexServer.Game test ~s|`new/0` create a context that start with the game "__choosing__" and zero players (only values that is used in the __choosing__ screen with the client)| do %{game: game, players: players} = Game.new() ...
03edcf4cb7dad52aa142edfc234d37c1df0aa130
11,337
[ 725888586, 112710296 ]
[ "documented" ]
defmodule Parser do defmodule Result do defstruct value: :nomatch, rest: "" def reverse(result = %Result{value: value}) do %Result{result|value: deep_reverse(value)} end def reverse(not_result), do: not_result defp deep_reverse(value) when is_list(value) do value |> Enum.rever...
03ede57650a493cc693bf6f4246424218f878b27
1,628
[ 105520863 ]
[ "macro", "documented", "phoenix" ]
defmodule SpenderWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, views, channels and so on. This can be used in your application as: use SpenderWeb, :controller use SpenderWeb, :view The definitions below will be executed for every view, controller, ...
03ee019696a38bfc1dc802e5d34c31dbc25b1cad
4,472
[ 395289414 ]
[ "documented" ]
defmodule DomainNameBench do @moduledoc """ Benchmark script for comparing domain name creation performance """ # Legacy implementation for comparison def create_domain_name_legacy(name) do name |> String.split(".") |> Enum.map(&DNSpacket.create_character_string/1) |> DNSpacket.concat_binary_...
03ee7db86d397e84c5b15da1c647413f9142da99
2,225
[ 212156376 ]
[ "phoenix" ]
defmodule Web.PermitController do use Web, :controller action_fallback(Web.FallbackController) plug :authenticate when action in [:index, :new, :create, :show] # plug :authenticate when action not in [:select_category] alias Workpermit.Permits alias Workpermit.Permits.Permit require Ecto.Query requir...
03eeed77417e2c4e50fcc0fd57c223752c0369e9
5,083
[ 421520876 ]
[ "test" ]
defmodule HandleReadyTest do use ExUnit.Case test "ready message not sent (original)", do: test_ready_message_not_sent(&Wasper.HBBFT.RBC.Bracha.handle_message/2) test "ready message not sent (generated)", do: test_ready_message_not_sent(&Generated.HandleReadyMessage.handle_message/2) defp test_ready_...
03ef737fa0a66ce0d2250b05206569dbdfc7690a
1,926
[ 79564417 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule Juggler.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use Juggler.Web, :controller use Juggler.Web, :view The definitions below will be executed for every view, controller, etc, so keep them sho...
03ef80529ee9b17ec5d621fa9a2f1243a9794d79
1,597
[ 392875067 ]
[]
defmodule WabanexWeb.Schema.Types.Root do use Absinthe.Schema.Notation alias Crudry.Middlewares.TranslateErrors alias WabanexWeb.Resolvers alias Resolvers.File, as: FileResolver alias Resolvers.User, as: UserResolver alias Resolvers.Training, as: TrainingResolver alias WabanexWeb.Schema.Types impor...
03ef935a647331cc8c3ea25b0b0b7aa13a9b0a6d
2,785
[ 863118743, 863118926 ]
[]
defmodule Astarte.Housekeeping.ReleaseTasks do require Logger alias Astarte.Housekeeping.Config alias Astarte.Housekeeping.Migrator alias Astarte.Housekeeping.Queries @start_apps [ :logger, :crypto, :ssl, :xandra ] def init_database do :ok = start_services() with {:ok, exists?}...
03efc39f12eb08b36df4777f55d5f95e70c29e44
3,760
[ 495192550 ]
[ "typespec", "macro", "documented" ]
defmodule Bcs.Encoder do import Bitwise, only: [<<<: 2] @doc """ Unsigned Little Endian Base 128. See https://en.wikipedia.org/wiki/LEB128#Unsigned_LEB128 """ def uleb128(value) when value >= 0 and value < unquote(1 <<< 7) do <<value::8>> end def uleb128(value) when value >= unquote(1 <<< 7) and ...
03efe9c0a7673905b6d1b48db1b3bfd5b16bd654
1,891
[ 207672878 ]
[ "phoenix", "ecto" ]
defmodule BackerWeb.MetadataController do use BackerWeb, :controller alias Backer.Account alias Backer.Account.Metadata def index(conn, params) do metadatas = Account.list_metadatas(params) render(conn, "index.html", metadatas: metadatas) end def new(conn, _params) do changeset = Account.chan...
03f1088f2a1f3829533c21bdcbdd5cb404b94900
2,104
[ 107482482 ]
[ "genserver", "documented" ]
defmodule ClientWorkerModule do use GenServer def start_link do GenServer.start_link(__MODULE__,[]) #WorkerModule.get_bitcoins(pid, no_of_zeros) end def get_bitcoins(process_id, k, superpid) do GenServer.cast(process_id,{:get_bitcoins, pro...
03f16b112d69c0584504b413ccfd91d400686201
3,632
[ 542291437 ]
[ "typespec", "documented" ]
defmodule AshAuthentication.Strategy.Custom.Transformer do @moduledoc """ Transformer used by custom strategies. It delegates transformation passes to the individual strategies. """ use Spark.Dsl.Transformer alias AshAuthentication.{Info, Strategy} alias Spark.{Dsl.Transformer, Error.DslError} import...
03f1aa71811327f9cbfdd8885ec2c8ff39ebb140
1,555
[ 317952633 ]
[ "documented" ]
defmodule MonsterMessages do @moduledoc """ https://adventofcode.com/2020/day/19 """ def count_matching_messages(input) do data = parse(input) pattern = build_pattern(data.rules) Enum.count(data.messages, & &1 =~ pattern) end def parse(input) do [rule_input, message_input] = String.split(in...
03f1c2a1ffecc7a55a31cb2a95f8c42fd0187d78
2,748
[ 416599995 ]
[ "test", "phoenix" ]
defmodule TwewwoApiWeb.TaskListControllerTest do use TwewwoApiWeb.ConnCase alias TwewwoApi.Todo alias TwewwoApi.Todo.TaskList @create_attrs %{ name: "some name", order: [] } @update_attrs %{ name: "some updated name", order: [] } @invalid_attrs %{name: nil, order: nil} def fixture(:...
03f1dbfac706ec714cdd19e97f44caa53e88f43c
2,552
[ 140489612 ]
[ "test", "ecto" ]
defmodule DocumentGenerator.UserTest do use DocumentGenerator.DataCase alias DocumentGenerator.Accounts alias DocumentGenerator.Accounts.User setup do {:ok, user: insert(:user)} end # TODO: get rid of these module attributes if they're not needed @valid_attrs %{ email: "some email", name: "...
03f1fdc2ce5ed173f463396db3baddd11f1e3435
2,576
[ 96117673 ]
[ "test" ]
defmodule BlowCasherWeb.ItemControllerTest do use BlowCasherWeb.ConnCase alias BlowCasher.Casher @create_attrs %{item_name: "some item_name"} @update_attrs %{item_name: "some updated item_name"} @invalid_attrs %{item_name: nil} def fixture(:item) do {:ok, item} = Casher.create_item(@create_attrs) ...
03f212466248ef27c0fe2ba8e2ce4aa1d88e4a13
17,376
[ 322345781 ]
[]
%{ "assert_html": {:hex, :assert_html, "0.1.2", "d87fb80ca5ee190f9be97fbdc649826c17135fff1a1cfcef6ea5be550a1fcd4d", [:mix], [{:floki, "~> 0.21", [hex: :floki, repo: "hexpm", optional: false]}], "hexpm", "602212a42bad9026f297a72366087ffeece7e39a3504fc587153f90e738e4272"}, "bamboo": {:hex, :bamboo, "1.6.0", "adfb583b...
03f22caf01f235902800b730db85c369a649f509
3,219
[ 273085190, 406732766, 425222664, 286403536, 294000469, 407445450, 290969763, 404104258, 295382766, 273096993, 256354544, 122517060, 272192752, 257246799, 299711271, 280469788, 281229752, 333225527, 528199088, 267936422, 297389399, 217930962, 264829031 ]
[ "typespec", "documented" ]
defmodule Mix.Ecto do @moduledoc """ Conveniences for writing Ecto related Mix tasks. """ @doc """ Parses the repository option from the given command line args list. If no repo option is given, it is retrieved from the application environment. """ @spec parse_repo([term]) :: [Ecto.Repo.t] def parse...
03f231eabafbc33b4f033a4f58b2c4e494337481
4,176
[ 877242231 ]
[ "typespec", "documented", "ecto" ]
defmodule Membership.Subscription do use Postgres.Schema use Postgres.Service alias __MODULE__ @moduledoc """ Field status: PENDING subscription can be ACCEPTED or REJECTED after verifying transaction ACCEPTED subscription can be CANCELLED by external specialist ACCEPTED or CANCELLED subscription can ...
03f23aa541dd447a5f2ed20ade5605df2128761b
2,601
[ 140890391 ]
[ "test" ]
defmodule DatabaseWeb.SurveyControllerTest do use DatabaseWeb.ConnCase alias Database.Surveys alias Database.Surveys.Survey @create_attrs %{event_attended: true, met_someone: true, person_id: 1} @update_attrs %{event_attended: false, met_someone: false, person_id: 1} @invalid_attrs %{event_attended: nil, ...
03f2681cc20cfe8ba11f0d2ab61a02703b802cbe
2,309
[ 325447072 ]
[ "documented" ]
defmodule ParamMap do @moduledoc """ A subset of the `Map` module that operates on string-keyed maps using atom key arguments. ## Examples iex> params = %{"color" => "red", "size" => "large", "age" => 100} iex> ParamMap.get(params, :color) "red" iex> ParamMap.delete(params, :size) ...
03f272bf6d3d5ff483ec3a8dc6a7e24661cda708
4,070
[ 330019424 ]
[]
defmodule NflRusher.ResolverRushers do @limit 100 import Ecto.Query alias NflRusher.{Repo, Rusher} alias NflRusher.{Rusher, RusherVersion} def resolve(_parent, %{input: input}, _resolution) do rushers = query_rushers(input) |> Enum.map(&build_rusher/1) {:ok, %{rushers: rushers}} end ...
03f28ac53f98f07319e58621c0c578048649e755
5,850
[ 185558207, 213229236, 1000104078, 589089007, 982054619, 589866492, 691980346, 882572863, 217320195, 174991383, 807904878, 215544723, 540729553, 887377354 ]
[ "test" ]
defmodule Pleroma.Config.TransferTaskTest do use Pleroma.DataCase import ExUnit.CaptureLog import Pleroma.Factory alias Pleroma.Config.TransferTask setup do: clear_config(:configurable_from_database, true) test "transfer config values from db to env" do refute Application.get_env(:pleroma, :test_key...
03f2a1aba5f7365a0dc00028e401846f60c428a6
16,043
[ 238230407 ]
[ "genserver", "typespec", "documented" ]
defmodule Automata.AutonomousGovernance.DistributedGovernance.ZoneManager do @moduledoc """ Manager for governance zones in the distributed governance system. This module provides functionality for: - Creating and configuring governance zones - Managing agent registrations within zones - Tracking zone me...
03f2ecb848a4efe197f5b556345045946a2dbb78
10,647
[ 372010192 ]
[]
%{ "amqp": {:hex, :amqp, "2.1.1", "ad8dec713ba885afffffcb81feb619fe7cfcbcabe9377ab65ab7a110bd4f43a0", [:mix], [{:amqp_client, "~> 3.8.0", [hex: :amqp_client, repo: "hexpm", optional: false]}], "hexpm", "b6d926770e4508e30e3e9e476c57b6c8aeda44f7715663bdc38935620ce5be6f"}, "amqp_client": {:hex, :amqp_client, "3.8.14",...
03f3567a50a6fdb1105953a8c7d4f6b1be1c1611
1,545
[ 220570508, 220614607 ]
[ "phoenix" ]
defmodule TimesheetSpaWeb.TaskController do use TimesheetSpaWeb, :controller alias TimesheetSpa.Tasks alias TimesheetSpa.Tasks.Task action_fallback TimesheetSpaWeb.FallbackController def index(conn, _params) do tasks = Tasks.list_tasks() render(conn, "index.json", tasks: tasks) end def create(...
03f377c201431ef5ef3a124c2ce688c862135aee
15,673
[ 28715631 ]
[ "documented" ]
defmodule Zc do @moduledoc """ record for erlcloud aws_config() ## Example aws_config(ddb_port: 9001) """ require Record Record.defrecord :aws_config, Record.extract(:aws_config,from_lib: "erlcloud/include/erlcloud_aws.hrl") end defmodule Zdb do defstruct table: "test_table" require Zc require L...
03f43db4e5955febc5ac92e5cbc0b6f240a1d3ea
2,036
[ 147132440 ]
[ "documented" ]
defmodule SimplePrinter do @moduledoc """ This module is responsible for printing a simple board. """ @doc """ Return all cells ## Parameters - board: The current board\n - width: Used to split by line\n - xray: If true, shows the bombs ## Examples iex(1)> Game.init(2, 2, 1)\n |> SimplePrint...
03f463a6e65dceaa0ed82014eadd0822453829d0
2,020
[ 113956009, 114703850 ]
[ "phoenix" ]
defmodule TwitterSimulator.Endpoint do use Phoenix.Endpoint, otp_app: :twitter_simulator socket "/socket", TwitterSimulator.UserSocket # Serve at "/" the static files from "priv/static" directory. # # You should set gzip to true if you are running phoenix.digest # when deploying your static files in produ...
03f47f13110abab7caac6072b0a737225e85a757
4,005
[ 942811655, 920024200 ]
[ "test", "documented" ]
defmodule Ppl.Ppls.STMHandler.DoneState.Test do @moduledoc """ Test for the DoneState handler with GRPC server integration. Uses a dynamic port to avoid conflicts. """ use Ppl.IntegrationCase alias Ppl.Ppls.STMHandler.DoneState.Test.Record alias Ppl.Ppls.STMHandler.DoneState.Test.RecordingGofer alias P...
03f4871483ded16817ec0fd0ace1ee16945407fd
4,229
[ 612916241 ]
[ "documented", "ecto" ]
defmodule Accumulator.Comments do import Ecto.Query alias Accumulator.{Comments.Comment, Repo} def get_all_comments() do Repo.all(Comment) end @doc """ Gets a single comment by ID. """ def get_comment(id) do case Repo.get(Comment, id) do nil -> nil comment -> Repo.preload(comment, ...
03f4f7fe6e618fadfc49ac22b8a9852698dcf746
1,652
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DisplayVideo.V3.Model.Status do @moduledoc """ The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code...
03f52ae08b3fa181c4b87e9247fd0fb90aef053b
3,534
[ 401148660 ]
[]
defmodule NervesSystemRpi3.MixProject do use Mix.Project @github_organization "nerves-project" @app :nerves_system_rpi3 @source_url "https://github.com/#{@github_organization}/#{@app}" @version Path.join(__DIR__, "VERSION") |> File.read!() |> String.trim() def project do [ ...
03f546a2316a5d297f518b435e17d481ef925087
13,703
[ 478602178 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hex...
03f54b028565a45c29a0cd16ab724733c9437668
3,681
[ 474618505 ]
[ "liveview", "test" ]
defmodule ElixirsandboxWeb.ArticleLiveTest do use ElixirsandboxWeb.ConnCase import Phoenix.LiveViewTest import Elixirsandbox.BlogsFixtures @create_attrs %{body: "some body", title: "some title"} @update_attrs %{body: "some updated body", title: "some updated title"} @invalid_attrs %{body: nil, title: nil}...
03f55555e9f2a87cd34b4ecaadf75495ec2f8ef0
7,579
[ 170792694, 919826844 ]
[ "liveview", "phoenix" ]
defmodule MobaWeb.CommunityView do use MobaWeb, :view alias MobaWeb.PlayerView def formatted_body(%{body: body}) do body |> text_to_html() |> safe_to_string() |> String.replace( ~r/https:\/\/browsermoba.com\/battles\/([0-9]+)/, "<a href='/battles/\\1' class='text-primary'>Battle #\\1...
03f5dbbb70e22b08932ee49c31233e0a50ca95c9
1,553
[ 48624949 ]
[]
defmodule Tentabucket.Mixfile do use Mix.Project @description """ Simple Bitbucket API client library for Elixir """ def project do [app: :tentabucket, version: "0.0.1", elixir: "~> 1.3", name: "Tentabucket", description: @description, package: package(), build_embedded: ...
03f66378e348587ef818cbd6a48ffa71b8b54b9f
1,666
[ 683707419 ]
[ "liveview", "documented", "ecto" ]
defmodule UndiOnlineWeb.AccountLive.FormComponent do @moduledoc """ This component is used for creating an account and setting the first membership. """ use UndiOnlineWeb, :live_component alias UndiOnline.Accounts alias UndiOnline.Accounts.Account @impl true def render(assigns) do ~H""" <div...
03f675163095aabb4ce7806b3412c9340323deff
1,600
[ 91498911 ]
[ "macro", "documented", "phoenix" ]
defmodule DistribVideos.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use DistribVideos.Web, :controller use DistribVideos.Web, :view The definitions below will be executed for every view, controller, etc...
03f68443de8b5de9360a92570203f81f972aa258
5,874
[ 744421640 ]
[ "documented" ]
defmodule Explorer.Account.Notifier.Summary do @moduledoc """ Compose a summary from transactions """ alias Explorer alias Explorer.Account.Notifier.Summary alias Explorer.{Chain, Repo} alias Explorer.Chain.Wei defstruct [ :transaction_hash, :from_address_hash, :to_address_hash, :met...
03f6df3184912df2958aa12668840d70274cc84b
2,570
[ 294836292 ]
[ "documented" ]
defmodule PixelSmash.Battles.ActionPropertiesDeck do alias PixelSmash.Sprites # counts of colors should be >= 0 @colors_attack_multiplier [ {%{red: 12, pink: 5}, 2.0}, {%{dark_red: 7, dark_green: 3}, 1.5}, {%{red: 3}, 1.0} ] @colors_cast_multiplier [ {%{purple: 12, dark_pink: 5}, 3.0}, {...
03f6f3f6c2434c92f94aace39b93bb92d001431c
1,839
[ 898789010 ]
[]
defmodule FileProcessor do def process_input_stream() do {col1, col2} = IO.stream(:stdio, :line) |> Stream.map(&String.trim/1) |> Stream.map(&parse_line/1) |> Enum.reduce({[], []}, fn {:error, msg}, acc -> IO.puts("Error: #{msg}") acc {a, b}, {list1, list2} -> ...
03f7267b07b8bcdfb88157b8a64e0ee1193161c7
1,850
[ 111461650 ]
[ "test" ]
defmodule HappoWeb.LoadUserTest do use HappoWeb.ConnCase alias HappoWeb.LoadUser setup [:prepare_session_and_flash] describe "If the `user_id` session variable is NOT present" do test "sets current user to nil", %{conn: conn} do conn = LoadUser.call(conn, []) assert conn.assigns.current_user =...
03f8346de8fc25710c93a9d43f3ffaf7de687b0b
2,290
[ 151584267 ]
[]
defmodule Corker.Factory do use ExMachina.Ecto, repo: Corker.Repo alias Corker.Accounts.User alias Corker.Feedback.HighFive def user_factory do %User{ slack_id: Faker.String.base64(), username: Faker.Internet.user_name() } end def slack_user_factory do username = Faker.Internet.us...
03f85029b6dafde3b0b64e04120ac4d15bf19712
1,735
[ 146636103 ]
[ "phoenix" ]
defmodule TextingWeb.PhoneVerifyController do use TextingWeb, :controller alias Texting.PhoneVerify alias Texting.Formatter alias Texting.Account # def new(conn, %{"token" => token}) do # case Account.verify_token(token) do # {:ok, user_id} -> # user = Account.get_user_by_id(user_id) # changeset ...
03f8b68a1584467ea58579256e6968c7f7cb0a83
5,145
[ 367361617 ]
[ "genserver", "documented" ]
defmodule SkyscraperOtp.Dispatcher.Server do alias SkyscraperOtp.Elevator.Server, as: Elevator alias SkyscraperOtp.{Dispatcher, Interface, Cache} alias SkyscraperOtp.Dispatcher.Display require IEx use GenServer @moduledoc """ Provides statefull and OTP related abstraction for `Dispatcher` logic """ ...
03f945476ec80adb49e00631f31cd216a03eb19a
1,810
[ 147283516 ]
[]
defmodule Cuandoesquincena.Quincena do import Timex use Timex def next_quincena(), do: local() |> next_canonical_date |> calculate_quincena def prev_quincena, do: local() |> prev_canonical_date |> calculate_quincena def calculate_quincena(canonical_date), do: canonical_date |> to_date |> fix_we...
03f9b3016f2e0d65eb2f234735a84d73769004cb
3,556
[ 87435320 ]
[ "test" ]
defmodule CoursePlanner.TaskTest do use CoursePlannerWeb.ModelCase import CoursePlanner.Factory alias CoursePlanner.Tasks.Task @valid_attrs %{name: "mahname", max_volunteers: 2, start_time: Timex.now(), finish_time: Timex.shift(Timex.now(), days: 2)} @invalid_attrs %{} setup do insert(:system_variabl...
03faa0810ce3479550f8832984953bd4c771e7a2
5,606
[ 322475495 ]
[]
%{ "certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"}, "cowboy": {:hex, :cowboy, "2.8.0", "f3d...
03fac7e5e038ad0ab953b906dbde2104f1022f67
1,696
[ 289522129 ]
[]
defmodule Mazes.MazeGeneration.HuntAndKillAlgorithm do @behaviour Mazes.MazeGeneration.Algorithm alias Mazes.Maze @impl true def supported_maze_types do [ Mazes.RectangularMaze, Mazes.RectangularMazeWithMask, Mazes.CircularMaze, Mazes.HexagonalMaze, Mazes.TriangularMaze ] ...
03fae109c8f4a1720f38d54ca06c7977b3f04acb
3,184
[ 152527699 ]
[ "test" ]
defmodule FCInventory.Router.DeleteTransactionTest do use FCBase.RouterCase import FCInventory.Fixture alias Decimal, as: D alias FCInventory.Router alias FCInventory.DeleteTransaction alias FCInventory.{ TransactionDeleted, TransactionPrepared, EntryAdded, EntryDeleted } setup do ...
03faf2b352030d8d5f1c242bb7b8c619b1edcade
3,865
[ 866648389 ]
[ "typespec", "documented" ]
defmodule NeoSaxy.XML do alias NeoSaxy.Builder @moduledoc """ Helper functions for building XML elements. """ @type characters() :: {:characters, String.t()} @type cdata() :: {:cdata, String.t()} @type comment() :: {:comment, String.t()} @type ref() :: entity_ref() | hex_ref() | dec_ref() @type ...
03fb4ea458c5875d304fdb9eb4cfb8c0ccdfdf39
5,087
[ 84335867 ]
[ "documented" ]
defmodule KnetikPlatformAPIDocumentationLatest.Api.Store_Shipping do @moduledoc """ Documentation for KnetikPlatformAPIDocumentationLatest.Api.Store_Shipping. """ use Tesla plug Tesla.Middleware.BaseUrl, "https://jsapi-integration.us-east-1.elasticbeanstalk.com" plug Tesla.Middleware.JSON @doc """ Cr...
03fb77796572a1a41e6c556a2e6a9d06ca12bcbd
1,538
[ 147445441 ]
[ "ecto" ]
defmodule ReactorWeb.Resolvers.Calendar do alias Reactor.Calendar def list_tasks(_parent, _args, _resolution) do {:ok, Reactor.Calendar.list_tasks()} end def create_task(_root, %{task: task}, _info) do case Calendar.create_task(task) do {:ok, task} -> {:ok, %{task: task}} ...
03fb969e04888f78421d7074dd9598b38c547cd6
1,746
[ 116493698 ]
[ "test" ]
if !System.get_env("EXERCISM_TEST_EXAMPLES") do Code.require_file("file_parser.exs", __DIR__) end ExUnit.start() ExUnit.configure(exclude: :pending, trace: true) defmodule FileParserTest do use ExUnit.Case setup do {:ok, file} = File.open("test.txt", [:write]) on_exit(fn -> File.rm("test.txt") ...
03fbda787832571b0cf29e58dade9bc370aad259
2,847
[ 677875369 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule RadioappWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, components, channels, and so on. This can be used in your application as: use RadioappWeb, :controller use RadioappWeb, :html The definitions below will be executed for every controller,...