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
00000ee267e279ac588a5044b6b576e9537de48c
1,807
[ 417664530, 444472658 ]
[ "documented" ]
defmodule Legendary.CoreWeb.ErrorHelpers do @moduledoc """ Conveniences for translating and building error messages. """ use Phoenix.HTML def error_class(form, field) do if Keyword.get_values(form.errors, field) |> Enum.any?() do "error" else "" end end @doc """ Generates tag ...
0000115ec3cfb681daca8bf4df114d6493f6767f
1,796
[ 673137173 ]
[ "liveview" ]
defmodule Pax.Plugins.Breadcrumbs do use Pax.Interface.Plugin use Phoenix.Component import Pax.Components import Pax.Util.String @default_placement [:show_header_primary, :edit_header_primary, :new_header_primary, :delete_header_primary] @default_truncate_length 25 @impl true def init(_callback_module...
000018c45f803a3108f03cb2f248069c67d47933
3,246
[ 245239469 ]
[ "typespec", "documented" ]
defmodule Usps.Shipment do @moduledoc """ Get tracking information about a shipment """ import XmlBuilder, only: [element: 2, element: 3] import SweetXml alias Usps.Configuration alias Usps.Operation @type shipment :: %{ number: nil | binary(), status: nil | binary(), cate...
000021c9e835f94067fd89b41c950ce02fa726b2
9,012
[ 996364241 ]
[ "documented" ]
defmodule DeeperHub.Core.Data.Schemas.EntityData do @moduledoc """ Schema para a tabela entity_data do CMS dinâmico. Gerencia os dados reais armazenados usando padrão EAV (Entity-Attribute-Value). """ use DeeperHub.Core.Data.SchemaBase, table_name: "entity_data", primary_key: :id alias DeeperHub.C...
000028a973d767a125e31f112cac40654bb7966b
1,630
[ 796426596 ]
[ "liveview", "phoenix" ]
defmodule PlanningPokerWeb.Endpoint do use Phoenix.Endpoint, otp_app: :planning_poker # 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...
00002b57b2cfb0a08b68b17db682711ab6369cbc
1,500
[ 423243340 ]
[ "macro", "test", "documented", "ecto" ]
defmodule MCT.DataCase do @moduledoc """ This module defines the setup for tests requiring access to the application's data layer. You may define functions here to be used as helpers in your tests. Finally, if the test case interacts with the database, we enable the SQL sandbox, so changes done to the d...
000055fd06d2989d8ee1b5ab4c0599a02eaba011
1,725
[ 937621150 ]
[ "genserver" ]
defmodule ArchiveGHRepos.List do {:ok, _} = Application.ensure_all_started(:req) use GenServer @impl true def init(token \\ nil) do {:ok, %{ url_fun: fn gh_org -> "https://api.github.com/orgs/#{gh_org}/repos" end, token: token }} end @impl true def handle_call({:all_repos, g...
000064785c438220aec20bd68721617684baae49
4,276
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CommentAnalyzer.V1alpha1.Model.AnalyzeCommentRequest do @moduledoc """ The comment analysis request message. LINT.IfChange ## Attributes * `clientToken` (*type:* `String.t`, *default:* `nil`) - Opaque token that is echoed from the request to the response. * `comment` (*type:* `Google...
00007f33d799df0e21af34b02f2cdbd0ae537ba4
1,914
[ 276464294 ]
[]
defmodule TodaySocial.MixProject do use Mix.Project def project do [ app: :today_social, version: "0.1.0", elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: alias...
00009b98bd7094c6471be8e961c63154ef8fa838
1,686
[ 457855573 ]
[]
import Config config :pingsite, PingSite.Repo, username: "postgres", password: "hackme", hostname: "localhost", database: "pingsite_dev", show_sensitive_data_on_connection_error: true, pool_size: 10 config :pingsite, PingSiteWeb.Endpoint, phoenix_profiler: [server: PingSite.Profiler], https: [ por...
0000f8effdb786196441aac501b367c402c5d259
15,458
[ 521810418 ]
[]
%{ "castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"}, "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [...
0001106aaab3505f98d61968818930b98a87310d
1,778
[ 95085372 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. use Mix.Config # General application configuration config :mywallet, ecto_repos: [Mywallet.Repo] ...
00019934d4ae725db228d5169b7e715d0095f1a1
1,718
[ 106213670, 106211954, 115815537 ]
[ "genserver" ]
defmodule MainApplication do use GenServer @convergence 90 def start_process(numNodes, topo, algo, mainPid) do IO.puts "Starting #{topo} topology with #{numNodes} nodes" {:ok, _pid} = GenServer.start_link(__MODULE__, [numNodes, topo, algo, mainPid], name: :manager) end def init(config) do [num...
0001ac23d20988efe79a367ba3e919d99d726332
6,654
[ 632584748 ]
[ "liveview", "phoenix", "documented" ]
defmodule GetThingsDoneWeb.UserAuth do use GetThingsDoneWeb, :verified_routes import Plug.Conn import Phoenix.Controller alias GetThingsDone.Accounts # Make the remember me cookie valid for 60 days. # If you want bump or reduce this value, also change # the token expiry itself in UserToken. @max_age ...
00024662ed0bf300f197bfb2889009469bc376ef
2,331
[ 432524514 ]
[ "genserver", "liveview", "documented" ]
defmodule UserdocsDesktopWeb.PageLive.Show do @moduledoc "Shows a page, will eventually include element and annotation CRUD operations" use UserdocsDesktopWeb, :live_view alias Schemas.Elements.Element alias UserdocsDesktopWeb.Root alias UserdocsDesktopWeb.LiveHelpers alias UserdocsDesktopWeb.RootSubscrip...
00035cc9be31d8f58a323d502270fda02ed45b55
8,045
[ 271873331, 632926645 ]
[]
%{ "acceptor_pool": {:hex, :acceptor_pool, "1.0.0", "43c20d2acae35f0c2bcd64f9d2bde267e459f0f3fd23dab26485bf518c281b21", [:rebar3], [], "hexpm", "0cbcd83fdc8b9ad2eee2067ef8b91a14858a5883cb7cd800e6fcd5803e158788"}, "chatterbox": {:hex, :ts_chatterbox, "0.13.0", "6f059d97bcaa758b8ea6fffe2b3b81362bd06b639d3ea2bb0883355...
00037f62d1066dd2c7fb15ce2946e8611a874508
4,060
[ 402134949 ]
[ "test" ]
defmodule Exercism.Alias.NeedForSpeedTest do use ExUnit.Case import ExUnit.CaptureIO alias Exercism.Alias.NeedForSpeed describe "print_race" do @tag task_id: nil test "prints a race with no cars" do race = %NeedForSpeed.Race{ title: "Need For Speed 2021", total_distance_in_meter...
0003a04ae7062f61acd90a5d8e2a7eb09f1dbc90
2,201
[ 433484844 ]
[ "typespec", "test" ]
defmodule ExCubicIngestion.S3ScanTest do use ExUnit.Case, async: true alias __MODULE__.FakeAws alias ExCubicIngestion.S3Scan describe "list_objects_v2/2" do test "single page" do stream = S3Scan.list_objects_v2("bucket", prefix: "prefix/", lib_ex_aws: FakeAws) assert [ %{prefix...
000416eb63dd9baa895a95319a92cd412d87b26a
1,993
[ 344147620 ]
[ "test", "ecto" ]
defmodule EventApp.UpdatesTest do use EventApp.DataCase alias EventApp.Updates describe "updates" do alias EventApp.Updates.Update @valid_attrs %{update: "some update"} @update_attrs %{update: "some updated update"} @invalid_attrs %{update: nil} def update_fixture(attrs \\ %{}) do {:...
0004390278da6b8a31f9a52abfe90f4ad46b92a8
5,176
[ 76956742 ]
[]
%{"bbmustache": {:hex, :bbmustache, "1.0.4", "7ba94f971c5afd7b6617918a4bb74705e36cab36eb84b19b6a1b7ee06427aa38", [:rebar], []}, "cf": {:hex, :cf, "0.2.2", "7f2913fff90abcabd0f489896cfeb0b0674f6c8df6c10b17a83175448029896c", [:rebar3], []}, "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb...
00044234e38879a8f7ba364b600fad7438373800
5,334
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.RemoteBuildExecution.V2.Model.BuildBazelRemoteExecutionV2Action do @moduledoc """ An `Action` captures all the information about an execution which is required to reproduce it. `Action`s are the core component of the [Execution] service. A single `Action` represents a repeatable action that can ...
000518f7ef88ccd1579c0a691dac125540920094
17,265
[ 674827810, 846193522 ]
[]
%{ "amqp": {:hex, :amqp, "3.3.0", "056d9f4bac96c3ab5a904b321e70e78b91ba594766a1fc2f32afd9c016d9f43b", [:mix], [{:amqp_client, "~> 3.9", [hex: :amqp_client, repo: "hexpm", optional: false]}], "hexpm", "8d3ae139d2646c630d674a1b8d68c7f85134f9e8b2a1c3dd5621616994b10a8b"}, "amqp_client": {:hex, :amqp_client, "3.12.4", "...
000523013d6dc0d700a92601505323a8f3931b5d
2,816
[ 324620561 ]
[ "test" ]
defmodule Excontainers.ExUnit.TestsIsolationTest do use ExUnit.Case import Support.DockerTestUtils import Support.ExUnitTestUtils import ExUnit.CaptureIO test "containers are re-created for each test" do defmodule SampleTestWithIsolatedContainers do use ExUnit.Case import Excontainers.ExUnit...
0005a5685628349de09e2aa615570d0451c4413a
1,653
[ 67948155, 64800791, 65724742, 66568267 ]
[]
defmodule SeatSaver.Mixfile do use Mix.Project def project do [app: :seat_saver, version: "0.0.1", elixir: "~> 1.2", elixirc_paths: elixirc_paths(Mix.env), compilers: [:phoenix, :gettext] ++ Mix.compilers, build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, a...
0005bf3bc86ee427edaea7fc6a1eec5bf9271d5a
7,877
[ 419820423 ]
[ "test" ]
defmodule VelocityWeb.Resolvers.SimulatePtoTest do use VelocityWeb.ConnCase, async: true # credo:disable-for-this-file @simulate_pto_mutation """ mutation SimulatePto($startDate: Date!, $endDate: Date!, $user: InputUser!, $accrualPolicy: InputPtoAccrualPolicy!, $takenEvents: [InputTakenEvent], $manualEvents...
0005eb582c686dae1bb60cc5404dc0f39a1a5e69
16,902
[ 381987064 ]
[ "test" ]
defmodule Membrane.RTC.SIPEndpointTest do use ExUnit.Case import Membrane.ChildrenSpec alias Membrane.RTC.Engine alias Membrane.RTC.Engine.Endpoint.File, as: FileEndpoint alias Membrane.RTC.Engine.Endpoint.File.TrackConfig alias Membrane.RTC.Engine.Endpoint.HLS alias Membrane.RTC.Engine.Endpoint.HLS.{HL...
00065246ed24387c33f45d850fa24bef44511d66
2,178
[ 226573349 ]
[]
use Mix.Config # Configure your database config :todo_phoenix, TodoPhoenix.Repo, username: "postgres", password: "postgres", database: "todo_phoenix_dev", hostname: "localhost", show_sensitive_data_on_connection_error: true, pool_size: 10 # For development, we disable any cache and enable # debugging and ...
00065d8aa1267d1c207b4bc5dc5eff30120e8ef6
1,505
[ 376390340 ]
[ "phoenix" ]
defmodule FootballApiWeb.ConfederationController do use FootballApiWeb, :controller alias FootballApi.Organizations alias FootballApi.Organizations.Confederation action_fallback FootballApiWeb.FallbackController def index(conn, _params) do confederations = Organizations.list_confederations() render...
0006b7e2ba921278b7bb06da18eb41ed97a21bdc
2,397
[ 406155044, 441830115 ]
[ "typespec", "documented" ]
defmodule Lotus.Gen.Helpers do @moduledoc """ Helper functions to create and render files """ @type artifact() :: %{} @doc """ List artifacts (directory and files) that need to be generated. For the purpose of wrapping a new component. """ @spec list_artifacts(map()) :: map() def list_artifacts(%{ ...
0006d1a81dbf65eeb37590b43d3ca84ef24685c6
3,211
[ 588348046 ]
[ "liveview", "test" ]
defmodule RetroBoardWeb.BoardLiveTest do use RetroBoardWeb.ConnCase import Phoenix.LiveViewTest import RetroBoard.BoardsFixtures @create_attrs %{title: "some title"} @update_attrs %{title: "some updated title"} @invalid_attrs %{title: nil} defp create_board(_) do board = board_fixture() %{board...
000794b55ca42218a38bb175de2683ef4a588ffd
1,962
[ 153312992, 153720874, 153394287 ]
[ "test", "ecto" ]
defmodule TaskTracker.UsersTest do use TaskTracker.DataCase alias TaskTracker.Users describe "users" do alias TaskTracker.Users.User @valid_attrs %{admin: true, email: "some email"} @update_attrs %{admin: false, email: "some updated email"} @invalid_attrs %{admin: nil, email: nil} def user...
00080ac5c3ba380176c475fc2324d9f9dcd38b8c
4,344
[ 985853139 ]
[]
# Generated by Mochi compiler v0.10.25 on 2025-07-13T11:50:16Z defmodule Main do def main do # company_type :: list(map()) company_type = [%{ct_id: 1, kind: "production companies"}, %{ct_id: 2, kind: "other"}] # info_type :: list(map()) info_type = [%{it_id: 10, info: "languages"}] # title :: list...
000852d80788d98c13aedaba7424a53f0f894681
1,547
[ 281029696 ]
[ "typespec", "documented" ]
defmodule Account.Http.Transfer do @moduledoc false @required_body %{ amount: &is_number/1, currency: &is_atom/1, recipient_account_id: &is_number/1 } @spec execute(map(), number()) :: {number(), map()} def execute(%{} = entry_body, account_id) do parsed_body = Helpers.parse_body_request(ent...
00087592db2fc5b04ac30ac53f89807c2ce28afb
2,664
[ 610107322 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule PasswordGeneratorPhxWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, components, channels, and so on. This can be used in your application as: use PasswordGeneratorPhxWeb, :controller use PasswordGeneratorPhxWeb, :html The definitions below wi...
0008f6a06c2c0bd9ad1d78d1881f7cde9ae11514
3,199
[ 434254847 ]
[ "documented" ]
defmodule Day03 do @moduledoc """ Documentation for `Day03`. """ def sum_bits([first_line | _] = lines) do initial_bits = List.duplicate(0, Enum.count(first_line)) lines |> Enum.reduce(initial_bits, fn line, acc -> Enum.zip_with(acc, line, fn x, y -> x + y end) end) |> then(& {&1...
000a6bab4dbf0723177f1d82c09517b85ae5e361
1,853
[ 58178674 ]
[ "supervisor", "documented" ]
defmodule Exdb do use Application require Logger @port 4040 @doc false def start(_type, _args) do import Supervisor.Spec #Exdb.Server.start_link() Logger.info "Starting ExDB" children = [ supervisor(Task.Supervisor, [[name: Exdb.TaskSupervisor]]), worker(Task, [Exdb,...
000a8c4186fa4af70dba51592cb1d72fa6c7351f
2,320
[ 66467062, 67251634, 87683657, 99106424, 99126072, 125414041, 207847106, 297237670, 77253880, 86030418, 95605888, 100505295, 77785313, 86063602, 96350285, 63643631, 70405590, 72784914, 96857265, 97959122, 71519558, 73516692, 80629259, 86415043, 242077992, 65229557, ...
[ "documented", "ecto" ]
defmodule Mix.Tasks.Ecto.Gen.Migration do use Mix.Task import Macro, only: [camelize: 1, underscore: 1] import Mix.Generator import Mix.Ecto @shortdoc "Generates a new migration for the repo" @moduledoc """ Generates a migration. The repository must be set under `:ecto_repos` in the current app co...
000ae5c6a04222f6e8ccd6549af359707f9d8b71
2,974
[ 583462031 ]
[ "supervisor" ]
defmodule TrelloAppWeb.Telemetry do use Supervisor import Telemetry.Metrics def start_link(arg) do Supervisor.start_link(__MODULE__, arg, name: __MODULE__) end @impl true def init(_arg) do children = [ # Telemetry poller will execute the given period measurements # every 10_000ms. Lear...
000b103072c98338586875952ae89911a3228dad
3,577
[ 164356495 ]
[ "typespec", "documented" ]
defmodule Kojin.Pod.PodObject do @moduledoc """ Module for defining plain old data objects, independent of target language """ alias Kojin.Pod.{PodField, PodObject, PodTypeRef, PodTypes} use TypedStruct @typedoc """ A plain old data object, with an `id`, a `doc` comment and a list of fields. """ ...
000b261096aa9e2cf9bf2ec4ae55c81d1fbd9a69
2,347
[ 608743094 ]
[ "documented", "ecto" ]
defmodule Osuuspuutarha.Orders do @moduledoc """ The Orders context. """ import Ecto.Query, warn: false alias Osuuspuutarha.Repo alias Osuuspuutarha.Orders.Order alias Osuuspuutarha.ConfirmationSender alias Osuuspuutarha.Mailer @doc """ Returns the list of orders. ## Examples iex> list...
000bbe5c2fab9ce4dbaa1638e8db6cc9c05b7917
1,874
[ 656946312 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. # General application configuration import Config config :warp, ecto_repos: [Warp.Repo] # Configures...
000c43f12ffc69200db751fc4252b273984a6051
2,254
[ 854895872 ]
[ "test", "ecto" ]
defmodule Tasks.CatalogTest do use Tasks.DataCase alias Tasks.Catalog describe "products" do alias Tasks.Catalog.Product import Tasks.CatalogFixtures @invalid_attrs %{description: nil, price: nil, title: nil} test "list_products/0 returns all products" do product = product_fixture() ...
000ca0cdd8bc612cebce2f7d93dc88d4c4b4ab65
3,611
[ 97252713 ]
[ "macro", "documented" ]
defmodule Arguments do @moduledoc """ Arguments provides a module with argument parsing through `YourArguments.parse(incoming)` `use Arguments` There are two styles of arguments allowed - `command` - `$ cmd new project` - `flag` - `$ cmd --dir /etc` These two styles can be mixed, but the ...
000d0b7079390c45716fb612ba4bf34f54cd89f3
1,987
[ 813470654 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. # General application configuration import Config config :dev_jobs, ecto_repos: [DevJobs.Repo], gen...
000d0e0d0f77427564a92c38bd2118af2a5571f4
2,444
[ 265701271 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule PersonalLibraryWeb 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 PersonalLibraryWeb, :controller use PersonalLibraryWeb, :view The definitions below will be executed for ev...
000db825542375de2ffe366e372c30e03836fba4
1,705
[ 210992973 ]
[ "phoenix", "ecto" ]
defmodule TestWeb.OrderController do use TestWeb, :controller alias Test.Orders alias Test.Orders.Order def index(conn, _params) do orders = Orders.list_orders() render(conn, "index.html", orders: orders) end def new(conn, _params) do changeset = Orders.change_order(%Order{}) render(conn,...
000dc545515e4270e36a973d072bf271a962faab
2,023
[ 641733968 ]
[ "documented" ]
defmodule WithOnnx do @moduledoc """ Helper module from ONNX to Axon. """ @doc """ Loads an ONNX model into Axon and saves the model ## Examples iex> OnnxToAxon.onnx_axon(path_to_onnx_file, path_to_axon_dir) """ def onnx_axon(path_to_onnx_file, path_to_axon_dir) do axon_name = axon_name_fr...
000ddf640478e549ae660056c0c8cad98e2cc662
5,638
[ 560223196 ]
[ "typespec", "documented" ]
defmodule LAP2.Main.Helpers.HostBuffer do @moduledoc """ Acts as a buffer abstraction for service hosts. Uses ShareHandler to reconstruct original service requests. Provides utility functions for deconstructing responses to the appropriate requests. """ require Logger alias LAP2.Main.Master alias LAP...
000de4e4d7fdee5f898524f619ef2479c61a52a3
5,195
[ 1007789241 ]
[ "test", "ecto" ]
defmodule TeleCarex.ConversationsTest do use TeleCarex.DataCase alias TeleCarex.Conversations import TeleCarex.AccountsFixtures import TeleCarex.ConversationsFixtures describe "conversations" do alias TeleCarex.Conversations.Conversation import TeleCarex.ConversationsFixtures @invalid_attrs %...
000e0b52b7aab2e9814685eb3a628e2f7bb8a500
1,902
[ 13218759 ]
[ "test" ]
defmodule ExVCR.FilterTest do use ExUnit.Case, async: true test "filter_sensitive_data" do ExVCR.Config.filter_sensitive_data("<PASSWORD>.+</PASSWORD>", "PLACEHOLDER") ExVCR.Config.filter_sensitive_data("secret", "PLACEHOLDER") content = "<PASSWORD>foo</PASSWORD><content>I have a secret</content>" ...
000e216a829229c91ad14fbc87e3c6ffc92b33f2
1,763
[ 428034073 ]
[ "genserver", "supervisor" ]
defmodule Mastery.Boundary.QuizSession do alias Mastery.Core.{Quiz, Response} use GenServer def child_spec({quiz, email}) do # :id tuple uniquely identifies the process so supervisors can diff them # :start has everything OTP needs to invoke start_link func # - Module, name of func, args list # :...
000e277a8d48e5873ca64d543247b7439a68dde2
1,864
[ 523585239 ]
[ "phoenix", "ecto" ]
defmodule EstoreWeb.ProductController do use EstoreWeb, :controller alias Estore.Inventory alias Estore.Inventory.Product def index(conn, _params) do products = Inventory.list_products() render(conn, "index.html", products: products) end def new(conn, _params) do changeset = Inventory.change_...
000e8eb4f5b99c8cbb8cae80433beff8599c6a06
3,201
[ 118819250 ]
[ "typespec", "documented" ]
defmodule JaSerializer.Builder.PaginationLinks do import JaSerializer.Formatter.Utils, only: [format_key: 1] @page_number_origin Application.get_env(:ja_serializer, :page_number_origin, 1) @moduledoc """ Builds JSON-API spec pagination links. Pass in a map with the necessary data: JaSerializer.Builder...
000eb7dfbf6a741931f2886eea5be24232d818f3
2,113
[ 744281225, 116826798, 313251367 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. use Mix.Config config :ewallet, ecto_repos: [], version: "2.0.0-dev", cors_origin: {:system, "CORS_ORIGIN", nil}, blockchain_adapter: EthGethAdapter.Adapter, settings: [ :base_url, ...
000ee3e44fe2613ac3e8c33cecd7e1d19f02739b
1,627
[ 732088494 ]
[ "liveview", "phoenix" ]
defmodule LiveViewStudioWeb.Router do use LiveViewStudioWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {LiveViewStudioWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end p...
000f6a5af11326f3b165960b89c556c12b806ed7
1,588
[ 832393742 ]
[ "macro", "documented", "phoenix" ]
defmodule MsAirwallexWebhooksWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, components, channels, and so on. This can be used in your application as: use MsAirwallexWebhooksWeb, :controller use MsAirwallexWebhooksWeb, :html The definitions below will ...
000f7d614ff4f8b7079c3ebdf1342ed922b480c3
3,450
[ 39093815 ]
[ "genserver", "typespec", "documented" ]
defmodule Ecto.Adapters.Poolboy.Worker do @moduledoc false use GenServer use Behaviour @type modconn :: {module :: atom, conn :: pid} @spec start_link({module, Keyword.t}) :: {:ok, pid} def start_link({module, params}) do GenServer.start_link(__MODULE__, {module, params}, []) end @spec checkout(p...
000f83eb1720b5b694937e3db7105c3880e5d7cf
1,791
[ 515926901 ]
[ "test", "ecto" ]
defmodule TodoApp.TodoTest do use TodoApp.DataCase alias TodoApp.Todo describe "items" do alias TodoApp.Todo.Item import TodoApp.TodoFixtures @invalid_attrs %{status: nil, text: nil} test "list_items/0 returns all items" do item = item_fixture() assert Todo.list_items() == [item] ...
00104ed96222e766264d90f46b3034de14d29d09
1,629
[ 192407200, 228414339 ]
[ "test" ]
defmodule Dictionary.Type.LatitudeTest do use ExUnit.Case import Checkov test "can be encoded to json" do expected = %{ "version" => 1, "name" => "name", "description" => "description", "__type__" => "dictionary_latitude" } assert expected == JsonSerde.serialize!...
001058d9dfa2cb49b73dc3459d54cae9d53673ad
21,639
[ 932176619 ]
[ "typespec", "liveview", "documented" ]
defmodule OtelWeb.CoreComponents do @moduledoc """ Provides core UI components. At first glance, this module may seem daunting, but its goal is to provide core building blocks for your application, such as modals, tables, and forms. The components consist mostly of markup and are well-documented with doc s...
0010904e5ac43068abac5d206d803a44c0feffc4
1,703
[ 558206604 ]
[]
defmodule RustlerGithub.Arch do defp system_arch() do base = :erlang.system_info(:system_architecture) |> List.to_string() |> String.split("-") triple_keys = case length(base) do 4 -> [:arch, :vendor, :os, :abi] 3 -> [:arch, :vendor, :os] ...
00109bca5fdaa951dfbf5281037315cbc7d53da8
1,692
[ 819374265 ]
[ "liveview" ]
defmodule AshUnionIssueWeb.IssueLive do use AshUnionIssueWeb, :live_view @impl true def mount(_params, _session, socket) do {:ok, resource} = AshUnionIssueWeb.Domain.create_parent(%{children: [%{type: "one_of_the_children", prompt: "Prompt"}]}) socket = assign(socket, :form, AshPhoenix.Form.for_update(r...
0010db797dfc69b5a690c56193ec5fe3ccd547b0
3,158
[ 412861294 ]
[ "documented", "ecto" ]
defmodule Webshop.UserContext do @moduledoc """ The UserContext context. """ import Ecto.Query, warn: false alias Webshop.Repo alias Webshop.UserContext.User @doc """ Returns the list of users. ## Examples iex> list_users() [%User{}, ...] """ def list_users do Repo.all(User) ...
00112695c044c59f06671a3c4bc32e458a4a02f5
2,311
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.SecretManager.V1beta1.Model.AuditConfig do @moduledoc """ Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are Au...
0011417e41df040a27ec93ad5b066dc720f0ebff
3,562
[ 92200052 ]
[ "test" ]
defmodule Searchlight.Web.EventControllerTest do use Searchlight.Web.ConnCase alias Searchlight.EventManager alias Searchlight.EventManager.Event @create_attrs %{capability: "some capability", current_iteration: 42, event_date: %DateTime{calendar: Calendar.ISO, day: 17, hour: 14, microsecond: {0, 6}, minute:...
00117b341bc315fcb01518c0cfe2740cd7692616
3,312
[ 52797857 ]
[ "test" ]
defmodule Cloak.Query.AnonymizedSubqueriesTest do use ExUnit.Case, async: true import Cloak.Test.QueryHelpers setup_all do :ok = Cloak.Test.DB.create_table("anon_sq", "i INTEGER, i2 INTEGER") for i <- 1..10, do: :ok = insert_rows(_user_ids = 1..15, "anon_sq", ["i"], [i]) for i <- 1..5, do: :ok = ins...
00117c4e6519d0724ff66d4a4c71eb09888d57cd
2,623
[ 116661854 ]
[ "documented", "ecto" ]
defmodule Rumbl.Comment do @moduledoc """ The Comment context. """ import Ecto.Query, warn: false import Ecto alias Rumbl.Repo alias Rumbl.Comment.Annotation alias Rumbl.Movie.Video alias Rumbl.Account alias Rumbl.Account.User @doc """ Returns the list of annotations. ## Examples ie...
0011d0200fe611245a89043f248e475b3d9dc5b1
5,859
[ 201743910 ]
[]
defmodule Sorter do def build_tree(paths) do paths |> Enum.map(&path_to_tree/1) |> Enum.reduce(%{}, &deep_merge/2) end def path_to_tree(path) do pdict = path |> String.split("/") |> Enum.drop(1) |> Enum.reduce([], fn x, paths -> parent = Enum.at(paths, 0) || "" [parent <>...
0011ec96557e56418d3da5f8d927a9b7d1ea1879
2,756
[ 132191194 ]
[ "test" ]
defmodule TicTacToe.GameTest do use ExUnit.Case alias TicTacToe.Game test "should validate users turn" do name = "name" {:ok, pid} = Game.start_link(name) {:error, message} = Game.play(name, :player_2, {0, 0}) assert message == "It's not your turn!" {:ok, game_message} = Game.play(name, :pl...
0011f6ba4f11490278e45464fff2a5684991deff
1,670
[ 367278931 ]
[ "documented" ]
defmodule Google.Devtools.Resultstore.V2.LineCoverage do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :instrumented_lines, 1, type: :bytes, json_name: "instrumentedLines" field :executed_lines, 2, type: :bytes, json_name: "executedLines" end defmodule Google.Devto...
00120a45c30dd387ccfcf598aad3b4cd7a0a2a14
1,807
[ 574117985 ]
[ "test" ]
defmodule PairDance.Infrastructure.Integrations.EctoRepositoryTest do use PairDance.DataCase alias PairDance.Infrastructure.Integrations.EctoRepository, as: Repository alias PairDance.Domain.Integration import PairDance.TeamsFixtures defp setup_data(_) do team = create_team(%{member_names: ["ana"], tas...
0012315eabf3ecac75acfc42382dde1678d10d0d
6,729
[ 899837642 ]
[ "typespec" ]
defmodule Day6.Part2.Patrol do @spec move(%Day6.State{}) :: [Day6.T.coord()] defp move(%Day6.State{pointing: :up, guard: {gx, _}} = state) do collision = Day6.Objects.collide(:up, state.objects, state.guard) # IO.inspect({state.pointing, state.guard, state.forked, collision}, label: "{pointing, guard, forke...
00125615639f1c5985ce5908386e4825cb4e95b3
2,593
[ 705690956 ]
[ "liveview", "ecto" ]
defmodule CompanyPocWeb.UserRegistrationLive do use CompanyPocWeb, :live_view alias CompanyPoc.Accounts alias CompanyPoc.Accounts.User def render(assigns) do ~H""" <div class="mx-auto max-w-sm"> <.header class="text-center"> Register for an account <:subtitle> Already r...
0012734ff2468545530fdc7ddd0f67bfa788225c
1,884
[ 347427848 ]
[ "test" ]
defmodule Magnemite.Identity.UserTest do use Magnemite.DataCase, async: true use Magnemite.Changeset alias Magnemite.Identity.User describe "schema/2" do test "has :encrypted_password and it defaults to nil" do assert %User{encrypted_password: nil} = %User{} end test "has :password and it d...
0012a981e63f64be3e8f76286e4cbeb5cdb6fdc1
3,757
[ 738454113 ]
[]
import Config # config/runtime.exs is executed for all environments, including # during releases. It is executed after compilation and before the # system starts, so it is typically used to load production configuration # and secrets from environment variables or elsewhere. Do not define # any compile-time configurati...
0012f27a78dbb01b9028d4abaacb67e8d133374c
6,036
[ 221940752 ]
[ "test", "ecto" ]
defmodule Arrow.HastusTest do use Arrow.DataCase alias Arrow.Hastus describe "exports" do alias Arrow.Hastus.Export import Arrow.HastusFixtures @invalid_attrs %{s3_path: nil} test "list_exports/0 returns all exports" do export = export_fixture() assert Hastus.list_exports() == [ex...
00130eb72b86cc91ebe6392700f6c559347eb431
3,983
[ 89376117 ]
[]
%{ "earmark": {:hex, :earmark, "1.2.4", "99b637c62a4d65a20a9fb674b8cffb8baa771c04605a80c911c4418c69b75439", [:mix], [], "hexpm", "1b34655872366414f69dd987cb121c049f76984b6ac69f52fff6d8fd64d29cfd"}, "earmark_parser": {:hex, :earmark_parser, "1.4.37", "2ad73550e27c8946648b06905a57e4d454e4d7229c2dafa72a0348c99d8be5f7"...
00131dcda9829277fe60c6dedd5821dfedea2f61
4,442
[ 667862361 ]
[ "genserver", "typespec", "documented" ]
if Code.ensure_loaded?(Redix.PubSub) do defmodule ForkWithFlags.Notifications.Redis do @moduledoc false use GenServer require Logger alias ForkWithFlags.{Config, Store} # Use the Redis conn from the persistence module to # issue Redis commands (to publish notification). @write_conn ForkWithFlags.Store.P...
00138b6194272728fd1a5fbb3854ef76d9c02baa
1,751
[ 665453499 ]
[ "test" ]
defmodule RulesTest do use ExUnit.Case test "eat_ghost?/2 ghost gets eaten" do assert Rules.eat_ghost?(true, true) end test "eat_ghost?/2 ghost does not get eaten because no power pellet active" do refute Rules.eat_ghost?(false, true) end test "eat_ghost?/2 ghost does not get eaten because not to...
0013cef5751ee473a5bb8dd1335696508d5f4f25
2,749
[ 109417598 ]
[ "genserver", "documented" ]
defmodule NigiwikiWeb.Presence do @moduledoc """ Provides presence tracking to channels and processes. See the [`Phoenix.Presence`](http://hexdocs.pm/phoenix/Phoenix.Presence.html) docs for more details. ## Usage Presences can be tracked in your channel after joining: defmodule Nigiwiki.MyChannel ...
0013d164155e74d30063fe16d67e3fe3f314f7c6
1,733
[ 190087378 ]
[]
defmodule Day7 do def part1() do File.open("input.txt", [:read, :utf8], fn(f) -> IO.read(f, :all) |> String.split("\n") |> Enum.filter(&(String.length(&1) > 0)) |> Enum.map(&parse_ipv7/1) |> Enum.count(&tls?/1) end) |> elem(1) end def parse_ipv7(ip) do parts = Strin...
0013efcbd8680897bd198b66cd1d9406cf0bd7c0
10,680
[ 969999971 ]
[ "documented" ]
defmodule DeeperHub.WebInterface.Resources.SysPagesTypesResource do @moduledoc """ Recurso REST para sys_pages_types. Fornece endpoints para gerenciar sys_pages_types. Endpoints disponíveis: - GET /api/{{PLURAL_NAME}} - Lista todos os registros com suporte a paginação e ordenação - GET /api/{{PLURAL_NAME...
001406f837d77173acd4d99cb9fd6575925d316a
2,004
[ 67395039 ]
[]
use Mix.Config # For production, we configure the host to read the PORT # from the system environment. Therefore, you will need # to set PORT=80 before running your server. # # You should also configure the url host to something # meaningful, we use this information when generating URLs. # # Finally, we also include t...
0014101f4af960615472837b11ea9a501312b46d
1,774
[ 121569378 ]
[ "test" ]
defmodule Kraken.ApiTest do use ExUnit.Case setup do api_key = System.get_env("KRAKEN_API_KEY") private_key = System.get_env("KRAKEN_PRIVATE_KEY") {:ok, %{api_key: api_key, private_key: private_key}} end test "fetching balance for some account", %{api_key: api_key, private_key: private_key} do ...
001454190674d39991451c446c156e830858dc79
3,582
[ 863121838 ]
[ "test", "phoenix" ]
defmodule ChatCatWeb.UserSessionControllerTest do use ChatCatWeb.ConnCase, async: true import ChatCat.AccountsFixtures setup do %{user: user_fixture()} end describe "POST /users/log_in" do test "logs the user in", %{conn: conn, user: user} do conn = post(conn, ~p"/users/log_in", %{ ...
00147cb5456f8cdd463c53c5ee421146b9570362
1,689
[ 212740598 ]
[]
defmodule MemoryWeb.GamesChannel do use MemoryWeb, :channel alias Memory.Game alias Memory.BackupAgent def join("games:" <> name, payload, socket) do if authorized?(payload) do game = BackupAgent.get(name) || Game.new() BackupAgent.put(name, game) socket = s...
0014b4712920fc63ee74a576e9a6c4b2bae4569c
2,318
[ 80350625 ]
[]
use Mix.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 # MediumPhxExample.Web.Endpoint.load_from_system_env/1 dynamically. # Any dynamic configuration should be moved to such ...
0014c79ccb8ad82f0732fd722141a6064b9e99d6
2,011
[ 433516278 ]
[ "documented" ]
defmodule Aoc.Day14 do @moduledoc """ Solutions for Day 14. """ @behaviour Aoc.Day alias Aoc.Day @impl Day def day(), do: 14 @impl Day def a({initial, rules}) do 1..10 |> Enum.reduce(initial, &grow(&1, &2, rules)) |> score() end @impl Day def b({initial, rules}) do 1..40 ...
0014d6171ef5f673ea41b1c001bd8caa39b5fe81
6,672
[ 494905647 ]
[ "genserver" ]
defmodule KyokoWeb.GameChannel do @five_minutes 60 * 1000 * 5 use KyokoWeb, :channel alias KyokoWeb.Presence alias Kyoko.{Rooms, Issues} alias Kyoko.PubSub alias KyokoWeb.RoomView @impl true def join("room:" <> room_code, %{"player" => player_name, "team" => team} = _payload, socket) do if authori...
00152ed88325f1d93f01fb52444db1a5d3cd3c3e
4,282
[ 289130764 ]
[]
# Script for populating the database. You can run it as: # # mix run priv/repo/seeds.exs # # Inside the script, you can read and write to any of your # repositories directly: # # TrainingSrvr.Repo.insert!(%TrainingSrvr.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as...
0016d6a110ad67a3f2e292c04409e6f24958b3e0
4,716
[ 757463973, 768011158, 279895213, 610994830, 792554244, 493445187, 644559297, 895439861, 756299391, 449967422 ]
[ "documented" ]
defmodule ChatApi.Workers.SendAccountConversationReminders do @moduledoc false use Oban.Worker, queue: :default alias ChatApi.{Accounts, Conversations, Messages} alias ChatApi.Accounts.{Account, Settings} alias ChatApi.Conversations.Conversation alias ChatApi.Messages.Message require Logger @impl Ob...
0016fe0f62f13ce21de2bfc06f067a7ceda5514f
3,529
[ 681840069 ]
[ "liveview", "test" ]
defmodule NotKnittingWeb.UserResetPasswordLiveTest do use NotKnittingWeb.ConnCase import Phoenix.LiveViewTest import NotKnitting.AccountsFixtures alias NotKnitting.Accounts setup do user = user_fixture() token = extract_user_token(fn url -> Accounts.deliver_user_reset_password_instru...
001702a2e7e398dce76b4cf006f3a37628c79827
4,185
[ 224220984 ]
[]
defmodule Exec do defp eval(op, a, b) when rem(op, 100) == 1 do a + b end defp eval(op, a, b) when rem(op, 100) == 2 do a * b end defp eval(op, a, b) when rem(op, 100) == 7 do if a < b, do: 1, else: 0 end defp eval(op, a, b) when rem(op, 100) == 8 do if a == b, do: 1, else: 0 end d...
0017789ac69cc4a79b38d1310d3761e44afd0528
1,972
[ 46629591, 923244502, 692082018, 909658395, 912882682, 287980430, 911720513, 915017740, 913584739, 915276886, 911775889, 915075587, 904415954, 909708083, 912548158, 207218146, 211094750, 309136006, 913224565, 912453278, 838060830, 912996596 ]
[]
%{ "earmark_parser": {:hex, :earmark_parser, "1.4.42", "f23d856f41919f17cd06a493923a722d87a2d684f143a1e663c04a2b93100682", [:mix], [], "hexpm", "6915b6ca369b5f7346636a2f41c6a6d78b5af419d61a611079189233358b8b8b"}, "ex_doc": {:hex, :ex_doc, "0.36.1", "4197d034f93e0b89ec79fac56e226107824adcce8d2dd0a26f5ed3a95efc36b1",...
00186f0a81783d83244d14bf14bb88a80e0114ae
5,859
[ 829059969 ]
[ "test" ]
defmodule BACnet.Protocol.AccumulatorRecordTest do alias BACnet.Protocol.AccumulatorRecord alias BACnet.Protocol.BACnetDate alias BACnet.Protocol.BACnetDateTime alias BACnet.Protocol.BACnetTime alias BACnet.Protocol.Constants require Constants use ExUnit.Case, async: true @moduletag :protocol_data_str...
0018a62df64149c1fbe351ec9626547c7d647b9b
16,475
[ 343232014, 807637070 ]
[ "documented" ]
defmodule Belmont.CPU.Instructions do @moduledoc """ Defines all of the 6502 instructions. """ import Belmont.CPU.Definstr alias Belmont.CPU definstr x01(cpu, "ORA", :byte), do: CPU.logical_op(cpu, :indexed_indirect, :or) definstr x03(cpu, "*SLO", :byte), do: CPU.slo(cpu, :indexed_indirect) definstr x...
00198c6935ee4388b86704e060b5ba1e0adfc4ce
2,003
[ 380328747 ]
[]
use Mix.Config # For production, don't forget to configure the url host # to something meaningful, Phoenix uses this information # when generating URLs. # # Note we also include the path to a cache manifest # containing the digested version of static files. This # manifest is generated by the `mix phx.digest` task, # ...
0019d00541e8648c5182970d4a97974a4ebf5a07
1,815
[ 872624471 ]
[ "documented", "ecto" ]
defmodule Wcm.Chapters do @moduledoc """ The Chapters context. """ import Ecto.Query, warn: false alias Wcm.Repo alias Wcm.Chapters.Chapter @doc """ Returns the list of chapters. ## Examples iex> list_chapters() [%Chapter{}, ...] """ def list_chapters do Repo.all(Chapter) e...
001a0198c521ce1778720a0c73ef22cb16543eb5
4,180
[ 695415986 ]
[ "documented" ]
defmodule AshSqlite.DataLayer.Info do @moduledoc "Introspection functions for " alias Spark.Dsl.Extension @doc "The configured repo for a resource" def repo(resource) do Extension.get_opt(resource, [:sqlite], :repo, nil, true) end @doc "The configured table for a resource" def table(resource) do ...
001a4f0bf4be6a6d333d9c103692f878a803161a
4,141
[ 481390473 ]
[ "genserver" ]
defmodule Broth.Routes.GitHubAuth do import Plug.Conn use Plug.Router require Logger alias Beef.Users alias Kousa.Utils.Urls plug(:match) plug(:dispatch) get "/web" do redirect_to_beta = Enum.any?(conn.req_headers, fn {k, v} -> k == "referer" and Urls.is_beta_site_url(v) end) ...