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
0180d65588696feb586a6be757ec704905519f16
2,150
[ 809186626 ]
[ "documented", "ecto" ]
defmodule LsmFoodReloaded.BusinessHours do @moduledoc """ The BusinessHours context. """ import Ecto.Query, warn: false alias LsmFoodReloaded.Repo alias LsmFoodReloaded.BusinessHours.BusinessHour @doc """ Returns the list of business_hours. ## Examples iex> list_business_hours() [%Bus...
01811605c0fecac18e7db6efa2702265c7016100
2,022
[ 345322913 ]
[ "typespec" ]
defmodule ListOps do # Please don't use any external modules (especially List or Enum) in your # implementation. The point of this exercise is to create these basic # functions yourself. You may use basic Kernel functions (like `Kernel.+/2` # for adding numbers), but please do not use Kernel functions for Lists...
01817c905bf8d66c4aed4c4312205cd896585762
2,096
[ 121729706 ]
[ "typespec" ]
defmodule Aspect.Lexer do alias Aspect.Lexer, as: Lexer @opaque t :: %Lexer{} defstruct [:words] def parse_token(%Lexer{words: [w | ws]} = lexer) do {%Lexer{lexer | words: ws}, w} end @spec remaining_words(t()) :: Aspect.Compiler.AST.t() def remaining_words(%Lexer{words: words}), do: words @spe...
0181d275dff6d9220b4ad9759485a9ed91cf1424
1,690
[ 367908738 ]
[ "liveview", "phoenix" ]
defmodule AnonymousChatWeb.Endpoint do use Phoenix.Endpoint, otp_app: :anonymous_chat # The session will be stored in the cookie and signed, # this means its contents can be read but not tampered with. # Set :encryption_salt if you would also like to encrypt it. @session_options [ store: :cookie, key...
0181e168cf1a03708b63471c85268d414bce4fc7
3,008
[ 191315971 ]
[ "test" ]
defmodule SchoolWeb.AnnouncementControllerTest do use SchoolWeb.ConnCase alias School.Affairs @create_attrs %{message: "some message"} @update_attrs %{message: "some updated message"} @invalid_attrs %{message: nil} def fixture(:announcement) do {:ok, announcement} = Affairs.create_announcement(@creat...
0182360903ca02b4ea278c81b1e0942b4629a2f4
4,041
[ 190667844, 171961091 ]
[ "phoenix", "ecto" ]
defmodule ArtemisWeb.WikiPageController do use ArtemisWeb, :controller use ArtemisWeb.Controller.CommentsShow, path: &Routes.wiki_page_path/3, permission: "wiki-pages:show", resource_getter: &Artemis.GetWikiPage.call!/2, resource_id_key: "wiki_page_id", resource_type: "WikiPage" alias Artemi...
018296853df8bdba188238e253523a969b2a3794
1,741
[ 674654866 ]
[ "documented" ]
defmodule Tester.ScanfortransportsFixtures do @moduledoc """ This module defines test helpers for creating entities via the `Tester.Scanfortransports` context. """ @doc """ Generate a scanfortransport. """ def scanfortransport_fixture(attrs \\ %{}) do {:ok, scanfortransport} = attrs |> ...
0182d2a2526c2d09fbb95152bdb6e09f17061e2f
1,930
[ 155122330 ]
[ "genserver", "liveview", "documented" ]
defmodule DashboardWeb.IndexLive do @moduledoc false use Phoenix.LiveView @refresh_delay 1_000 @weather_refresh_delay 1_800_000 @menu_refresh_delay 1_800_000 require Logger def render(assigns) do Phoenix.View.render(DashboardWeb.PageView, "index_live.html", assigns) end def mount(_params, sess...
01839873bcf9d78c1cd6cb8d51cec4e77c650ba5
4,886
[ 135832997 ]
[ "liveview" ]
defmodule Data.Article.Static.Freizeitroute13 do use Article.Static def id(), do: "FR13" def route_group(), do: :freizeit def title(), do: "Radweg „Dritte Meile“ (FR13)" def color(), do: RouteColors.freizeit_normal() def color_faded(), do: RouteColors.freizeit_faded() def summary(), do: "Video und ...
0183f2bf8ad32f7ed3dab7f8efd8c461c3b28fe9
2,346
[ 581479339 ]
[ "typespec" ]
defmodule Derive do #Define types and expressions @type literal() :: {:num, number()} | {:var, atom()} @type expr() :: {:add, expr(), expr()} |{:mul, expr(), expr()} | literal() def test() do e = {:add, {:mul,{:num,2},{:var,:x}},{:num,4}} #{:pow,{:var, :x},{:num, 3}} d = deriv(e, ...
01846540ab6d2a493d0ac17ca5f6a3cb84440e9e
1,837
[ 969999971 ]
[ "documented" ]
defmodule DeeperHub.Core.Data.Migrations.BxAdsScores do @moduledoc """ Migration para criar e remover a tabela bx_ads_scores. """ alias DeeperHub.Core.Data.Repo alias DeeperHub.Core.Logger require DeeperHub.Core.Logger @doc """ Cria a tabela de bx_ads_scores. """ def up do Logger.info("Criando...
01848869b2590d29753815fa989798b144ec13b5
6,171
[ 942276709 ]
[ "test" ]
defmodule Funx.Monad.Effect.ContextTest do use ExUnit.Case, async: true doctest Funx.Monad.Effect.Context alias Funx.Monad.Effect describe "new/1" do test "generates a trace_id when none is provided" do context = Effect.Context.new() assert is_binary(context.trace_id) assert byte_size(co...
018515e7b079223f899c935204481c513473f6fd
4,741
[ 981784524, 1011444481, 44419624, 765390321 ]
[ "typespec", "documented" ]
defmodule Absinthe.Phase.Schema.ApplyDeclaration do @moduledoc false use Absinthe.Phase alias Absinthe.Blueprint @type operation :: :query | :mutation | :subscription @type root_mappings :: %{operation() => Blueprint.TypeReference.Name.t()} def run(blueprint, _opts) do blueprint = process(blueprint)...
018542a743cd4e911423d3b5aa440cceb63b38dc
4,543
[ 326412832 ]
[]
%{ "certifi": {:hex, :certifi, "2.5.3", "70bdd7e7188c804f3a30ee0e7c99655bc35d8ac41c23e12325f36ab449b70651", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "ed516acb3929b101208a9d700062d520f3953da3b6b918d866106ffa980e1c10"}, "earmark": {:hex, :earmark, "1.4.13", "...
018596a8cefef0ed9383832e694b03fdbc92956d
1,974
[ 403822924 ]
[ "macro", "test", "documented" ]
defmodule ElixirIcWeb.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 t...
01859ed28015f477b4c2127ec7077b66b1fe0472
1,505
[ 929981060 ]
[]
defmodule LandingPage.SpeciesAPI do @api_url "https://api.api-ninjas.com/v1/animals" @api_key "kdLqdPfZ5DJH76HajCSV3w==D23GMtSxpqIThEhH" def search_endangered_species(offset \\ 0, limit \\ 6) do # Liste de termes courants pour obtenir un maximum d'animaux search_terms = ["mammal", "bird", "reptile", "amp...
0185a82344180f37322c0638db3c85752e9e34cd
2,686
[ 965334823 ]
[ "test" ]
defmodule ManagementApi.Orders.OrderTest do use ManagementApi.DataCase alias ManagementApi.Orders.Order alias ManagementApi.Users.UserRepository alias ManagementApi.Products.ProductRepository setup do # Cria usuário {:ok, user} = UserRepository.register_user(%{ "email" => "<EMAIL>", ...
0185b83ddc75adc17333918e9ea7f9442acc0bbd
2,732
[ 278949943 ]
[ "test", "phoenix" ]
defmodule PhoenixAdventureworksWeb.PersonControllerTest do use PhoenixAdventureworksWeb.ConnCase alias PhoenixAdventureworks.Listings @create_attrs %{} @update_attrs %{} @invalid_attrs %{} def fixture(:person) do {:ok, person} = Listings.create_person(@create_attrs) person end describe "inde...
0185e2e636f871f3977e16d13fb75911f9b8dec2
1,532
[ 51613678 ]
[]
{:ok, cache} = Todo.Cache.start Todo.Cache.server_process(cache, "Bob's list") Todo.Cache.server_process(cache, "Bob's list") alice_list = Todo.Cache.server_process(cache, "Alice's list") charlie_list = Todo.Cache.server_process(cache, "Charlie's list") bobs_list = Todo.Cache.server_process(cache, "Bob's list") Tod...
0185eb542d8e6f5e3a996459f9750ecc5c563b37
8,581
[ 172567605 ]
[ "typespec", "documented", "ecto" ]
defmodule FinancialSystem.Core.FinHelper do @moduledoc """ This module is responsable to help other modules with the financial operations. """ alias FinancialSystem.Core.{ Accounts.Account, Accounts.AccountRepository, Currency, Split } @doc """ Verify if the account have funds for the op...
0186b261177ca74f9c1b2ce07da22c7e94c02653
6,305
[ 897718743 ]
[]
defmodule GardenGroups do def at2(_, i, _) when i < 0, do: :xoverflow def at2(_, _, j) when j < 0, do: :yoverflow def at2(input, i, j) do case y = Enum.at(input, j, :yoverflow) do :yoverflow -> :yoverflow _ -> Enum.at(y, i, :xoverflow) end end def at2(input, {i, j}), do: at2(input, i, j)...
018796df2bdfefdf07722ebb4f6de9aecd5929ac
1,879
[ 896813990 ]
[]
defmodule Day24 do def find_the_answer_p1() do "data/day_24.txt" |> read_the_input() |> parse() |> play_the_game_p1() end def play_the_game_p1(input) do activate(input) |> Enum.filter(fn {k, _v} -> String.starts_with?(k, "z") end) |> Enum.sort_by(fn {k, _v} -> k end, :desc) |> Enu...
0187b07ed4aedd928d79408b79a56a9eee1765de
5,028
[ 450742124 ]
[ "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 plug AppWeb.Authenticator end pipelin...
018825fef0afdc9b2438454c4ce71ec55f069c80
1,734
[ 711695115 ]
[ "documented" ]
defmodule BankApiWeb.UserJSON do alias BankApi.Account.User @doc """ Renders a list of users. """ def index(%{users: users}) do %{data: for(user <- users, do: data(user))} end @doc """ Renders a single user. """ def show(%{user: user}) do %{data: data(user)} end def show_transactions(...
01883d57f097173f0abaf96fc3e0ea44895f50c7
2,112
[ 236191702 ]
[ "ecto" ]
defmodule Mppm.Repo.Migrations.CreateGameRulesTable do use Ecto.Migration def change do create table(:game_rules, primary_key: false) do add :server_id, references(:servers, on_delete: :delete_all), primary_key: true add :mode_id, references(:game_modes) ### Time Attack add :ta_respawn...
01884c6dd49ab0f4c867ecb18460e762c9bf69e4
3,322
[ 932521447 ]
[ "documented" ]
defmodule Outerfaces do @moduledoc """ Outerfaces - Portable, Dynamic Web Applications. This 'Outerfaces' core Elixir library contains helper modules for working with "client-side" applications that live within a Phoenix web application, and are served dynamically with the application at runtime by individua...
01887d188ed77331b744f7e0b8fc0f328d238d55
2,034
[ 435195036 ]
[]
lines = File.read!("day10.txt") |> String.split("\n") defmodule SyntaxScoring do @scores %{ ")" => 3, "]" => 57, "}" => 1197, ">" => 25137 } @incomplete_scores %{ ")" => 1, "]" => 2, "}" => 3, ">" => 4 } @map %{ ")" => "(", "]" => "[", "}" => "{", ">" => "<" ...
0188d02a560dd38a70b805be9ee2b9f67ea15d23
1,529
[ 208260462 ]
[ "test" ]
defmodule ContyTest do use ExUnit.Case import TestHelper alias Conty.{Entry} setup_all do {:ok, account} = Conty.create_account(%{name: "Test Account"}) [account: account] end test "unbalanced Entry is invalid", context do changeset = %Entry{} |> Entry.changeset(%{ date: ...
0188fa0753f05c08bf0b3e80885fe2c856aad793
3,359
[ 790608551, 428103901, 834909069 ]
[ "typespec", "documented" ]
defmodule Solana.SPL.Token.MultiSig do @moduledoc """ Functions for dealing with multi-signature accounts. Multi-signature accounts can used in place of any single owner/delegate accounts in any token instruction that require an owner/delegate to be present. """ alias Solana.{Instruction, Account, SPL.T...
01891adab3109f0fbfe3be69ffb99372bde4ba6d
1,577
[ 383340007 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Compute.V1.Model.FirewallPolicyRuleMatcher do @moduledoc """ Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. ## Attributes * `destIpRanges` (*type:* `list(String.t)`, *default:* `nil`) - CIDR IP address range. Maximum number o...
018940da63db8cc13bac2ddeafb5dfc1cfc17987
1,709
[ 329067740 ]
[ "test" ]
defmodule RumblWeb.Channels.VideoChannelTest do use RumblWeb.ChannelCase import RumblWeb.TestHelpers setup do user = insert_user(name: "Gary") video = insert_video(user, title: "Testing") token = Phoenix.Token.sign(@endpoint, "user socket", user.id) {:ok, socket} = ...
0189bb10c76f4ff574c3a30ca0f25a0748bb6d5b
5,174
[ 309664950 ]
[ "typespec", "documented" ]
defmodule Tapper do @moduledoc """ The high-level client API for Tapper. ## Example ``` # start new trace (and span) id = Tapper.start(name: "main", type: :client, debug: true, annotations: Tapper.tag("a", "b")) # or join an existing one # id = Trapper.join(trace_id, span_id, parent_id, sample, debug,...
018a374469fc14dae0bd1c3355f9c7f7d38095c7
14,326
[ 211344977 ]
[ "test" ]
defmodule Elias.ParserTest do use ExUnit.Case alias Elias.Parser describe "the basics" do test "simple section" do string = """ rooms "town_square" { name = "Town's Square" } """ {:ok, ast} = Parser.parse(string) assert ast == [ {:section, [string...
018abf9bdad595350fb471d2e4b0778dc0f95d94
4,626
[ 1009867727 ]
[ "test" ]
defmodule ElixirGatewayWeb.Plugs.DomainRouterTest do use ExUnit.Case, async: true import Plug.Test import Plug.Conn alias ElixirGatewayWeb.Plugs.DomainRouter describe "domain routing" do setup do # Set up test configuration original_config = Application.get_env(:elixirgateway, :gateway) ...
018bcb501e32069ed845d6e2c35e166093bca4dd
2,929
[ 200765224 ]
[ "typespec" ]
defmodule Blockchain.Blockchain do use Agent alias Blockchain.Record alias Blockchain.Block @spec start_link(List) :: :ok def start_link(_opts) do Agent.start_link(fn -> [] end, name: __MODULE__) end @spec get_blockchain() :: {:ok, [Block]} | {:error, :empty} def get_blockchain() do blockchai...
018bd027035a67b4f8c901bdb38f21ba47cdad1c
4,423
[ 206417, 576680349, 524421812, 397989039, 39005786, 585631074, 118678239, 564330558, 804192353 ]
[ "test", "documented" ]
defmodule RecreateDocTest do use CouchTestCase @moduletag :recreate_doc @moduledoc """ Test CouchDB document recreation This is a port of the recreate_doc.js suite """ @tag :with_db test "recreate document", context do db_name = context[:db_name] # First create a new document with the ID "fo...
018bd4d3bc8e3bef1d9a43ba3ee5b2bf7e184a48
8,403
[ 919065026 ]
[ "typespec", "supervisor", "documented", "ecto" ]
defmodule Durandal.Game.UniverseLib do @moduledoc """ Library of universe related functions. """ use DurandalMacros, :library alias Durandal.Game.{Universe, UniverseQueries} @spec global_topic() :: String.t() def global_topic(), do: "Durandal.Global.Universe" @spec topic(Durandal.universe_id()) :: Str...
018c59f817511476e723ec9c356cba1c0a3d3daf
2,351
[ 900038510 ]
[ "test", "phoenix" ]
defmodule GithubElixirServiceWeb.Controllers.WebhookControllerTest do use GithubElixirServiceWeb.ConnCase, async: true alias GithubElixirService.Repo describe "fetch_data_issues/2" do test "successfully schedules a job", %{conn: conn} do Mox.expect(GithubElixirService.MockHttpClient, :get, fn ...
018d49d9c39f75a577fd8708e47a8b4ad7cc81f4
3,342
[ 760325476 ]
[ "typespec", "documented" ]
defmodule ArticleCompiler.MarkdownModifier do @moduledoc """ This module provides functions to add, remove, and load YAML front matter from a markdown file. """ def save_yaml_front_matter(file_path, metadata) do if has_yaml_front_matter_from_file?(file_path) do remove_yaml_front_matter(file_path) ...
018d4b9725cfacbb7fcf43e2194dfd3e6a45aad0
3,799
[ 305091318 ]
[ "phoenix", "ecto" ]
defmodule RiddlerAdminWeb.PublishRequestController do use RiddlerAdminWeb, :controller alias RiddlerAdmin.Definitions alias RiddlerAdmin.Environments alias RiddlerAdmin.PublishRequests alias RiddlerAdmin.PublishRequests.PublishRequest def index(conn, %{"workspace_id" => workspace_id}) do publish_reque...
018d785f9a3ae4c8a15ed1948b6c8640aee471c7
1,589
[ 118131028 ]
[ "macro", "documented", "phoenix" ]
defmodule PokkenWeb 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 PokkenWeb, :controller use PokkenWeb, :view The definitions below will be executed for every view, controller, etc...
018dd3bbc0dc7a37a2788194993782911cbeb57e
4,870
[ 445685360 ]
[ "genserver", "documented" ]
defmodule Superwatch.Svc.Watcher do use GenServer defstruct [:pid, :dirs, :ftypes, :filter, :tripwire] @debounce_timeout 250 @proc_name :monitor_proc alias Superwatch.Svc.Watcher alias Superwatch.Svc.Worker @moduledoc """ Watcher - file watcher and command runner Struct: - pid - the w...
018ddb6f973b9c2d2568b2ec434e6ae57fe4131b
11,375
[ 172625290 ]
[]
%{ "certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"}, "connection": {:hex, :connection, "1.0....
018f5d68394119c6b934b2010c14a80b3d5e0668
2,603
[ 127430141, 863118743, 887750784, 863118926 ]
[]
import Config # For production, we often load configuration from external # sources, such as your system environment. For this reason, # you won't find the :http configuration below, but set inside # Astarte.RealmManagement.APIWeb.Endpoint.load_from_system_env/1 dynamically. # Any dynamic configuration should be moved...
018faaf12c5c168530b01e8a12b6d236898fcf1a
2,163
[ 131115152 ]
[ "test" ]
defmodule WerewolfApiWeb.ConversationChannelTest do use WerewolfApiWeb.ChannelCase import WerewolfApi.Factory import WerewolfApi.Guardian alias WerewolfApi.Repo alias WerewolfApi.Conversation.Message setup do user = insert(:user) conversation = insert(:conversation) users_conversation = ...
018ff66d150d09c2d915e072f9105720427501bb
1,679
[ 122517743 ]
[ "genserver", "documented" ]
defmodule Hammoc.Retriever do @moduledoc "Retrieves Tweets from the Twitter API." use GenServer alias Hammoc.Retriever.Status @search Application.get_env(:hammoc, Hammoc.Search)[:module] @client Application.get_env(:hammoc, Hammoc.Retriever)[:client_module] def start_link(_args) do GenServer.start_l...
0190486f1b5ef6a634936919bebed3b996e887a9
3,771
[ 159980217 ]
[]
defmodule ElfCode do use Bitwise def build_instructions(filename) do [{:"#ip", ip}|instructions] = File.stream!(filename) |> Stream.map(&(build_instruction(&1))) |> Enum.to_list() instruction_map = instructions |> Enum.with_index(0) |> Enum.map(fn {k,v}->{v,k} end) |> Map.new {ip, instructi...
019081bf847253a959d82833fd0faa0720193c36
3,127
[ 196200304, 211097139, 125843928, 19643959, 180274417 ]
[ "test" ]
defmodule Logger.ErrorHandlerTest do use Logger.Case @moduletag :error_logger test "add_translator/1 and remove_translator/1" do defmodule CustomTranslator do def t(:debug, :info, :format, {'hello: ~p', [:ok]}) do :skip end def t(:debug, :info, :format, {'world: ~p', [:ok]}) do ...
0190828cc6a2ef197ed89b1f39c142f6e66425ae
5,642
[ 189605397, 1005862559 ]
[ "genserver", "documented" ]
defmodule VintageNetWizard.Backend.Default do @moduledoc """ The default backend implementation for target devices This backend will be used if no other backend is configured in the application configuration. """ @behaviour VintageNetWizard.Backend alias VintageNetWizard.{APMode, WiFiConfiguration} @...
01909bd201d5b5742702e8bec67cf248065b8fee
1,846
[ 498588143 ]
[ "documented" ]
defmodule BuildkiteTestCollector.MixProject do use Mix.Project @moduledoc false @version "0.3.1" def version, do: @version @collector_name :buildkite_test_collector def collector_name, do: "elixir-#{@collector_name}" def project do [ app: @collector_name, description: "Official Buildkit...
0190da0498e5b0f0f3a2fa55cbf518e5e8c49637
1,801
[ 160021547 ]
[ "documented", "ecto" ]
defmodule Mercury.Main do @moduledoc """ The Main context. """ import Ecto.Query, warn: false alias Mercury.Repo alias Mercury.Main.Project @doc """ Returns the list of projects. ## Examples iex> list_projects() [%Project{}, ...] """ def list_projects do Repo.all(Project) e...
0190dfd9f6ea002bdf7b25b34924c7edfaaa9db3
1,508
[ 275466745, 657799110, 43247111, 679652486, 343276976 ]
[ "test" ]
defmodule Credo.Check.Consistency.MultiAliasImportRequireUse.CollectorTest do use Credo.Test.Case alias Credo.Check.Consistency.MultiAliasImportRequireUse.Collector @single """ defmodule Credo.Sample1 do alias Foo.Bar import Foo.Bar alias Foo.Baz # this and the first line counts as 1 import Fo...
01917bb42bc5c5c8461a5d50175ae431bd387bbe
7,487
[ 669564794 ]
[]
%{ "cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd...
019194f82e703df7e79922db28f0acafa0398d7f
3,154
[ 270842782 ]
[ "documented" ]
defmodule UserDocs.JobsFixtures do @moduledoc false alias UserDocs.Jobs alias UserDocs.StepInstances alias UserDocs.ProcessInstances alias UserDocs.JobInstances def step_instance(step_id \\ nil, job_id \\ nil, process_instance_id \\ nil) do {:ok, step_instance } = step_instance_attrs(:valid, ste...
019272281517f640390add88878da939869146b4
6,024
[ 346114697 ]
[ "test" ]
defmodule OzfariumWeb.Live.Gallery.PaginationTest do use Ozfarium.DataCase alias OzfariumWeb.Live.Gallery.Pagination describe "#show_pages default width 4" do test "render one page" do assert Pagination.show_pages(1, 1) == [1] end test "render 5 pages" do assert Pagination.show_pages(5,...
01929a7d8b2950aba792bd53e612e7f747230733
4,030
[ 168637688, 190667844, 171961091 ]
[]
defmodule ArtemisWeb.GetUserByAuthProviderData do require Logger alias Artemis.CreateAuthProvider alias Artemis.CreateUser alias Artemis.GetSystemUser alias Artemis.GetAuthProvider alias Artemis.GetRole alias Artemis.GetUser alias Artemis.UpdateAuthProvider alias Artemis.UpdateUser @default_role "...
0193e333c6895ad14d9f2c4f1636efb1736e252e
2,320
[ 158100912 ]
[ "typespec" ]
defmodule Solution do # 318ms - 340ms @spec merge_arrays(nums1 :: [[integer]], nums2 :: [[integer]]) :: [[integer]] def merge_arrays(nums1, nums2) do merge_arrays(nums1, nums2, 0, 0, []) end @spec merge_arrays(nums1 :: [[integer]], nums2 :: [[integer]], i :: integer, j :: integer, res :: [[integer]]) :: ...
0193faa8911219bdede84a203c1c9896c113d690
2,026
[ 498776552 ]
[ "test" ]
defmodule WandaWeb.V1.CatalogJSONTest do use WandaWeb.ConnCase, async: true import Wanda.Factory alias WandaWeb.V1.CatalogJSON describe "CatalogJSON" do test "renders catalog.json" do checks = [ build(:check, expectations: build_list(2, :catalog_expectation, type: :expect)), build(:...
0194406f34c1417c3b9442f80cf1ed7cee5a3c77
1,543
[ 818720874 ]
[ "test" ]
defmodule TableFormatterTest do # bring in the test functionality use ExUnit.Case # And allow us to capture stuff sent to stdout import ExUnit.CaptureIO alias IssueFetcher.TableFormatter, as: TF @simple_test_data [ [c1: "r1 c1", c2: "r1 c2", c3: "r1 c3", c4: "r1+++c4"], [c1: "r2 c1", c2: "r2 c2", c...
0194564f46d7b234e038cb439c0a60016c49d03e
11,171
[ 63497734 ]
[ "typespec", "documented" ]
defmodule CodeCorps.Factories do @moduledoc false # with Ecto use ExMachina.Ecto, repo: CodeCorps.Repo def category_factory do %CodeCorps.Category{ name: sequence(:name, &"Category #{&1}"), slug: sequence(:slug, &"category-#{&1}"), description: sequence(:description, &"A description for ...
019462f71abae86c1cdb2de328bafa309a2fdc84
1,542
[ 795126868 ]
[ "liveview" ]
defmodule ElixirGistWeb.UsersConfirmationInstructionsLive do use ElixirGistWeb, :live_view alias ElixirGist.Accounts def render(assigns) do ~H""" <div class="mx-auto max-w-sm"> <.header class="text-center"> No confirmation instructions received? <:subtitle>We'll send a new confirma...
0194ccc06dd8c39c66f7a9d20d58c60a56cae37d
3,607
[ 44166271 ]
[]
defmodule AsyncAck.Handler do def start_link(ref, socket, transport, opts) do pid = spawn_link(__MODULE__, :init, [ref, socket, transport, opts]) {:ok, pid} end def init(ref, socket, transport, _Opts = []) do :ok = :ranch.accept_ack(ref) transport.setopts(socket, [nodelay: :true]) responder_...
0194d092cfa5a43abed8cf65a0edcff9e6fb2b71
2,173
[ 225366221 ]
[]
defmodule AdventOfCode.Day11 do import AdventOfCode.Utils alias AdventOfCode.Day05, as: IntCode defmodule State do defstruct pos: {0, 0}, dir: :up, image: %{}, painted: 0 end def move({x, y}, dir) do case dir do :up -> {x, y - 1} :down -> {x, y + 1} :left -> {x - 1, y} :right...
01954ee8887898bfb73b4e419f1804b8a28b7f26
1,904
[ 592336262 ]
[ "macro", "documented", "phoenix" ]
defmodule SolutionWeb 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 SolutionWeb, :controller use SolutionWeb, :view The definitions below will be executed for every view, controlle...
01956278a97c7d0bfcb0572e68fe5c057d129693
2,646
[ 367278931 ]
[ "documented" ]
defmodule Google.Ads.Googleads.V18.Services.MutateCampaignBidModifiersRequest do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :customer_id, 1, type: :string, json_name: "customerId", deprecated: false field :operations, 2, repeated: true, type: Google.Ads....
01957523b082b14c272742fb37d3e24422b5a2c3
6,469
[ 19658570 ]
[ "typespec", "documented" ]
defmodule Conform.Utils do @moduledoc false @doc """ Recursively merges two keyword lists. Values themselves are also merged (depending on type), such that the resulting keyword list is a true merge of the second keyword list over the first. ## Examples iex> old = [one: [one_sub: [a: 1, b: 2]], two: ...
019647a71d4e867ce34b260e0051f46e2956ad28
3,436
[ 957363940 ]
[ "liveview", "test" ]
defmodule RoomlyWeb.RoomLiveTest do use RoomlyWeb.ConnCase import Phoenix.LiveViewTest import Roomly.OrchestratorFixtures import Roomly.AccountsFixtures @create_attrs %{name: "some name", description: "some description"} @update_attrs %{name: "some updated name", description: "some updated description"} ...
0196ab4f0d244295459bf125b155c3f587043233
2,182
[ 436940871 ]
[ "documented", "ecto" ]
defmodule Mehungry.Meta do @moduledoc """ The Meta context. """ import Ecto.Query, warn: false alias Mehungry.Repo alias Mehungry.Meta.Visit @doc """ Returns the list of visits. ## Examples iex> list_visits() [%Visit{}, ...] """ def list_visits do from(vi in Visit, orde...
0196e43219d6b83937aa5fd14a7a9490ca0b4fe4
4,069
[ 598050696, 616127556, 651606171, 612868361 ]
[ "genserver", "documented" ]
defmodule Ockam.Transport.TCP.RecoverableClient do @moduledoc """ TCP client wrapper to recover connections. Creates and monitors Ockam.Transport.TCP.CLient If client stops, it's restarted after `refresh_timeout` Options: `desination` - Ockam.Transport.TCPAddress or {host, port} tuple to connect to `re...
0196fad5935ce9f9821c978a1199e80d18f3d703
13,174
[ 807489394 ]
[ "typespec", "documented" ]
defmodule LixLox.Parser do @moduledoc """ Lox parser """ @type literal :: number() | String.t() | boolean() | nil @type ast :: {:literal, literal()} | {:identifier, atom()} | {:define, atom(), ast()} | {:assign, atom(), ast()} | {:block, list(ast())} ...
019744d51830966c04eeb56a1aa25e2c2b5bf4f0
1,809
[ 273983840 ]
[]
# In this file, we load production configuration and secrets # from environment variables. You can also hardcode secrets, # although such is generally not recommended and you have to # remember to add this file to your .gitignore. import Config database_url = System.get_env("DATABASE_URL") || raise """ envir...
0197609f178940928c8e67c235407c28406532c6
4,364
[ 831995252 ]
[ "typespec", "macro", "documented" ]
defmodule ColouredFlow.Runner.Enactment.Workitem do @moduledoc """ The workitem in the coloured_flow runner. """ use TypedStructor @type id() :: Ecto.UUID.t() @transitions [ # normal {:enabled, :start, :started}, {:started, :complete, :completed}, {:enabled, :complete_e, :completed}, ...
019787c428f84369d277075c51f991672d770e88
3,998
[ 56316387 ]
[ "test" ]
defmodule Readability.TitleFinderTest do use ExUnit.Case, async: true doctest Readability.TitleFinder @html """ <html> <head> <title>Tag title - test</title> <meta property='og:title' content='og title'> </head> <body> <p> <h1>h1 title</h1> <h2>h2 title</h2> ...
01979db4faa66fe7692df5dd05146067885539f4
4,723
[ 940751031 ]
[]
defmodule Mix.Tasks.Mandate.Gen.MixTask do use Mandate, as: :igniter_task example "mix mandate.gen.mix_task my_app.my_task --example arg" shortdoc "Generate a mix task for your application" longdoc """ Genetares a mix task for your application """ argument :task_name do doc "Task name. Example: `m...
01982e6f56b480db258b9b201ffaf96fb6d72214
4,026
[ 884535618 ]
[ "liveview" ]
defmodule ElixirAdvancedWeb.Components.Navbar do use Phoenix.Component use Phoenix.VerifiedRoutes, endpoint: ElixirAdvancedWeb.Endpoint, router: ElixirAdvancedWeb.Router import Phoenix.Component alias Phoenix.LiveView.JS attr :current_user, :map, required: true def navbar(assigns) do ~H""" ...
0198317101f3facaab3f8957a99100219f9823f7
1,708
[ 397485555 ]
[ "typespec" ]
defmodule Lox.Token do @type token_type :: :left_paren | :right_paren | :left_brace | :right_brace | :comma | :dot | :minus | :plus | :semicolon | :slash | :star | :eof # One or two chara...
01988f5e229c4b768c7f6ea877855d7f2950de3b
1,507
[ 312085174 ]
[ "test", "phoenix" ]
defmodule HelloSocketsWeb.WildcardChannelTest do use HelloSocketsWeb.ChannelCase import ExUnit.CaptureLog alias HelloSocketsWeb.UserSocket describe "join/3 success" do test "ok when numbers in the format a:b where b = 2a" do assert {:ok, _, %Phoenix.Socket{}} = socket(UserSocket, nil, %{}) ...
0198b71713ee0fd8ceae9c28c53f9600cc252515
8,518
[ 159929788 ]
[]
defmodule Day15 do defmodule Elf do defstruct position: {-1, -1}, initial_position: {-1, -1}, type: :elf, health: 200, # 34 found manually for part2 attack_value: 3 end defmodule Gremlin do defstruct position: {-1, -1}, i...
0199cc6956888cb57840bc8feff9e6865cc08d8a
2,615
[ 765952288 ]
[ "phoenix" ]
defmodule FortuneWeb.Router do use FortuneWeb, :router import FortuneWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {FortuneWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers ...
019a08ea61b521007c2151ae338578149a22773a
4,982
[ 927234821, 492752264, 327711808, 554455380 ]
[ "liveview" ]
defmodule LivebookWeb.Output.AudioInputComponent do use LivebookWeb, :live_component @impl true def mount(socket) do {:ok, socket |> assign( endianness: System.endianness(), value: nil, audio_url: nil, decoding?: false ) |> allow_upload(:file, accept: :a...
019a5c9fa53c93234b02f69302709e037d233190
3,714
[ 659949427 ]
[ "test", "phoenix" ]
defmodule WellnessPulseWeb.UserConfirmationControllerTest do use WellnessPulseWeb.ConnCase, async: true alias WellnessPulse.Accounts alias WellnessPulse.Repo import WellnessPulse.AccountsFixtures setup do %{user: user_fixture()} end describe "GET /users/confirm" do test "renders the resend conf...
019a616f55522ac5d6038af7c956adebf10aa324
4,333
[ 829716858 ]
[ "liveview", "test" ]
defmodule SbCascadeWeb.ComicLiveTest do use SbCascadeWeb.ConnCase import Phoenix.LiveViewTest import SbCascade.ContentFixtures import SbCascade.AccountsFixtures @create_attrs %{ title: "create some title", body: "create some body", slug: "create some slug", published: true, post_date: "2...
019aba0a7866d0a9d29a59071d6c380d96d56c18
3,062
[ 540159730 ]
[ "test" ]
defmodule Bank.BranchTest do alias Bank.Branch use ExUnit.Case doctest Branch describe "given a new disconnected Branch" do setup _ctx do start_supervised!({Bank.Network, %{}}) [{pid, nil}] = Registry.lookup(BankRegistry, {:branch, 1}) [pid: pid] end test "the initial state is ...
019afb82d0db23be191b3491bfab7e6e4042339c
10,631
[ 989917979 ]
[ "test", "documented" ]
defmodule ExLLM.Integration.ContextCachingComprehensiveTest do @moduledoc """ Comprehensive context caching tests for Gemini provider. Tests CRUD operations, performance optimization, and error handling. """ use ExUnit.Case @moduletag :integration @moduletag :comprehensive alias ExLLM.Providers.Gemini ...
019b3fc3ae7d9ac600c0e38ffc2003ff56af5439
14,932
[ 418504855 ]
[ "test" ]
defmodule Flagsmith.EngineTest do use ExUnit.Case, async: true alias Flagsmith.Schemas.{Environment, Features, Segments, Traits, Identity} alias Flagsmith.Engine.Test # stub the mock so that it calls the normal module as it would under regular usage setup do Mox.stub_with(Flagsmith.Engine.MockHashing, F...
019b686a3d17e49c3c44ab87d78e5055725129b8
1,602
[ 650698680 ]
[ "documented" ]
defmodule CoreWeb.GraphQL.Resolvers.ScheduleResolver do @moduledoc false alias Core.Schedules alias CoreWeb.Controllers.UserScheduleController def list_user_schedules(_, _, _) do {:ok, Schedules.list_user_schedules()} end def get_user_schedule(_, %{input: %{user_id: user_id}}, _) do {:ok, Schedule...
019bb1ec814a08dd83562059e95b980b01e31421
11,803
[ 762131773, 579412520, 682357176, 675225385, 739033590 ]
[ "typespec", "documented", "ecto" ]
defmodule Pleroma.Object do use Ecto.Schema import Ecto.Query import Ecto.Changeset alias Pleroma.Activity alias Pleroma.Config alias Pleroma.Hashtag alias Pleroma.Object alias Pleroma.Object.Fetcher alias Pleroma.ObjectTombstone alias Pleroma.Repo alias Pleroma.User alias Pleroma.Workers.Atta...
019be0e1a0aaec2fe3c699e329674c01dbc8a68e
1,524
[ 52788387 ]
[ "genserver" ]
defmodule Kairos.Slack.Client do use Slacker use Slacker.Matcher alias Kairos.Slack.MessageFormatter @token Application.get_env(:kairos, :slack_token) @channel_id Application.get_env(:kairos, :slack_channel_id) @slack_bot_id Application.get_env(:kairos, :slack_bot_id) match ~r/Projects overview/, :proj...
019bf863be4f9dd825574d4780e18b4cdcadfdc4
1,789
[ 703750244 ]
[ "test" ]
defmodule Lnx.CommitmentSecretsTest do use ExUnit.Case, async: true alias Lnx.CommitmentSecrets test "create commitment seed" do seed = CommitmentSecrets.new_seed() assert is_binary(seed) == true assert byte_size(seed) == 32 end test "calculate commitment from seed and index, Bolt 03 Appendix D"...
019c6589e293bd57c53bcb9d34d83a5164f63e22
4,054
[ 92755436 ]
[ "macro" ]
defmodule Flux.HTTP.Headers.Macros do defmacro def_fuzzy_handle_header(conn, key, value, do: do_block) do matches = [String.upcase(key), String.downcase(key), String.capitalize(key)] for key_match <- matches do quote do def handle_header(unquote(conn), unquote(key_match), unquote(value)), ...
019c9eef82164f94cfa80b563d83dac3f33fc830
1,805
[ 900488866 ]
[]
defmodule Solver do def get_answer() do contents = File.read!("input.txt") solve(String.split(contents, "\n"), 0) end # Called when rows handled def solve([], sum) do IO.puts("Answer is #{sum}") end # Called for every row individually def solve(rows, sum) do [ row | rest ] = rows [ ans | t...
019d2d428f3794498885580aecbeb8b36df6a052
2,589
[ 27944357 ]
[ "documented" ]
defmodule ExGenius.Song do @moduledoc """ %ExGenius.Song{} holds the essential elements on a song, while the functions of the module allow for locating a song by its id and pulling out its lyrics. """ defstruct id: 0, lyrics: nil, title: nil @doc """ Find a song by the Genius id. Also takes a `text_form...
019d39a8e1ab78fb6c69fd9d9cddd9fad158812a
4,619
[ 776043484 ]
[ "genserver" ]
defmodule Cantastic.Receiver do use GenServer alias Cantastic.{Frame, Interface, ConfigurationStore, ReceivedFrameWatcher} require Logger @id_mask 0x1FFFFFFF def start_link(%{process_name: process_name} = args) do GenServer.start_link(__MODULE__, args, name: process_name) end @impl true def init(...
019d805d74dd329385142a48d5e06c060f47ccf6
3,169
[ 225233137 ]
[]
defmodule CrapCups do def play(cups, moves, current_cup, max_val) def play(cups, 0, _, _), do: cups def play(cups, moves, current_cup, max_val) do {taken_cups, new_end, last_taken_cup} = take_cups(cups, Map.get(cups, current_cup)) new_cups = Map.drop(cups, Map.keys(taken_cups)) |> Map.put(c...
019d932c66c55d4f228136f1341635f7cffaffaf
1,572
[ 721243569 ]
[ "genserver" ]
defmodule UDP.Sender do use GenServer require Logger def start_link(opts) do GenServer.start_link(__MODULE__, opts) end def init(opts) do source = Keyword.fetch!(opts, :source) destination = Keyword.fetch!(opts, :destination) name = Keyword.fetch!(opts, :name) Logger.info("Opening UDP ...
019e0b4be6b81d2b556fbe99f19858130a83d9d9
1,735
[ 205963180 ]
[ "documented", "ecto" ]
defmodule CieloSdk.Api.PaymentCC.Payment do @moduledoc false use Ecto.Schema import Ecto.Changeset alias CieloSdk.Api.PaymentCC.CreditCard alias CieloSdk.Api.PaymentCC.Payment.RecurrentPayment embedded_schema do field(:Type, :string) field(:Amount, :integer) field(:Currency, :string) field...
019e52ac32f4738ff98a65f8d2ce868faed14160
6,235
[ 723859089 ]
[ "documented" ]
defmodule AdventOfCode.Year2021.Day18 do @moduledoc """ https://adventofcode.com/2021/day/18 """ use AdventOfCode, year: 2021, day: 18 # =============================================================================================== # Input # ==============================================================...
019e5688e3217e5ba0eb35d1d3849a60fe6671c6
5,578
[ 49205324 ]
[ "documented" ]
defmodule SecureHeaders.XXssProtection do @moduledoc """ IO.inspect( SecureHeaders.XXssProtection.validate [x_xss_protection: [value: 0]]) IO.inspect( SecureHeaders.XXssProtection.validate [x_xss_protection: [value: 1]]) IO.inspect( SecureHeaders.XXssProtection.validate [x_xss_protection: [value: 1, mode: "blo...
019e898bb640eedd49ccd66c9d60c69eefb9a8d3
2,894
[ 814876346 ]
[ "phoenix" ]
defmodule UserApplicationWeb.Router do use UserApplicationWeb, :router import UserApplicationWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {UserApplicationWeb.Layouts, :root} plug :protect_from_forgery pl...
019ea4b683d77f4e42f224134e7d0f70d45676a2
6,637
[ 93925149 ]
[ "test" ]
defmodule Xema.SchemaValidationTest do use ExUnit.Case, async: true setup do source = { :tuple, items: [ [ any_of: [ {:ref, "#/definitions/type"}, {:ref, "#/definitions/types"} ] ], {:ref, "#/definitions/keywords"} ], m...