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
0120babf1decd4fcff8f71d9735ebefbef5ca238
2,681
[ 44419624, 765390321 ]
[ "test" ]
defmodule Absinthe.Phase.Document.VariablesTest do use Absinthe.Case, async: true alias Absinthe.{Blueprint, Phase, Pipeline} @pre_pipeline [Phase.Parse, Phase.Blueprint] @query """ query Foo($id: ID!) { foo(id: $id) { bar } } query Profile($age: Int = 36, $name: String!) { ...
0121bcffc75f7009cf7de4132f8fd777550140a4
12,907
[ 44490645 ]
[ "liveview", "documented" ]
defmodule DtCore.Monitor.PartitionFsm do @moduledoc """ Finite State Machine for alarm partition (aka zones) """ use GenStateMachine, callback_mode: [:handle_event_function] alias DtCore.ArmEv alias DtCore.DetectorEv alias DtCore.ExitTimerEv alias DtCore.Monitor.Detector alias DtCore.Monitor.Utils ...
01225bc6219531f487ab98142ea964acab286d2b
3,089
[ 680445064 ]
[ "phoenix", "documented" ]
defmodule ChacWeb.TransactionsController do use ChacWeb, :controller alias Chac.TransactionContext alias ChacWeb.{Auth, Response} @doc """ Create transaction ---| swagger |--- tag "transactions" post "/api/transactions" consumes "application/json" produces "application/json" ...
012317191060f01791b06abbaa9a8093609c4db4
1,732
[ 933514757 ]
[ "documented" ]
defmodule ExESDB.EnVars do @moduledoc """ This module contains the environment variables that are used by ExESDB """ @doc """ Returns the data directory. default: `/data` """ def data_dir, do: "EX_ESDB_DATA_DIR" @doc """ Returns the khepri store id. default: `ex_esdb_store` """ def store_id...
012361abdd220865d8df37c6a00500956c88ad9c
5,649
[ 322094360 ]
[ "documented" ]
defmodule Day19 do @moduledoc false def process_input(filename) do filename |> File.read!() |> String.split("\n\n", trim: true) |> Enum.map(&build_scanner/1) end defp build_scanner(str) do [scanner | positions] = String.split(str, "\n", trim: true) scanner_id = Regex.run(~r/.*sc...
0123f971c9d1cbbc1b99e0e4651f458300706a9c
1,856
[ 546459982 ]
[ "test", "documented" ]
defmodule Manx.VulkanAttentionTest do use ExUnit.Case, async: true import Nx.Defn import Manx.Assert @moduletag :nx @moduletag :attention @moduletag :vulkan setup do Nx.Defn.default_options(compiler: Manx.Compiler, default_backends: {Manx, device: :vulkan}) :ok end # original implementation ...
01242f3cf8d40e83c2f91d741b36284e0b92493a
5,086
[ 38275975 ]
[ "typespec", "documented" ]
defmodule ExHal do @moduledoc """ Use HAL APIs with ease. Given a resource `http://example.com/hal` whose HAL representation looks like ```json { "name": "Hello!", "_links": { "self" : { "href": "http://example.com" }, "profile": [{ "href": "http://example.com/special" }, ...
01245332435293d27099e6dc87027836333fbcc1
1,600
[ 491961474 ]
[]
defmodule Proxy.MixProject do use Mix.Project @app :proxy @version "0.0.0-local.dev" def project do [ app: @app, version: @version, build_path: "../../_build", deps_path: "../../deps", lockfile: "../../mix.lock", elixir: "~> 1.15", start_permanent: Mix.env() == :p...
0124cf452dca41d63304f24f8e8d92bd71232085
1,723
[ 112397323 ]
[ "macro", "documented", "phoenix" ]
defmodule ElmPhoenixExampleWeb 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 ElmPhoenixExampleWeb, :controller use ElmPhoenixExampleWeb, :view The definitions below will be executed ...
012574736530b8f6153e92520843db0ce4efc8f8
5,389
[ 121171214 ]
[ "documented" ]
defmodule MangoPay.Card do @moduledoc """ Functions for MangoPay [credit cards](https://docs.mangopay.com/endpoints/v2.01/cards#e177_the-card-registration-object). """ alias MangoPay.User, as: User alias MangoPay.Transaction, as: Transaction use MangoPay.Query.Base set_path "cards" @doc """ Get a c...
01259a77c36307cb1282e93ec89020ff6a85ff31
1,646
[ 141308758 ]
[]
defmodule IslandsEngine.Rules do alias __MODULE__ defstruct state: :initialized, player1: :islands_not_set, player2: :islands_not_set def new(), do: %Rules{} def check(%Rules{state: :initialized} = rules, :add_player) do {:ok, %Rules{rules | state: :players_set}} end def chec...
0125ebf81ee96fdac306373246eff531c7997653
4,387
[ 426470708 ]
[ "genserver", "documented" ]
defmodule Eeyeore.Settings do use GenServer require Logger @moduledoc """ The main settings for Eeyeore These settings include things like, default LED Color, default number of bolts on a trigger, and maximum brightness. This module also broadcasts changes for network connections such as MQTT. """ ...
0126a07f7a8f45c74b0522d8cb43049cf0eb266a
2,003
[ 338118832 ]
[ "macro", "test", "documented", "ecto" ]
defmodule EpiViewpoint.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...
0127246cafc912208262ab9ffcb755cdc53c9255
1,738
[ 215167745, 276796571 ]
[ "genserver" ]
defmodule BossServer do use GenServer def start_link(boss_name) do GenServer.start_link(__MODULE__, [], name: via_tuple(boss_name)) end def init(init_arg) do {:ok, init_arg} end def handle_call({:process, start, finish},_from, _state) do start = if start >= 1000, do: start, else: 1000 lo...
01275083a1ff6d3b9b702ec95dd22c6d6b880530
1,501
[ 799696051 ]
[ "phoenix" ]
defmodule WarplinksWeb.Router do use WarplinksWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {WarplinksWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api do...
0127b0ce94ac3d94684c04a338cecea3dae01a34
3,160
[ 276901189 ]
[ "typespec", "phoenix" ]
defmodule Battleship.Setup.State do require Logger alias Battleship.Core.{Player, Game} alias Battleship.Setup.PlayerStatus defstruct [:player1, :player2, :game] @type t :: %__MODULE__{ player1: PlayerStatus.t() | nil, player2: PlayerStatus.t() | nil, game: Game.t() | nil ...
0127eedec85317302ea88ae31d9362429766d6c2
9,408
[ 605242810 ]
[ "documented" ]
defmodule Mix.Tasks.Package do @moduledoc """ Creates the Lexical application's artifacts Lexical does some strange things to its own code via namespacing, but because it does so, we can't use standard build tooling. The app names of its modules and dependencies are changed, so `mix install` won't realize th...
012812176b4e780915d6ad0dcf51c471e7efced8
9,141
[ 399459421 ]
[ "documented" ]
defmodule HexSolver.PackageLister do @moduledoc false alias HexSolver.{Constraint, Incompatibility, PackageLister, PackageRange, Term} alias HexSolver.Constraints.{Range, Version} defstruct registry: nil, root_dependencies: [], locked: [], overrides: [], already...
01286cd24de4a396638525dac30e656414a1ebbe
4,056
[ 135688419 ]
[ "documented", "ecto" ]
defmodule Buddy.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias Buddy.Repo alias Buddy.Accounts.User def get_user_or_create(attrs, search_params) do case Repo.get_by(User, Map.to_list(search_params)) do nil -> create_user(attrs) user -> ...
01289feaabbb73cec47161820b6fe07726cf52e1
10,793
[ 367278931 ]
[ "documented" ]
defmodule Google.Cloud.Aiplatform.V1beta1.CreateFeatureGroupRequest do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :parent, 1, type: :string, deprecated: false field :feature_group, 2, type: Google.Cloud.Aiplatform.V1beta1.FeatureGroup, json_name: "featur...
0128dab0ad9684659abf9ce6fb3079e37b60fccb
3,678
[ 334843340 ]
[]
alias Onicn.Categories.{Solid, Liquid, Gas, Building, Critter, Plant, Food, Geyser, Other} alias Onicn.Translation defmodule Onicn.Item do @skiplist [ "水下", "水中", "水域", "水温", "溺水", "眼冒金星", "离水之鱼", "补水", "被水淹没", "金属" ] def name_to_link(string, escape \\ []) def name_to_...
0128f599cd618f7e36e2abc106ddac135a8463f9
2,971
[ 878677487 ]
[ "test", "ecto" ]
defmodule StoryWeaver.StoriesTest do alias StoryWeaver.AccountsFixtures use StoryWeaver.DataCase alias StoryWeaver.Stories describe "stories" do alias StoryWeaver.Stories.Story import StoryWeaver.StoriesFixtures import StoryWeaver.AccountsFixtures @invalid_attrs %{title: nil} test "list...
01291cbffb87da4ff2fc9a756871e2d5e5a4b9d7
4,772
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CloudAsset.V1.Model.BigQueryDestination do @moduledoc """ A BigQuery destination for exporting assets to. ## Attributes * `dataset` (*type:* `String.t`, *default:* `nil`) - Required. The BigQuery dataset in format "projects/projectId/datasets/datasetId", to which the snapshot result shou...
01291d95e7e599e6958361e9384e4c27a268e722
3,282
[ 1009429289 ]
[ "liveview", "test" ]
defmodule RbhicksWeb.UserLive.LoginTest do use RbhicksWeb.ConnCase, async: true import Phoenix.LiveViewTest import Rbhicks.AccountsFixtures describe "login page" do test "renders login page", %{conn: conn} do {:ok, _lv, html} = live(conn, ~p"/users/log-in") assert html =~ "Log in" asser...
01292dbb0986fb8753ab0ff6ab0c2669af10e699
15,369
[ 81246705 ]
[ "typespec", "documented" ]
defmodule Accounting.XeroAdapter do @moduledoc """ The journal adapter for https://developer.xero.com/. """ alias Accounting.{ Account, AccountTransaction, Adapter, Entry, Helpers, Journal, XeroView, } import Helpers, only: [sort_transactions: 1] import XeroView, only: [render...
012949e668e73da6368dfe4e77c2d4deea1a159e
13,413
[ 800182948 ]
[ "liveview", "documented" ]
defmodule BudgetTrackerWeb.Components.Footer do @moduledoc """ The `BudgetTrackerWeb.Components.Footer` module provides a customizable footer component for Phoenix applications, allowing for various styles, colors, and layout options. It supports different design variants such as default, outline, transparent, ...
01295ab41b3c1bd5d75597993509018f444aaccd
1,583
[ 62952823 ]
[]
%{"bbmustache": {:hex, :bbmustache, "1.0.4", "7ba94f971c5afd7b6617918a4bb74705e36cab36eb84b19b6a1b7ee06427aa38", [:rebar], []}, "cf": {:hex, :cf, "0.2.1", "69d0b1349fd4d7d4dc55b7f407d29d7a840bf9a1ef5af529f1ebe0ce153fc2ab", [:rebar3], []}, "earmark": {:hex, :earmark, "0.2.1", "ba6d26ceb16106d069b289df66751734802777a...
0129619fa57d3233664afa63ced719f01e3e0968
2,157
[ 710839494 ]
[ "phoenix" ]
defmodule TimeManagerApiWeb.WorkingtimeController do use TimeManagerApiWeb, :controller alias TimeManagerApi.TimeManagement alias TimeManagerApi.TimeManagement.Workingtime action_fallback TimeManagerApiWeb.FallbackController def index(conn, _params) do workingtimes = TimeManagement.list_workingtimes() ...
012968257c35c02258f9866e69358f0b8cf265f1
2,381
[ 303675756 ]
[ "liveview", "test" ]
defmodule AmbuneWeb.UserLiveTest do use AmbuneWeb.ConnCase import Phoenix.LiveViewTest alias Ambune.Users @create_attrs %{email: "<EMAIL>", name: "some name"} @update_attrs %{email: "<EMAIL>", name: "some updated name"} @invalid_attrs %{email: nil, name: nil} defp fixture(:user) do {:ok, user} = U...
0129bac7aed6f8c38f90e41c0da638ec6bad647e
4,136
[ 838283940 ]
[ "typespec", "documented" ]
defmodule Recordlocator do @moduledoc """ `Recordlocator` is a module for generating Recordlocators from integer values and decoding Recordlocators back to the integer value. A Recordlocator is an alphanumeric representation for an integer value. It uses a 32 character alphabet to encode the integer values. A Re...
0129bb0231e9d3266dd382209500f54a12739e15
4,661
[ 251077511 ]
[ "test", "ecto" ]
defmodule Doumi.EctoCaseHelperTest do use Doumi.EctoCase, async: true alias Doumi.EctoCaseHelper alias Doumi.TestRepo @changeset %Ecto.Changeset{ types: %{field0: :string, field1: :integer}, action: :update, changes: %{field0: "value0", field1: 1}, errors: [], data: %{}, valid?: false ...
012a0da1db8c3d4fbe72b34e5a3dd3e3c9669ff6
3,981
[ 159991022 ]
[]
defmodule Elixir2020.Day08.Computer do alias Elixir2020.Day08.Computer defstruct [ :program, :pc, :pc_seen, :pc_max, :acc ] ## new/1: Given a program, create a new computer. def new(program) when is_list(program) do pc_max = length(program) - 1 ## Turn program into a map with th...
012a24d62ff661d5c5998d5af751a0357b750bbe
5,616
[ 87468898 ]
[ "documented", "ecto" ]
defmodule AwesomeElixir.AwesomeList do @moduledoc """ The boundary for the AwesomeList system. """ import Ecto.{Query, Changeset}, warn: false alias AwesomeElixir.Repo alias AwesomeElixir.AwesomeList.{Section, Repository} @doc """ Returns the list of repositories with preloaded sections filtered by s...
012a7f6afe33372e417affa78af9272ff2eaa52e
2,369
[ 317783162 ]
[]
defmodule Aoc2020.Day18 do def part1(input) when is_binary(input), do: part1([input]) def part1(input) do input |> Enum.reduce(0, fn line, acc -> acc + (line |> String.replace(" ", "") |> calc([])) end) end def part2(input) when is_binary(input), do: part2([input]) def part2(input) do ...
012abf948c5fe26337710e0ca0fdf5a3615a15e1
6,381
[ 1002010697 ]
[ "genserver", "documented" ]
defmodule SnmpSimUi.Scheduler.JobManager do @moduledoc """ Manages scheduled jobs using Quantum scheduler with database persistence """ use GenServer require Logger alias SnmpSimUi.Scheduler alias SnmpSimUi.Scheduler.Job def start_link(opts \\ []) do GenServer.start_link(__MODULE__, opts, name: _...
012afabfecc442016f7c95ec6e52eca0f2ecdead
2,766
[ 176353168 ]
[ "test" ]
defmodule SmartCity.Registry.OrganizationTest do use ExUnit.Case use Placebo alias SmartCity.Registry.Organization setup do string_key_message = %{ "id" => "12345-6789", "orgName" => "This is an Org", "orgTitle" => "This is a title", "homepage" => "homepage" } json_message ...
012b6d0a676a1b908b7a0bb2a9ad4b41a6ee509a
1,694
[ 769131610 ]
[ "test" ]
defmodule Tetrom.Game.ColorTest do use ExUnit.Case alias Tetrom.Game.Color describe "shape name" do test "blue shape name" do res = Color.get(:i) case res do {:ok, shape_name} -> assert shape_name == "blue" _unexpected_result -> assert false end end test "red shape ...
012befcbddd1e562eb709346984e2f05ae363d3b
1,982
[ 562197135 ]
[ "documented" ]
defmodule ExBanking.Accounts.UserRequestManager do @moduledoc """ This module required functions to manage user request. If the user request exceed allowed limit, returns error. """ alias ExBanking.Accounts.UserRegistry alias ExBanking.Accounts.UserRequestCounter @maximum_allowed_request Application.com...
012c64b19ff5a76d26c8f2933e61c0da549a63ad
2,186
[ 712391766 ]
[ "documented" ]
defmodule FoodFromHome.Orders do @moduledoc """ The Orders context. """ alias FoodFromHome.Orders.Finders.OrderWithAssociatedData alias FoodFromHome.Orders.OrderRepo alias FoodFromHome.Orders.Services.SetCancelledStatusAndAddSellerRemarkAndProduceOrderCancelledEvent alias FoodFromHome.Orders.Services.Se...
012c66be2e6ba0edfa77f7f3bbad1b59347684da
3,410
[ 437631072 ]
[ "documented" ]
defmodule TmiboxWeb.Components.Layouts.AppLayout do @moduledoc """ Component for Layout """ use Surface.Component use Phoenix.HTML alias TmiboxWeb.Router.Helpers, as: Routes alias TmiboxWeb.Endpoint @doc "flash object" prop flash, :map, default: %{} @doc "current logged in user" prop current_us...
012d13984421c88084c262f289b94b345642145f
3,682
[ 107399932, 898705038 ]
[ "typespec", "documented" ]
defmodule ExAudit.Diff do @type addition :: {:added, term} @type removal :: {:removed, term} @type change :: {:changed, changes} @type primitive_change :: {:primitive_change, removed :: term, added :: term} @type list_addition :: {:added_to_list, index :: integer, term} @type list_removal :: {:removed_from_...
012dcb36508216ed725f2e122191dfcfa6cbc46f
1,770
[ 367278931 ]
[ "documented" ]
defmodule Google.Cloud.Aiplatform.V1.TensorboardTimeSeries.ValueType do @moduledoc false use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :VALUE_TYPE_UNSPECIFIED, 0 field :SCALAR, 1 field :TENSOR, 2 field :BLOB_SEQUENCE, 3 end defmodule Google.Cloud.Aiplatform.V1.Tenso...
012e42e20d5654f8d875d11c85615c6730576fd7
7,365
[ 405539677 ]
[ "documented" ]
defmodule EnochEx.Calendar.CurrentDatetime do @moduledoc """ The date and clock, ticking minute by minute, returning the advanced current datetime. Note that this module knows only to move time forward, minute by minute, it has no awareness of the equinox (handled upstream of this). [ day: 1, week: 1, ...
012e49021bbd8a77e461e84c00d859faaafcc4ab
1,921
[ 44564329 ]
[ "test" ]
defmodule ExvcrUtilsTest do use TestCase, async: false test ".read_fixture reads the fixture from file" do fixture = ExvcrUtils.read_fixture("checkDomain/success.http") assert fixture == """ HTTP/1.1 200 OK\r Server: nginx\r Date: Fri, 26 Feb 2016 16:04:05 GMT\r Content-Type: application/j...
012e8b4d80b9fd68b2642a77843ab9c9a6219a93
1,846
[ 159997786 ]
[ "typespec" ]
defmodule Day2 do @spec letter_counts(String.t()) :: {non_neg_integer(), non_neg_integer()} def letter_counts(id) do id |> String.codepoints() |> Enum.reduce(%{}, fn letter, counts -> counts |> Map.update(letter, 1, & &1 + 1) end) |> Enum.reduce_while({0, 0}, fn {_, 2}, {0, _} ...
012f006f58c4b1e59d6008b95e038eed1470413b
3,446
[ 60067859 ]
[ "genserver", "typespec", "documented" ]
defmodule Game do use GenServer require Logger require Player @moduledoc """ Module which functions as game master: assigning turns, enforcing rules, declaring winners etc """ # public api def start([player1_pid, player2_pid]) when is_pid(player1_pid) do player1 = Player.current_state player1_pid...
012f22579a41096457651f5ac659ef1b78e27e42
1,849
[ 525522734 ]
[]
defmodule RandomV.LinkService do require Logger alias RandomV.YoutubeApi @page_size 50 def get_random_link(playlist_id, api_key) do playlist_size = get_playlist_size(playlist_id, api_key) link_index = random_index(playlist_size) get_nth_link(link_index, playlist_id, api_key) end def get_pla...
012f317ea1806c249084a108067937e2e2421167
2,095
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1SafeSearchAnnotation do @moduledoc """ Set of features pertaining to the image, computed by computer vision methods over safe-search verticals (for example, adult, spoof, medical, violence). ## Attributes * `adult` (*type:* `String.t`, *default:*...
012f89ecacd1ee3b9702e3ab2afb1feeb2cba41b
2,038
[ 956147075 ]
[ "liveview", "test" ]
defmodule GistTwoWeb.UserConfirmationInstructionsLiveTest do use GistTwoWeb.ConnCase, async: true import Phoenix.LiveViewTest import GistTwo.AccountsFixtures alias GistTwo.Accounts alias GistTwo.Repo setup do %{user: user_fixture()} end describe "Resend confirmation" do test "renders the res...
012fe6f19bc20808b186d435424fd3134c2dcca7
1,718
[ 313995562 ]
[]
defmodule Ppa.ErrorHandler do def handle(conn, error_map, extra_data \\ %{}) def handle(conn, %{kind: kind, reason: reason, stack: stacktrace}, extra_data) do conn = conn |> Plug.Conn.fetch_cookies() |> Plug.Conn.fetch_query_params() Rollbax.report(kind, reason, stacktrace, extra_data, %{ ...
01300666bbe682b239b7cd00840650ff7e78454b
2,913
[ 766206456 ]
[ "test" ]
defmodule PollApp.PollsManagerTest do use ExUnit.Case, async: true alias PollApp.PollsManager setup do unique_name = :"#{__MODULE__}_#{:erlang.unique_integer([:positive])}" {:ok, _pid} = PollsManager.start_link(name: unique_name) {:ok, polls_manager: unique_name} end describe "create_poll/3" do ...
01300a3ef173e7417f051c4082e9514f1770adcf
1,977
[ 427185287, 60522995 ]
[ "typespec", "macro", "ecto" ]
defmodule AsNestedSet.Scoped do import Ecto.Query @type scope :: [atom] defmacro __using__(args) do quote do @scope unquote(Keyword.get(args, :scope, [])) @before_compile AsNestedSet.Scoped end end defmacro __before_compile__(env) do scope = Module.get_attribute(env.module, :scope)...
0130a441155e6aaf352ee9d24015b363060d7c3c
1,661
[ 863925441 ]
[ "phoenix" ]
defmodule ForumWeb.Router do use ForumWeb, :router use AshAuthentication.Phoenix.Router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {ForumWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_header...
0130e7d9d8534c4c4abddffba3cc24ad91896731
16,156
[ 1009046953 ]
[ "test" ]
defmodule SoupAndNutz.XBRL.ConceptsTest do use ExUnit.Case, async: true alias SoupAndNutz.XBRL.Concepts describe "asset_types/0" do test "returns a list of valid asset types" do asset_types = Concepts.asset_types() assert is_list(asset_types) assert length(asset_types) > 0 assert "Ca...
0130eac7b654aa2a220999023156342fedad664b
5,374
[ 581217076 ]
[ "documented", "ecto" ]
defmodule Greenhouse.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias Greenhouse.Repo alias Greenhouse.Accounts.User alias GreenhouseWeb.Auth.Auth import Greenhouse.Guards @doc """ Returns the list of users. ## Examples iex> list_users() [%Use...
013121e4304228210e34560936b68dc47921909a
1,545
[ 689341821 ]
[ "typespec", "ecto" ]
defmodule BookStore.Utils.DocIdValidators do def validate_isbn(isbn) do cleaned_isbn = String.replace(isbn, ~r/\D/, "") len = String.length(cleaned_isbn) if len != 13 do {:fail, "ISBN must have only 13 digits [0-9], got " <> Integer.to_string(len) <> "!"} else cleaned_isbn |> String....
01316045c4bea9f8410221ea1c70c09ca8238947
2,198
[ 658939155 ]
[ "test" ]
defmodule WordleTest do use ExUnit.Case alias Games.Wordle import Mox describe "testing feedback/2 check rounds" do test "returns all green for exact match" do assert Wordle.feedback("race", "race") === [:green, :green, :green, :green] end test "returns partial green for inexact match" do ...
01316904b4e5c882fb45eed11d59373051630d79
3,229
[ 261108040 ]
[ "liveview", "test" ]
defmodule PusemitWeb.GameLiveTest do use PusemitWeb.ConnCase import Phoenix.LiveViewTest alias Pusemit.Games @create_attrs %{} @update_attrs %{} @invalid_attrs %{} defp fixture(:game) do {:ok, game} = Games.create_game(@create_attrs) game end defp create_game(_) do game = fixture(:gam...
0131bd56bcfcc4b844841adb48c8ee62c93d8e71
3,000
[ 708950292 ]
[ "liveview" ]
defmodule TarragonWeb.PageLive.Ecspanse.CommonComponents do use TarragonWeb, :html attr :thing, :any, required: true def inspect(assigns) do ~H""" <pre><%= inspect(@thing, pretty: true) %></pre> """ end slot :header slot :inner_block, required: true def details_card(assigns) do ~H""" ...
0131eeb955a5283923bc79e44f073caeffe8111b
6,268
[ 761334224 ]
[ "documented" ]
defmodule TaskManager.Cli do @moduledoc """ Command Line Interface for Task Management System This module provides a command line interface (CLI) for interacting with a Task Management System. It allows users to view, add, edit, and delete tasks. ## Usage 1. Start the CLI by calling `TaskManager.Cli.sta...
01326895c27a73e330242eebe18e19e2b342145b
2,240
[ 419435907 ]
[]
defmodule Oli.Plugs.SetCurrentUser do import Plug.Conn import Oli.Utils, only: [value_or: 2] alias Oli.Accounts alias Oli.AccountLookupCache def init(_params) do end def call(conn, _params) do conn |> set_author |> set_user |> set_user_token |> update_ctx end def set_author(co...
013365962c108ef4d1daa4ef24e8ab8f345cea5b
1,704
[ 57454382 ]
[]
defmodule Interface.Mixfile do use Mix.Project def project do [app: :interface, version: "0.0.1", build_path: "../../_build", config_path: "../../config/config.exs", deps_path: "../../deps", lockfile: "../../mix.lock", elixir: "~> 1.4", elixirc_paths: elixirc_paths(Mix.env), ...
0133a0711959195a426f2f9eba80d5616a001dd8
5,262
[ 954882315 ]
[]
%{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0...
0134193306a5efa910b4038e8a33b031f32f4ea1
5,897
[ 410121215 ]
[ "liveview" ]
defmodule SigLive.EmployeeRegistrations.CompanyAssignments.Form do use SigLive, :surface_live_component alias Sig.HR alias Sig.Entities alias Sig.Organizations alias Surface.Components.Form alias Surface.Components.Form.{ Select, ErrorTag, Field, Label, Submit, DateInput } al...
0134640b0d9d80ff441581fa5766e20e8bb48014
2,130
[ 435905213 ]
[]
defmodule AdventOfCode.Day17 do def part1(input) do {target_x, target_y} = target = parse_input(input) Enum.reduce( for(x <- 1..target_x.last, y <- -target_y.first..target_y.first, do: {x, y}), [], fn vel, acc -> case vel |> reaches_target(target) |> Enum.filter(&elem(&1, 0)) do ...
0134ac1eaf7a97fe30e870fcad5d3fde665199e4
1,595
[ 160319353 ]
[]
defmodule Aoc.Y2020.D10 do use Aoc.Input alias Aoc.Cache def part1(str \\ nil) do %{1 => diff1, 3 => diff3} = (str || input()) |> parse_input() |> make_chain() |> Enum.group_by(fn [prev, next] -> next - prev end) (length(diff1) * length(diff3)) |> IO.inspect() end defp ...
013558fc1ed780d3738d8ca9b373a28a338237c4
2,460
[ 942584872 ]
[ "liveview" ]
defmodule InvoicyWeb.InvoiceLive.PaymentInfo do use InvoicyWeb, :live_component def render(assigns) do ~H""" <div class="rounded-lg bg-card dark:bg-gray-800 w-full space-y-6"> <h3 class="font-bold text-lg my-2">Payment Information</h3> <div class="flex flex-wrap justify-between"> <div ...
0137ab589b9749486bd1a140d0d543f42e80519f
2,315
[ 355734322 ]
[ "phoenix", "ecto" ]
defmodule App2Web.ItemController do use App2Web, :controller alias App2.Todo alias App2.Todo.Item def index(conn, params) do item = if not is_nil(params) and Map.has_key?(params, "id") do Todo.get_item!(params["id"]) else %Item{} end items = Todo.list_items() cha...
0137d35424d195086a6cb9722c9507a16c08be48
2,235
[ 424531182 ]
[ "phoenix" ]
defmodule AppWeb.Router do use AppWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {AppWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api do plug :accepts, [...
0137ed5497107c4dcc6ddeb5f4da4589f4936170
4,292
[ 75487919 ]
[ "documented" ]
defmodule Advent2018.Day14 do @moduledoc """ https://adventofcode.com/2018/day/14 Only two recipes are on the board: the first recipe got a score of 3, the second, 7. Each of the two Elves has a current recipe: the first Elf starts with the first recipe, and the second Elf starts with the second recipe. To cr...
0137fcb68e097589b4559faa9147d21d5b475743
1,514
[ 916991118 ]
[ "phoenix" ]
defmodule PensieveWeb.Router do use PensieveWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {PensieveWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers # plug :put_format, "jso...
013893a6bb8085b527606daa0f234d152888f196
1,880
[ 88363764 ]
[ "typespec", "documented" ]
defmodule SecretHandshake do @doc """ Determine the actions of a secret handshake based on the binary representation of the given `code`. If the following bits are set, include the corresponding action in your list of commands, in order from lowest to highest. 1 = wink 10 = double blink 100 = close yo...
0139c637c49c7f9007b09bd6811da8d366e195fe
4,144
[ 818960294 ]
[ "genserver", "liveview", "documented" ]
defmodule StayConnectWeb.AddReleaseLive do use StayConnectWeb, :live_view alias StayConnect.{Release, Artist, Category} alias StayConnectWeb.AutoCompleteComponent require Logger def mount(_params, _session, socket) do release_changeset = Release.changeset(%Release{}) release_types = [Projet: "project...
0139f839dfddb24f98b760244bee2764325a7640
1,895
[ 64435461 ]
[ "test" ]
defmodule Activio.ActivityTest do use ExUnit.Case alias Activio.Activity doctest Activity setup do activity = %Activity{} activity_with_participants = activity |> Activity.put_participant("user1") |> Activity.put_participant("user2") |> Activity.put_partic...
013a1320da6d92b9dcab1e0749850a15748f5964
1,636
[ 83414333 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule PerudoWeb.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use PerudoWeb.Web, :controller use PerudoWeb.Web, :view The definitions below will be executed for every view, controller, etc, so keep th...
013ad44d8d57e89b0569d75901f04821067ded05
3,088
[ 135821524 ]
[ "phoenix" ]
defmodule Shield.ClientController do use Shield.Web, :controller alias Shield.Store.Client, as: ClientStore @views Application.get_env(:shield, :views) @hooks Application.get_env(:shield, :hooks) plug :scrub_params, "client" when action in [:create, :update] plug Authable.Plug.Authenticate, [scopes: ~w(se...
013b610001116979c511aa9eb977de00ae3382a4
3,174
[ 321503223 ]
[ "test", "phoenix" ]
defmodule BookmarkWeb.UserSessionControllerTest do use BookmarkWeb.ConnCase, async: true import Bookmark.AccountsFixtures setup do %{user: user_fixture()} end describe "GET /users/log_in" do test "renders log in page", %{conn: conn} do conn = get(conn, Routes.user_session_path(conn, :new)) ...
013b81a5b8ec0deb1fc4a054501bb6819aeaf74b
3,793
[ 838907457, 763575502 ]
[ "test", "documented" ]
defmodule Electric.Postgres.Proxy.TestScenario.ExtendedNoTx do @moduledoc """ Statements are issued using the extended protocol, but no explicit transactions are used. """ use Electric.Postgres.Proxy.TestScenario def tags do [scenario: :extended_no_tx, protocol: :extended, framework: false, tx: false, ...
013be762cfd43ef5609fd427ef91f27485c08d01
3,422
[ 313428891 ]
[ "documented" ]
# this may belong in PartitionedClusterLayout instead of Chassis proper defmodule Chassis.Cluster.TransitionRanges do @moduledoc false alias Chassis.Cluster.RangeSteal alias Chassis.Cluster.RangeAccept alias Chassis.Cluster.RangeRelease alias Chassis.Range defstruct [ {:active, IntervalMap.new()}, ...
013d3462722d2d15083b444036ac0ca35fa6e9c7
5,669
[ 54967115 ]
[ "typespec", "macro", "documented" ]
defmodule Integer do @moduledoc """ Functions for working with integers. """ import Bitwise @doc """ Determines if an integer is odd. Returns `true` if `n` is an odd number, otherwise `false`. Allowed in guard clauses. ## Examples iex> Integer.is_odd(3) true iex> Integer.is_od...
013d38ead970be6312fb712fcc38e1245f1013d8
1,603
[ 62018879 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule Talkex.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use Talkex.Web, :controller use Talkex.Web, :view The definitions below will be executed for every view, controller, etc, so keep them short ...
013ecd1abe30de37924ea9a4dc1d403e4a4de734
2,981
[ 648655468 ]
[ "liveview" ]
defmodule NoxWeb.LePartnerLive.Index do use NoxWeb, :live_view alias Nox.LearnEarn alias Nox.Repo.LePartner @impl true def mount(_params, _session, socket) do {:ok, assign(socket, :le_partners, list_le_partners())} end @impl true def handle_params(params, _url, socket) do {:noreply, apply_act...
013f4aef947d46d1cef522c9224978decffbef3f
11,526
[ 829059969 ]
[ "macro", "test" ]
defmodule BACnet.Protocol.ReadAccessResult.ReadResultTest do alias BACnet.Protocol.ApplicationTags.Encoding alias BACnet.Protocol.BACnetError alias BACnet.Protocol.Constants alias BACnet.Protocol.ReadAccessResult.ReadResult require Constants use ExUnit.Case, async: true @moduletag :protocol_data_structu...
013f9a60a6f29c64579a11667e1e8a0d3709ce15
5,349
[ 67368302 ]
[ "test" ]
defmodule LeanCoffee.MeetupControllerTest do use LeanCoffee.ConnCase alias LeanCoffee.Meetup @valid_attrs %{name: "some meetup"} @invalid_attrs %{name: ""} setup %{conn: conn} = config do if username = config[:login_as] do user = insert_user(username: username) conn = assign(conn, :current_u...
013ff7dec8ae665d5c4fed5e43166a260a2c8d6e
8,912
[ 962017994 ]
[ "test" ]
defmodule SleekFlowTodo.Todos.Commands.EditTodoHandlerTest do use ExUnit.Case, async: true alias SleekFlowTodo.Todos.Commands.{EditTodo, EditTodoHandler} alias SleekFlowTodo.Todos.Aggregates.Todo alias SleekFlowTodo.Todos.Events.TodoEdited @valid_todo_id Commanded.UUID.uuid4() @initial_aggregate_state %To...
014016492a15ebc588f068fe88c7767023aae1bc
2,417
[ 531107016 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule TriviaWeb 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 TriviaWeb, :controller use TriviaWeb, :view The definitions below will be executed for every view, controller, etc...
014066e227832e82f75b75e47d89251244321930
1,635
[ 463426998, 159876173 ]
[ "test" ]
defmodule ExBitmex.Rest.HTTPClientTest do use ExUnit.Case, async: false use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney doctest ExBitmex.Rest.HTTPClient @credentials %ExBitmex.Credentials{ api_key: System.get_env("BITMEX_API_KEY"), api_secret: System.get_env("BITMEX_API_SECRET") } setup_all do ...
0140d7584b7c7947baaaa93c2ddf2c241ce54f12
1,629
[ 85082137 ]
[]
use Mix.Config # expose enviroment to enable react debugging config :crowd_crush, :environment, :dev # Configure your database config :crowd_crush, CrowdCrush.Repo, username: "postgres", password: "postgres", database: "crowd_crush_dev", hostname: "localhost", show_sensitive_data_on_connection_error: true, ...
01411ecadb52fb9b849fb696e2b44a45f4067270
3,703
[ 364735928 ]
[ "liveview", "test" ]
defmodule KoinsWeb.AccountLiveTest do use KoinsWeb.ConnCase import Phoenix.LiveViewTest alias Koins.Brokerage @create_attrs %{name: "some name"} @update_attrs %{name: "some updated name"} @invalid_attrs %{name: nil} defp fixture(:account) do {:ok, account} = Brokerage.create_account(@create_attrs)...
0141211c5da702f2d9e2a9f95f352435deabed4c
2,652
[ 151253194 ]
[]
%{"certifi": {:hex, :certifi, "1.2.1", "c3904f192bd5284e5b13f20db3ceac9626e14eeacfbb492e19583cf0e37b22be", [:rebar3], []}, "exactor": {:hex, :exactor, "2.2.3", "a6972f43bb6160afeb73e1d8ab45ba604cd0ac8b5244c557093f6e92ce582786", [:mix], []}, "exjsx": {:hex, :exjsx, "3.2.1", "1bc5bf1e4fd249104178f0885030bcd75a4526f4d...
014129ae2c4722f7f50c7440bc37b0562fa3439f
6,861
[ 373050552, 332750859 ]
[]
defmodule AxonTestUtil do import Nx.Defn def test_compiler do use_exla? = System.get_env("USE_EXLA") if use_exla?, do: EXLA, else: Nx.Defn.Evaluator end def test_backend do cond do System.get_env("USE_TORCHX") -> Torchx.Backend System.get_env("USE_EXLA") -> EXLA.Backend true -> N...
01412f9bc584a396415d5f00e9b2acc4284d32bf
2,225
[ 165037321 ]
[ "test" ]
defmodule MecksUnit.PreserveTest do use ExUnit.Case, async: true use MecksUnit.Case defmock Foo do def bar, do: "what?!?" end defmock Foo.Bar.Baz, preserve: true do def qux(_string), do: "MOCKED :)" end mocked_test "mocked number 1" do assert "what?!?" = Foo.bar() assert "MOCKED :)" = F...
0141be4bdfcdd992037f67d7574cb0d34cbff3ef
4,686
[ 91598458 ]
[ "phoenix" ]
defmodule HelloPhoenix.Players do alias HelloPhoenix.Player, as: Player @width 1000 @height 700 @bomb_distance 100 @bomb_duration 10 def start_link() do Agent.start_link(fn -> %{players: [], bomb: nil,time: ""} end,name: __MODULE__) Task.start fn -> spawn_bomb() end end def new_player(player) ...
0141dc0d8110a34531e9152ae0865de872e327e7
2,497
[ 344280000 ]
[ "typespec", "documented", "ecto" ]
defmodule LiveView.Studio.Stores do @moduledoc """ The Stores context. """ import Ecto.Query, warn: false alias LiveView.Studio.Repo alias LiveView.Studio.Stores.Store @typedoc "Store" @type store :: %Store{} @typedoc "Zip code" @type zip :: String.t() @typedoc "City" @type city :: String.t()...
014205eb67dc6665751c06337e48ee17afb95aaf
16,047
[ 994404603 ]
[ "documented" ]
defmodule WandererKillsWeb.PageHTML do @moduledoc """ HTML generation module for the dashboard page. Contains functions for rendering the dashboard HTML with proper separation of concerns from the controller logic. """ alias WandererKills.Utils @doc """ Generates the complete HTML for the dashboard i...
014258749b25fe4bc495a19bbf9607e3fe788dd2
5,277
[ 97516940 ]
[ "test" ]
defmodule Shen.TokenizerTest do use ExUnit.Case alias Shen.Tokenizer setup do {:ok, _} = Agent.start_link(fn -> [] end, name: :buffer) :ok end describe "whitespace" do test "is ignored between tokens" do io_string = open_io_string(" \n\r (\"foo\" \"bar\"\t) \n") assert Tokenizer.n...
0142dc6fc3d77187f289af751fbd9b01ae0ae250
4,666
[ 433747443 ]
[ "typespec", "documented" ]
defmodule Aoc2021.Day16 do @moduledoc """ See https://adventofcode.com/2021/day/16 """ alias Aoc2021.Day16.Packet @type operator() :: :literal | :sum | :prod | :min | :max | :gt | :lt | :eq defmodule Packet do @moduledoc false alias Aoc2021.Day16 defstruct [:version, :type, :value] @ty...
0142ef24eaee73064995abf70a56f28cba8dd4ec
6,787
[ 455144231 ]
[ "liveview", "ecto" ]
defmodule HexaWeb.ProfileLive.UploadFormComponent do use HexaWeb, :live_component alias Hexa.{MediaLibrary, MP3Stat} alias HexaWeb.ProfileLive.SongEntryComponent @max_songs 10 @impl true def update(%{action: {:duration, entry_ref, result}}, socket) do case result do {:ok, %MP3Stat{} = stat} -> ...
01430d18a0823fbd8af3e6d06ec1baaf9a47d37e
4,887
[ 66467062, 87683657, 99106424, 87457687, 207847106, 297237670, 77253880, 86030418, 95605888, 123950289, 77785313, 86063602, 70405590, 72784914, 96857265, 71519558, 73516692, 80629259, 86415043, 133864047, 145635147, 242077992, 17908039, 68463570, 80284638, 85355617, ...
[ "phoenix", "documented" ]
defmodule Phoenix.Router.Scope do alias Phoenix.Router.Scope @moduledoc false @stack :phoenix_router_scopes @pipes :phoenix_pipeline_scopes defstruct path: nil, alias: nil, as: nil, pipes: [], host: nil, private: %{}, assigns: %{} @doc """ Initializes the scope. """ def init(module) do Module.p...
014341e386750aef93cf7d159222030a0064c48f
2,099
[ 144485838 ]
[ "typespec", "documented" ]
defmodule PBCS do @moduledoc ~S""" PKCS #5: Password-Based Cryptography Specification Version 2.0. See: https://tools.ietf.org/html/rfc2898 """ alias PBCS.Utils alias PBCS.ContentEncryptor alias PBCS.KeyManager @type tag :: binary @type plain_text :: binary @type cipher_text :: binary @type pro...