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
02c9e584ac626d922c3ac0c5e74fbff849c03eb0
5,788
[ 105800498, 79044379 ]
[ "genserver", "macro" ]
defmodule Volapi.Module2 do defmacro __using__(module_name) do quote bind_quoted: [module_name: module_name] do use GenServer import Volapi.Module @module_name module_name @before_compile Volapi.Module init_attrs() def start_link(opts \\ []) do {:ok, _pid} = GenServe...
02c9e5e1c5a2375b614194ef8bfbdbeab4aa717f
3,185
[ 618596235 ]
[ "liveview", "test" ]
defmodule ExperWeb.BookLiveTest do use ExperWeb.ConnCase import Phoenix.LiveViewTest import Exper.LibraryFixtures @create_attrs %{name: "some name"} @update_attrs %{name: "some updated name"} @invalid_attrs %{name: nil} defp create_book(_) do book = book_fixture() %{book: book} end describ...
02ca60c15569c631d07d3925f062e7f4f62eff82
4,153
[ 1018168705 ]
[ "test" ]
defmodule MockProvider.ChaosGeneratorTest do use ExUnit.Case, async: true alias MockProvider.ChaosGenerator describe "generate_random_phone/0" do test "generates phone number with correct format" do phone = ChaosGenerator.generate_random_phone() assert String.starts_with?(phone, "+1555") ...
02ca7ee29d9bc513f11a63c6c2ff0ea075d77538
6,891
[ 93435133 ]
[ "test" ]
defmodule AnnotatedStringTest do alias Annotations.AnnotatedString alias Annotations.Annotation alias Annotations.List use ExUnit.Case @sentence_string "first second third. fourth fifth sixth." def test_sentence(str \\ @sentence_string) do AnnotatedString.new(str) |>AnnotatedString.tag_all(~r/[.]/...
02caedc20b6593b7b14f217b8e6333848730c6cc
12,209
[ 670005691 ]
[]
%{ "castore": {:hex, :castore, "1.0.3", "7130ba6d24c8424014194676d608cb989f62ef8039efd50ff4b3f33286d06db8", [:mix], [], "hexpm", "680ab01ef5d15b161ed6a95449fac5c6b8f60055677a8e79acf01b27baa4390b"}, "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix],...
02caf2d6861413abd4748bb91adc85b9ade4d6be
1,852
[ 535293919 ]
[ "test", "ecto" ]
defmodule FlowTimer.BreaksTest do use FlowTimer.DataCase alias FlowTimer.Breaks describe "breaks" do alias FlowTimer.Breaks.Break import FlowTimer.BreaksFixtures @invalid_attrs %{finished_at: nil} test "list_breaks/0 returns all breaks" do break = break_fixture() assert Breaks.lis...
02caf9a588d50f5620e447b7f18f2e6a17758e38
2,068
[ 85517857 ]
[]
%{"certifi": {:hex, :certifi, "1.0.0", "1c787a85b1855ba354f0b8920392c19aa1d06b0ee1362f9141279620a5be2039", [:rebar3], []}, "distillery": {:hex, :distillery, "1.2.2", "d5a52920cbe2378c8a21dfc83b526b4225944b9dce7bf170fe5f5cddda81ffb3", [:mix], []}, "exjsx": {:hex, :exjsx, "3.2.1", "1bc5bf1e4fd249104178f0885030bcd75a4...
02cb19f04371137af42a491924a256e1bcbebef0
3,139
[ 86610609 ]
[ "test", "documented" ]
defmodule ConciergeSite.RouteSelectHelperTest do @moduledoc false use ExUnit.Case, async: true alias ConciergeSite.RouteSelectHelper test "render/2" do html = Phoenix.HTML.safe_to_string(RouteSelectHelper.render(:foo, :bar)) assert html =~ "<select class=\"form-control\" data-type=\"route...
02cb515deab19af48b50f09336e67b57466b1d63
1,722
[ 190499547 ]
[ "phoenix" ]
defmodule PhotogWeb.AlbumView do use PhotogWeb, :view alias PhotogWeb.AlbumView alias PhotogWeb.ImageView alias PhotogWeb.TagView def render("index.json", %{albums: albums}) do %{data: Enum.map(albums, &album_excerpt_to_map/1)} end def render("index_for_tags.json", %{albums: albums}) do %{data: ...
02ccde01907195e3f669fd12612aff33dd2f2a63
6,199
[ 12595601, 929962132, 1017179531, 1018310553, 979689738 ]
[ "documented" ]
defmodule ExCoveralls.Cobertura do @moduledoc """ Generate XML Cobertura output for results. """ alias ExCoveralls.Settings alias ExCoveralls.Stats @file_name "cobertura.xml" @doc """ Provides an entry point for the module. """ def execute(stats, options \\ []) do stats |> generate_xml(En...
02cd22cff7b872984ac33175dec786a251a6ee53
2,782
[ 100530505 ]
[ "genserver", "test" ]
defmodule GenPoller.StatelessTest do import TestHelper use ExUnit.Case, async: true defmodule TestPoller do use GenPoller.Stateless def handle_tick(args = [receiver]) do send(receiver, {:tick, args}) receive do resp -> resp end end end defmodule NoStartTestPoller do ...
02cd23682eec45f9140e80ee5eb563de5b0f7b51
3,278
[ 805616069 ]
[ "liveview", "documented" ]
defmodule CommonUI.Components.Dropdown do @moduledoc false use CommonUI, :component import CommonUI.Components.Button, only: [button: 1] import CommonUI.Components.Icon alias CommonUI.IDHelpers attr :id, :string attr :class, :any, default: nil slot :inner_block, required: true slot :trigger def...
02cd8640c9e49350ea27f6d408495f37f1f953b6
1,995
[ 367278931 ]
[ "documented" ]
defmodule Google.Cloud.Identitytoolkit.V2.AutoRetrievalInfo do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :app_signature_hash, 1, type: :string, json_name: "appSignatureHash" end defmodule Google.Cloud.Identitytoolkit.V2.StartMfaPhoneRequestInfo do @moduledoc fa...
02cd9859e301747c04c5ad1e50e00e0868da075b
1,539
[ 129493511 ]
[ "macro", "documented" ]
defmodule ElixirExtras.Fold do @doc """ Elixir Fold Comprehension. ## Examples iex> import ElixirExtras.Fold; fold {num, acc} <~ [1,2,3] do num + acc end 6 """ defmacro fold({:<~, _line, [{val, acc}, values]}, do: expression) do quote do Enum.reduce(unquote(values), fn unquote(val), unquote(a...
02cdaa26a86c7ced97ecde761658eca8b03dfa55
1,691
[ 513077845 ]
[ "phoenix" ]
defmodule LiveOperationsWeb.UserConfirmationController do use LiveOperationsWeb, :controller alias LiveOperations.Accounts def new(conn, _params) do render(conn, "new.html") end def create(conn, %{"user" => %{"email" => email}}) do if user = Accounts.get_user_by_email(email) do Accounts.deliv...
02cdbf7bdda00a6077870530f10bad7f27c40643
6,763
[ 830050847 ]
[ "documented", "ecto" ]
defmodule Rms.Order.Movement do use Ecto.Schema import Ecto.Changeset alias Rms.SystemUtilities.TariffLine @cast [ :commodity_id, :consignee_id, :station_code, :consigner_id, :batch_id, :consignment_date, :container_no, :dead_loco, :destin_station_id, :loco_id, :move...
02ce3f9769646db1a993ce67b3159faca88ecd7d
1,715
[ 84610656 ]
[ "test" ]
defmodule Learnathon.PersonControllerTest do use Learnathon.Web.ConnCase, async: true import Learnathon.Factory test "index/2 responds with all People." do people = [ insert(:person), insert(:person, %{name: "Phil", email: "<EMAIL>"}) ] response = get build_conn(), person_path(bu...
02ce5aaf934994997602ce4f3d38cf7231213966
4,439
[ 776960390 ]
[ "liveview" ]
defmodule SmtpAnnWeb.DnsblCheckLive do use SmtpAnnWeb, :live_view alias SmtpAnn.DnsblServers alias Phoenix.LiveView.AsyncResult attr :source, :string, required: true attr :result, :atom, required: true def result(assigns) do ~H""" <div :if={@result == :failed}> <div class="tooltip" data-tip=...
02cebf30ab7c8fe65920166e4db975c126536b97
3,162
[ 854838454 ]
[ "genserver" ]
defmodule Throttle.PortalQueue do use GenServer require Logger alias Throttle.OAuthManager @flush_interval 900 # Flush after 900 milliseconds @max_batch_size 100 # Flush if queue reaches 100 actions ## Client API def start_link(portal_id) do GenServer.start_link(__MODULE__, portal_id, name: v...
02cf704d5473f1f2c5100cc0dfb252e3e57d6fcd
4,369
[ 928304975 ]
[ "typespec", "documented" ]
defmodule NeoFaker.Color do @moduledoc """ Functions for generating random colors. This module provides utilities to generate random colors in various formats. """ @moduledoc since: "0.8.0" alias NeoFaker.Color.CMYK alias NeoFaker.Color.HEX alias NeoFaker.Color.HSL alias NeoFaker.Color.HSLA alias ...
02cf764d0a5a82909355dbc38ff0131dec3aad64
1,963
[ 234994656, 109245082 ]
[]
defmodule ListOperations do # Returns the n´th elemt of the list. def nth(0, [head | _tail]) do head end def nth(n, [_head | tail]) do nth(n - 1, tail) end # Returns the number of elements in the list. def len([]) do 0 end def len([_head | tail]) do 1 + len(tail) end # Returns the sum of all the lement...
02cfc8d3f187fb4e7932e772ae02de9be78caf68
1,961
[ 63213349 ]
[]
%{"certifi": {:hex, :certifi, "0.4.0", "a7966efb868b179023618d29a407548f70c52466bf1849b9e8ebd0e34b7ea11f", [:rebar3], []}, "cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:rebar, :make], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.0",...
02d14d0db300658b4b39848e87c9de755257eb11
1,673
[ 556740394 ]
[ "test", "ecto" ]
defmodule Timemanagerapi.ClocksTest do use Timemanagerapi.DataCase alias Timemanagerapi.Clocks describe "clocks" do alias Timemanagerapi.Clocks.Clock import Timemanagerapi.ClocksFixtures @invalid_attrs %{} test "list_clocks/0 returns all clocks" do clock = clock_fixture() assert C...
02d14ff064e818a00ad186aad63a2d74bbea0208
1,923
[ 997966787 ]
[ "documented", "ecto" ]
defmodule App.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias App.Repo alias App.Accounts.{User, Person} @role %{admin: 0, dentist: 1, receptionist: 2, nurse: 3} def create_user(attrs \\ %{}) do %User{} |> User.changeset(attrs) |> Repo.insert() ...
02d155d1c11cbc6be001395dc6e29bcfc4eb43b4
4,309
[ 192653852 ]
[ "typespec", "documented", "ecto" ]
defmodule OOTPUtility.Players.Attributes do alias OOTPUtility.Repo alias OOTPUtility.Players.{Attribute, Player} import Ecto.Query import OOTPUtility.Players, only: [is_pitcher: 1] @base_scale 200 @doc """ Returns a collection of `%Attribute{}` structs for the specified `%Player{}`. To allow the ...
02d157f8c12fd4ed27a11bfbca30df56e9facece
2,724
[ 279839775 ]
[ "typespec", "macro", "documented" ]
defmodule BsvP2p.Message do @moduledoc """ Handles P2P messages. """ alias BSV.Crypto.Hash alias BsvP2p.Command alias BsvP2p.Util.NetworkMagic @type t :: Command.Ping.t() | Command.Pong.t() | Command.Version.t() | Command.Verack.t() @spec parse(binary) :: {[{:ok, NetworkMagic.t(), __MODULE__...
02d193f3b8f497e14fbc24ad8238ac62f24eefe5
2,280
[ 200503555 ]
[ "documented" ]
defmodule Cards do @moduledoc """ Provides a set of operations to create and handle a deck of cards. """ @doc """ Returns a list of strings mirroring a real life deck, with a set of individual cards and their suits. """ def create_deck do values = ["Ace", "Two", "Three", "Four", "Five"] suits...
02d20e1ccf89497ab481f5aa85de393a5b9f7aa1
3,041
[ 718609993 ]
[ "genserver" ]
defmodule Servy.PledgeServer do @name :pledge_server use GenServer defmodule State do defstruct cache_size: 3, pledges: [] end # This will run in the client process def start_link(_args) do IO.puts("Starting PledgeServer...") GenServer.start_link(__MODULE__, %State{}, name: @name) end # c...
02d2a4e4d497e3b24b1dcddf6ed3db8a385f3a7e
4,138
[ 10641158 ]
[ "test" ]
Code.require_file "test_helper.exs", __DIR__ defmodule Poxa.PresenceSubscriptionTest do use ExUnit.Case alias Poxa.PusherEvent alias Poxa.Subscription import :meck import Poxa.PresenceSubscription setup do new PusherEvent new Subscription new :gproc end teardown do unload PusherEvent ...
02d2ad6fcc71315b4fb89102aeb2c49c32998170
1,713
[ 90910741 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule Connectionserver.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use Connectionserver.Web, :controller use Connectionserver.Web, :view The definitions below will be executed for every view, contro...
02d371e62d2e451bc309b9d18d052743b0fa6388
8,572
[ 197455959 ]
[ "test", "phoenix" ]
defmodule DoormanWeb.DoorControllerTest do use DoormanWeb.ConnCase import DoormanWeb.AuthTestHelpers import DoormanWeb.DoorTestHelpers alias Doorman.Access @create_attrs %{forward_number: "some forward_number", incoming_number: "some incoming_number", name: "User Door", timezone: "Etc/UTC"} @update_attrs...
02d3979c402fe5e6f9afff6779cc1fe3702316ed
4,465
[ 577915163 ]
[ "liveview" ]
defmodule FakeArtistWeb.PlayGameLive.Drawing do use FakeArtistWeb, :live_component alias FakeArtist.Game alias FakeArtistWeb.Components def mount(socket) do {:ok, assign( socket, line: %{points: []} )} end def handle_event("submit_drawing", _params, socket) do {:noreply, ...
02d3a6f52b07a7b9399f6ece45061c101be16600
2,906
[ 889879238 ]
[ "documented" ]
defmodule JSONPathEx.Parser do @moduledoc """ Defines parsers for JSONPath expressions using NimbleParsec. This module handles the parsing of JSONPath syntax, including filters, grouping, and the main JSONPath expression. The parsed output is structured and tagged for further processing. """ require Log...
02d3f6beb583429315eed369b2499c6c28a1ca93
6,875
[ 942811655, 920024200 ]
[ "typespec", "documented" ]
defmodule InternalApi.RepositoryIntegrator.GetTokenRequest do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ user_id: String.t(), repository_slug: String.t(), integration_type: integer, project_id: String.t() } defstruct [:user_id, :reposi...
02d4430a43807b269770c8ea71e4e6508b8f474f
8,903
[ 1015669945 ]
[ "documented" ]
defmodule DebugHelpers do @moduledoc """ Debugging utilities for distributed tests. Provides functions to inspect cluster state, trace operations, and debug distributed functionality during testing. """ alias OTPSupervisor.Distributed.{ToolManager, ClusterStateManager, SingleNodeSimulator} @doc """...
02d4b4e650891fd760079705d0b80ba126ac9e6f
2,095
[ 156054729 ]
[ "test" ]
defmodule Avidade.ShelvesTest do use Avidade.DataCase alias Avidade.{Repo, Shelves} alias Shelves.{Item, Shelf} test "it should update existing shelf" do Repo.insert!(%Shelf{ id: 1, owner_name: "Bernardo Amorim", owner_phone: "+5521999888777", lat: 0.0, long: 0.0 }) ...
02d4c5564acbba99abe2e0816a1faf84ed563a32
2,528
[ 115533257 ]
[ "documented", "ecto" ]
Code.ensure_loaded Phoenix.Swoosh defmodule LoginEjemplo.Coherence.UserEmail do @moduledoc false use Phoenix.Swoosh, view: LoginEjemplo.Coherence.EmailView, layout: {LoginEjemplo.Coherence.LayoutView, :email} alias Swoosh.Email require Logger alias Coherence.Config import LoginEjemplo.Gettext defp site_...
02d507bdc66df3dfcb662ee16cc5a19bf16e6c0f
1,882
[ 950751962 ]
[ "typespec", "supervisor", "documented" ]
defmodule Sportify.Client.DirectorySupervisor do use Supervisor @moduledoc """ This module defines a supervisor responsible for managing the lifecycle of the `Client.ClientDir` worker. The supervisor ensures that the `Client.ClientDir` worker is properly monitored and restarted if it terminates abnormally, ...
02d50d624367fa1ea099071b4419bfd17f983448
3,366
[ 521263294 ]
[]
import Config config :ueberauth, Ueberauth.Strategy.Microsoft.OAuth, tenant_id: System.get_env("MICROSOFT_TENANT_ID"), client_id: System.get_env("MICROSOFT_CLIENT_ID"), client_secret: System.get_env("MICROSOFT_CLIENT_SECRET") # Configure your database config :toolbox, Toolbox.EfrontRepo, username: System.get_...
02d54babdf4834970896f192a49abca08945fca0
3,909
[ 482555587 ]
[ "typespec", "documented", "ecto" ]
defmodule ExOAPI.Stripe.Schemas.Sku do use TypedEctoSchema import Ecto.Changeset @type params :: map() @moduledoc """ **description**: Stores representations of [stock keeping units](http://en.wikipedia.org/wiki/Stock_keeping_unit). SKUs describe specific product variations, taking into account any combin...
02d612d85ab6f912c1d66a7567a569cd2a1430ed
17,328
[ 244870223 ]
[ "typespec", "documented" ]
defmodule AeMdw.Aex9 do @moduledoc """ Context module for dealing with Blocks. """ alias :aeser_api_encoder, as: Enc alias AeMdw.AexnContracts alias AeMdw.Collection alias AeMdw.Db.Model alias AeMdw.Db.State alias AeMdw.Db.Util, as: DbUtil alias AeMdw.Error alias AeMdw.Error.Input, as: ErrInput ...
02d658dad38821de2eb24e52c4d77e039bfc4dce
3,342
[ 239736987 ]
[]
defmodule TodoList do defstruct auto_id: 1, entries: %{} def new(), do: %TodoList{} def add_entry(todo_list, entry) do # add id key to new entry entry = Map.put(entry, :id, todo_list.auto_id) # creates new entries adding auto_id as key and entry as value new_entries = Map.put( todo_list.e...
02d6a8da697f00acb5247d7a5e423d94294ec50a
1,979
[ 147264774 ]
[ "test", "ecto" ]
defmodule Teacher.BlogTest do use Teacher.DataCase alias Teacher.Blog describe "posts" do alias Teacher.Blog.Post @valid_attrs %{body: "some body", title: "some title"} @update_attrs %{body: "some updated body", title: "some updated title"} @invalid_attrs %{body: nil, title: nil} def post_...
02d6cf6b1788838c9372b5830e2bd4bceb459d49
3,765
[ 378857028 ]
[ "test" ]
defmodule Evolution.GeneticTest do use ExUnit.Case, async: true use ExUnitProperties @moduletag :full_test @problems [Evolution.Genetic.Problems.OneMax] alias Evolution.Genetic property "initialise/2 builds a population" do check all problem <- one_of(@problems), population_size <- int...
02d7032662f70f65f4ba99d4047c6152991b25f0
2,724
[ 875013880 ]
[ "genserver", "typespec" ]
defmodule RedisClient.SocketPool do @behaviour NimblePool alias RedisClient.RESP defstruct [:socket, :host, :port] @spec child_spec(keyword()) :: Supervisor.child_spec() def child_spec(options) when is_list(options) do NimblePool.child_spec(worker: {__MODULE__, options}, pool_size: 5) end @spec st...
02d740f7d37d53f039e73d64149caecee4399fd0
3,770
[ 89027329 ]
[ "test" ]
defmodule Sponge.WSDLParserTest do use ExUnit.Case doctest Sponge.WSDLParser alias Sponge.WSDLParser alias Sponge.WSDLParser.{Type, Operation} @raw Fixtures.read!("stock_quote.wsdl") setup do {:ok, wsdl} = WSDLParser.parse(@raw) {:ok, wsdl: wsdl} end test "soap version", %{wsdl: wsdl} do ...
02d76a6d2b1ad371449e0701af1afaf3ed620ede
6,897
[ 154180160, 178534852, 181408000, 198546741, 243129821, 275480123, 425222664, 130058225, 153681753, 161121883, 162856964, 174991023, 194748074, 217096433, 239182752, 297237670, 147200116, 147655359, 184531181, 195853566, 207503388, 231666876, 238344742, 248292846, 3058...
[ "genserver", "documented" ]
defmodule Phoenix.PubSub.Local do @moduledoc """ PubSub implementation for handling local-node process groups. This module is used by Phoenix pubsub adapters to handle their local node subscriptions and it is usually not accessed directly. See `Phoenix.PubSub.PG2` for an example integration. """ use Gen...
02d77819ef59e2e666b06206c915c9d644ab4491
1,913
[ 898484172 ]
[ "phoenix", "ecto" ]
defmodule TodoWeb.TaskController do use TodoWeb, :controller alias Todo.Tasks alias Todo.Tasks.Task def index(conn, _params) do changeset = Tasks.change_task(%Task{}) conn |> assign(:changeset, changeset) |> assign(:tasks, Tasks.list_tasks()) |> render("index.html") end def create(co...
02d8200c09aeed7edac238ac9f89631a047279e9
2,030
[ 714976383 ]
[]
# 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 :ex_poll, ecto_repos: [ExPoll.Repo], gener...
02d84de6380152be90e907cc7d64feb7abd05e27
3,791
[ 416045606 ]
[ "genserver", "documented" ]
defmodule Txtr.Player do @moduledoc """ A representation of a player. A player here is a process because we need a mailbox to receive msgs. """ use GenServer import ExTermbox.Constants, only: [key: 1] alias ExTermbox.Bindings, as: Termbox alias ExTermbox.{Cell, EventManager, Event, Position} requi...
02d94689c690ae94b40aee99ef3c67ae4042aafa
4,281
[ 506799163 ]
[ "test" ]
defmodule Peridiod.BundleTest do use PeridiodTest.Case doctest Peridiod.Bundle alias Peridiod.{Bundle, Binary} test "bundle parse manifest", %{release_manifest: release_manifest} do assert {:ok, %Bundle{}} = Bundle.metadata_from_manifest(release_manifest) end describe "bundle encode decode" do se...
02d9b2a0b2641d5a1781f546bd32e2f6cf0482f7
2,882
[ 911832785 ]
[ "typespec", "documented", "ecto" ]
defmodule Swaddled.Artists do @moduledoc """ An artist is the creator or performer of a track. With the extended streaming history data, each track is linked to only one artist, so even though a song may be a duet, the data shows it's only tied to one artist. Using the Spotify Web API, it is possible to get ...
02da0fa05bce754ffe27cad0d40db80690056bad
2,543
[ 535600628 ]
[ "test" ]
defmodule FuzzyTrieNifTest do use ExUnit.Case test "should support multiple data type" do trie = FuzzyTrie.new(1, true) |> FuzzyTrie.insert("something", "0") |> FuzzyTrie.insert("something", 1) |> FuzzyTrie.insert("something else", [2, "3"]) |> FuzzyTrie.insert("somewhere", {4, :w...
02da18af49faf5c983c8b81a5f03a67c771cde3c
3,172
[ 935034580 ]
[ "genserver" ]
defmodule DataIngestionMicroservice.MQTTHandler do use GenServer require Logger @topic "drivers_location/#" def start_link(_args) do GenServer.start_link(__MODULE__, %{}, name: __MODULE__) end def init(state) do emqtt_opts = [ # string, not charlist host: "localhost", port: 1883...
02dacfb3c627f30cdb09fea6963363c3fac2f022
1,718
[ 623011537 ]
[ "documented", "ecto" ]
defmodule SevenSage.Accounts.StudentNotifier do import Swoosh.Email alias SevenSage.Mailer # Delivers the email using the application mailer. defp deliver(recipient, subject, body) do email = new() |> to(recipient) |> from({"SevenSage", "<EMAIL>"}) |> subject(subject) |> text...
02db3e0b833f39a642487cb5b19ad9e7446c712c
2,919
[ 1009799947 ]
[ "phoenix" ]
# lib/locallink_api_web/router.ex defmodule LocallinkApiWeb.Router do use LocallinkApiWeb, :router pipeline :api do plug :accepts, ["json"] end pipeline :auth do plug LocallinkApi.Guardian.AuthPipeline end # Health check at root scope "/", LocallinkApiWeb do pipe_through :api get "/he...
02db3f214e44ab3443a7f8379511abe3bff9d12f
13,237
[ 552991938 ]
[ "test" ]
defmodule TakeANumberDeluxeTest do use ExUnit.Case doctest TakeANumberDeluxe alias TakeANumberDeluxe.Queue describe "start_link/1" do @tag task_id: 1 test "starts a new process" do {:ok, pid} = TakeANumberDeluxe.start_link(min_number: 1, max_number: 99) assert is_pid(pid) assert pid ...
02db41f569546ab93fc7f112a2cc00110b9ef3ec
8,528
[ 350875047 ]
[ "typespec", "documented", "ecto" ]
defmodule Central.Helpers.SchemaHelper do @moduledoc false # import Central.Helpers.NumberHelper, only: [dec_parse: 1] import Ecto.Changeset, only: [get_field: 2] defp make_date(d) do %{ "day" => Integer.to_string(d.day), "month" => Integer.to_string(d.month), "year" => Integer.to_string...
02dbc3e1245ef0eb619da53e11c0bc780c90ee62
3,080
[ 16017872, 19126921 ]
[ "phoenix" ]
defmodule MogoChat.Controllers.UsersApi do use Phoenix.Controller import Ecto.Query import MogoChat.ControllerUtils def index(conn) do conn = authenticate_user!(conn) authorize_roles!(conn, ["admin"]) users = Repo.all(from u in User, where: u.archived == ^false) users_attributes = lc user inl...
02dc167fc351edae746ddcaf723a6a216124e4b9
4,153
[ 896450710 ]
[]
defmodule AdventOfCode.Day09 do require Integer def part1(disk_map) do disk_map_to_block(String.replace(disk_map, "\n", "")) |> move_file_block() |> calculate_checksum() end def part2(disk_map) do disk_map_to_block(String.replace(disk_map, "\n", "")) |> move_file_block_full() |> calcul...
02dc4143e0b6345252c8d4261470da405ea76f57
2,529
[ 162377738 ]
[ "documented", "ecto" ]
defmodule Innerpeace.PayorLink.EmailSmtp do @moduledoc false use Bamboo.Phoenix, view: Innerpeace.PayorLink.Web.EmailView import Innerpeace.PayorLink.Web.Router.Helpers alias Innerpeace.PayorLink.Web.Endpoint alias Innerpeace.Db.Base.AcuScheduleContext def base_email do new_email |> from("<EMAIL>"...
02dc64bf77114591c39a6c3fb06706aa444942b3
2,402
[ 282086502 ]
[ "documented" ]
defmodule Servy.Handler do @moduledoc "Handles HTTP requests." @pages_path Path.expand("../../pages", __DIR__) alias Servy.Conv import Servy.Plugins, only: [rewrite_path: 1, log: 1, track: 1] import Servy.Parser, only: [parse: 1] alias Servy.BearController @doc "Transform a request into a response" de...
02dec048b84dbc7628c2b5c124028e211d0afb2f
1,747
[ 279839775 ]
[ "test" ]
defmodule BsvP2p.Command.BlockTest do use ExUnit.Case alias BsvP2p.Command alias BsvP2p.Command.Block doctest BsvP2p.Command.Block @block "010000006FE28C0AB6F1B372C1A6A246AE63F74F931E8365E15A089C68D6190000000000982051FD1E4BA744BBBE680E1FEE14677BA1A3C3540BF7B1CDB606E857233E0E61BC6649FFFF001D01E362990101000000...
02df051c298f61945907165ad8c695c2b09e1aca
2,326
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1SearchResponseSummary do @moduledoc """ Summary of the top N search results specified by the summary spec. ## Attributes * `safetyAttributes` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1SearchResponseSummar...
02df13917080a6a0c29a6733f3a7e6f0bd33120f
1,612
[ 835780740 ]
[ "liveview" ]
defmodule QuestApiV21Web.Superadmin.SuperadminConfirmationInstructionsLive do use QuestApiV21Web, :live_view alias QuestApiV21.Admin def render(assigns) do ~H""" <div class="mx-auto max-w-sm"> <.header class="text-center"> No confirmation instructions received? <:subtitle>We'll sen...
02df22b77c98e29cac510f7e7d28794c990e543f
1,562
[ 430374455 ]
[ "test" ]
defmodule Imglab.PositionTest do use ExUnit.Case doctest Imglab.Position import Imglab.Position describe "position/2" do test "using horizontal and vertical positions" do assert position("left", "top") == "left,top" assert position("left", "middle") == "left,middle" assert position("left...
02df95a8153909f3d7d675a4aaa7487207a916ab
2,415
[ 301982957 ]
[ "liveview", "ecto" ]
defmodule AmbueWeb.PageLive do use AmbueWeb, :live_view alias Ambue.Accounts alias Ambue.Accounts.User alias Services.SessionCache @impl true def mount(_params, %{"session_id" => session_id}, socket) do user = case SessionCache.get(session_id) do {:ok, saved_user} -> saved_user...
02dfa1b0022d10f393fe13a0ec88efcd4ea4be3f
7,358
[ 668433574 ]
[ "genserver", "liveview" ]
defmodule PointerPokerWeb.IndexLive do use PointerPokerWeb, :live_view use Phoenix.Component alias PointerPokerWeb.Presence alias PointerPoker.Pointer embed_templates("index/*") def mount(_params, _session, socket) do {:ok, assign(socket, users: [], name: nil, slug: nil, ...
02dfdfa26269a60e9bc7b65ea1fb3170a7b932fc
3,345
[ 127430141, 863118743, 887750784, 863118926 ]
[ "supervisor" ]
defmodule Astarte.DataUpdaterPlantWeb.Telemetry do use Supervisor import Telemetry.Metrics alias Astarte.DataUpdaterPlant.Config def start_link(arg) do Supervisor.start_link(__MODULE__, arg, name: __MODULE__) end def init(_arg) do children = [ {:telemetry_poller, measurements: periodic_measu...
02dfe463fd37ba5b337d3c3f915132d9e9d75c79
15,152
[ 540762359 ]
[ "macro", "typespec", "liveview", "documented" ]
defmodule Phoenix.Template do @moduledoc """ Templates are markup languages that are compiled to Elixir code. This module provides functions for loading and compiling templates from disk. A markup language is compiled to Elixir code via an engine. See `Phoenix.Template.Engine`. In practice, developers rar...
02e0548627e7cf6b8dadcfadf5030d114020f8e1
4,310
[ 376625251 ]
[ "test", "ecto" ]
defmodule Homebudget.TransactionsTest do use Homebudget.DataCase, async: true import Ecto.Query, warn: false alias Homebudget.Transactions alias Homebudget.Transactions.{Transaction, Account} describe "create_transactions_from/2" do setup do %{user: Homebudget.TestHelpers.user_fixture()} end ...
02e0577cba927e36389ad568e44c40622f0b8e05
3,591
[ 672062856 ]
[ "liveview", "test" ]
defmodule LantternWeb.Admin.StrandLiveTest do use LantternWeb.ConnCase import Phoenix.LiveViewTest import Lanttern.LearningContextFixtures @create_attrs %{ name: "some name", description: "some description" } @update_attrs %{ name: "some updated name", description: "some updated descripti...
02e05807a000fad3d548b268d9e8af38e5f9805c
2,072
[ 149084779 ]
[ "phoenix" ]
defmodule TodoWeb.TaskItemController do use TodoWeb, :controller use Timex alias Todo.TaskList def index(conn, _params) do unfinished_task_items = TaskList.fetch_tasks_by_status(false) finished_task_items = TaskList.fetch_tasks_by_status(true) render conn, "index.html", %{ unfinished_task_i...
02e07ec3a364d05b09c56b1ee401e8c2a60dc2d9
8,221
[ 367278931 ]
[ "documented", "phoenix" ]
defmodule Google.Ads.Googleads.V18.Common.CpcBidSimulationPointList do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :points, 1, repeated: true, type: Google.Ads.Googleads.V18.Common.CpcBidSimulationPoint end defmodule Google.Ads.Googleads.V18.Common.CpvBidSimulation...
02e09c967f151f28d1d676db75d14546f7782190
3,052
[ 115008833 ]
[ "test" ]
defmodule BshipWeb.UserInfoControllerTest do use BshipWeb.ConnCase # alias Bship.User # # @create_attrs %{account: "some account", nick: "some nick", pwd_hash: "some pwd_hash"} # @update_attrs %{account: "some updated account", nick: "some updated nick", pwd_hash: "some updated pwd_hash"} # @invalid_attrs %{acco...
02e0e152fd0352f1407e3d071e8b1eb91682635e
1,779
[ 335777481 ]
[ "typespec" ]
defmodule Santorini.Cards.Atlas do alias Santorini.Board, as: Board alias Santorini.BoardUtils, as: BoardUtils alias Santorini.Cards, as: Cards @spec to_function(actions :: [[]]) :: Board.t() def to_function([actions | _]) when is_list(actions) do Enum.reduce(actions, &Function.identity/1, fn action, fun...
02e15a7a5fd3f42deb77bd7647be3c896a447eba
1,914
[ 807904878 ]
[]
defmodule Pleroma.Uploaders.IPFS do @behaviour Pleroma.Uploaders.Uploader require Logger alias Tesla.Multipart @config_impl Application.compile_env(:pleroma, [__MODULE__, :config_impl], Pleroma.Config) defp get_final_url(method) do config = @config_impl.get([__MODULE__]) post_base_url = Keyword.get...
02e1d5b98e9cbb54abca4df0aa930982cdbb7565
2,654
[ 311042836 ]
[]
defmodule ElixirBank.Factory do alias Ecto.{Changeset, UUID} alias ElixirBank.Accounts.{Profile, User} alias ElixirBank.Interactions.Like alias ElixirBank.Records.{Category, Record} alias ElixirBank.Repo @build_action :build @build_action! :build! @insert_action :insert @insert_action! :insert! de...
02e1ecba2322f45aa75f837b723beb931454db11
2,932
[ 39919111 ]
[ "typespec", "documented" ]
defmodule FinTex.Parser.Lexer do @moduledoc false @control_chars ["?", "+", ":", "'", "@"] @spec segment_end :: String.t def segment_end, do: "(?<!\\?)'" @spec escaped_binary(String.t) :: Regex.t def escaped_binary(len), do: Regex.compile!("\\A(.*)@#{len}@(.{#{len}})(.*)\\z", "mUs") @spec escaped_bin...
02e253cb4c9c2c703a4b820fddb1e5c55953bd2d
1,630
[ 100808909 ]
[ "test" ]
defmodule Web.OpportunitiesControllerTest do use Web.ConnCase alias Data.{Opportunities, Projects} test "GET /opportunities", %{conn: conn} do {:ok, %{id: project_id}} = Projects.insert(%{name: "Example Project", url: "example.com"}) Opportunities.insert(%{ level: 1, project_id: project_id,...
02e2c79f3de6c0aa37ee0fcce0ce30e43671ecc1
4,097
[ 565401564 ]
[ "liveview" ]
defmodule ZabiceWeb.KontaktListaLive do use ZabiceWeb, :live_view def mount(_,_,socket) do { :ok, socket |> assign_new(:selected, fn -> nil end) } end def details do %{ "dusan" => %{ name: "Dusan Veljkovic", title: "Backend", more: "...Lorem ipsu...
02e2cc13cfacb537cb83f6692849e52da65022c8
1,549
[ 44822990 ]
[]
defmodule PersonalTwitterBot.Mixfile do use Mix.Project def project do [app: :personal_twitter_bot, version: System.get_env("BUILD_VERSION") || "0.0.1", elixir: "~> 1.0", elixirc_paths: elixirc_paths(Mix.env), compilers: [:phoenix] ++ Mix.compilers, build_embedded: Mix.env == :prod, ...
02e3444cbb0979db98c685b7ef3d1c52abab624b
2,106
[ 228797147 ]
[ "documented", "ecto" ]
defmodule TdCx.Jobs do @moduledoc """ The Jobs context. """ import Ecto.Query, warn: false alias TdCx.Jobs.Job alias TdCx.Repo alias TdCx.Search.IndexWorker @doc """ Returns the list of jobs. ## Examples iex> list_jobs() [%Job{}, ...] """ def list_jobs do Repo.all(Job) end...
02e36384203a818e0c3f0f2454dc08dce8502fc5
18,656
[ 996802329 ]
[ "genserver", "documented" ]
defmodule SnmpSim.Core.Server do @moduledoc """ High-performance UDP server for SNMP request handling. Supports concurrent packet processing with minimal latency. """ use GenServer require Logger alias SnmpLib.PDU, as: PDU alias SnmpSim.Device.OidHandler # Suppress Dialyzer warnings for async functi...
02e3914e9164f4751b3dae2676cac2b78e787f0c
2,366
[ 120443725 ]
[]
defmodule Mix.Tasks.Changelog.News.Historic do use Mix.Task import ChangelogWeb.Router.Helpers alias Changelog.{Episode, NewsItem, Person, Post, Repo, UrlKit} alias ChangelogWeb.{Endpoint} @shortdoc "Generates news items for all historic episodes and posts" def run(_) do Mix.Task.run("app.start") ...
02e3d823fba424f314cd3273b95c106e7d14e173
3,911
[ 597751032 ]
[]
defmodule Ecspanse.MixProject do use Mix.Project @version "0.10.0" @source_url "https://github.com/iacobson/ecspanse" def project do [ app: :ecspanse, version: @version, elixir: "~> 1.17", start_permanent: Mix.env() == :prod, consolidate_protocols: Mix.env() != :test, e...
02e3faf8e9dc61acc2c600135160eb21e6afbab1
2,307
[ 166092965 ]
[ "test", "documented" ]
defmodule State.FacilityTest do @moduledoc false use ExUnit.Case import State.Facility alias Model.Facility setup do new_state([ %Facility{ id: "6", type: "ESCALATOR", stop_id: "place-alfcl" }, %Facility{ id: "701", type: "ELEVATOR", stop...
02e40ff2d97067f16777d8241b5967611f628815
1,705
[ 224855137 ]
[ "genserver" ]
defmodule ExIRB do use GenServer @name __MODULE__ def start_link(opts) do name = Keyword.get(opts, :name, @name) GenServer.start_link(__MODULE__, opts, name: name) end def eval_ruby(server \\ @name, expression) do GenServer.call(server, {:eval_ruby, expression}) end def apply(server \\ @na...
02e5469314c4946874d9352d6c8833d7e57b98ec
1,894
[ 958231508 ]
[ "ecto" ]
defmodule Elixir.Conduit.QAD.Table.Fpci_mstr do use Ecto.Schema import Ecto.Changeset schema "qad_fpci_mstr" do field :fpci_index, :string field :fpci_mod_date, Conduit.QAD.Types.Date field :fpci_reval_link, :decimal field :fpci_userid, :string field :fpci_values, {:array, :decimal} ...
02e56c8f979addb58f7668279f29cab636494fb8
1,516
[ 441281984 ]
[ "test", "ecto" ]
defmodule QuarryTest do use ExUnit.Case doctest Quarry alias Quarry alias Quarry.Post import Ecto.Query describe "build!/2" do test "can limit results" do expected = from(p in Post, as: :post, limit: ^1) actual = Quarry.build!(Post, limit: 1) assert inspect(expected) == inspect(actua...
02e5fd11b39b1f32bdd63d135a07a3b3a72f6832
8,485
[ 958231508 ]
[ "ecto" ]
defmodule Elixir.Conduit.QAD.Table.Gl_ctrl do use Ecto.Schema import Ecto.Changeset schema "qad_gl_ctrl" do field :gl_ar_acct, :string field :gl_ar_cc, :string field :gl_disc_acct, :string field :gl__qadc01, :string field :gl__qadc03, :string field :gl__qadc05, :string field :gl...
02e652b1786066a4595000ad32565c61016d33f9
3,170
[ 672062856 ]
[ "documented" ]
defmodule Lanttern.StudentsRecordsFixtures do @moduledoc """ This module defines test helpers for creating entities via the `Lanttern.StudentsRecords` context. """ alias Lanttern.SchoolsFixtures @doc """ Generate a student_record. """ def student_record_fixture(attrs \\ %{}) do {:ok, student_rec...
02e665742a4a08a2fcb1fde2d51a95e1407bfea9
1,501
[ 762366923 ]
[]
import Config # Application config config :orbit, appcues_enabled?: false, allow_test_data?: false, ecto_repos: [Orbit.Repo], generators: [timestamp_type: :utc_datetime], force_https?: true, timezone: "America/New_York", poll_rtr?: true, rtr_poll_delay: 3_000, subscribe_to_ocs?: true # Kinesis confi...
02e6b7cd8fb648c065d0823f59872e0916f7ca8c
7,096
[ 593077436 ]
[]
defmodule TestData do def foo_enum() do %{ enum: %{ annotations: [%{name: "MarkerAnnotation"}], name: "FooEnum", visibility: :public, values: [ %{name: "FOO"}, %{name: "BAR", annotations: [%{args: ["foo"], name: "SomeAnnotation"}]} ] }, ...
02e6ca22c381dd89d760fafac348406481fc8509
4,371
[ 79652984 ]
[]
require Day05 require Day07 require ScreenDraw {:ok, input} = File.read("inputs/15.txt") defmodule RepairDroid do defstruct map: %{}, position: {0, 0} def move(program, direction) do {[status], new_program} = Day05.solve1(program, [direction]) |> Map.pop(:outputs) droid_state = parse_status(...
02e6db9b335ee96d27760eaaeb30db4d7f158923
4,199
[ 249869696 ]
[ "test" ]
defmodule Malan.RateLimitsTest do use Malan.DataCase, async: true alias Malan.RateLimits.PasswordReset alias Malan.RateLimits.PasswordReset.{UpperLimit, LowerLimit} # This is covered indirectly by the other tests describe "Malan.RateLimits" do end describe "Malan.RateLimits.PasswordReset" do def us...
02e75dd1263e8aa5a174837f2e6256b99734cd82
2,925
[ 332108035 ]
[ "ecto" ]
defmodule QueroAlugar.Vacations do import Ecto.Query alias QueroAlugar.Repo alias QueroAlugar.Vacations.{Place, Booking, Review} alias QueroAlugar.Accounts.User def get_place_by_slug!(slug) do Repo.get_by!(Place, slug: slug) end def list_places do Repo.all(Place) end def list_places(crite...
02e7b2a71a7f596f7df6bff99e2ac32017f524bf
4,308
[ 318256012 ]
[ "liveview", "test" ]
defmodule BytepackWeb.PackageLiveTest do use BytepackWeb.ConnCase, async: true import Phoenix.LiveViewTest import Bytepack.AuditLog, only: [system: 1] setup :register_and_login_user defp setup_package(context) do tarball = Bytepack.PackagesFixtures.hex_package_tarball("foo-1.0.0/foo-1.0.0.tar") {:...
02e7ff5e7596fcf9ea0ca7ec33fc159217e84d0e
2,783
[ 164875982 ]
[ "genserver" ]
defmodule HttpHandler do use GenServer def start(_) do GenServer.start(__MODULE__, []) end def stop(pid, reason) do IO.puts("-------STOP 4-----\n") GenServer.cast(pid, {:stop, reason}) end def start_link(args) do GenServer.start_link(__MOD...
02e87df53b9c2a2b3dc6aea97ff4e25afac620e0
1,994
[ 117142970 ]
[]
# 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: # # Tasks3.Repo.insert!(%Tasks3.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will f...