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
008743d3528a35273e15ed73344d30072e030bf2
4,329
[ 550796194 ]
[ "test" ]
defmodule BorutaWeb.Plugs.RateLimitTest do use ExUnit.Case alias BorutaWeb.Plugs.RateLimit setup do {:ok, conn: Phoenix.ConnTest.build_conn()} end describe "rate limiting" do test "request passes", %{conn: conn} do :timer.sleep(1) options = [time_unit: :millisecond, count: 1] asse...
008809b8aeb50c30ab9b153a099df30bf7ce8548
7,918
[ 202575975 ]
[ "test", "documented" ]
defmodule Tablespoon.Communicator.BtdTest do @moduledoc false use ExUnit.Case use ExUnitProperties alias Tablespoon.Communicator.Btd import Btd doctest Tablespoon.Communicator.Btd alias Tablespoon.Protocol.NTCIP1211Extended, as: NTCIP alias Tablespoon.Query alias Tablespoon.Transport.Fake, as: FakeT...
0088bb02bef71c8f9169058f56b9375ca225d4b7
4,796
[ 109609623 ]
[ "test" ]
defmodule APIacAuthBasicTest do use ExUnit.Case, async: true use Plug.Test @valid_client_id "my_client" @valid_client_secret "My secret" @test_realm_name "It's closed" setup_all do Application.put_env( :apiac_auth_basic, :clients, %{ @test_realm_name => [ {@valid_cl...
00897008de6daaa8c90cd214c257379bc48be702
1,872
[ 160186508 ]
[ "documented" ]
defmodule Mix.Tasks.PublishGhPages do @moduledoc """ Publishes the API reference documentation (mix docs) to the gh-pages branch. Fails if the branch doesn't exist. """ use Mix.Task require Logger @target_branch "gh-pages" @target_dir "source_docs" @shortdoc "Publishes the output of mix docs to th...
0089f9b932ca6f342607a4780bc3c2e37c5b7bb7
2,625
[ 624875756 ]
[ "macro", "documented" ]
defmodule ExchangeZoo.API do @moduledoc """ Conveniences for defining exchange REST APIs. * Imports ExchangeZoo.API and ExchangeZoo.__MODULE__.API * Sets @base_url and defines macros in example below. ## Example defmodule ExchangeZoo.Binance.API do use ExchangeZoo.API, base_url: "https://fapi...
008a24b7e26051e46538321e52294001429bf8f0
5,141
[ 94937098 ]
[ "typespec", "documented" ]
defmodule Number do @moduledoc """ Documentation for Number. """ # -- Number patterns used for regexes --# @npan ~r/\A^[2-9][0-9]{2}[2-9][0-9]{6}$\z/ @one_npan ~r/\A^1[2-9][0-9]{2}[2-9][0-9]{6}$\z/ @us_e164 ~r/\A^\+1[2-9][0-9]{2}[2-9][0-9]{6}$\z/ @e164 ~r/\A^\+[1-9][0-9]{10,14}$\z/ @international ~r/...
008a62d790dfbeb9dbd5c41fd0438fb36828124f
11,092
[ 567653956 ]
[ "documented" ]
defmodule Mix.Tasks.Deps.Compile do use Mix.Task @shortdoc "Compiles dependencies" @moduledoc """ Compiles dependencies. By default, this task attempts to compile all dependencies. A list of dependencies can be given to compile multiple dependencies in order. This task attempts to detect if the proj...
008a8136b02b54191e802c37cfc9bbf21520c127
1,537
[ 255878149 ]
[]
defmodule ILikeTrains.Route do alias __MODULE__ alias ILikeTrains.MapConfig # assignable: true & assigned_to: username => taken by user # assignable: true & assigned_to: nil => alternative route taken, this one can't be assigned # assignable: false => can be claimed defstruct id: 0, places: [],...
008ad6b9031d62b10fcd408c771acd49faa5d4d3
8,184
[ 985853139 ]
[]
# Generated by Mochi compiler v0.10.26 on 2025-07-16T17:33:45Z defmodule Main do def main do # date_dim :: list(map()) date_dim = [%{d_date_sk: 1, d_year: 1998, d_moy: 12}] # store_sales :: list(map()) store_sales = [ %{ss_sold_date_sk: 1, ss_item_sk: 1, ss_ext_sales_price: 10}, %{ss_sold_...
008b7172d7003d9e4b50c9cdc41dce3512497f0d
2,495
[ 105636145 ]
[ "test" ]
defmodule MehrSchulferienWeb.SlotControllerTest do use MehrSchulferienWeb.ConnCase alias MehrSchulferien.Timetables @create_attrs %{} @update_attrs %{} @invalid_attrs %{} def fixture(:slot) do {:ok, slot} = Timetables.create_slot(@create_attrs) slot end describe "index" do test "lists al...
008bbce765da905d0eb0ad71c05c0f953ebb971c
7,273
[ 162377738 ]
[ "test" ]
defmodule Innerpeace.Db.Base.ExclusionContextTest do use Innerpeace.Db.SchemaCase alias Innerpeace.Db.Schemas.{ Exclusion # ExclusionDisease, # ExclusionProcedure } alias Innerpeace.Db.Base.{ ExclusionContext } test "get_all_exclusions/0 returns all exclusion" do exclusion = :excl...
008c1e0965793bed8d5a82d3292721c762925bfb
2,171
[ 478687101 ]
[ "genserver", "typespec", "documented" ]
defmodule MmoNightwatch.HeroState do @moduledoc """ GenServer responsible for representing and holding key information about the players/heroes of the game. """ use GenServer @type t() :: %__MODULE__{ position: {integer(), integer()}, name: String.t(), alive: boolean() }...
008cd477499370bcd724b9a0fb485185b4e2be61
3,514
[ 582665516 ]
[]
defmodule Mastery.Core.Quiz do alias Mastery.Core.{Template, Question, Response} defstruct title: nil, mastery: 3, templates: %{}, used: [], current_question: nil, last_response: nil, record: %{}, mastered: [] def new(fields) do...
008d194df91befe75b215154147bd656bb864ead
5,480
[ 340654506 ]
[ "macro" ]
defmodule Fset.ReserveUsername do defmacro __using__([]) do quote do @reserved_username [ # Internal_source_list "users", "products", "public", "status", "ping", # External_source_list # https://github.com/Mottie/github-reserved-names/blob/mast...
008d2ccd1c862bd188cdc15b76882ef2c588b27a
2,091
[ 335151011 ]
[ "test" ]
defmodule Lti_1p3.Tool.Services.AccessTokenTest do use Lti_1p3.Test.TestCase import Mox alias Lti_1p3.Test.MockHTTPoison alias Lti_1p3.Tool.Services.AccessToken # Make sure mocks are verified when the test exits setup [:create_active_jwk, :verify_on_exit!] describe "fetch_access_token/3" do test "...
008d6233733e20887fbb51083c9793cd325b8b35
2,097
[ 180495038 ]
[]
defmodule NightVision.MixProject do use Mix.Project @all_targets [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :bbb, :x86_64] def project do [ app: :night_vision, version: "0.1.0", elixir: "~> 1.8", archives: [nerves_bootstrap: "~> 1.5"], start_permanent: Mix.env() == :prod, build_...
008d730ae6618b51f3c89c8ba1ff99aeb7ff436c
6,142
[ 685642170, 678564218 ]
[ "documented", "ecto" ]
defmodule RemindMe.Accounts.UserToken do use Ecto.Schema import Ecto.Query alias RemindMe.Accounts.UserToken @hash_algorithm :sha256 @rand_size 32 # It is very important to keep the reset password token expiry short, # since someone with access to the email may take over the account. @reset_password_v...
008d86ddba127bc501cdb0f038dc8e492ffea685
1,503
[ 350383395 ]
[ "typespec", "documented" ]
defmodule Mailer.Delivery do @moduledoc """ Implements the delivery of emails This is implemented in a separate module in case we want to do immediate delivery of emails without using Oban. """ alias Mailer alias Mailer.{Email, Telemetry} require Logger @doc """ Returns the adapter module that ...
008da1a71e40f0852c1ee78216748865a55609d1
1,529
[ 337870341 ]
[ "phoenix" ]
defmodule DiscussWeb.AuthController do use DiscussWeb, :controller alias Discuss.Schema.User plug Ueberauth def callback(%{assigns: %{ueberauth_auth: auth}} = conn, params) do user_params = %{ token: auth.credentials.token, email: auth.info.email, provider: params["provider"] } ...
008dba76ef2c103b83606e4c5e88cbd861bc4602
2,806
[ 171283872 ]
[ "test", "phoenix" ]
defmodule GitesWeb.PageDataControllerTest do use GitesWeb.ConnCase alias Gites.PagesData alias Gites.PagesData.PageData @create_attrs %{ content: "some content", name: "some name" } @update_attrs %{ content: "some updated content", name: "some updated name" } @invalid_attrs %{content: ...
008e5ac270c2af4ac3909db282edc12c91a2eada
2,030
[ 420196452 ]
[ "typespec", "documented" ]
defmodule Vhs.Clients.Slack do @moduledoc """ Interface to communicate with Slack through a webhook """ require Logger @caller Application.get_env(:vhs_elixir, :username) @client_config Application.get_env(:vhs_elixir, :slack) @spec webhook_post(map()) :: map() def webhook_post(%{"hash" => tx_id, "st...
008e63be4a58db9bd0fa1dd0b8956aa70db9e4a6
1,896
[ 129699403 ]
[ "liveview", "documented" ]
defmodule TuistWeb.Previews.AppPreview do @moduledoc """ Component to render a preview of an app. """ use TuistWeb, :live_component use Noora import TuistWeb.Previews.PlatformBadge import TuistWeb.Previews.RunButton attr :preview, :map, required: true attr :user_agent, :map, required: true def ap...
008e6f2e89a7c69c0f0ae0f61a52c9521a8f19c7
22,779
[ 821769193, 739964336, 774405652 ]
[ "typespec", "documented" ]
defmodule EarmarkParser do @type ast_meta :: map() @type ast_tag :: binary() @type ast_attribute_name :: binary() @type ast_attribute_value :: binary() @type ast_attribute :: {ast_attribute_name(), ast_attribute_value()} @type ast_attributes :: list(ast_attribute()) @type ast_tuple :: {ast_tag(), ast_attr...
008ec9560fbd79cd0ed3fb83928869b5e3b70d17
6,733
[ 215378694 ]
[ "typespec", "documented" ]
defmodule ExIdentityMind.KYC.Consumer.Application do @moduledoc """ KYC consumer application. More info: https://documentation.identitymindglobal.com/api/#kyc:-consumer-application """ @type t :: %__MODULE__{ # REQUIRED: Account name for the user. This must be a unique value to the user (email, UUI...
008efb67c33b98ad9b4e16c093166df19ec059fb
2,872
[ 936213595, 929997332 ]
[ "documented" ]
defmodule ProjectsApiWeb.ProjectJSON do alias ProjectsApi.Projects.Project alias ProjectsApi.Projects.{Image, Tool} alias ProjectsApi.Accounts.Guest @doc """ Renders a list of projects. """ def index(%{projects: projects, current_user_id: current_user_id}) do %{data: for(project <- projects, do: dat...
008f06eee1c0f7cd2779c212b2e0162824a5580b
5,406
[ 619386228 ]
[ "documented", "ecto" ]
defmodule QRClass.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias QRClass.Repo alias QRClass.Accounts.{User, UserToken, UserNotifier} @teacher User.teacher() @student User.student() def list_students do Repo.all(from u in User, where: u.type == @studen...
008f2a3be083e3a9171c806d22cf1276e5940f3d
1,592
[ 695444944 ]
[ "liveview" ]
defmodule GreyWeb.SupplierLive.Index do use GreyWeb, :admin_live_view alias Grey.Suppliers alias Grey.Suppliers.Supplier alias Grey.Users alias Grey.Status @impl true def mount(_params, session, socket) do user = Users.get_user_by_session_token(session["user_token"]) {:ok, socket |> a...
00902e8bd5c1d33d81259d4410a44095c4e120d2
3,272
[ 184292043 ]
[ "test" ]
defmodule RumblWeb.VideoControllerTest do use RumblWeb.ConnCase alias Rumbl.Multimedia @create_attrs %{url: "http://youtu.be", title: "video", description: "not a real video"} @invalid_attrs %{title: "invalid video"} describe "without a logged-in user" do test "requires user authentication on all action...
0090d5a987f1041e6d2f59957701135024461c54
1,930
[ 950747020 ]
[]
defmodule Aoc2023.Day8 do def parse(data) do lines = data |> String.split("\n", trim: true) [instructions | network] = lines instructions = String.graphemes(instructions) network = network |> Enum.map(fn line -> String.split(line, " = ") end) |> Enum.map(fn [k, val] ->...
009123ef847501db7889839f130d5a75ca7f2271
14,552
[ 313251054, 559360912 ]
[ "phoenix" ]
defmodule KiraBijouxWeb.ItemController do use KiraBijouxWeb, :controller # get all items swagger_path :index do get("/items") summary("Get all items") description("List of items") response(code(:ok), "Success") end def index(conn, _) do items = Repo.all(from i in Item, select: i) put...
009178d32ff83365764243264814b0b409971ac2
2,172
[ 564777585 ]
[]
defmodule RabbitMQ.CLI.Core.Distribution do alias RabbitMQ.CLI.Core.{Config, Helpers} # # API # def start() do start(%{}) end def start(options) do node_name_type = Config.get_option(:longnames, options) result = start(node_name_type, 10, :undefined) ensure_cookie(options) result ...
0091e056cb5be36c1de1d262b1bc46b3cf33b0c8
3,590
[ 193244709 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CloudBuild.V1.Model.Results do @moduledoc """ Artifacts created by the build pipeline. ## Attributes * `artifactManifest` (*type:* `String.t`, *default:* `nil`) - Path to the artifact manifest for non-container artifacts uploaded to Cloud Storage. Only populated when artifacts are upload...
00929b3e67866e5501ca103fd701de45b4b720a7
3,566
[ 129697834 ]
[ "test" ]
defmodule AntikytheraCore.GearLog.WriterTest do use Croma.TestCase alias Antikythera.Time alias Antikythera.Test.GearConfigHelper alias AntikytheraCore.Context alias AntikytheraCore.GearLog @dir Path.join([__DIR__, "..", "..", "..", "_build", "test", "log", "testgear"]) |> Path.expand() # GearLog....
00931552d4704753743ad2801f7969cb5f8616c8
6,705
[ 85309894 ]
[ "typespec", "documented" ]
defmodule ExAws.Config do @moduledoc """ Generates the configuration for a service. It starts with the defaults for a given environment and then merges in the common config from the ex_aws config root, and then finally any config specified for the particular service. ## Refreshable fields Some fields a...
0093276da4ff8edb97f26d3c031a0005c2c7b6fe
2,615
[ 434898411 ]
[ "documented" ]
defmodule Trento.Infrastructure.Operations.AMQP.Processor do @moduledoc """ AMQP processor for the operations events """ @behaviour GenRMQ.Processor require Trento.Operations.Enums.ClusterHostOperations alias Trento.Contracts alias Trento.Operations.V1.{ OperationCompleted, OperationStarted }...
0093e688400ffd27dcc05911bc48a6bb58716a88
1,589
[ 152429559 ]
[ "macro", "documented", "phoenix" ]
defmodule WizardWeb 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 WizardWeb, :controller use WizardWeb, :view The definitions below will be executed for every view, controller, etc...
009416470244e2c5ad05f5c4b214a76d816e7637
3,218
[ 669286235 ]
[ "test", "phoenix" ]
defmodule BlogWeb.UserSessionControllerTest do use BlogWeb.ConnCase, async: true import Blog.AccountsFixtures @placeholder_password "hello world!" setup do %{user: user_fixture(password: @placeholder_password)} end describe "GET /users/log_in" do test "renders log in page", %{conn: conn} do ...
00947167d5adfd4dac0dc1267f1ce9c22f6882c6
1,760
[ 365101813 ]
[ "test" ]
defmodule Project.Argx.General do use Argx.Defconfig defconfig(GeneralA, a(:string)) defconfig(GeneralB, b(:integer)) defconfig(GeneralC, [c(:list, 1..10), d(:map)]) def fmt_errors({:error, _}), do: false def fmt_errors(_), do: true end defmodule Project do use Argx, share: Project.Argx.General defc...
0094b7a6b0d32216292b793b56b9ce045b77664e
2,396
[ 165560547 ]
[ "documented", "ecto" ]
defmodule Videosync.Contents.Video do use Ecto.Schema import Ecto import Ecto.Query, warn: false import Ecto.Changeset alias Videosync.Repo alias Videosync.Utils.Crypto schema "videos" do field :url, :string field :title, :string field :description, :string field :slide_count, :integer ...
0094cb7535ca53a13170800be0b8d58010276f01
3,652
[ 63304973 ]
[ "documented" ]
defmodule Mongo.Ecto.Connection do @moduledoc false alias Mongo.Ecto.NormalizedQuery.ReadQuery alias Mongo.Ecto.NormalizedQuery.WriteQuery alias Mongo.Ecto.NormalizedQuery.CommandQuery alias Mongo.Ecto.NormalizedQuery.CountQuery alias Mongo.Ecto.NormalizedQuery.AggregateQuery ## Worker def storage_do...
0095384d067c7288007e4ca1397a5143dade947c
3,807
[ 266799167 ]
[ "typespec" ]
defmodule MCEx.Server do alias MCEx.MC.Packet alias MCEx.MC.Parse alias MCEx.MC.Response alias :gen_tcp, as: GenTcp require Logger def accept(port) do {:ok, sochet} = GenTcp.listen(port, [:binary, active: false, reuseaddr: true]) Logger.info("Accepting connections on port #{port}") loop_accepto...
00953e43dacc0e1eedd35cb1660c4ba43d513908
1,715
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1betaImportCompletionSuggestionsMetadata do @moduledoc """ Metadata related to the progress of the ImportCompletionSuggestions operation. This will be returned by the google.longrunning.Operation.metadata field. ## Attributes * `createT...
00955a9c905b79713e089f4e2a530330187a101e
3,586
[ 225329374 ]
[ "typespec", "documented" ]
defmodule AdventOfCode.Day07 do alias AdventOfCode.Utils.Input import AdventOfCode.Utils.Intcode @spec part1(binary) :: integer() def part1(integers) do elements = 0..4 combinations = for x <- elements, y <- elements, z <- elements, w <- elements, v <- ele...
0095eb2cdc9bd16eb4413d558570e91fa3bc722a
1,669
[ 212487543 ]
[ "documented" ]
if Code.ensure_loaded?(Igniter) do defmodule Mix.Tasks.Ash.Gen.Preparation do @moduledoc """ Generates a custom preparation See [Custom Preparations](https://hexdocs.pm/ash/preparations.html#custom-preparations) for more. ## Example ```bash mix ash.gen.preparation MyApp.Preparations.Top5 ...
0095f38ca3faa15e3adde60c54e5dcfb817fa888
5,071
[ 236492554 ]
[ "typespec", "documented", "ecto" ]
defmodule Mud.Engine.Shop do use Mud.Schema import Ecto.Changeset alias Mud.Repo alias Mud.Engine.Shop.Product import Ecto.Query require Logger @derive {Jason.Encoder, only: [ :id, :area_id, :name, :description, :products ...
00960054450198b68f8933884b46a50abe30cdc6
4,618
[ 588226575, 980529497, 775065727, 930000513 ]
[ "test", "ecto" ]
defmodule Supavisor.TenantsTest do use Supavisor.DataCase alias Supavisor.Tenants describe "tenants" do alias Supavisor.Tenants.{Tenant, User} import Supavisor.TenantsFixtures @invalid_attrs %{ db_database: nil, db_host: nil, external_id: nil, default_parameter_status: nil,...
009614967b3ca8c6c4a4c0464c7f18c153e3d8e7
1,768
[ 1113188 ]
[ "phoenix" ]
defmodule News.ArticleController do use News.Web, :controller alias News.Article plug :scrub_params, "article" when action in [:create, :update] plug :action def index(conn, _params) do articles = Repo.all(Article) render(conn, "index.html", articles: articles) end def new(conn, _params) do ...
009615c46757944a67e85398b3aafedd26da6cce
1,849
[ 839023495 ]
[ "ecto" ]
defmodule RenewCollab.Commands.UpdateLayerEdgeStyle do import Ecto.Query, warn: false alias RenewCollab.Hierarchy.Layer alias RenewCollab.Style.EdgeStyle defstruct [:document_id, :layer_id, :style_attr, :value] def new(%{document_id: document_id, layer_id: layer_id, style_attr: style_attr, value: value}) do...
00961b9f18177b73320b197f72ff7def062f1d84
12,262
[ 16328245 ]
[ "test" ]
defmodule HexpmWeb.API.AuthControllerTest do use HexpmWeb.ConnCase, async: true setup do owned_org = insert(:organization) unowned_org = insert(:organization) user = insert(:user) insert(:organization_user, organization: owned_org, user: user) user_full_key = insert( :key, ...
00962d26279e6d97b1217fcb2753cfafb95cb3f6
3,489
[ 25378550 ]
[]
defmodule Brainfuck do # opcodes @op_vinc "+" # increment value at memory address @op_vdec "-" # decrement value at memory address @op_pinc ">" # increment memory address @op_pdec "<" # decrement memory address @op_putc "." # output byte at memory address @op_getc "," # input byte into memory address @op_lbeg ...
0096c072ce2f7f76d09c9ad2f9ea2d7654dd2c23
2,794
[ 896817496 ]
[ "documented" ]
defmodule AdventCode2024.Solutions.Day05 do @moduledoc """ Day 5: Solution for Advent of Code 2024 """ @behaviour AdventCode2024.Solution @impl true def solve(""), do: {:error, :no_input} def solve(path \\ "priv/inputs/day05/input.txt") do case File.read(path) do {:ok, content} -> solve_conte...
009714dadd9ead83165324bf799dcba0a5181aea
3,613
[ 160186508, 107638632 ]
[ "typespec", "documented" ]
defmodule Rig.EventFilter.Config do @moduledoc """ Configuration object for event filters. """ @index_field "stable_field_index" @type jwt_config :: %{ json_pointer: String.t() } @type event_config :: %{ json_pointer: String.t() } @type field_config :: %{ ...
00971789350c9306aca5162ef23882ad5e2efe4c
2,211
[ 197233981 ]
[ "test" ]
defmodule WordCounterTest do use ExUnit.Case @a_lot_of_words "lib/word_files/a_lot_of_words.txt" @r_frost "lib/word_files/rfrost.txt" @rfrost_count %{ "village" => 1, "a" => 2, "stopping" => 1, "near" => 1, "see" => 1, "sleep" => 2, "know" => 1, "evening" => 1, "stop" => 1,...
009728c505c4080137a6a1a6f34fffb737fc3dda
2,207
[ 307155967 ]
[]
defmodule Dreadnought.Core.Player do use TypedStruct use Dreadnought.Core.Mission.Spec # *** ******************************* # *** TYPES typedstruct enforce: false do field :id, integer | nil, default: nil field :type, :human | :ai field :uuid, String.t field :name, String.t field :miss...
0097adb68e7e111c5cc930d714f0720c5f20afc9
1,925
[ 107599083, 195623682 ]
[ "phoenix", "documented" ]
defmodule EllieWeb.Endpoint do use Phoenix.Endpoint, otp_app: :ellie use Absinthe.Phoenix.Endpoint use Sentry.Phoenix.Endpoint socket "/api/sockets", EllieWeb.Graphql.Socket # Code reloading can be explicitly enabled under the # :code_reloader configuration of your endpoint. if code_reloading? do so...
00980b875ab82d021bdfe7e873de9d0055a18ab6
2,463
[ 588171994 ]
[ "phoenix" ]
defmodule ExTwitterWeb.FriendshipController do use ExTwitterWeb, :controller alias ExTwitter.{Accounts, Friendships} alias ExTwitter.Accounts.User def create(%{assigns: %{current_user: current_user}} = conn, %{"user_id" => user_id}) do Friendships.follow_user(current_user.id, user_id) |> case do ...
00980d8c84346f9382973412a5041b6f7581cec5
4,313
[ 77131803 ]
[ "typespec", "macro", "documented" ]
defmodule Jerboa.Format.Body.Attribute.ErrorCode do @moduledoc """ ERROR-CODE attribute as defined in [STUN RFC](https://tools.ietf.org/html/rfc5389#section-15.6) """ alias Jerboa.Format.Body.Attribute.{Decoder,Encoder} alias Jerboa.Format.ErrorCode.{FormatError, LengthError} alias Jerboa.Format.Meta de...
00985983fbf9cb6344ca461e337e6b7a4e6b5019
9,169
[ 997268013 ]
[ "liveview", "phoenix", "documented" ]
defmodule RepartoWeb.UserAuth do use RepartoWeb, :verified_routes import Plug.Conn import Phoenix.Controller alias Reparto.Accounts alias Reparto.Accounts.Scope # Make the remember me cookie valid for 14 days. This should match # the session validity setting in UserToken. @max_cookie_age_in_days 14 ...
009923ae886eddc841a92fd395f6e7afe078e215
1,555
[ 840726126 ]
[ "test" ]
defmodule EVM.VMTest do use ExUnit.Case, async: true doctest EVM.VM setup do account_interface = EVM.Interface.Mock.MockAccountInterface.new() {:ok, %{ account_interface: account_interface, }} end test "simple program with return value", %{} do instructions = [ :push1, 3, ...
0099588dcb9f204364969acd295d43702c221a86
1,663
[ 957363940 ]
[ "genserver" ]
defmodule Roomly.RoomServers.PomoServer do use Roomly.RoomServer alias Roomly.Rooms.Pomodoro alias Phoenix.PubSub def start_link({room_id, config}) do GenServer.start_link(__MODULE__, {room_id, config}, name: via_tuple(room_id)) end @impl true def init({room_id, config}) do pomo = Pomodoro.new(c...
009967af9777a3c6ce424533cb613ed8841d76ca
1,653
[ 402211574 ]
[ "ecto" ]
defmodule Archinyl.Repo.Migrations.InitalSchema do use Ecto.Migration def change do create_query = "CREATE TYPE gender AS ENUM ('female', 'male', 'other')" drop_query = "DROP TYPE gender" execute(create_query, drop_query) create table(:users) do add :full_name, :string, null: :false ad...
009982c3002486b1e961abe141e6342391a098d5
2,113
[ 850628335 ]
[ "test", "ecto" ]
defmodule GreekCoin.LocalizationTest do use GreekCoin.DataCase alias GreekCoin.Localization describe "countries" do alias GreekCoin.Localization.Country @valid_attrs %{name: "some name"} @update_attrs %{name: "some updated name"} @invalid_attrs %{name: nil} def country_fixture(attrs \\ %{}...
0099a8fa2ee198676870de6b36bcdd77f63a6431
1,988
[ 229347760 ]
[ "phoenix" ]
defmodule ShortyWeb.LinkController do use ShortyWeb, :controller alias Shorty.Links alias Shorty.Links.Link action_fallback ShortyWeb.FallbackController def create(conn, link_params) do conn = conn |> check_url_existence(%{}) |> check_shortcode_uniqueness(%{}) with {:ok, %Link{} = link} <-...
0099f77d02e70efae5d402b947f1dd14e1b2c081
1,511
[ 75360994 ]
[]
defmodule Triangle do def process do File.open("input.txt") |> read_from_file |> split_lines |> split_instructions([]) |> do_transpose |> start_counting |> IO.inspect end def read_from_file({:ok, file}) do IO.read(file, :all) end def read_from_file({_, error}) do IO.puts...
009a07e08a2036bd9f9715e28f47bbab4ffb3a70
6,290
[ 1008733310 ]
[ "test", "ecto" ]
defmodule Mymoney.AccountsTest do use Mymoney.DataCase alias Mymoney.Accounts describe "users" do alias Mymoney.Accounts.User import Mymoney.AccountsFixtures @invalid_attrs %{name: nil, password: nil, email: nil} test "list_users/0 returns all users" do user = user_fixture() asser...
009a3d83e4cf89d86d518d8d9541371010fb83b4
1,626
[ 138562706, 136571370, 786846015 ]
[]
defmodule Credo.Execution.Monitor do require Logger import Credo.Execution def task(exec, task, opts, fun, args) do context_tuple = {:task, exec, task, opts} log(:call_start, context_tuple) {time, exec} = :timer.tc(fun, args) log(:call_end, context_tuple, time) put_assign(exec, "credo.debu...
009a5ebcfb85b28473bfbca543e17769154570a9
1,922
[ 454233979 ]
[ "macro", "test", "documented" ]
defmodule PodsecWeb.ConnCase do @moduledoc """ This module defines the test case to be used by tests that require setting up a connection. Such tests rely on `Phoenix.ConnTest` and also import other functionality to make it easier to build common data structures and query the data layer. Finally, if the...
009a7281f4eb7f052f0ce58a2655fdf2bb0eb01b
1,588
[ 668251219 ]
[ "phoenix" ]
defmodule PetalProWeb.OrgPlugs do import Plug.Conn import Phoenix.Controller import PetalProWeb.Gettext use PetalProWeb, :verified_routes def assign_org_data(conn, _opts) do org_slug = conn.params["org_slug"] orgs = PetalPro.Orgs.list_orgs(conn.assigns.current_user) current_org = Enum.find(orgs,...
009a8f31ca5c43fbd3d5ded40e3cde4f1541d886
5,177
[ 100105858, 100098568 ]
[ "typespec", "ecto" ]
defmodule PhxWeb.Coherence.ViewHelpers do use Phoenix.HTML import PhxWeb.Gettext alias Coherence.Config @type conn :: Plug.Conn.t @type schema :: Ecto.Schema.t @seperator { :safe, "&nbsp; | &nbsp;" } @helpers PhxWeb.Router.Helpers @recover_link dgettext( "coherence", "Forgot your password?" ) ...
009b1da477c66211d90ac1a218f50fabc2ef6c93
5,273
[ 101495477 ]
[ "documented" ]
defmodule SmileysWeb.Coherence.Messages do @moduledoc """ Application facing messages generated by the Coherence application. This module was created by the coh.install mix task. It contains all the messages used in the coherence application except those in other generated files like the view and templates. ...
009bf4860102a5be83ddf82ef7f7b5a97c626a1c
1,659
[ 743823110 ]
[ "documented", "ecto" ]
defmodule Pento.Blogs do @moduledoc """ The Blogs context. """ import Ecto.Query, warn: false alias Pento.Repo alias Pento.Blogs.Blog @doc """ Returns the list of blog. ## Examples iex> list_blog() [%Blog{}, ...] """ def list_blog do Repo.all(Blog) end @doc """ Gets a ...
009c431cf07c65ed95bea03376db2b2f4ffe410b
1,987
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.ChromeManagement.V1.Model.GoogleChromeManagementV1TotalMemoryEncryptionInfo do @moduledoc """ Memory encryption information of a device. * This field provides device information, which is static and will not change over time. * Data for this field is controlled via policy: [ReportDeviceMemoryInf...
009c9e2492b43091c158e2b97179bd3190983862
2,074
[ 93620373 ]
[ "test" ]
defmodule Wep.ShowControllerTest do use Wep.ConnCase alias Wep.Show @valid_attrs %{imdb_id: "some content", title: "some content"} @invalid_attrs %{} setup %{conn: conn} do {:ok, conn: put_req_header(conn, "accept", "application/json")} end test "lists all entries on index", %{conn: conn} do co...
009d29b105a432627ff02968893a6e536d91d723
2,721
[ 196329157 ]
[]
defmodule BankID.Requests do @user_visible_data_limit 40_000 @user_non_visible_data_limit 200_000 def encode_auth(end_user_ip, personal_number \\ nil, requirement \\ nil) do request = case {is_nil(personal_number), is_nil(requirement)} do {true, true} -> %{ "endUserIp" => ...
009d3d8c4b6f75036e7ff86bbac4dcab6b24a995
5,044
[ 646081319 ]
[ "typespec", "documented" ]
defmodule Game.Engine do @moduledoc """ The Engine performs operations on the game state. Probably badly named and in the wrong place. """ @type game_object :: %{ x: integer(), y: integer(), width: integer(), height: integer(), __struct__: atom(), id: ...
009d857b3b44868f1361d73c86d07d7318992b6c
5,592
[ 942311758 ]
[]
Code.require_file("backgammon/engine/game_state.exs") Code.require_file("backgammon/player/player.exs") Code.require_file("backgammon/game/game_validator.exs") Code.require_file("backgammon/engine/engine_utils.exs") Code.require_file("backgammon/engine/move_generator.exs") defmodule GameEngine do @max_depth 5 @pos...
009de982083a6eb9d92eaec61529961624e86f33
2,060
[ 573556642 ]
[]
Code.compile_file(Path.expand("../../lib/grid.ex", __ENV__.file)) defmodule GoClimbARock do @deltas [ {0, 1}, {1, 0}, {-1, 0}, {0, -1} ] @target ?z - ?a + 1 @start ?S - ?a def run(stream) do parser = fn "E" -> @target <<chr>> -> chr - ?a end map = Grid.new(stream, p...
009e4f38e6c349779982db412419db763b720d34
6,483
[ 167979367, 676484638 ]
[ "test" ]
defmodule ExRabbitPool.ConsumerTest do use ExUnit.Case, async: false import ExUnit.CaptureLog alias ExRabbitPool.Worker.SetupQueue alias ExRabbitPool.RabbitMQ alias AMQP.Queue require Logger @moduletag :integration defmodule TestConsumer do use ExRabbitPool.Consumer def setup_channel(%{adapt...
009e63e6a84ac91e1fdf27b51a268318ce7302e8
2,033
[ 74784499 ]
[ "test" ]
defmodule Usd2rur.CrawlStrategy.TinkoffTest do use ExUnit.Case, async: true alias Usd2rur.CrawlStrategy.Tinkoff test "response success json parsed" do success_data = [ payload: [ rates: [ [ category: "DebitCardsTransfers", fromCurrency: [code: 840], ...
009e8b204719f33a2ca9eef86ef8b0596b36bb8d
3,135
[ 969632369 ]
[ "phoenix" ]
defmodule PentoWeb.Router do use PentoWeb, :router import PentoWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {PentoWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug ...
009ee015668bc769b61d319b07aa617cad2ea330
1,563
[ 112797301 ]
[]
defmodule AdventOfCode.Q2 do def lineToGame(line) do ["Game " <> number | tail] = String.split(line, ": ") {String.to_integer(number), getMaxBalls(hd(tail))} end def getMaxBalls(line) do plays = String.split(line, "; ") plays |> Enum.map(&playToBallsMap/1) end def playToBallsMap(play) d...
009f87dee2f20031966ba21c5f07d88d337fc2f6
6,584
[ 358149491 ]
[ "test", "ecto" ]
defmodule Animina.RailControlTest do use Animina.DataCase alias Animina.RailControl describe "locos" do alias Animina.RailControl.Loco test "list_locos/0 returns all locos" do Repo.delete_all(Loco) loco = insert(:loco) assert RailControl.list_locos() == [loco] end test "get_l...
00a077a4e0a0f1924ee61003a5be0d71de9865c9
2,254
[ 270032449 ]
[ "documented" ]
defmodule SurfaceBulma.Form.RadioButton do @moduledoc """ The radio button component as defined in https://bulma.io/documentation/form/radio/ """ use SurfaceBulma.Component alias Surface.Components.Form.{Field, RadioButton} @doc "The the field on the changeset" prop field, :atom, required: true @doc...
00a07c1796e4affe56dc2ba3a01f580b5294eb34
2,131
[ 756043300 ]
[ "typespec", "documented" ]
defmodule UrFUAPI.Modeus.Schedule.ScheduleData.Event do @moduledoc false use TypedStruct use ExConstructor defmodule HoldingStatus do @moduledoc false use TypedStruct use ExConstructor typedstruct enforce: true do field :aud_modified_at, any() field :aud_modified_by, any() fi...
00a0bd6e5f8d01601e0f67eea083a2618b9100d9
3,820
[ 442253220 ]
[ "typespec" ]
#! /usr/bin/env elixir defmodule CupGame do defstruct entries: %{}, current: 0, max_value: 0 @type t :: %__MODULE__{ entries: %{integer() => integer()}, current: integer(), max_value: integer() } @spec new(list(integer())) :: t() def new(init) do rotated = Stream.concat(Stream.drop(init, 1)...
00a0f2036b0bae7190238d19e6b8256e64c56882
1,874
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.ServiceControl.V2.Model.Response do @moduledoc """ This message defines attributes for a typical network response. It generally models semantics of an HTTP response. ## Attributes * `backendLatency` (*type:* `String.t`, *default:* `nil`) - The amount of time it takes the backend service ...
00a0f30f29e97f55cf33758e771e393c21c5fb15
9,539
[ 560255935 ]
[ "documented" ]
defmodule AoC.Day10.Spec do @moduledoc false use ESpec describe "sanity checks" do it "tests a small example" do expect( AoC.Day10.zap_asteroids( [ ".#....#####...#..", "##...##.#####..##", "##...#...#.#####.", "..#.....X...###..", ...
00a0f3e9feefc52c4cdabc62004024f63db74f04
1,544
[ 749568700 ]
[ "documented" ]
defmodule IceBoxWeb.Schemas.Company do @moduledoc false alias OpenApiSpex.Schema require OpenApiSpex defmodule Request do @moduledoc false OpenApiSpex.schema(%{ title: "CompanyRequest", description: "Company Request Schema", type: :object, properties: %{ name: %Schema{...
00a0f6c5df25e409f56d45317fac25b5d68e3459
1,574
[ 966681343 ]
[ "test" ]
defmodule Realtime.Cluster.Strategy.PostgresTest do use ExUnit.Case alias Cluster.Strategy.State alias Postgrex.Notifications, as: PN alias Realtime.Cluster.Strategy.Postgres setup do Ecto.Adapters.SQL.Sandbox.mode(Realtime.Repo, :auto) end test "handle_event/4, :internal, :connect is successful" d...
00a1654e0ab6ab77b116db15854ada0b7b2b9902
7,779
[ 363463124 ]
[]
defmodule ExUssd.Navigation do alias ExUssd.Registry alias ExUssd.Utils @default_value 436_739_010_658_356_127_157_159_114_145 def navigate( %ExUssd{} = menu, api_parameters, route ) do {menus, _} = menu.menu_list {validation_menu, _} = menu.validation_menu execute_nav...
00a189a72d506abf5c242d16a2ce8741e96b17f9
2,936
[ 837319868, 514687923 ]
[ "documented" ]
defmodule Norm.Conformer do @moduledoc false # This module provides an api for conforming values and a protocol for # conformable types def conform(spec, input) do Norm.Conformer.Conformable.conform(spec, input, []) end def group_results(results) do results |> Enum.reduce(%{ok: [], error: []},...
00a1a3cd1b44a10253d556b71ff3e8aae5603805
2,273
[ 111415024, 563322590 ]
[ "macro", "documented", "ecto" ]
defmodule GroupherServer.Accounts.Model.Embeds.UserMeta.Macro do @moduledoc false import Helper.Utils, only: [get_config: 2, plural: 1] @article_threads get_config(:article, :threads) defmacro published_article_count_fields() do @article_threads |> Enum.map(fn thread -> quote do field(u...
00a1a7dcc9cbef2a16b83cbef591f1e0b8304ec2
6,969
[ 329086896 ]
[ "test" ]
defmodule Secretwords.GameStateTest do use ExUnit.Case, async: true alias Secretwords.{GameState, WordSlot} describe "next_round" do test "advances the round and cycles now_guessing" do game = %GameState{now_guessing: :red, round: 1} updated_game = GameState.next_round(game) assert update...
00a2210e3c7eb644660f314bb36b1c5b1ca3e69c
2,375
[ 782243854 ]
[ "test", "ecto" ]
defmodule MiniViking.AccountsTest do use MiniViking.DataCase alias MiniViking.Accounts describe "users" do alias MiniViking.Accounts.User import MiniViking.AccountsFixtures @invalid_attrs %{role: nil, first_name: nil, last_name: nil, email: nil} test "list_users/0 returns all users" do ...
00a276620a94e4f31aeb06e2977f7024781b145c
2,690
[ 106938910 ]
[ "phoenix", "ecto" ]
defmodule RepWeb.ComplectationController do use RepWeb, :controller alias Rep.Lifts alias Rep.Lifts.Complectation def index(conn, %{"address_id" => address_id}) do address = Lifts.get_address!(address_id) complectations = Lifts.list_complectations(address) render(conn, "index.html", address: addre...
00a2e8b27d9674437a7fb56dce8907d3c9e1d70f
12,670
[ 949822535 ]
[ "liveview", "ecto" ]
defmodule AiposWeb.ProductSkuLive.FormComponent do use AiposWeb, :live_component alias Aipos.Products alias Aipos.ProductSkus @impl true def mount(socket) do {:ok, socket |> assign(:uploaded_files, []) |> assign(:remove_image, false) |> assign(:cards, Aipos.Cards.list_cards()) |...
00a2f57218ac72d081ed6902730aa0fd4504404f
1,595
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.NetworkServices.V1.Model.TcpRouteRouteDestination do @moduledoc """ Describe the destination for traffic to be routed to. ## Attributes * `serviceName` (*type:* `String.t`, *default:* `nil`) - Required. The URL of a BackendService to route traffic to. * `weight` (*type:* `integer()`,...
00a32a33a8dd290389c039ca8061166abd512bb1
4,906
[ 788901630 ]
[ "test", "ecto" ]
defmodule PandaPolls.PollsTest do use PandaPolls.DataCase import PandaPolls.PollsFixtures import PandaPolls.UsersFixtures alias PandaPolls.Model.Poll alias PandaPolls.Polls alias PandaPolls.PollServer @nonexisting_id "018f0b97-0ab9-75b4-bd00-000c7584a6d1" describe "Polls.list_polls/0" do test "r...
00a34cea4571e52104f412481915a8e38ba0c3a0
4,179
[ 87600453 ]
[ "test", "phoenix" ]
defmodule ConductorTest do use Support.ConnCase describe "conn without any scope" do test "GET show", %{conn: conn} do conn = get(conn, example_path(conn, :show)) assert response(conn, 200) end test "POST create", %{conn: conn} do conn = post(conn, example_path(conn, :create)) ...
00a3853c2ed39be2401e05be8f3c313c999308aa
1,754
[ 66568492 ]
[ "documented" ]
defmodule JSONPointer do @doc """ Takes a URI, optionally containing JSON pointers, and an ExJsonSchema resolved schema and returns a 2-element tuple containing a path template, and the variables to insert in the template. > parse( "/foo/{(%23%2Fdefinitions%2Fthing%2Fdefinitions%2Fweight)}/bar", schema ...