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
02393dd7c90454a7c3622d823dcd7c8633370c6f
1,967
[ 506532872 ]
[ "liveview" ]
defmodule FkcElixirWeb.RegisterLive do use FkcElixirWeb, :live_view alias FkcElixir.Accounts alias FkcElixir.Accounts.User def mount(_params, session, socket) do changeset = Accounts.change_user_registration(%User{}) socket = assign_current_user(socket, session) socket = allow_upload( ...
023a3f2fe47352cd1a476d3e5af8348cc7011b88
3,057
[ 828087786 ]
[ "documented" ]
defmodule Ash.Domain.Info.Livebook do @moduledoc """ Generate a Livebook from a specified domain. """ # Strip Elixir off front of module defp module_name(module) do module |> Module.split() |> Enum.join(".") end defp resource_name(resource) do resource |> Ash.Resource.Info.short_name...
023a5f0d76e9ea9a4ae459fd6e21d7542e2e3c9f
2,915
[ 114550036 ]
[ "test" ]
defmodule MxTrackerWeb.MxNodeControllerTest do use MxTrackerWeb.ConnCase alias MxTracker.Admin @create_attrs %{name: "some name", node_type: "some node_type", url: "some url", node_uuid: "456"} @update_attrs %{name: "some updated name", node_type: "some updated node_type", url: "some updated url", node_uuid: ...
023a61329a6eb0ed3d0d689359a42d5be1cc48dc
15,512
[ 772267738 ]
[ "typespec", "macro", "documented" ]
defmodule Splode do @moduledoc """ Use this module to create your error aggregator and handler. For example: ```elixir defmodule MyApp.Errors do use Splode, error_classes: [ invalid: MyApp.Errors.Invalid, unknown: MyApp.Errors.Unknown ], unknown_error: MyApp.Errors.Unknown.Unknown ...
023aec805d536b11370c34054b48417921735851
9,889
[ 622053022 ]
[]
# Script for populating the database. You can run it as: # # mix run priv/repo/seeds.exs # # Inside the script, you can read and write to any of your # repositories directly: # # NewsForum.Repo.insert!(%NewsForum.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they ...
023bbfe7c7359a17d7e1efc24955cba425697c0f
2,335
[ 357561319 ]
[ "test" ]
defmodule NifTest do alias USAddress.Nif use ExUnit.Case doctest USAddress.Nif test "init :ok" do {:ok, resource} = Nif.init(Application.fetch_env!(:us_address, :data_path)) assert resource end test "init :error" do {:error, error} = Nif.init("bad_path") assert "Could not open the mdAddr....
023c092c5564878ad052b29fb7830b94cd01bb94
3,791
[ 453162461 ]
[ "test" ]
defmodule HangmanWeb.OptionsControllerTest do use HangmanWeb.ConnCase setup_all do: [] setup %{conn: conn} do {:ok, conn: put_req_header(conn, "accept", "application/json")} end # Info describe "[OPTIONS] /manager/:" do test "Returns the CORS options" do conn = build_conn() conn_respo...
023d0fabf3abdc7d9d011b639382c0f84d898296
1,660
[ 138208143 ]
[ "genserver", "typespec" ]
defmodule Slave do require Logger use GenServer alias Events.{BalanceEvent, WithdrawEvent, DepositEvent, CreateEvent, RegisterEvent} def balance(bank, name), do: GenServer.call(bank, %BalanceEvent{name: name}) def withdraw(name, amount), do: Master.withdraw(name, amount) def deposit(name, amount), do: ...
023d4fb4d5890e362a8abe4e47e3bb72f4ed87f2
2,399
[ 363419449, 123528600 ]
[ "genserver", "test" ]
defmodule OMG.WatcherInfo.ReleaseTasks.SetTracerTest do use ExUnit.Case, async: true import ExUnit.CaptureLog, only: [capture_log: 1] alias OMG.WatcherInfo.ReleaseTasks.SetTracer alias OMG.WatcherInfo.Tracer @app :omg_watcher_info setup do {:ok, pid} = __MODULE__.System.start_link([]) nil = Proces...
023db1644ab00ee2ca9291f1c09aeede1c124efc
2,406
[ 77584337 ]
[ "test", "ecto" ]
defmodule LookupTest do use ExUnit.Case require Ecto.Query doctest Lookup import Lookup, only: [ parse_args: 1] test "filter_list_with_term selects the correct sublist" do list1 = ["ax by cz", "cz du eu", "du eu fu gu hu"] assert Lookup.Note.filter_list_with_term(list1, "cz") == ["ax by cz", "...
023dccabd952ac2a6e0f16aedb10cb9b2d873691
1,709
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.SecurityCenter.V1.Model.TicketInfo do @moduledoc """ Information about the ticket, if any, that is being used to track the resolution of the issue that is identified by this finding. ## Attributes * `assignee` (*type:* `String.t`, *default:* `nil`) - The assignee of the ticket in the tic...
023dee942cb48731945c73635204aaf1b91da2e8
2,248
[ 318438871 ]
[]
defmodule Machine do defstruct [pointer: 0, acc: 0, history: []] def run(%Machine{} = m, instructions) when is_list(instructions) do i = Enum.at(instructions, m.pointer) m = run(m, i) |> Map.put(:history, [m.pointer | m.history]) cond do should_halt?(m, instructions) -> {:ok, m} wrong_poin...
023e4fd0e45504495b4a02f1d6908e02d5da38ca
3,332
[ 1004770419 ]
[]
defmodule Tunez.Accounts.Token do use Ash.Resource, otp_app: :tunez, domain: Tunez.Accounts, data_layer: AshPostgres.DataLayer, authorizers: [Ash.Policy.Authorizer], extensions: [AshAuthentication.TokenResource] postgres do table "tokens" repo Tunez.Repo end actions do defaults...
023e57fae70043c3311c23e05ea4c93897fa69b9
1,694
[ 250396789 ]
[ "typespec", "documented" ]
defmodule Diplomacy.Game.Order do alias Diplomacy.Game.Province @type move :: %{from: Province.t(), to: Province.t()} @type convoy :: %{convoyer: Province.t(), convoyee: Province.t(), to: Province.t()} @type hold :: %{holder: Province.t()} @type support :: %{supporter: Province.t(), supportee: Province.t(), ...
023e6018f0cc14329c38c90993be56defa63fa4b
2,998
[ 693701365 ]
[ "typespec", "documented", "ecto" ]
defmodule SimpleBank.Transaction do @moduledoc """ Modulo Transaction para o SimpleBank Este módulo define o schema para a tabela "transactions" e fornece uma função para manipular registros de transações, incluindo a criação de um changeset para validação de dados das transações Campos do schema: - :nu...
023ea92ab2432a7552460d057a1eb72ff18b4ca7
1,844
[ 360852259 ]
[ "typespec", "documented" ]
defmodule ExJenga.AccountServices.AccountBalance do @moduledoc """ This enables your application to retrieve the current and available balance of an account. """ import ExJenga.JengaBase alias ExJenga.Signature @uri_affix "/account/v2/accounts/balances/" @doc """ Inquire current and available account...
023f0ffdf21bf356d3bf87f7051e905d9bf20df2
17,574
[ 563730500 ]
[ "typespec", "documented", "ecto" ]
defmodule Explorer.Chain.SmartContract do @moduledoc """ The representation of a verified Smart Contract. "A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain." http://solidity.readthedocs.io/en/v0.4....
023fcd2f668be2a189fe2d600c90e94c073ab1f3
1,862
[ 896767143 ]
[]
defmodule Solution do def parse_robot(line) do [_, px_str, py_str, vx_str, vy_str] = List.flatten(Regex.scan(~r/p=(-?\d+),(-?\d+) v=(-?\d+),(-?\d+)/, line)) {px, _} = Integer.parse(px_str) {py, _} = Integer.parse(py_str) {vx, _} = Integer.parse(vx_str) {vy, _} = Integer.parse(vy_str) {{px, py}, {vx, vy}...
023ff1a3f357282dd57140cc6fbaa855693f44c5
1,722
[ 191612022 ]
[ "documented", "phoenix" ]
defmodule EHealth.Web.MedicationRequestController do @moduledoc false use EHealth.Web, :controller alias Core.MedicationRequests.API alias Scrivener.Page action_fallback(EHealth.Web.FallbackController) def index(%Plug.Conn{req_headers: headers} = conn, params) do client_type = conn.assigns.client_typ...
0240049d2ff931170856f5cc87f8edbaeced3697
1,888
[ 347794413 ]
[ "documented" ]
defmodule Issues.CLI do import Issues.TableFormatter, only: [print_table_for_columns: 2] @default_count 4 @moduledoc """ Handle the command line parsing and the dispatch to the various functions that end up generating a table of the last _n_ issues in a github project """ def main(argv) do ...
02403cee75b4a10ae4a4e0e829e64c8c64cb1ef2
9,746
[ 995944955 ]
[ "test", "liveview" ]
defmodule PetalComponents.Custom.CascaderTest do use ShopUxPhoenixWeb.ComponentCase import PetalComponents.Custom.Cascader describe "cascader/1" do test "renders basic cascader" do assigns = %{ options: [ %{ value: "zhejiang", label: "浙江", children:...
02405c6d0507b814a7514705ccc9f327efef859a
5,094
[ 135832997 ]
[ "liveview" ]
defmodule Data.Article.Blog.KreuzungElbchausseeManteuffelSchenefelderMuehlenberg do use Article.Default def updated_at(), do: ~D[2023-01-09] def title(), do: "Kreuzung Elbchaussee / Manteuffelstraße / Mühlenberg (Radroute 1)" def summary(), do: "Veloroute 1 wird im südlichen Blankenese meist Fahrrad...
02407f99fb7721d4c8a7566513ba5ac20f0959eb
5,604
[ 158013615 ]
[ "typespec", "documented", "phoenix" ]
defmodule AsteroidWeb.API.OAuth2.IntrospectController do @moduledoc false use AsteroidWeb, :controller import Asteroid.Utils alias Asteroid.Token.{RefreshToken, AccessToken} alias Asteroid.{Client, Subject} alias Asteroid.OAuth2 def handle(%Plug.Conn{body_params: %{"token" => token}} = conn, params) do ...
0240fb7a1d1a65001d70947bb3b96fe88c0b62dc
1,957
[ 112778302, 112784179 ]
[]
defmodule MemoryReallocation do def run([path]) do solve(path, &count_reallocations/2) end def run(["-l", path]) do solve(path, &count_loop/2) end def run(_args) do IO.puts "USAGE: elixir #{Path.basename(__ENV__.file)} " <> "[-l] INPUT_FILE_PATH" end defp solve(path, counter) do ...
0240fc88d08945d7ef62195407dd62e7dbe5b20f
1,563
[ 128991706 ]
[]
%{ "cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, optional: false]}]}, "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec...
02414634ac9801217f339faffaafec82d4fc58d3
3,052
[ 335774384 ]
[ "test", "phoenix" ]
defmodule BillinhoElixirWeb.InstitutionControllerTest do use BillinhoElixirWeb.ConnCase alias BillinhoElixir.Directory alias BillinhoElixir.Directory.Institution @create_attrs %{ cnpj: "some cnpj", kind: "some kind", name: "some name" } @update_attrs %{ cnpj: "some updated cnpj", kind:...
0241529acb0242c174990f837a87b88d4e559d1d
1,672
[ 319461204 ]
[ "liveview" ]
defmodule LiveSpatWeb.PageLive do use LiveSpatWeb, :live_view @impl true def mount(_params, _session, socket) do socket = socket |> assign(point: %{x: 128, y: 128}, color: "#f00") |> assign(traj: []) |> assign(path: traj_to_path([])) |> assign(markers: []) {:ok, socket} e...
02416a99d3982ab4f2087ff1bb78cf65dc8d1713
4,283
[ 435185954 ]
[]
defmodule Day24 do def answer_part_1_example, do: answer_part_1("inputs/24/example.txt") def answer_part_1_input, do: answer_part_1("inputs/24/input-test.txt") def answer_part_1(file_path) do file_path |> read_file() |> find_largest_input() end def read_file(file_path) do {:ok, contents} = ...
02417e3734378484b8cbe9dab8bdd3d5b8b46c3e
2,255
[ 55327297 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. use Mix.Config # Configures the endpoint config :trucksu, Trucksu.Endpoint, url: [host: "localhost...
0241f217212a844b035e4fe5f4c96cb53f1b0a26
1,619
[ 652635425 ]
[ "typespec", "documented" ]
defmodule Foodtruck.Boundary.FileReader do @moduledoc """ Process CSV files at the boundary. Files parsed here are inserted into an Agent in lieu of a database. A database for a product of this variety is probably overkill. I used NimbleCSV here because some wheels don't need to be remade. """ alias Foodtruc...
024243461f88f85db3d94b1e0a051e65fe976993
17,402
[ 604449586 ]
[]
%{ "castore": {:hex, :castore, "0.1.22", "4127549e411bedd012ca3a308dede574f43819fe9394254ca55ab4895abfa1a2", [:mix], [], "hexpm", "c17576df47eb5aa1ee40cc4134316a99f5cad3e215d5c77b8dd3cfef12a22cac"}, "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix]...
02425974ad173057787021ef10b5483c07821762
1,806
[ 877242231 ]
[ "test" ]
defmodule EMR.PatientRecords.Timeline.Item.CommentTest do use Postgres.DataCase, async: true alias EMR.PatientRecords.Timeline.Item.Comment alias EMR.PatientRecords.Timeline.Commands.CreateItemComment @timeline_item_id "3c0abe99-7c16-435e-85c2-740ebea4501f" defp prepare_comment(body) do cmd = %CreateI...
024298ef02844e1247f824024b62f2c95a171ee5
2,408
[ 176909905 ]
[]
use Mix.Config # For development, we disable any cache and enable # debugging and code reloading. # # The watchers configuration can be used to run external # watchers to your application. For example, we use it # with brunch.io to recompile .js and .css sources. config :mvp_elixir, MvpElixirWeb.Endpoint, http: [ ...
0242ac67639fe092bf31df2271b6525ce59e8286
17,536
[ 624054242 ]
[ "typespec", "documented" ]
# Code generated by protox. Don't edit. # credo:disable-for-this-file defmodule PgQuery.XmlExpr do @moduledoc false if function_exported?(Protox, :check_generator_version, 1) do Protox.check_generator_version(1) else raise "This code was generated with protox 2 but the runtime is using an older version of...
0242cd2c64f914ae40a7d628bf570e657a679d01
5,810
[ 129169627 ]
[ "typespec", "documented" ]
# ┌──────────────────────────────────────────────────────────────┐ # │ Based on the course "Elixir for Programmers" by Dave Thomas. │ # └──────────────────────────────────────────────────────────────┘ defmodule Hangman.Dictionary do @moduledoc """ Dictionary for the _Hangman Game_. Returns a random word. ##### B...
02436dd9a5b9c8d08354d41cd33106aba2ed9e68
4,466
[ 967292127 ]
[ "test" ]
defmodule RiotApi.Crypto.HmacSignerTest do use ExUnit.Case, async: true alias RiotApi.Crypto.HmacSigner @test_secret_hex "0ae5e796b8ed60750af2fa49a6ab6d2a74fa425a792cf0a8ab11cba7550de86a" @test_secret_binary Base.decode16!(@test_secret_hex, case: :lower) @wrong_secret_binary Base.decode16!("11111111111111111...
0243774b8bc586fc552fa95d9be9232b395cbc13
2,500
[ 434371960 ]
[]
input = File.read!("day16/input.txt") defmodule Input do def parse(hex) do hex |> String.split("", trim: true) |> Enum.flat_map(&hex_to_binary/1) |> parse_packet() end defp hex_to_binary(hex_char) do hex_char |> Integer.parse(16) |> elem(0) |> Integer.digits(2) |> pad_zero() ...
0243aab2149d6dbd6355d9214fd85bdfa40cd826
1,915
[ 234185313 ]
[ "documented" ]
defmodule NervesHubLinkHTTP.Client.Default do @moduledoc """ Default NervesHubLinkHTTP.Client implementation Requests are completed via `:hackney` FWUP messages are simply logged as warnings See `NervesHugLinkHTTP.Client` for more details. """ alias NervesHubLinkHTTP.Client require Logger @behavi...
0243c405e7a9be41f92cc8750018b0532bc00042
1,721
[ 222093328 ]
[ "macro", "documented", "phoenix" ]
defmodule DbServerWeb 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 DbServerWeb, :controller use DbServerWeb, :view The definitions below will be executed for every view, controlle...
0244d3655cfed0e8a2caadcccc95a0b2ebff88a8
6,433
[ 214500969 ]
[ "typespec", "documented" ]
defmodule AshJsonApi.Plug.Parser do @moduledoc """ Extracts ash multipart request body. For use with `Plug.Parsers`, as in the example below. ## Examples Should be used with `Plug.Parsers`: plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json, #{inspect(__MODULE__)}], pass: ["...
02457c9f0c706d6b2f467936283894a6773830fa
9,864
[ 110499505 ]
[]
if Code.ensure_loaded?(SweetXml) do defmodule ExAws.SQS.Parsers do use ExAws.Operation.Query.Parser def parse({:ok, %{body: xml}=resp}, :list_queues) do parsed_body = xml |> SweetXml.xpath(~x"//ListQueuesResponse", queues: ~x"./ListQueuesResult/QueueUrl/text()"sl, ...
02458ec143a2fb9de6ac0e7b3ffa70ff821927d4
4,057
[ 998660175 ]
[]
defmodule SuperContactApiWeb.Schemas.Organization do require OpenApiSpex alias OpenApiSpex.Schema defmodule CreateOrganizationRequest do OpenApiSpex.schema(%{ title: "CreateOrganizationRequest", description: "새 조직 생성 요청", type: :object, required: [:org_name], properties: %{ ...
0246266aa76dd85b1e4b1a276f130c01c7f3accb
14,768
[ 650700339 ]
[ "documented", "ecto", "phoenix" ]
defmodule ApiWeb.Api.V1_0.UserFavoriteController do @moduledoc """ Manage user favorite places, businesses, etc. """ #============================================================================ # Uses, Requires, Aliases #============================================================================...
0246664bdbe209c6f4198804d8f4a6399c2c768f
2,519
[ 942811655, 920024200 ]
[ "documented" ]
defmodule Ppl.DefinitionReviser.JobMatrixValidator do @moduledoc """ This module serves to validate that all job matrix values are provided as a list of strings either explicitly or after evaluation by SPC command line tool. """ alias Util.ToTuple def validate(definition) do with {:ok, definition} <- ...
0246a0a633d4389e3ee06be5d38f3442512e6191
5,542
[ 419820423 ]
[ "test", "ecto" ]
defmodule Velocity.Contexts.Pto.LevelsTest do use Velocity.DataCase, async: true alias Velocity.Contexts.Pto.AccrualPolicies alias Velocity.Contexts.Pto.Levels alias Velocity.Schema.Pto.Level describe "Levels.effective_date/2" do test "it can handle '7' 'days'" do hire_date = Date.utc_today() ...
0246e188ddc863794a680a94a7f53bb5ac63c0e8
2,535
[ 246484977 ]
[ "documented", "ecto" ]
defmodule LifeCoachApi.Accounts.User do use Ecto.Schema import Ecto.Changeset alias LifeCoachApi.Accounts.User alias LifeCoachApi.Survey.Template import Comeonin.Bcrypt, only: [hashpwsalt: 1] schema "users" do field :name, :string field :email, :string field :password_hash, :string # Virt...
0246f36869a6f48f8665763aba889e212862c26e
5,039
[ 778029642 ]
[ "documented", "ecto" ]
defmodule GoalmaticExAk556.Achievement do @moduledoc """ The Achievement context. """ import Ecto.Query, warn: false alias GoalmaticExAk556.Repo alias GoalmaticExAk556.Achievement.{Challenge, Activity} alias GoalmaticExAk556.Accounts.User @doc """ Returns the list of challenges. ## Examples ...
024704656bbf7062332f168ebc573add5eaebbd3
2,899
[ 144616590 ]
[ "documented", "ecto" ]
defmodule Up.Images do @moduledoc """ The Images context. """ import Ecto.Query, warn: false alias Up.Repo alias Up.Images.{Image, ImageSet} @doc """ Returns the list of image_sets. ## Examples iex> list_image_sets() [%ImageSet{}, ...] """ def list_image_sets do Repo.all(Imag...
024708a2ec55d4464ea06c9c96bdfc6f64ede5b8
3,066
[ 209416400 ]
[ "documented" ]
defmodule MessageBroker.Consumer do @moduledoc """ RabbitMQ Consumer. This is a Broadway application that keeps a connection open with the broker and know how to consume messages from it. """ use Broadway require Logger alias Broadway.Message alias MessageBroker.Consumer.{MessageRetrier, Setup} ...
02485ca53f9b84457b3c2a0a4c32789831ed4714
3,608
[ 994076961 ]
[]
%{ "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, "earmark_parser": {:hex, :earmark_parser, "1.4.44...
02486c4b4a72332f222bf5a929ba4feab0800459
1,502
[ 202243115 ]
[ "test" ]
defmodule BankWeb.Plugs.AuthTest do use BankWeb.ConnCase, async: true import Plug.Conn, only: [put_req_header: 3] alias BankWeb.Plugs.Auth, as: AuthPlug alias Bank.{Auth, Users} test "pass through and set current user assign when Bearer token is valid" do {:ok, user} = Users.create(%{email: "<EMAIL>", ...
0248778733e0cf043597d9d1e9bf370f85a2f3cf
6,042
[ 239822890, 459291087 ]
[ "documented" ]
defmodule Oli.Delivery.Depot do @moduledoc """ This module provides a generic interface to an ETS table based data store of Ecto schemas. This interface is not intended to be used directly, but rather to be used as a base for more specific data store implementations (for example, the SectionResourceDepot modu...
0248c7b00c1efbfe8e002f35e3e578890bf186c6
8,402
[ 1003670950 ]
[ "liveview", "documented" ]
defmodule Cognit.Select do @moduledoc """ Implement of select components from https://ui.shadcn.com/docs/components/select ## Examples: <form> <.select default="banana" id="fruit-select"> <.select_trigger class="w-[180px]"> <.select_value placeholder=".select a fruit"/> ...
0248cb98b6191957b383457bfd087e4d41c7bee9
3,423
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DataCatalog.V1.Model.GoogleCloudDatacatalogV1Taxonomy do @moduledoc """ A taxonomy is a collection of hierarchical policy tags that classify data along a common axis. For example, a "data sensitivity" taxonomy might contain the following policy tags: ``` + PII + Account number + Age + SSN + Zipc...
024939ab204a3c81f0118000bc0fc756727000c7
9,995
[ 196200304, 211097139, 180274417 ]
[ "genserver", "documented" ]
defmodule ExUnit.CLIFormatter do @moduledoc false use GenServer import ExUnit.Formatter, only: [format_time: 2, format_filters: 2, format_test_failure: 5, format_test_all_failure: 5] ## Callbacks def init(opts) do print_filters(Keyword.take(opts, [:include, :exclude])) config = %{ seed: ...
02495d077c90a311244111482f28150ebf73d658
14,471
[ 803809623 ]
[ "documented", "ecto" ]
defmodule Operately.Updates do @moduledoc """ The Updates context. """ import Ecto.Query, warn: false alias Operately.Activities alias Operately.Updates.Update alias Operately.Projects.Project alias Operately.Projects.ReviewRequest alias Operately.Access.{Binding, Fetch} alias Operately.Repo al...
0249a6103bc74c1262c972bc899e56fddac4fe22
2,353
[ 352503942 ]
[ "phoenix", "ecto" ]
defmodule RumblWeb.VideoController do use RumblWeb, :controller alias Rumbl.Multimedia alias Rumbl.Multimedia.Video alias RumblWeb.Router.Helpers, as: Routes plug :load_categories when action in [:new, :create, :edit, :update] defp load_categories(conn, _) do assign(conn, :categories, Multimedia.list...
0249f1138963acc7a5dc9a78f9975c34896ba95d
2,825
[ 354621697 ]
[ "genserver" ]
defmodule WebSpirit.GenericServer do def start(callback_module, initial_state, name) do pid = spawn(__MODULE__, :listen_loop, [initial_state, callback_module]) Process.register(pid, name) pid end def call(pid, message) do send pid, {:call, self(), message} receive do {:response, response} ->...
024a702553e8112f0f168ee332aac3c51df12d44
1,535
[ 454916156 ]
[ "documented" ]
defmodule PlConnect.Cod.SummaryStats do @moduledoc """ High Level Summary of how the app is operating. """ use Ash.Resource, data_layer: AshPostgres.DataLayer postgres do repo PlConnect.Repo table "summary_stats" end attributes do uuid_primary_key :id # range attribute :start_range, ...
024a813f2691252e0369f935fb67f2296375020e
1,582
[ 513180102 ]
[ "typespec", "documented" ]
defmodule Tmde.Contacts.Country do @moduledoc """ Countries for use in Contacts. Implemented as custom Ecto Type backed by compile-time static data. If given, zip_validator is used in Address to validate the zip code. If something more dynamic is needed, if would be a nice use case for an agent handling th...
024a81f5734421ff4619faf0b42d90a91dce86d1
3,388
[ 590950624 ]
[ "test" ]
# mix run benchmarks/diff.exs # # The first run will save benchmark results to a file and subsequent # results will compare to that file. # # Set env var `BENCHEE_SAVE=true` to overwrite the saved results. # Set env var `BENCHEE_PROFILE=true` to run profiler. save_file = Path.expand("_diff.benchee", __DIR__) inputs =...
024aade72fba95a72220fbf7a2f9583ad6512971
5,496
[ 135832997 ]
[ "liveview" ]
defmodule Data.Article.Blog.GeorgWilhelmStrasse do use Article.Default def created_at(), do: ~D[2021-11-07] def updated_at(), do: ~D[2022-01-03] def title(), do: "Georg-Wilhelm-Straße (Freizeitroute 6)" def summary(), do: "Radweg Richtung Norden wird neu gepflastert, in der Gegenrichtung ein Radf...
024ba6fbc6eb7502057f5ed6f08fe68017b7b23a
1,783
[ 433034488 ]
[]
defmodule Y2015.Day16 do use Advent.Day, no: 16 @tape %{ "children" => 3, "cats" => 7, "samoyeds" => 2, "pomeranians" => 3, "akitas" => 0, "vizslas" => 0, "goldfish" => 5, "trees" => 3, "cars" => 2, "perfumes" => 1 } def part1(input, tape \\ @tape) do input |> p...
024bc631d8673165cd75de2f5c8397834e7354d9
2,068
[ 165495941 ]
[ "typespec", "documented" ]
defmodule Hex.Crypto.AES_GCM do @moduledoc false # Content Encryption with AES GCM # # See: https://tools.ietf.org/html/rfc7518#section-5.3 # See: http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf alias Hex.Crypto.ContentEncryptor @behaviour ContentEncryptor @spec content_encrypt({bin...
024bdec1008a3411b647087ab94d2b0875aa8793
1,957
[ 155686146, 154710995 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2IntentTrainingPhrase do @moduledoc """ Represents an example or template that the agent is trained on. ## Attributes - name (String.t): Required. The unique identifier of this training phrase. Defaults to: `null`. - parts ([GoogleCloudDialogflow...
024c3faa1f9f1229c84f144bfef8ee7e47f85dd9
1,671
[ 882383397 ]
[ "liveview" ]
# lib/gtd_web/live/components/project_form_component.ex defmodule GtdWeb.ProjectFormComponent do use GtdWeb, :live_component @impl true def render(assigns) do ~H""" <div> <div :if={@show} class="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50"> <div class="bg-white p-6...
024c96418cca28d02042932fabf73b25e9f6820e
2,181
[ 559744925 ]
[ "documented" ]
defmodule Credo.Check.Refactor.NegatedIsNil do use Credo.Check, id: "EX4020", base_priority: :low, tags: [:controversial], explanations: [ check: """ We should avoid negating the `is_nil` predicate function. For example, the code here ... def fun(%{external_id: external_i...
024ccce78639b84b9a41ddb82697915241d1185d
1,606
[ 156374766, 299670305 ]
[ "macro", "documented", "phoenix" ]
defmodule PokerWeb 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 PokerWeb, :controller use PokerWeb, :view The definitions below will be executed for every view, controller, etc, s...
024cf860abcce40a25c465c95e2ddd034d33728d
1,932
[ 743691894 ]
[ "typespec", "documented" ]
defmodule PasswordGenerator do @moduledoc """ Documentation for `PasswordGenerator`. generate random password ------------------------ parameters needed to generate includes: 1. length(number) 2. numbers(boolean) // Coming soon 3. uppercase(boolean) // Coming soon 4. symbols(boolean)** // Coming soon...
024e3a148c1ac2645c40e79488cbac89ae793de7
3,367
[ 97758441 ]
[]
defmodule SimpleDocker.Image do alias SimpleDocker.{Image, SystemInfo} defstruct repository: nil, id: nil, tag: nil, created_at: nil, size: nil @format """ "{{.Repository}}, {{.ID}}, {{.Tag}}, {{.CreatedAt}}, {{.Size}}" """ def build(dockerfile, stdio \\ false) do case docker ["image"...
024eac4258ea931f53966332400bdfe9102ba02d
2,527
[ 324142110 ]
[ "test", "documented" ]
defmodule Nebulex.Adapters.Cachex.TransactionTest do use ExUnit.Case, async: true import Nebulex.CacheCase, only: [setup_with_cache: 1] defmodule Cache do @moduledoc false use Nebulex.Cache, otp_app: :nebulex_adapters_cachex, adapter: Nebulex.Adapters.Cachex end setup_with_cache Cache ...
024f57d5eb672bf4b4d472622923add02ea2b2ae
3,692
[ 63497734 ]
[ "test", "documented", "ecto" ]
defmodule CodeCorps.AccountsTest do @moduledoc false use CodeCorps.DbAccessCase alias CodeCorps.{Accounts, Comment, Task, User, GitHub.TestHelpers} alias Ecto.Changeset describe "create_from_github/1" do test "creates proper user from provided payload" do {:ok, %User{} = user} = "user" ...
024fa3b67d1153729e7e451c601086222c71abd6
13,166
[ 290934484 ]
[ "test" ]
defmodule Absinthe.Relay.Mutation.ModernTest do use Absinthe.Relay.Case, async: true defmodule SchemaWithInputAndOutput do use Absinthe.Schema use Absinthe.Relay.Schema, :modern query do end mutation do payload field(:simple_mutation) do input do field :input_data, :in...
025000028b51c40d839ef9a73a4a91be213a3a37
2,203
[ 106712767 ]
[ "ecto" ]
defmodule Sanbase.Accounts.UserApikeyToken do use Ecto.Schema import Ecto.Changeset import Ecto.Query alias __MODULE__ alias Sanbase.Accounts.User alias Sanbase.Repo @api_keys_per_user_limit 10 def api_keys_per_user_limit(), do: @api_keys_per_user_limit schema "user_api_key_tokens" do field(:to...
025021bdaf2f4ee74b41b45263fdd9b7f1a6c389
3,112
[ 337419923 ]
[ "test" ]
defmodule CloudflareStreamTest do use ExUnit.Case describe "Parse metadata" do @metadata """ #EXTM3U #EXT-X-VERSION:6 #EXT-X-INDEPENDENT-SEGMENTS #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_audio",NAME="eng",LANGUAGE="en",DEFAULT=YES,AUTOSELECT=YES,URI="stream_tf1bea3e54501931464e543bb005e9d0d_r1...
0250b809c51110e0d0ba186d12e6ab38aea6f6b4
3,476
[ 70401270 ]
[ "documented" ]
defmodule Repo.Changeset.DynamicEmbeds do @moduledoc """ This module provides validation function that can inject `DynamicEmbed` type as embed schema in changeset. Also it will run embed run child changeset as `cast_embed` would do. """ def cast_dynamic_embeds(changeset, fields, opts \\ []) do Enum.reduc...
02514cea23ae225d707e232b1cf3291049318abd
2,756
[ 1005378015 ]
[]
defmodule DriveBox.MixProject do use Mix.Project def project do [ app: :drive_box, version: "0.1.0", elixir: "~> 1.15", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), listeners: [Phoenix.CodeReloade...
0251e4c9aef06defc583fa3db10975fe86eb4124
1,670
[ 187270854 ]
[]
%{ "adsb_parser": {:git, "https://github.com/fatty-arbuckle/adsb-parser.git", "5bb321707ae001564505305a922d866a3998a136", []}, "dump_1090_client": {:git, "https://github.com/fatty-arbuckle/dump-1090-client.git", "629f0245008d2334582a4d18835a3a206845137a", []}, "elixir_make": {:hex, :elixir_make, "0.5.2", "96a28c7...
0252458018eb2ab6016f4560580ba98dddbc31a3
3,363
[ 413442344 ]
[ "test", "phoenix" ]
defmodule EchipatalaWeb.ServiceControllerTest do use EchipatalaWeb.ConnCase import Echipatala.ServicesFixtures @create_attrs %{consult_fee: "some consult_fee", descript: "some descript", has_subs: "some has_subs", inst_id: "some inst_id", is_sub: "some is_sub", maker_id: "some maker_id", name: "some name", pare...
0252d5ef62dbf2ef6c1997854191211d193c1f57
2,005
[ 672288019, 565925031 ]
[ "test" ]
defmodule Sequence.AlphabetsTest do use ExUnit.Case, async: true alias Bio.Sequence.Alphabets.{Dna, Rna, AminoAcid} describe "DNA Alphabet" do test "exposes common, iupac, and with_n" do assert Dna.common() assert Dna.with_n() assert Dna.iupac() end test "provides complements for ...
0252dee432aedd64683f9cd14fd55aba5991143a
15,767
[ 185558207, 213229236, 1000104078, 982054619, 882572863, 217320195, 174991383, 807904878, 540729553, 887377354 ]
[ "macro", "test" ]
defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do use Pleroma.Web.ConnCase alias Pleroma.Chat alias Pleroma.Chat.MessageReference alias Pleroma.Object alias Pleroma.Tests.Helpers alias Pleroma.UnstubbedConfigMock, as: ConfigMock alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias ...
0253f2202f4987c5aca42ab78f78c04fdc3026c3
1,906
[ 407840429 ]
[ "macro", "test", "documented", "ecto" ]
defmodule Tinyurl.DataCase do @moduledoc """ This module defines the setup for tests requiring access to the application's data layer. You may define functions here to be used as helpers in your tests. Finally, if the test case interacts with the database, we enable the SQL sandbox, so changes done to t...
0253f2b70eaa5c25f35ad6c161991b2006cb00e7
3,555
[ 415463387 ]
[ "liveview", "test" ]
defmodule TaskyWeb.TodoLiveTest do use TaskyWeb.ConnCase import Phoenix.LiveViewTest import Tasky.TodosFixtures @create_attrs %{description: "some description", done: true, title: "some title"} @update_attrs %{description: "some updated description", done: false, title: "some updated title"} @invalid_attr...
0253fb5d4bf263e9f614119666a600e95943957f
2,269
[ 127551324 ]
[ "macro", "test" ]
defmodule Haytni.Authenticable.SessionHTMLTest do use HaytniWeb.ConnCase, [ async: true, plugin: Haytni.AuthenticablePlugin, ] @email "<EMAIL>" @firstname "Tony" @lastname "Stark" setup %{conn: conn} do user_fixture(email: @email, firstname: @firstname, lastname: @lastname, password: "not a sec...
0254081950561cb7aac7a906a85b39e44dcea739
5,607
[ 212487543 ]
[ "macro", "test", "documented" ]
defmodule Ash.Test.Resource.ResourceTest do @moduledoc false use ExUnit.Case, async: true alias Ash.Test.Domain, as: Domain defmacrop defposts(do: body) do module = Module.concat(["rand#{System.unique_integer([:positive])}", Post]) quote do defmodule unquote(module) do @moduledoc false ...
025417dcc8295896ec8127eb1cba29e6adee5da9
2,552
[ 650698680 ]
[ "test", "ecto" ]
defmodule Core.ErrorsTest do use Core.DataCase alias Core.Errors describe "dart_errors" do alias Core.Schemas.DartError @valid_attrs %{level: "some level", message: "some message", tag: "some tag"} @update_attrs %{ level: "some updated level", message: "some updated message", tag:...
0254237e7d64779f6b0d149a65a3c99762621e21
1,875
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemotebuildexecutionAdminV1alphaUpdateWorkerPoolRequest do @moduledoc """ The request used for UpdateWorkerPool. ## Attributes * `updateMask` (*type:* `String.t`, *default:* `nil`) - The update mask applies to worker_pool. For the `FieldMask` d...
0254fbeee4b334fae11e7a63e0535a4f9f931333
4,674
[ 109202475 ]
[ "typespec", "documented" ]
defmodule Roulette.Config do @moduledoc ~S""" Here is a minimum configuration example, You must setup `servers` list. Put your load-balancers' hostname into it. ```elixir config :my_app, MyApp.PubSub, servers: [ "gnatsd-cluster1.example.org", "gnatsd-cluster2.example.org" ] ``` O...
025563fc1be29aa499b265a521bbb8454c1a39a3
11,637
[ 25529124 ]
[ "typespec", "macro", "documented" ]
defmodule Murmur do @moduledoc ~S""" This module implements the x86_32, x86_128 and x64_128 variants of the non-cryptographic hash Murmur3. ## Examples iex> Murmur.hash_x86_32("b2622f5e1310a0aa14b7f957fe4246fa", 2147368987) 3297211900 iex> Murmur.hash_x86_128("some random data") 55866...
02557974cddbb4ffa0a25d947ba487506be2b6fd
6,414
[ 160228995 ]
[ "test" ]
alias Advent.Intcode defmodule Advent.IntcodeTest do use ExUnit.Case doctest Advent.Intcode test "example 1" do state = %Intcode{state: Advent.list_to_map([1, 9, 10, 3, 2, 3, 11, 0, 99, 30, 40, 50])} observed = Intcode.operate(state) |> Advent.state_to_list() expected = [3500, 9, 10, 70, 2, 3, 11, 0...
025593736ba5bc5bcb35cdffad9f1a298147d5f9
3,794
[ 600920760 ]
[ "genserver", "typespec", "supervisor" ]
defmodule Protohackers.BudgetChatServer do use GenServer require Logger @port 5004 @spec start_link([]) :: :ignore | {:error, any} | {:ok, pid} def start_link([] = _opts) do GenServer.start_link(__MODULE__, :no_state) end defstruct [:listen_socket, :supervisor, :ets] @impl true def init(:no_s...
02559857c6e1d9769ee0bfaa51f89e53550d4633
2,434
[ 340721639 ]
[ "test", "ecto" ]
defmodule BgsiteOfficial.ContactsTest do use BgsiteOfficial.DataCase alias BgsiteOfficial.Contacts describe "feedback" do alias BgsiteOfficial.Contacts.Feedback @valid_attrs %{email: "some email", name: "some name", text: "some text"} @update_attrs %{email: "some updated email", name: "some updated...
0255c95812161220374bb97a1cb473980c77b85a
7,741
[ 441809309 ]
[ "typespec", "documented" ]
defmodule Infer do @moduledoc """ A dependency free library to infer file and MIME type by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)) signature. An elixir adaption of the [`infer`](https://github.com/bojand/infer) rust library. """ defmodule Type do defstruct [...
0255fe55765b9e7e35e3b0761934b9251f2dead9
2,821
[ 15050283 ]
[ "documented" ]
defmodule EulerEleven do @grid """ 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91 22 31 16 71 51 67 63 89 41 92 36 ...
0256d4d08389f19f0acaf456a1794cc93364418d
2,147
[ 240012222, 282263329, 175013067, 260155866, 183600860 ]
[ "typespec", "documented" ]
defmodule Stripe.FileUpload do @moduledoc """ Work with Stripe file_upload objects. You can: - Create a file - Retrieve a file - List all files Stripe API reference: https://stripe.com/docs/api/files """ use Stripe.Entity import Stripe.Request @type t :: %__MODULE__{ id: Stripe.id()...
0256e57b5d2e50b3c5ec424e0fe8fbeac941b5c4
1,654
[ 146029981 ]
[ "macro", "documented", "phoenix" ]
defmodule QuantumSwarmWeb 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 QuantumSwarmWeb, :controller use QuantumSwarmWeb, :view The definitions below will be executed for every view,...
025710cabe57f199b65fed199fa6ded300c5f1d3
5,707
[ 516269200 ]
[ "genserver", "documented" ]
defmodule Challenges.MatchingEngine do @moduledoc false use GenServer defmodule Order do defstruct price: 0.0, volume: 0.0 end defmodule OrderBook do defstruct tree_buy: %{}, tree_sell: %{} end defmodule OrderBookFromJson do @derive [Poison.Encoder] defstruct [:command, :price, :amount]...
0257e2b96d8a63d86a8f94963025e3f6f036f8f0
17,160
[ 71608796 ]
[ "typespec", "macro", "documented" ]
defmodule Mix.Project do @moduledoc """ Defines and manipulates Mix projects. A Mix project is defined by calling `use Mix.Project` in a module, usually placed in `mix.exs`: defmodule MyApp.Mixfile do use Mix.Project def project do [app: :my_app, version: "0.6.0"] ...
0257ebc52a0c2ea74f322b83d1413dc0ed2a932f
23,652
[ 274576808 ]
[ "test", "phoenix", "ecto" ]
defmodule ArangoXEctoTest do use ArangoXEcto.Integration.Case, write: ["users", "posts", "posts_users", "posts_users_options", "user_user"] alias ArangoXEcto.Integration.{ Class, DynamicClass, NonEcto, Post, User, UserPosts, UserPostsOptions, UsersView } alias ArangoXEcto.I...
02583a2821f14fcb61e36f406e300386cf051aba
2,194
[ 631728187 ]
[ "typespec", "documented" ]
defmodule Tringin.LocalRegistry do @moduledoc false @behaviour Tringin.Registry.Behaviour alias __MODULE__ defstruct [:name, :prefix] @type t :: %__MODULE__{ name: pid() | atom(), prefix: atom() | binary() } def new(name, prefix) when is_atom(name) or (is_pid(name) and...