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
0aed854bafcb09fc8b5c73c279fc126d7e1b1c87
2,053
[ 173733519 ]
[]
defmodule SequencerinterfaceWeb.SequencerChannel do use SequencerinterfaceWeb, :channel @impl true def join("sequencer:lobby", payload, socket) do if authorized?(payload) do {:ok, socket} else {:error, %{reason: "unauthorized"}} end end # Channels can be used in a request/response fa...
0aeddc139f4971b6c29243f0c2e04292db478e07
2,740
[ 905783417 ]
[ "liveview" ]
defmodule ExListeningWeb.TeacherResetPasswordLive do use ExListeningWeb, :live_view alias ExListening.Teachers def render(assigns) do ~H""" <div class="mx-auto max-w-sm"> <.header class="text-center">Reset Password</.header> <.simple_form for={@form} id="reset_password_form"...
0aef360c92f84fe4f7e4803d6117e1d25d6fd6fd
1,547
[ 627511667 ]
[ "macro", "documented", "phoenix" ]
defmodule TellerapiWeb 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 TellerapiWeb, :controller use TellerapiWeb, :html The definitions below will be executed for every controll...
0aef6ba10a32ffb1c66d8d19b09aae49b3d1d59f
4,194
[ 87027 ]
[ "liveview", "test" ]
defmodule VenieriWeb.ProjectLiveTest do use VenieriWeb.ConnCase import Phoenix.LiveViewTest import Venieri.ProjectsFixtures import Venieri.AccountsFixtures @create_attrs %{description: "some description", title: "some title", slug: "some slug", statement: "some statement", show: true} @update_attrs %{descr...
0aef749f7ddac759823e800116ee54f57e0726b2
2,090
[ 658215221 ]
[ "ecto" ]
defmodule Remindly.Orgs.Membership do use Ecto.Schema import Ecto.Changeset import Ecto.Query import RemindlyWeb.Gettext alias Remindly.Accounts.User alias Remindly.Orgs.Org @role_options ~w(admin member)a @default_role :member @admin_role :admin schema "orgs_memberships" do field :role, Ecto...
0aefc36bcdad6deb465bc0dff479e0729abdb3f7
4,597
[ 451567660 ]
[ "test" ]
defmodule Wordual.RowTest do use ExUnit.Case import Wordual.Test.Support.Factories alias Wordual.Row alias Wordual.Tile describe "init/0" do test "it creates a row" do result = Row.init() assert result.current_tile == 0 assert result.tiles == [Tile.init(), Tile.init(), Tile.init(), Ti...
0af00da50fa9e203166d103d0d851f9f0a2396b0
1,507
[ 248702688 ]
[ "test" ]
defmodule Stripy.CustomerTest do use Stripy.StripeCase, async: true test "is creatable" do assert {:ok, %Stripe.Customer{}} = Stripe.Customer.create(%{}) assert_stripe_requested(:post, "/v1/customers") end test "is retrievable" do assert {:ok, %Stripe.Customer{}} = Stripe.Customer.retrieve("cus_12...
0af0258f7544ffaba918ca4a63397a15ab318790
6,443
[ 785177129 ]
[ "typespec", "documented", "ecto" ]
defmodule ChatApi.Customers do @moduledoc """ The Customers context. """ import Ecto.Query, warn: false alias ChatApi.Repo alias ChatApi.Customers.Customer alias ChatApi.Tags.CustomerTag @spec list_customers(binary()) :: [Customer.t()] @doc """ Returns the list of customers. ## Examples ...
0af0458c3f594c0d621baf791b8cc728a0bc0baf
3,766
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.ServiceNetworking.V1.Model.Api do @moduledoc """ Api is a light-weight descriptor for an API Interface. Interfaces are also described as "protocol buffer services" in some contexts, such as by the "service" keyword in a .proto file, but they are different from API Services, which represent a con...
0af06e1a7e421b91dd956b0c3caec3f04c8cd082
2,632
[ 192653852 ]
[ "ecto" ]
defmodule OOTPUtility.Imports.Games.Game do alias OOTPUtility.Imports use OOTPUtility.Imports, from: "games", headers: [ {:game_id, :id}, {:game_type, :type}, {:home_team, :home_team_id}, {:away_team, :away_team_id}, {:runs0, :away_team_runs}, {:runs1, :home_team_runs}, ...
0af0c9a5d05c8d8635658b30f3afc392dd09fd4f
5,565
[ 802933855 ]
[]
%{ "castore": {:hex, :castore, "1.0.7", "b651241514e5f6956028147fe6637f7ac13802537e895a724f90bf3e36ddd1dd", [:mix], [], "hexpm", "da7785a4b0d2a021cd1292a60875a784b6caef71e76bf4917bdee1f390455cf5"}, "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769"...
0af16823781b4f2ac11f72a1504bb88b4af01cbf
2,345
[ 434058815 ]
[]
defmodule Util do def hexa do %{ "0" => [0, 0, 0, 0], "1" => [0, 0, 0, 1], "2" => [0, 0, 1, 0], "3" => [0, 0, 1, 1], "4" => [0, 1, 0, 0], "5" => [0, 1, 0, 1], "6" => [0, 1, 1, 0], "7" => [0, 1, 1, 1], "8" => [1, 0, 0, 0], "9" => [1, 0, 0, 1], "A" =...
0af1d6b34f11f723bfe8c87d468690fcb1cc917a
4,247
[ 320693528 ]
[]
defmodule Advent.Day11.SeatingSystem do def occupied_seats_at_stable(input, in_vision \\ false) do input = input |> parse_input() input |> Enum.reduce_while({input, ""}, fn (_input, {input, hash}) -> ticked = input |> tick(in_vision) hashed = ticked |> Enum.jo...
0af21ac7382e7f8d4598abf4629b651cc647d956
1,967
[ 725933719 ]
[]
defmodule Day1 do def part1 do input() |> Stream.map(fn code -> ints = code |> String.trim() |> String.to_charlist() |> Enum.reject(& &1 in ?a..?z) [List.first(ints), List.last(ints)] |> to_string() |> String.to_integer() end) |> Enum.sum() en...
0af29cdc005245ba36653455dc100d95cdb3fcde
2,420
[ 810423033 ]
[]
defmodule Jalka2022.MixProject do use Mix.Project def project do [ app: :jalka2022, version: "0.1.0", elixir: "~> 1.14.1", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), ...
0af2f2e7a6e1d668d6a61574531f266754796d76
2,260
[ 129426758 ]
[ "typespec", "documented" ]
defmodule Delta.Messenger do require Logger require ALog @type call_options :: [mu_call_id_trail: String.t(), mu_session_id: String.t()] @moduledoc """ Sends constructed messages to all interested clients. """ @spec inform_clients(Delta.Message.t(), call_options) :: :ok def inform_clients(message, opt...
0af32ceb2750a68a0004e25f874aabe4fe2d2398
4,782
[ 119747156 ]
[ "liveview" ]
defmodule NervesHubWeb.Components.DeviceHeader do use NervesHubWeb, :component alias NervesHub.Devices attr(:org, :any) attr(:product, :any) attr(:device, :any) attr(:device_connection, :any) def render(assigns) do ~H""" <h1 class="ff-m mt-2 mb-2">{@device.identifier}</h1> <%= if @device.d...
0af3d18072c1ef1b4c46debaf0142551d5377dcd
4,207
[ 638863870 ]
[ "liveview", "test" ]
defmodule BrightWeb.NotificationLive.SkillUpdateTest do use BrightWeb.ConnCase import Phoenix.LiveViewTest setup [:register_and_log_in_user] describe "render page" do test "renders page", %{conn: conn, user: user} do {:ok, _lv, html} = live(conn, ~p"/notifications/skill_updates") assert html...
0af3ded0307887f99f9a208ede325c89b3e82dc7
2,739
[ 229052095 ]
[]
# 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. # General application configuration use Mix.Config config :elixir, :time_zone_database, Tzdata.Time...
0af3eef3d49fb11ed12b47089788bad328159675
1,803
[ 480917740 ]
[ "test" ]
defmodule QueueTest do use ExUnit.Case doctest Queue doctest Queue.Collection doctest Queue.ReverseCollection if Application.compile_env(:elixir_queue, :implement_enumerable, true) == true do describe "Queue implements Enumerable" do test "to_list" do assert [1, 2, 3, 4, 5] == Enum.to_list(...
0af400d97570240065455930e7f9cff85fa7363d
1,918
[ 974362253 ]
[ "test", "ecto" ]
defmodule ElixirNotesApp.NotesTest do use ElixirNotesApp.DataCase alias ElixirNotesApp.Notes describe "notes" do alias ElixirNotesApp.Notes.Note import ElixirNotesApp.NotesFixtures @invalid_attrs %{title: nil, content: nil} test "list_notes/0 returns all notes" do note = note_fixture() ...
0af45078833543a0234f7a0156f04dfa65a032d3
5,860
[ 455872535 ]
[ "typespec", "documented", "ecto" ]
defmodule Explorer.Chain.Import.Runner.Addresses do @moduledoc """ Bulk imports `t:Explorer.Chain.Address.t/0`. """ require Ecto.Query alias Ecto.{Multi, Repo} alias Explorer.Chain.{Address, Hash, Import, Transaction} alias Explorer.Chain.Import.Runner import Ecto.Query, only: [from: 2] @behaviour...
0af4912a2707561d9d01edfac7403aa74519fce2
2,339
[ 844332486 ]
[ "test", "ecto" ]
defmodule FirmSync.BoardsTest do use FirmSync.DataCase alias FirmSync.Boards describe "boards" do alias FirmSync.Boards.Board import FirmSync.BoardsFixtures @invalid_attrs %{name: nil, boardType: nil, manufacturer: nil, mac_address: nil} test "list_boards/0 returns all boards" do board ...
0af503dd42ebdac31074fb4da07d900f949a59e4
4,803
[ 929182713 ]
[ "typespec" ]
{:ok, content} = File.read("example.json") {:ok, json} = JSON.decode(content) names = json |> Enum.map(& &1["first"]) IO.puts(names) IO.puts(json |> Enum.map(& &1["first"])) # erljson = :json.decode(content) IO.puts(:json.decode(content) |> Enum.map(& &1["first"])) IO.puts(inspect(Enum.at(:json.decode(content), 0))) ...
0af5b3f2ff2d59168f7528824567197f971dbf0d
8,658
[ 100941452 ]
[ "test" ]
defmodule Toggly.StrategiesTest do use ExUnit.Case alias Toggly.Features.Strategies defmodule TestNeverAppliesStrategy do @behaviour Strategies.ActivationStrategy def name(), do: "Test1" def parameters(), do: %{} def applies_to?(_request) do false end def matches?(_request, _) do...
0af6273371bbb8fd8afd7bb18c646f3c44ed9118
2,344
[ 34638796, 36077338, 34568272 ]
[]
defmodule Ejabberd.Mixfile do use Mix.Project def project do [app: :ejabberd, version: "15.03.0", elixir: "~> 1.0", elixirc_paths: ["lib"], compile_path: ".", compilers: [:asn1] ++ Mix.compilers, erlc_options: erlc_options, erlc_paths: ["asn1", "src"], deps: deps] end ...
0af67c884928936125f6a644e42150302f2ddb93
2,470
[ 638633985 ]
[ "documented" ]
defmodule Strings do @moduledoc """ Documentation for `Strings`. """ @doc """ ## Purpose - Trims whitespace from a given string. ## Parameters - value: a string containing whitespace. ## Examples -iex> Strings.trim_string(" Hello World ") => "Hello World" """ def trim_string(value) d...
0af686ff3dca1df6a5da7d48bd93ed1729689b79
9,425
[ 65307188 ]
[ "typespec", "documented" ]
defmodule Fastimage.Stream do @moduledoc false alias Fastimage.Stream.Acc alias Fastimage.{Error, Utils} @file_chunk_size 500 @binary_chunk_size 500 defmodule Acc do @moduledoc false alias __MODULE__ @default_stream_timeout 3_000 @default_max_error_retries 5 @default_max_redirect_retrie...
0af6949ddc513665da208796501d9e8afcd292ee
11,137
[ 362678555 ]
[]
%{ "argon2_elixir": {:hex, :argon2_elixir, "2.4.0", "2a22ea06e979f524c53b42b598fc6ba38cdcbc977a155e33e057732cfb1fb311", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "4ea82e183cf8e7f66da...
0af6aba38985baea2ef9fe31cd4b0cad3f4a4c67
5,092
[ 1002277727 ]
[ "documented" ]
defmodule AiSelfSustainingMinimal.TelemetryPipeline.OtlpDataPipelineReactor do @moduledoc """ High-throughput OpenTelemetry data processing pipeline using Reactor. Processes telemetry data through configurable stages: 1. Ingestion from multiple sources (OTLP, HTTP, file) 2. Validation and parsing 3. Enri...
0af71d2248eb36bc508a536a6b033633d303101e
17,118
[ 974171368 ]
[ "typespec", "documented" ]
defmodule HOL.Terms do @moduledoc """ This module gives functions for creating terms, applications and abstractions. ## Examples iex> var_x = HOL.Data.mk_free_var("x", mk_type(:i)) iex> const_f = HOL.Data.mk_const("f", mk_type(:i, [mk_type(:i)])) iex> application = mk_appl_term(mk_term(const_f...
0af71de7c9a2240c6c2e7f3300049c97a393fd72
2,029
[ 563013159 ]
[ "typespec", "documented" ]
defmodule Blogo.Authors do @moduledoc """ Author context """ alias Blogo.Authors.AuthorQueries alias Blogo.{Author, Repo} alias Faker.DateTime @doc """ Get an author by id. """ @spec get(binary()) :: Author.t() | nil def get(id), do: Repo.get(Author, id) @type author_query_params :: %{ ...
0af72c33ba362e85533d1fbbd570cf2ece8c4a82
2,072
[ 162383211 ]
[ "phoenix" ]
defmodule ApiWeb.V1.FacilityGroupController do use ApiWeb, :controller alias Data.{ Contexts.FacilityGroupContext, Contexts.ValidationContext, Contexts.UtilityContext } alias ApiWeb.{ FacilityGroupView, ErrorView } def get_facility_groups(conn, params) when is_map(params) do :searc...
0af73136c54bcac4feab9232034ec484a9f431dd
13,098
[ 53535974 ]
[ "genserver", "documented" ]
defmodule Exq.Manager.Server do @moduledoc """ The Manager module is the main orchestrator for the system It is also the entry point Pid process used by the client to interact with the Exq system. It's responsibilities include: * Handle interaction with client and delegate to responsible sub-system ...
0af73667dcafa5adeaa60fccfca34b56d3e401a3
2,060
[ 297389399 ]
[ "documented" ]
defmodule Phoenix.LiveDashboard.ProcessesPage do @moduledoc false use Phoenix.LiveDashboard.PageBuilder alias Phoenix.LiveDashboard.SystemInfo @table_id :table @menu_text "Processes" @impl true def render_page(_assigns) do table( columns: columns(), id: @table_id, row_attrs: &row_...
0af782454cdea2adfedf1c686813b4ddb8b58b6b
3,105
[ 272767175 ]
[]
%{ "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"}, "db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd36893...
0af7e309172ec0ca3e66f17b4d5d260a8cda6685
1,953
[ 770097397 ]
[ "liveview" ]
defmodule LiveViewStudioWeb.AthletesLive do use LiveViewStudioWeb, :live_view alias LiveViewStudio.Athletes def mount(_params, _session, socket) do socket = assign(socket, filter: %{sport: "", status: ""}, athletes: Athletes.list_athletes() ) {:ok, socket, temporary_assigns:...
0af7e328e5547b4e0b3325938d17a7a0a00d3d86
2,333
[ 119819912 ]
[ "phoenix" ]
defmodule Cmsv1.InactivityController do use Cmsv1.Web, :controller alias Cmsv1.Inactivity def index(conn, _params) do reasons = Repo.all(Inactivity) render(conn, "index.html", reasons: reasons) end def new(conn, _params) do changeset = Inactivity.changeset(%Inactivity{}) render(conn, "new.h...
0af84cde1911a0285d030f75fd652c8240241f08
1,762
[ 880476081 ]
[ "macro", "documented" ]
defmodule ULID.Extension do @moduledoc """ This ULID Postgrex.Extension was made for use with: https://github.com/andrielfn/pg-ulid `h Postgrex.Extension` for more information """ @behaviour Postgrex.Extension @impl true def init(opts) do Keyword.get(opts, :decode_copy, :copy) end @impl true ...
0af873f55584adaf4780adc1f3b36b9dd2de50cf
2,489
[ 508105110 ]
[ "documented" ]
defmodule FennecPrecompile.Config do @moduledoc false # This is an internal struct to represent valid config options. defstruct [ :app, :version, :base_url, :nif_filename, :nif_version, :force_build, :force_build_args, :force_build_using_zig, :targets ] @default_targets_m...
0af8aa298fcc15c8f763ea9d01e1697728a72d7a
1,586
[ 127486472 ]
[ "phoenix" ]
defmodule TravelpalWeb.UserController do use TravelpalWeb, :controller alias Travelpal.Users alias Travelpal.Users.User alias Travelpal.Email alias Travelpal.Mailer action_fallback TravelpalWeb.FallbackController def index(conn, _params) do users = Users.list_users() render(conn, "index.json", ...
0af8dacb7c88cbc897f2d76f3d96867e339c217c
2,142
[ 591436677 ]
[ "documented", "ecto" ]
defmodule LiveViewStudio.Boats do @moduledoc """ The Boats context. """ import Ecto.Query, warn: false alias LiveViewStudio.Repo alias LiveViewStudio.Boats.Boat @doc """ Returns the list of boats. ## Examples iex> list_boats() [%Boat{}, ...] """ def list_boats do Repo.all(Boa...
0af8fc9fb93db780f85e95d8fca520fd9f8deb7c
6,519
[ 416259673, 415908578 ]
[ "typespec" ]
defmodule Surface.Compiler.Helpers do alias Surface.AST alias Surface.Compiler.CompileMeta alias Surface.IOHelper @builtin_common_assigns [ :socket, :flash, :__context__, :__surface__ ] @builtin_component_assigns [:inner_block] ++ @builtin_common_assigns @builtin_live_component_assigns ...
0af9959b770477a598e1e9ca3a13b4f103559da9
2,640
[ 905416889 ]
[ "liveview", "ecto" ]
defmodule AllyourgymWeb.ExerciseLive.FormComponent do use AllyourgymWeb, :live_component alias Allyourgym.Fitness @impl true def render(assigns) do ~H""" <div> <.header> {@title} <:subtitle>Use this form to manage exercise records in your database.</:subtitle> </.header> ...
0af9a3d81b1c9240e29adb9f177f169ae30025f3
2,308
[ 223896113 ]
[ "macro", "documented", "ecto" ]
defmodule Ares do @moduledoc """ Ares is a simple Data Moddler, where you can generate dynamic models. """ def gen_schema(module, table, fields) do Module.create(module, quote do use Ecto.Schema schema unquote(table) do unquote(for {name, type} <- fields do quote do ...
0af9fb6a13b4290f2138ea94ce93d1987a06ffe9
1,500
[ 896664060 ]
[]
defmodule Solution do require Integer def blink(_stone, 0, count, cache), do: {count, cache} def blink(0, times, count, cache), do: blink(1, times - 1, count, cache) def blink(1, times, count, cache), do: blink(2024, times - 1, count, cache) def blink(stone, times, count, cache) do cached_count = Map.ge...
0afa105c9b6e13a158743cdcbe6f27d1a4636487
5,681
[ 563474993 ]
[]
defmodule Player.Impl do def update(player = %{update_callback: nil}), do: player def update(player = %{update_callback: update}) do update.(player) player end def handle_shoot(player, %{"x" => x, "y" => y}) do handle_shoot(player, %{x: x, y: y}) end def handle_shoot(player, %{x: x, y: y}) do ...
0afa97946069f0d703c14998a7ecb4729770c61a
1,723
[ 470851241 ]
[]
# 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 :apielx, ecto_repos: [Apielx.Repo], genera...
0afad5b04ee8d00ec43c364431ac02ccb3269c1e
1,576
[ 189564155 ]
[ "documented", "ecto" ]
defmodule Webapp.Accounts.Team do use Ecto.Schema import Ecto.Changeset alias Webapp.{ Accounts.Member, Machines.Machine } schema "teams" do field(:name, :string) field(:namespace, :string) has_many(:members, Member, on_delete: :delete_all) has_many(:users, through: [:members, :user]...
0afaf34392855f29bb18ad789aef6f3f784efa06
1,840
[ 187670264 ]
[ "phoenix" ]
defmodule AlbumTagsWeb.AppleMusicView do use AlbumTagsWeb, :view alias Jason def render("index.json", %{albums: apple_data}) do results = apple_data |> Jason.decode! |> Map.get("results") case results do %{"albums" => _} -> %{albums: results |> Map.get("albums") ...
0afb5c3b1fad1b4b9a15439fc25c675fd4e5998c
5,811
[ 116592609 ]
[ "test" ]
defmodule ActionTest do use ExUnit.Case alias JassLogic.Action alias JassLogic.{Globals, Card, Group, Game, Wys, GameState} @initial_state %GameState{cards: %{"pl1" => [%Card{color: "hearts", number: "jack"}, %Card{color: "spades", number: "jack"}, %Card{color: "spades", number: "king"}, %Card{color: ...
0afb803d1c0a74c950279a5f012912c91318e454
11,175
[ 248702688 ]
[ "test", "ecto" ]
defmodule Core.Services.BusinessTotalRevenueTest do use Core.DataCase alias Core.{ Repo, Services, Services.BusinessTotalRevenue } describe "business_total_revenues by role's Tp" do test "requires name and business_tax_return_id via role's Tp" do changeset = BusinessTotalRevenue.changese...
0afb95d1c38399656967070edf2d0deec05ca2d4
8,131
[ 80419236 ]
[ "typespec", "macro", "documented" ]
defmodule Jack.Builder do @moduledoc """ Conveniences for building jacks. This module can be `use`-d into a module in order to build a jack pipeline: defmodule MyApp do use Jack.Builder jack Jack.Logger jack :hello, upper: true # A function from another module can be ja...
0afc59ac3cc8f364e0a3325a511454883c254ee4
1,936
[ 171053300 ]
[]
defmodule Publit.MessageApiMock do @resp %HTTPoison.Response{body: "{\"success\":true,\"id\":\"58e24ae3a4f92943d0fd4e2f\"}", headers: [{"Content-Type", "application/json; charset=utf-8"}, {"Date", "Mon, 03 Apr 2017 13:15:15 GMT"}, {"Server", "nginx/1.8.0"}, {"Vary", "Accept-Encoding"}, {"Content-Length", "4...
0afc959aec1f26a171ef6f4599d459cc4d109fad
2,068
[ 605203314 ]
[ "liveview", "test" ]
defmodule GarrulusWeb.UserConfirmationLiveTest do use GarrulusWeb.ConnCase import Phoenix.LiveViewTest import Garrulus.AccountsFixtures alias Garrulus.Accounts alias Garrulus.Repo setup do %{user: user_fixture()} end describe "Confirm user" do test "renders confirmation page", %{conn: conn} ...
0afcb3c7b6515dd4fedde292ecbc2727e1345323
15,765
[ 756929967 ]
[ "test" ]
defmodule AddStruct do defstruct lhs: 0, rhs: 0, loc: {1, 1} end defmodule AddException do defexception message: "", loc: {1, 1} end defmodule AddRecord do import Record defrecord :record, lhs: 1, rhs: 2 end defmodule NewtypeRecord do import Record defrecord :newtype, a: 1 end defmodule TupleStructRecor...
0afd0bb7b820d6635c9c678c769dab417ed2945c
1,658
[ 1018261319 ]
[ "liveview", "phoenix" ]
defmodule NvivoWeb.Endpoint do use Phoenix.Endpoint, otp_app: :nvivo # 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: "_nvivo_key", ...
0afd0f7beb841ab25b0ce5234af11a59dc20c13d
17,464
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DFAReporting.V33.Api.AccountUserProfiles do @moduledoc """ API calls for all endpoints tagged `AccountUserProfiles`. """ alias GoogleApi.DFAReporting.V33.Connection alias GoogleApi.Gax.{Request, Response} @library_version Mix.Project.config() |> Keyword.get(:version, "") @doc """ ...
0afd71374ee6abd2e07a6d849d5319d27217f2f1
2,212
[ 60778080 ]
[ "phoenix" ]
# 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 config :academy, ecto_repos: [Academy.Repo] # Configures the endpoint config :academ...
0afdb9f6fa34eabc890605d0f339f9fd6061b47b
2,102
[ 760153692 ]
[ "genserver", "liveview" ]
defmodule LiveViewStudioWeb.PresenceLive do use LiveViewStudioWeb, :live_view alias LiveViewStudioWeb.Presence alias Phoenix.LiveView.JS @topic "users:video" def mount(_params, _session, socket) do if connected?(socket) do :ok = Presence.subscribe(@topic) {:ok, _ref} = Presence.tra...
0afe238bfc7f4c583b7ef6bad154a8faa3e75d63
1,798
[ 161179495 ]
[]
# https://www.decentlab.com/products/tipping-bucket-rain-gauge-for-lorawan defmodule Parser do use Platform.Parsing.Behaviour # device-specific parameters defp resolution(), do: 0.1 ## test payloads # 0202f8000300040258409a00000c54 # 0202f800020c54 def fields do [ %{field: "precipitatio...
0afe538b980c4fd98bb86770ffba07c3dbeca16b
3,043
[ 839851232 ]
[]
%{ "certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"}, "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [...
0afe53beb11e64093dd2c8b317844f8948a8f43e
1,718
[ 69807120 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule AuditApi.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use AuditApi.Web, :controller use AuditApi.Web, :view The definitions below will be executed for every view, controller, etc, so keep them ...
0afe6f6f593fe7ea00fc5792893f77ee5d641661
5,684
[ 192407200 ]
[ "test", "liveview" ]
defmodule AndiWeb.IngestionLiveView.FinalizeFormTest do use ExUnit.Case use Andi.DataCase use AndiWeb.Test.AuthConnCase.IntegrationCase use Placebo import Checkov import Phoenix.LiveViewTest import SmartCity.Event, only: [ingestion_update: 0, dataset_update: 0] import SmartCity.TestHelper, only: [event...
0afefe0af8aaf0bdaacd55fe98e3d4eb3978fea2
1,692
[ 455551254 ]
[]
defmodule DbInfoHelpers do import Phoenix.HTML import Phoenix.HTML.Link import Phoenix.HTML.Tag def pagination_text(list) do ~e""" <span class="tag is-info is-large">Displaying <%= list.first %>-<%= list.last %> of <%= list.count %></span> """ end def pagination_links(conn, list, route, shema)...
0aff4c45b39b9b86178de11f5f7c77cc7f98a681
4,079
[ 187397665 ]
[ "typespec", "ecto" ]
defmodule TimeManager.Manager.Task do use Ecto.Schema import Ecto.Query import Ecto.Changeset import TimeManager.Utils alias TimeManager.Repo alias TimeManager.Manager.Task schema "tasks" do field :title, :string field :color, :string field :priority, :integer field :date_completed, :na...
0aff837f188fa6b12cf4f8d1664fcd98195e9854
2,478
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Genomics.V1.Model.Pipeline do @moduledoc """ Specifies a series of actions to execute, expressed as Docker containers. ## Attributes * `actions` (*type:* `list(GoogleApi.Genomics.V1.Model.Action.t)`, *default:* `nil`) - The list of actions to execute, in the order they are specified. *...
0b0016c003c653f5c58a44738871bb7eca54a572
2,642
[ 328194918 ]
[ "phoenix" ]
defmodule LemonadeWeb.Router do use LemonadeWeb, :router import LemonadeWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {LemonadeWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers ...
0b0029a56258e5ac86a17e070db22b1dec35916d
2,501
[ 819518083 ]
[ "typespec", "documented" ]
defmodule ExAxos.Schema.ApproveTab do @moduledoc """ Provides struct and type for a Schema.ApproveTab """ @type t :: %__MODULE__{ anchorIgnoreIfNotPresent: String.t() | nil, anchorString: String.t() | nil, anchorUnits: String.t() | nil, anchorXOffset: String.t() | nil, ...
0b006333215c10ddb13e1454d5205e54f19ad246
4,275
[ 646602385 ]
[ "typespec", "documented" ]
defmodule Klife.Record do @moduledoc """ Kafka record representation. Represents a Kafka record struct that will be used in the `Klife.Client` APIs. In general terms it can be used to represent input or output data. As an input the `Klife.Record` may have the following attributes: - `:value` (required) ...
0b0074001bc1319a128480241aa61a1d5394d4d6
4,752
[ 334387837, 808443482 ]
[ "typespec", "documented", "ecto" ]
defmodule Teiserver.Telemetry.ComplexServerEventTypeLib do @moduledoc false use TeiserverWeb, :library_newform alias Teiserver.Telemetry.{ComplexServerEventType, ComplexServerEventTypeQueries} # Helper function @spec get_or_add_complex_server_event_type(String.t()) :: non_neg_integer() def get_or_add_compl...
0b00ba1e163854ad2f22c55d77bbf2f659205d9b
1,730
[ 672906167 ]
[ "phoenix", "ecto" ]
defmodule MentorioWeb.SubjectController do use MentorioWeb, :controller alias Mentorio.Study alias Mentorio.Study.Subject def index(conn, _params) do # subjects = Study.list_subjects() render(conn, :index, subjects: []) end def new(conn, _params) do changeset = Study.change_subject(%Subject{}...
0b00d6bff2ea974f60513b35c892f9f034858b97
7,691
[ 913981294 ]
[ "liveview", "documented" ]
defmodule SoundboardWeb.Components.Layouts.Navbar do @moduledoc """ The navbar component. """ use Phoenix.LiveComponent use SoundboardWeb, :html @impl true def mount(socket) do {:ok, assign(socket, :show_mobile_menu, false)} end @impl true def handle_event("toggle-mobile-menu", _, socket) do ...
0b010a255cd8d66fb3348cf440a0b258c2f2fac5
6,451
[ 147209893 ]
[ "test" ]
defmodule Hui.HttpTest do use ExUnit.Case, async: true import Fixtures.Update import Hui.Http import Mox alias Hui.Http alias Hui.Http.Client.Mock, as: ClientMock alias Hui.Query describe "get/3" do setup do ClientMock |> stub(:handle_response, fn resp, _req -> resp end) %{url: "http...
0b0178e881992553be202cb4df0fdcac146b393c
6,584
[ 963338593 ]
[ "liveview" ]
defmodule CursorAtsWeb.Components.Layouts.Dashboard do use Phoenix.Component import CursorAtsWeb.CoreComponents import CursorAtsWeb.Gettext def dashboard(assigns) do ~H""" <div class="min-h-screen bg-gray-50 flex"> <!-- Sidebar --> <div class="hidden md:flex md:w-64 md:flex-col"> <d...
0b018e22ce1a1d542a62f47793edccc14277cc66
1,577
[ 927305802 ]
[]
# This file is responsible for configuring your umbrella # and **all applications** and their dependencies with the # help of the Config module. # # Note that all applications in your umbrella share the # same configuration and dependencies, which is why they # all use the same configuration file. If you want different...
0b01e759311677d5647dbea1c5027377e5853a0e
2,507
[ 179240038 ]
[]
defmodule ImconWeb.MessageChannel do use ImconWeb, :channel alias Imcon.Chat alias Imcon.Chat.{Message, Channel} alias ImconWeb.{MessageService, MessageView, UnreadService, EventChannel, ChannelUserService} @default_history_count 100 # TODO: Authorization should be added, users can only join some chann...
0b023e22c7a713248e1bcb443aae2a8036adf1b5
2,212
[ 640505848 ]
[ "ecto" ]
defmodule Pt.Entry do import Ecto.Changeset alias Pt.{Category, Repo} use Pt, :schema import Ecto.Query, only: [from: 2] alias __MODULE__ @derive {Jason.Encoder, only: [:id, :amount, :title, :currency, :inserted_at]} schema "entries" do field(:amount, :integer) field(:title, :string) field(:...
0b0265f1e89a32de3ddd10d209b150a37a4af78a
1,555
[ 646256327 ]
[ "test" ]
defmodule PawnsAttacksTest do use ExUnit.Case import Bitwise setup_all do {white_table, black_table} = PawnsAttacks.table() {:ok, white_table: white_table, black_table: black_table} end # a8 b8 c8 d8 e8 f8 g8 h8 56 57 58 59 60 61 62 63 # a7 b7 c7 d7 e7 f7 g7 h7 48 49 50 51 52 53 54 55 ...
0b031643dde2266a660b00bf661b3d672c325a98
7,200
[ 562531501 ]
[ "test", "liveview" ]
defmodule Mix.LiveViewNative.CodeGenTest do use ExUnit.Case import Mix.LiveViewNative.Context, only: [ compile_string: 1, last?: 2 ] import Mix.LiveViewNative.CodeGen, only: [ build_patch: 2 ] alias Mix.LiveViewNative.CodeGen alias Sourceror.Zipper describe "patch" do test "inject be...
0b032006a3c3c8dc1ea0c4dd34a8a59431446d4a
2,544
[ 657799110, 679652486, 725959680, 541841921 ]
[ "documented" ]
defmodule Credo.Check.Refactor.NegatedConditionsWithElse do use Credo.Check, id: "EX4019", base_priority: :high, explanations: [ check: """ An `if` block with a negated condition should not contain an else block. So while this is fine: if not allowed? do raise "No...
0b0335b078d2190a8d8797906492037a7f898e3f
2,309
[ 184216447 ]
[ "test", "ecto" ]
defmodule Prototype.MachineTest do use Prototype.DataCase alias Prototype.Machine describe "customers" do alias Prototype.Machine.Customer @valid_attrs %{description: "some description", name: "some name"} @update_attrs %{description: "some updated description", name: "some updated name"} @inva...
0b0372f36eaae23e198b4279f85f81768e9e591c
11,562
[ 367292607 ]
[]
# 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: # # PfLive.Repo.insert!(%PfLive.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will f...
0b0395ef134a1ac7e4b3fb2a88303e50fde9258b
2,284
[ 686868352 ]
[ "phoenix" ]
defmodule Hunt.Activity.Selfie2 do use HuntWeb, :verified_routes use HuntWeb, :html def title do "Selfies with HubSpot Influencers" end def image do %{ src: ~p"/images/selfie-2.jpeg", class: "object-top" } end def total_points do activity_sum = activities() |> Enum.map(& &1....
0b04b034c7828efa2c161466b71aebb57ad7e8ff
2,955
[ 112801550 ]
[ "test" ]
defmodule AdventOfCode do def main_timed do {time, _} = :timer.tc(AdventOfCode, :main, []) milliseconds = time / 1000 IO.puts("Time: #{milliseconds} milliseconds") end def main do IO.puts("Day 07") file_path = "07.test" # file_path = "07.input" lines = file_path |> read_i...
0b057f7a659bcf2a7c243624347e878f02fe748f
8,238
[ 916484661 ]
[ "liveview" ]
#......................................................... Purpose ........................................................... # To chose and show a dynamic value from a range of values; # .................... Render the component .................... # Copy this to where you want to use it: # ...
0b05f3ece586c3c2cef4e9e5be3bf0e7b4549255
4,299
[ 243295103 ]
[ "typespec", "macro", "documented" ]
defmodule VBT.Credo.ModulePartExtractor do @moduledoc false @type module_part :: :moduledoc | :shortdoc | :behaviour | :use | :import | :alias | :require | :module_attribute | :defstruct | :opaque | :type ...
0b06128a41b0697f5c85da470620634eafc7e38a
1,755
[ 934490999 ]
[]
defmodule Realworld.Profiles.Follow do use Ash.Resource, data_layer: AshSqlite.DataLayer, authorizers: [Ash.Policy.Authorizer], domain: Realworld.Profiles sqlite do table "follow" repo Realworld.Repo end attributes do uuid_primary_key :id create_timestamp :created_at end rela...
0b0719084faccaa3e85a466e0bb8117276b004fc
2,990
[ 470453569 ]
[ "typespec", "documented", "ecto" ]
defmodule Mindful.Mailers.Email do @moduledoc """ Mindful.Mailers.Email module """ use Bamboo.Phoenix, view: MindfulWeb.EmailView @sender_name "Mindful Care" @billing "<EMAIL>" def confirmation_instructions(user, url) do user |> base_email() |> from({@sender_name, "<EMAIL>"}) |> subject...
0b072d2071dc70a2ef45fc4e49a8a1d7feba860a
8,524
[ 245405090 ]
[ "genserver" ]
defmodule PoloniexBroadcaster do use GenStage require Logger def start_link() do GenStage.start_link(__MODULE__, :ok, name: __MODULE__) end def sync_notify(event, timeout \\ 5000) do GenStage.call(__MODULE__, {:notify, event}, timeout) end @impl true def init(:ok) do hostname = ...
0b0768bdf108d13d9423c9dc174bb9220cfd90b1
1,860
[ 372304592 ]
[]
defmodule Mastery.Boundary.TemplateValidator do import Mastery.Boundary.Validator def errors(fields) when is_list(fields) do fields = Map.new(fields) [ ] |> require(fields, :name, &validate_name/1) |> require(fields, :category, &validate_name/1) |> optional(fields, :instructions, &validate_inst...
0b0775b804a25bcf0c9f2893f1e16184aca98414
11,945
[ 114043693 ]
[ "documented" ]
defmodule Monocle.Inline do @moduledoc """ Match and render inline sequences, passing each to the renderer. """ alias Monocle.Error alias Monocle.Helpers.LinkParser import Monocle.Helpers import Monocle.Helpers.StringHelpers, only: [behead: 2] import Monocle.Helpers.HtmlHelpers, only: [augment_ta...
0b07c7e6375ea9545e29701745462dc8b226ac44
2,909
[ 206623246 ]
[ "test" ]
defmodule FootballResults.SchemaTest do use ExUnit.Case, async: true doctest FootballResults.Schema import FootballResults.Support.Http import FootballResults.Guardian, only: [encode_and_sign: 3] test "should query seasons in the schema" do query = """ query { seasons { edges { ...
0b0830c8798b126d9890dee0b2992bd2cc757339
1,510
[ 155024547 ]
[ "test" ]
defmodule Rikrok.MatrixTest do use ExUnit.Case setup do matrix = Tensor.Matrix.new( [ [1, 2, 3, 4], [11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34] ], 4, 4 ) {:ok, matrix: matrix} end describe "sub_matrix" do ...
0b089ca489892a45801c94a25a6645c7efad2f52
1,884
[ 82238227 ]
[ "phoenix" ]
defmodule Teaminterface.RoundController do use Teaminterface.Web, :controller alias Teaminterface.Round plug :scrub_params, "round" when action in [:create, :update] def index(conn, _params) do rounds = Repo.all(Round) render(conn, "index.html", rounds: rounds) end def new(conn, _params) do ...
0b08ae76def7d2f954c0f59a6ad236faa48990d8
1,685
[ 46932258 ]
[ "test", "documented", "ecto" ]
defmodule Registrations.Integration.Invitations do @moduledoc false use RegistrationsWeb.ConnCase use Registrations.SwooshHelper use Registrations.SetAdventure, adventure: "clandestine-rendezvous" use Hound.Helpers alias Hound.Helpers.Session alias Registrations.Pages.Details alias Registrations.Pages....
0b093694f0c088945227b668c6d7f74710f19273
2,433
[ 48593541 ]
[ "documented", "ecto" ]
defmodule Cortex.Thing do use Cortex.Web, :model schema "things" do field :firmware_name, :string field :code, :string field :series_code, :string timestamps end @required_fields ~w(firmware_name code) @optional_fields ~w(series_code) @doc """ Creates a changeset based on the `model` a...
0b09d6e0bfe5e2366c2c0c80be76cff9dec213d5
8,514
[ 666725776 ]
[]
%{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "castore": {:hex, :castore, "1.0.7", "b651241514e5f6956028147fe6637f7ac13802537e895a724f90bf3e36ddd1dd", [:mix], [], "hexpm"...
0b0a11c4afe401c5136ba64bdc3b9d70dca36091
2,015
[ 486888869, 602592842, 613790613, 544735529, 606162432, 837291337, 596619994, 622051467, 618178308, 607081968 ]
[]
defmodule Sntx.UserMailer do import Bamboo.SendGridHelper alias Sntx.Mailer @web_url Application.fetch_env!(:sntx, :web_url) def welcome(user) do Mailer.prepare(user.email) |> with_template("d-04f2eb84554441889374efb487bcffe9") |> add_dynamic_field("full_name", full_name(user)) |> add_dynamic...
0b0a1cc84af717fd95fd8ed171d809ed653b0930
1,783
[ 897590762 ]
[]
defmodule Parser do def call(filename) do filename |> File.read!() |> String.split("\n", trim: true) end end defmodule StringReplacer do @dot_char "." def call(input) do data = input |> Enum.map(&String.graphemes/1) |> Enum.flat_map(fn row -> row |> Enum.with_...