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
087418651821b77304d970fdf34706822f9c2524
3,533
[ 321164143 ]
[ "genserver" ]
# nicked this from https://thoughtbot.com/blog/make-phoenix-even-faster-with-a-genserver-backed-key-value-store defmodule NetworkLab.GenServers.Cache do use GenServer # iex(18)> NetworkLab.GenServers.Cache.set(:message_cache, "B", 4) # iex(12)> NetworkLab.GenServers.Cache.set(:message_cache, "A", %{ a: 1,...
08741959451bd81bff830520f710611ee156a168
7,278
[ 184366155 ]
[ "test" ]
defmodule GoChampsApi.SportsTest do alias GoChampsApi.Sports use ExUnit.Case use GoChampsApi.DataCase alias GoChampsApi.Helpers.GameHelpers alias GoChampsApi.Helpers.PhaseHelpers alias GoChampsApi.Helpers.TeamHelpers alias GoChampsApi.Helpers.TournamentHelpers alias GoChampsApi.Draws alias GoChampsAp...
08743b93780028a1cb5be69713ca240b740d8a6a
2,377
[ 413158014 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule PhoneFinderWeb 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 PhoneFinderWeb, :controller use PhoneFinderWeb, :view The definitions below will be executed for every view, ...
087478fdfcacdd116a1a2bc1ce6dc45ec39a4303
6,308
[ 172532184 ]
[ "test", "ecto" ]
defmodule Oban.WorkerTest do use Oban.Case, async: true use ExUnitProperties doctest Oban.Worker alias Oban.{Job, Worker} defmodule BasicWorker do use Worker @impl Worker def perform(_job), do: :ok end defmodule SimpleUniqueWorker do use Worker, unique: true @impl Worker def...
08747a5f306569e9421ed192e2aba68dac5b8ff9
14,557
[ 521000174 ]
[ "test" ]
defmodule Oban.Met.RecorderTest do use Oban.Met.Case, async: true use ExUnitProperties alias Oban.Met.Recorder alias Oban.Met.Values.{Gauge, Sketch} alias Oban.Notifier @name Oban.Recorder @node "worker.1" describe "lookup/2" do setup [:start_supervised_oban, :start_supervised_recorder] test...
0874a08b515b16496c5c3d5812ce5c7dfab2e8db
2,709
[ 433759299 ]
[]
defmodule AdventOfCode.Day03 do def parse_binary_diagnosis(input) do String.split(input, "\n", trim: true) end def binary_to_dec(binaryString) do Integer.parse(binaryString, 2) |> elem(0) end def occurrences(enumerable, pattern) do Enum.count(enumerable, &(&1 == pattern)) end def part1(...
0874a50e01cc517ce27aaa89d676ba20bf103da6
2,147
[ 933982233 ]
[ "documented", "ecto" ]
defmodule Raffley.Charities do @moduledoc """ The Charities context. """ import Ecto.Query, warn: false alias Raffley.Repo alias Raffley.Charities.Charity @doc """ Returns the list of charities. ## Examples iex> list_charities() [%Charity{}, ...] """ def list_charities do Rep...
0874d39ae6e3372e08498a0686c4cf5095878dd4
12,564
[ 158013615 ]
[ "typespec", "documented", "phoenix" ]
defmodule AsteroidWeb.Error do @moduledoc """ Helper module to work with errors generated in the OAuth2 protocol flows """ import Asteroid.Utils import Phoenix.Controller import Plug.Conn alias Asteroid.Client alias Asteroid.OAuth2 alias Asteroid.OIDC alias AsteroidWeb.AuthorizeController alias ...
0875670d2ba1b9c514d940788b40329de89bcfb3
7,628
[ 624054242 ]
[ "typespec", "documented" ]
# Code generated by protox. Don't edit. # credo:disable-for-this-file defmodule PgQuery.DeclareCursorStmt do @moduledoc false if function_exported?(Protox, :check_generator_version, 1) do Protox.check_generator_version(1) else raise "This code was generated with protox 2 but the runtime is using an older ...
087596c659d35392a65ee6bfd6b70fe611217e33
2,205
[ 306753421 ]
[ "documented", "ecto" ]
defmodule GDLibrary.Checkout do @moduledoc """ The Checkout context. """ import Ecto.Changeset alias GDLibrary.Repo alias GDLibrary.Inventory alias GDLibrary.Schemas.{ BookRequest } def create_book_request!(attrs) do {:ok, book_request} = create_book_request(attrs) book_request end ...
0875de01ddd2380875ad98467ec42efdc7db9fd8
1,644
[ 163277988 ]
[]
Path.join(["rel", "plugins", "*.exs"]) |> Path.wildcard() |> Enum.map(&Code.eval_file(&1)) erlang_cookie = :sha256 |> :crypto.hash(System.get_env("ERLANG_COOKIE") || "/hdNA305fOYse3Rhak3qXn7CFJ/2zugbChgrnVm/M4HKRXGp0PDi7BFJpUaEaqaN") |> Base.encode16 |> String.to_atom use Mix.Releases.Config, default_release: :excl...
0875e4fa3521f3968830caa770e6175a24a799da
1,857
[ 48699281 ]
[ "test" ]
defmodule RepresentableTest do use ExUnit.Case, async: true doctest Hypermedia.Representable defmodule PropTest do use Hypermedia.Representable property :one property :two property :three link :self, do: "/test" end test "representable works for properties" do assert PropTest.to_ma...
0875f8b4216a025533ddfe97e6636bd4fa8da0c3
3,614
[ 967570208 ]
[ "typespec", "documented" ]
defmodule Pact.Patterns do @moduledoc """ A module for creating JSON and string patterns for Pact testing. JSON patterns can include various data types and matchers, while string patterns are limited to strings and specific matchers. """ @type json_pattern :: integer() | float() ...
0876418728b81f7e1f947f7927e3a7e21f134f67
3,962
[ 589849238 ]
[ "documented", "ecto" ]
defmodule Ciao.Accounts.UserNotifier do @moduledoc false import Swoosh.Email alias Ciao.Mailer use Phoenix.Swoosh, view: CiaoWeb.EmailView, layout: {CiaoWeb.LayoutView, :email} @from {"Ciao", "<EMAIL>"} # Delivers the email using the application mailer. defp deliver(recipient, subject, body) do em...
0876bcf42af2d733769a16058d2417d81e473120
2,392
[ 227743494 ]
[ "documented", "ecto" ]
defmodule UCast.Accounts.InfluencerProfile do use Ecto.Schema import Ecto.Changeset alias UCast.Accounts.{User, Tag, InfluencerProfile, Category, Review} alias UCast.Repo import Ecto.Query, warn: false schema "influencer_profiles" do field(:phone_number, :string) field(:sns_type, :string) fiel...
0876e720d743b116cad66f9581794a7d37567497
1,772
[ 66071134 ]
[]
defmodule PrometheusPhoenix.Mixfile do use Mix.Project @version "1.3.0" def project do [ app: :prometheus_phoenix, version: @version, elixir: "~> 1.3", build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, deps: deps(), description: description(),...
087727ffa1575fbd6000d5d9335761a2ed13e600
2,059
[ 179610911 ]
[ "test", "ecto" ]
defmodule ConnectedNeighbors.ChatTest do use ConnectedNeighbors.DataCase alias ConnectedNeighbors.Chat describe "messages" do alias ConnectedNeighbors.Chat.Message @valid_attrs %{content: "some content"} @update_attrs %{content: "some updated content"} @invalid_attrs %{content: nil} def me...
08773cdb509043809f6ed28bf08cc7546e53d2f3
4,508
[ 780461734 ]
[ "documented" ]
defmodule DoEnd do @moduledoc """ """ def my_fun(arg1, options) do dbg(arg1) dbg(options) end # play with if-macro def if_1a(condition) do if condition do a = 42 {:branch_1, a} else b = 100 {:branch_2, b + 10} end end def if_1b(condition) do if conditi...
0877a7c0f700e5de5547c3c31ebb8f4f29e7b845
3,160
[ 595229069 ]
[ "test", "ecto" ]
defmodule TartuBike.AccountsTest do use TartuBike.DataCase alias TartuBike.Accounts describe "users" do alias TartuBike.Accounts.User import TartuBike.AccountsFixtures @invalid_attrs %{creditcard: nil, dateofbirth: nil, email: nil, name: nil, password: nil, tartubusnumber: nil, username: nil} ...
0877bad6d9e3e535cdd1349286a5e28681958da5
2,600
[ 524219881 ]
[ "typespec", "documented" ]
defmodule FormulaBuilder.Rpn do @moduledoc """ Responsible for changing the functions from infix form to RPN form so that the function builder can understand them functionally """ import FormulaBuilder.Operations alias FormulaBuilder.Types @operation_precedence operation_precedence() @doc """ C...
0877c3ea24655b87685190dbd11c6e45c28ab360
2,227
[ 231183810 ]
[ "test" ]
defmodule Test.Redline.Impl.ParallelTest do alias Redline.Impl.Parallel alias Test.Redline.Steps.{Step2, Step3, Step4, Step1WithState, Step1WithError} use ExUnit.Case test "run_step/2 runs a step in parallel" do state = %{results: %{step_1: 2}, states: %{step_1: %{}}} step = [{Step2, %{input: :step_...
0877d595b18c0f2d8f331f53436789399517d247
3,534
[ 178534852, 181408000, 161121883, 162856964, 174991023, 184531181, 588290018, 190730445, 197853848, 161718503, 176622003, 173431331, 648343297, 764328843, 159038989, 177871154, 184910444, 349082708, 157882770, 162276071, 184338071, 294468145, 165631858, 170322344, 1834...
[ "test", "ecto" ]
defmodule Ecto.Integration.SQLTest do use Ecto.Integration.Case, async: true alias Ecto.Integration.TestRepo alias Ecto.Integration.Barebone alias Ecto.Integration.Post alias Ecto.Integration.CorruptedPk import Ecto.Query, only: [from: 2] test "fragmented types" do datetime = ~N[2014-01-16 20:26:51]...
087807ca36d13b6414d6e26dbee4d40c271d5a89
2,651
[ 588960578 ]
[ "documented", "ecto" ]
defmodule Portfolio.Users do @moduledoc """ The Users context. """ import Ecto.Query, warn: false alias Portfolio.Repo alias Portfolio.Users.User import Comeonin.Bcrypt, only: [checkpw: 2, dummy_checkpw: 0] alias Portfolio.Guardian @doc """ Returns the list of users. ## Examples iex> li...
0878bd85520465d4088376cce90021e04e79ed85
2,670
[ 237780590 ]
[ "typespec", "documented" ]
defmodule Cunilanista.Controller.V1alpha1.RabbitMQ do @moduledoc """ Cunilanista: RabbitMQ CRD. ## Kubernetes CRD Spec By default all CRD specs are assumed from the module name, you can override them using attributes. ### Examples ``` # Kubernetes API version of this CRD, defaults to value in module na...
0878f8db5833bfa02a13994698c0abafbf53c073
1,881
[ 120943327 ]
[ "test", "ecto" ]
defmodule PetApp.PetTest do use PetApp.DataCase alias PetApp.Pet describe "dogs" do alias PetApp.Pet.Dog @valid_attrs %{age: "some age", name: "some name"} @update_attrs %{age: "some updated age", name: "some updated name"} @invalid_attrs %{age: nil, name: nil} def dog_fixture(attrs \\ %{}...
08790fe073da4365404c78dc69edaec6382f494d
10,318
[ 280880198 ]
[ "documented" ]
defmodule Tyyppi.Matchers do @moduledoc false require Logger alias Tyyppi.Stats defguardp is_timeout(timeout) when timeout == :infinity or (is_integer(timeout) and timeout >= 0) def of?(_module, {:atom, _, term}, term) when is_atom(term), do: true def of?(_module, {:atom, _, _}, term) when is...
087a090b9fce3826772f820fe9a757c89a6960e5
5,493
[ 225197955 ]
[ "test" ]
defmodule Puzzle12Test do use ExUnit.Case, async: true import Puzzle12 import SpaceMath @moons [:io, :europa, :ganymede, :callisto] describe "history repeats itself" do @tag timeout: :timer.minutes(2) test "with input data" do positions = @moons |> Enum.zip(read_file()) ...
087a0c73c71fadbbf82a76cbf60456d3d14bd912
1,724
[ 263919098 ]
[ "test" ]
defmodule MasteryTest do use ExUnit.Case, async: false use QuizBuilders alias MasteryPersistence.Repo alias Mastery.Examples.Math alias Mastery.Boundary.QuizSession alias MasteryPersistence.Response setup do enable_persistence() always_add_1_to_2 = [ template_fields(generators: addition_ge...
087aad9d36ddbc9a3a3e1bf9de2c2cc42fda1ae1
4,248
[ 182161103 ]
[ "test" ]
defmodule JunksWeb.Api.NoteControllerTest do use JunksWeb.ConnCase alias Junks.Auth.Group alias Junks.Repo def contains_prop_val(p, v) do fn (m, acc) -> if (acc) do acc else m[p] == v end end end def fetch_by_prop_val(p, v) do fn (m, acc) -> if m[p] == ...
087ab70183e937f1796f71f01e34601f51b4b7e4
1,921
[ 299691268 ]
[ "test", "ecto" ]
defmodule MeetGame.ForumTest do use MeetGame.DataCase alias MeetGame.Forum describe "forum_topics" do alias MeetGame.Forum.Topic @valid_attrs %{title: "some title"} @update_attrs %{title: "some updated title"} @invalid_attrs %{title: nil} def topic_fixture(attrs \\ %{}) do {:ok, topi...
087b53aabec4643fedd4b4ce7de12f48cc9bd85c
5,489
[ 750025345 ]
[ "documented" ]
defmodule GithubWorkflows do @moduledoc """ Run `mix github_workflows.generate` after updating this module. See https://hexdocs.pm/github_workflows_generator. """ def get do %{ "ci.yml" => ci_workflow() } end defp ci_workflow do [ [ name: "CI", on: [ pul...
087b9989c0da4eb24612052f4f6a83a1ef69be0f
3,815
[ 132186675 ]
[]
%{ "certifi": {:hex, :certifi, "2.3.1", "d0f424232390bf47d82da8478022301c561cf6445b5b5fb6a84d49a9e76d2639", [:rebar3], [{:parse_trans, "3.2.0", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, "cowboy": {:hex, :cowboy, "2.4.0", "f1b72fabe9c8a5fc64ac5ac85fb65474d64733d1df52a26fad5d4ba3d9f70a9f", [:re...
087ba0c15165201fe926139c95392abb35307f65
7,671
[ 41579526 ]
[]
%{"bbmustache": {:hex, :bbmustache, "1.0.3"}, "calendar": {:hex, :calendar, "0.17.1", "5c7dfffde2b68011c2d6832ff1a15496292de965a3b57b3fad32405f1176f024", [:mix], [{:tzdata, "~> 0.5.8 or ~> 0.1.201603", [hex: :tzdata, optional: false]}]}, "certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0...
087c298f136796db131061d0cbb96e86d9214f7e
1,690
[ 279209749 ]
[]
defmodule ExMarketer.Umbrella.MixProject do use Mix.Project def project do [ apps_path: "apps", version: "0.1.0", start_permanent: Mix.env() == :prod, deps: deps(), aliases: aliases(), test_coverage: [tool: ExCoveralls], preferred_cli_env: [ lint: :test, ...
087d22e1755980a9a3503114ff71c3b60adabfaa
2,049
[ 31433548, 1018310553 ]
[ "typespec", "documented" ]
defprotocol CSV.Encode do @fallback_to_any true @moduledoc """ Implement encoding for your data types. """ @doc """ The encode function to implement, gets passed the data and env as a keyword list containing the currently used separator and delimiter. """ def encode(data, env \\ []) end defimpl CSV....
087d32d0c0be45aa1a865d192245a5071114ec2d
2,007
[ 570267526 ]
[ "documented", "ecto" ]
defmodule BackgroundWork.Demo do @moduledoc """ The Demo context. """ import Ecto.Query, warn: false alias BackgroundWork.Repo alias BackgroundWork.Demo.Pokemon alias BackgroundWork.PokemonDetailSupervisor @doc """ Returns the list of pokemons. ## Examples iex> list_pokemons() [%Pok...
087e1c0156ec66462b2352a68026bcd6a452106e
8,160
[ 638829513 ]
[ "liveview", "phoenix", "documented" ]
defmodule PentoWeb.UserAuth do use PentoWeb, :verified_routes import Plug.Conn import Phoenix.Controller alias Pento.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 60 * 60 * 24 * 60 @rem...
087e5e05588633fa3b8ea073a01b38a8b5d434a5
2,698
[ 764901590 ]
[]
import Config # Configure your database config :signbank, Signbank.Repo, username: "postgres", password: "postgres", hostname: "localhost", database: "signbank_dev", stacktrace: true, show_sensitive_data_on_connection_error: true, pool_size: 10 # For development, we disable any cache and enable # debugg...
087e6cf335e5d4e456903206598366a7feb29435
2,268
[ 163088493 ]
[ "documented" ]
defmodule ElvenGard.Network.Endpoint.Config do # Handles ElvenGard Endpoints configuration. # # This module is private to ElvenGard and should not be accessed # directly. The ElvenGard endpoint configuration can be accessed # at runtime using the `config/2` function (TODO). @moduledoc false ## Public API...
087e9b38a607cebfab29d4413014c70d7330ff33
5,946
[ 124185998 ]
[ "test" ]
defmodule Noizu.Cms.V1.AcceptanceTest do use ExUnit.Case, async: false use Amnesia use Noizu.Cms.Database require Logger @context Noizu.ElixirCore.CallingContext.admin() @tag :cms @tag :cms_v1 test "Create New Record" do post = %Noizu.Cms.PostEntity{ status: :enabled, type: :article, ...
087ea5449363c2591c2d34b882812dfd2c37798a
1,976
[ 173431331, 350811664, 165165414, 163277988 ]
[ "documented" ]
defmodule Credo.Check.Readability.SpaceAfterCommas do @moduledoc false @checkdoc """ You can use white-space after commas to make items of lists, tuples and other enumerations easier to separate from one another. # preferred alias Project.{Alpha, Beta} def some_func(first, second, third) d...
0880789f8cfbfe9ff70ce655513f9c4675fd12a4
2,933
[ 536680943 ]
[]
defmodule PosWeb.PlanChannel do use PosWeb, :channel alias Pos.Plans alias Pos.RechargeDetails alias Pos.Bill alias Pos.Staff require Logger intercept ["addPlan","recharge","currentPlan"] def join("plan:" <> _admin_id, _params, socket) do {:ok, %{"status" => true}, socket} end def handle_in("...
0881233477a16a2143517af1f78a0f985711b9bb
2,316
[ 851732291 ]
[ "test" ]
defmodule AIex.RequestTest do use ExUnit.Case describe "schema definition" do defmodule SentimentSchema do use AIex.Aifunction @zero_shot true inputs do field :messages, {:array, :map}, description: "Conversation messages" end input_template do for message <- @m...
0881658bd1e89c0a3209ed24761bd340f37bca91
2,403
[ 165101579 ]
[ "phoenix" ]
defmodule Staxx.WebApiWeb.StackController do use Staxx.WebApiWeb, :controller require Logger action_fallback(Staxx.WebApiWeb.FallbackController) alias Staxx.Instance alias Staxx.EventStream.Notification alias Staxx.Instance.Stack alias Staxx.Instance.Stack.ConfigLoader alias Staxx.WebApiWeb.SuccessV...
0881772c74c09d7b63704b1742c1de88506eca0a
8,568
[ 746362673 ]
[]
defmodule TashkentAqNotifier.Notifier do @locations %{us_embassy: 8881, tstu: 368_739} def get_notification_message do us_embassy_task = Task.async(fn -> fetch_from_api_for(@locations.us_embassy) end) # tstu_task = Task.async(fn -> fetch_from_api_for(@locations.tstu) end) us_embassy_result = Task.await...
0881e5f86075f842b8e15440010c77a05352cc6e
1,897
[ 417910248 ]
[ "test", "documented" ]
defmodule GithubRSS.SendWebhookJobTest do @moduledoc false use GithubRSS.DataCase use Oban.Testing, repo: GithubRSS.Repo import Mox alias GithubRSS.{Jobs.SendWebhookJob, Repositories} describe "perform/2" do test "succesfull perform" do expect(GithubRSS.WebhookMock, :send_to_webhook, fn _ -> ...
08828103abcb89958da0faaa4e17f0ff5e5feb15
2,459
[ 346114697 ]
[ "liveview", "documented" ]
defmodule OzfariumWeb.Live.Gallery.Pagination do use OzfariumWeb, :live_component @doc """ Returns pagination array ## Examples [[1] 2 3 4 5 6 7 8]\n [[1] 2 3 4 5 6 7 ... 99]\n [ 1 [2] 3 4 5 6 7 ... 99]\n [ 1 2 [3] 4 5 ...
08829a466c9b314ddbc935b0d387d830b548d10c
13,933
[ 949216957 ]
[ "documented", "ecto" ]
defmodule Schedshare.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias Schedshare.Repo require Logger alias Schedshare.Accounts.{User, UserToken, UserNotifier, Friendship} ## Database getters @doc """ Gets a user by email. ## Examples iex> get_us...
08831a52ab3a90ab757a541b64e8b7f71571f185
9,588
[ 256636071 ]
[ "documented" ]
defmodule Phx.New.Single do @moduledoc false use Phx.New.Generator alias Phx.New.{Project} template :new, [ {:eex, "phx_single/config/config.exs", :project, "config/config.exs"}, {:eex, "phx_single/config/dev.exs", :project, "config/dev.exs"}, {:eex, "phx_single/config...
088362526cf49c8a3355564e6a6617b69ed7f69b
2,317
[ 220596944 ]
[ "test", "ecto" ]
defmodule LiveQuiz.ControlPanelTest do use LiveQuiz.DataCase alias LiveQuiz.ControlPanel describe "questions" do alias LiveQuiz.ControlPanel.Question @valid_attrs %{content: "some content", category: "some cat", difficulty: "some dif"} @update_attrs %{ content: "some updated content", c...
0883e501136436c811165e1c89e1375693576960
1,527
[ 470564016 ]
[ "typespec", "macro", "documented" ]
defmodule Exmbus.Parser.Tpl.Device do @moduledoc """ A device type for the TPL header (also used in Wmbus DLL) ## Examples iex> decode(<<0x03>>) {:ok, %Exmbus.Parser.Tpl.Device{id: 3}} iex> encode(%Exmbus.Parser.Tpl.Device{id: 3}) {:ok, <<3>>} iex> format(%Exmbus.Parser.Tpl.Devic...
0884af7b6c857a6be87cc66ffbf5a9a0d5a02e4d
1,738
[ 114174469 ]
[ "test" ]
defmodule EximapTest do use ExUnit.Case, async: false alias Eximap.Imap.{Client, Request} doctest Eximap doctest Eximap.Socket doctest Eximap.Imap.Client doctest Eximap.Imap.Request doctest Eximap.Imap.Response @large_mailbox_message_count 500 setup_all do {:ok, pid} = Client.start_link() [p...
0884cf8c4db1ef4d228e59cf783763d16068b985
3,337
[ 474432467 ]
[]
%{ "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, "earmark_parser": {:hex, :earmark_parser, "1.4.41...
0884dd8aad54393209a072efc76166555b491941
20,560
[ 453497306 ]
[ "test" ]
defmodule AsciiCanvas.DrawingModelTest do use AsciiCanvas.DataCase alias AsciiCanvas.CanvasModel alias AsciiCanvas.DrawingModel describe "Drawing Model:" do test "Rectangle at [14, 0] with width 7, height 6, outline character: ., fill: ." do {:ok, canvas} = CanvasModel.create_blank_value() {:o...
08851fb4d83a06dffdeb9c3644bfcae3a80553bc
2,257
[ 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1AnswerQueryRequestQueryUnderstandingSpec do @moduledoc """ Query understanding specification. ## Attributes * `disableSpellCorrection` (*type:* `boolean()`, *default:* `nil`) - Optional. Whether to disable spell correction. The default...
0885290ac1000225967684e6f6e76b8a1095f4bc
6,882
[ 670103538, 718072585, 718071371, 717420537 ]
[ "typespec", "documented" ]
defmodule ExDoc.Config do @moduledoc false # Defaults @default_source_ref "main" def filter_modules(_module, _metadata), do: true def before_closing_head_tag(_), do: "" def before_closing_body_tag(_), do: "" def annotations_for_docs(_), do: [] defstruct annotations_for_docs: &__MODULE__.annotations_fo...
088535ae0928d95cc881dace75d131f646c24735
1,809
[ 120436576 ]
[ "documented" ]
defmodule Api.Accounts.Resolvers do import Logger @doc""" User """ @doc""" QUERY current_user """ def current(_args, %{context: %{current_user: %{id: current_user_id}}}) do {:ok, Api.Accounts.get_user!(current_user_id)} end @doc""" QUERY current_user without current_user "...
0885876e2359b0df2559575e7c1c45ce0598312b
1,593
[ 248817168 ]
[ "typespec", "documented" ]
defmodule Membrane.RTCP.TransportFeedbackPacket do @moduledoc """ Abstraction and generic encoding/decoding functionality for [RTCP transport layer feedback packets](https://datatracker.ietf.org/doc/html/rfc4585#section-6.1). """ @behaviour Membrane.RTCP.Packet alias Membrane.RTP @enforce_keys [:sender...
0886146f8efd2f9be57c795ad71f27c5db0cbc2d
1,543
[ 82389103 ]
[ "phoenix" ]
defmodule Todos.TodoController do use Todos.Web, :controller alias Todos.Todo def index(conn, _params) do query = from p in Todo, order_by: [desc: :id] todos = Repo.all(query) render(conn, "index.json", todos: todos) end def create(conn, %{"todo" => todo_params}) do changeset = ...
08861e6745bf6769c4b063ab011119f6cfa29b63
1,711
[ 71174933 ]
[ "test" ]
defmodule NelixmoValidateTest do use ExUnit.Case doctest Nelixmo.Validate test "sender_id as Numeric" do assert Nelixmo.Validate.sender_id("447525856424") == {:ok, "447525856424"} end test "sender_id as Alphanumeric" do assert Nelixmo.Validate.sender_id("MyCompany20") == {:ok, "MyCompany20"} end ...
088690a9c97e38bd024898c894b0b172cf4a2922
5,328
[ 820603223 ]
[ "typespec", "documented" ]
defmodule ArchethicClient.Transaction do @moduledoc """ Represents the main unit of the Archethic network and its Transaction Chain. Blocks are reduce to its unitary form to provide high scalability, avoiding double spending attack and chain integrity """ alias ArchethicClient.API alias ArchethicClient.Cr...
0886c8c66499ed61b76498b31929fa5f6468f649
2,101
[ 434772570 ]
[]
# 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...
0886d173345ab86b3957597e96685618d10aecbf
1,706
[ 862739585 ]
[ "documented", "ecto" ]
defmodule Blackjack.Accounts.PlayerNotifier do import Swoosh.Email alias Blackjack.Mailer # Delivers the email using the application mailer. defp deliver(recipient, subject, body) do email = new() |> to(recipient) |> from({"Blackjack", "<EMAIL>"}) |> subject(subject) |> text_...
0886d5494e75136ab9ba3c9d2e4d9118bc7b924e
15,144
[ 701825499 ]
[ "documented" ]
defmodule HttpDiff do @moduledoc """ CLI tool for identifying changes between two JSON files containing an array of HTTP request/response pairs. When I refer to objects in the comments I really mean decoded JSON objects, so either a Jason.OrderedObject or a map depending on the options used in Jason.decode....
08879a0aba93fcd5fa38922eb7486684dbe11434
1,603
[ 954784381 ]
[ "phoenix" ]
defmodule CdGigalixirWeb.Router do use CdGigalixirWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {CdGigalixirWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :...
0887d1b7827e1ae5abcfddd9981c160afceecb14
6,304
[ 180665419 ]
[ "genserver", "liveview" ]
defmodule DemoWeb.PongTwoLive do use Phoenix.LiveView @container_width 800 @container_height 400 @container_border 5 @board_width @container_width - 2*@container_border @board_height @container_height - 2*@container_border @game_loop_tick 30 # 16 = 60fps @paddle_speed 8 @ball_speed 5 @ball_direc...
0887e72e971c20a627c791d09de2024d8316a595
3,529
[ 67077446 ]
[ "test" ]
defmodule TrackingServiceApi.OrderControllerTest do use TrackingServiceApi.ConnCase alias TrackingServiceApi.Order alias TrackingServiceApi.Repo @valid_attrs %{address: "some content", finish_date: %{day: 17, hour: 14, min: 0, month: 4, sec: 0, year: 2010}, start_date: %{day: 17, hour: 14, min: 0, month: 4, s...
088805e77f0c7f338b2b4a575302101833d17ead
2,103
[ 912296145 ]
[ "phoenix" ]
defmodule EnrolmentformWeb.AdminSessionController do use EnrolmentformWeb, :controller alias Enrolmentform.Accounts alias EnrolmentformWeb.AdminAuth def create(conn, %{"_action" => "confirmed"} = params) do create(conn, params, "Admin confirmed successfully.") end def create(conn, params) do crea...
0888228683dbf29e74b9333c6a01ec9fec24acd1
1,633
[ 148225367, 153943055, 214698379, 145852031 ]
[ "macro", "documented", "phoenix" ]
defmodule MediumGraphqlApiWeb 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 MediumGraphqlApiWeb, :controller use MediumGraphqlApiWeb, :view The definitions below will be executed for...
08889a5429b67b11879ae55d1fb0466158b801b2
5,780
[ 146197989 ]
[ "test", "phoenix" ]
defmodule OneDHCPDTest do use ExUnit.Case test "decodes a DHCP request" do packet = <<0x01, 0x01, 0x06, 0x00, 0x39, 0x93, 0xF5, 0x7D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xDB, 0x55, 0xE7, 0x8B, 0x5D,...
0888b125ed55523019150d7261ace5fd145ffd0f
3,402
[ 507349355 ]
[ "test" ]
defmodule OmegaBravera.Challenges.NGOChalTest do use OmegaBravera.DataCase import OmegaBravera.Factory alias OmegaBravera.{Challenges.NGOChal, Accounts.User} test "changeset/2 is invalid if not provided the required attributes" do assert NGOChal.changeset(%NGOChal{}, %User{}, %{"activity_type" => "Walk"}...
0888b8beaa6c5509effb693b42f5729f4531b399
10,017
[ 865709812 ]
[ "typespec", "documented" ]
defmodule Sequential do # Regex que splitea por caracteres en blanco, cualquier número de estos @white_regex ~r/\s+/ @moduledoc """ A brute-force SAT solver implementation in Elixir that evaluates all possible combinations of boolean variables to find a satisfying assignment for a given CNF formula. The s...
08898aa565f497e09146f360e8ece9b4cd1102a1
1,782
[ 149640181 ]
[ "test", "phoenix" ]
defmodule BlockScoutWeb.AddressContractControllerTest do use BlockScoutWeb.ConnCase import BlockScoutWeb.Router.Helpers, only: [address_contract_path: 3] alias Explorer.Factory alias Explorer.Chain.Hash alias Explorer.ExchangeRates.Token describe "GET index/3" do test "returns not found for unexisten...
0889eaf3c37710f8ac36c58304c22b30a078e1e8
5,075
[ 939418214 ]
[ "liveview", "ecto" ]
defmodule HabitQuestWeb.TaskLive.FormComponent do use HabitQuestWeb, :live_component alias HabitQuest.Tasks alias HabitQuest.Tasks.Task @impl true def render(assigns) do ~H""" <div> <.header> {@title} <:subtitle>Create a new habit for your children to track</:subtitle> </...
088a4b54ab85ef238e31fbe7a9cc854e049283bb
1,707
[ 399311390 ]
[ "liveview", "ecto" ]
defmodule LifecycleWeb.RealmLive.FormComponent do use LifecycleWeb, :live_component alias Lifecycle.Users @impl true def update(%{realm: realm} = assigns, socket) do changeset = Users.change_realm(realm) {:ok, socket |> assign(assigns) |> assign(:changeset, changeset)} end @impl t...
088a8fb2ac4220643166a654c0e15ed2ff286a34
1,786
[ 65775721 ]
[ "documented" ]
defmodule ExMustang.Responders.Giphy do @moduledoc """ Grabs a random gif from Giphy """ use Hedwig.Responder import ExMustang.Utils, only: [useragent: 0] @random_gif_url "https://api.giphy.com/v1/gifs/random" @translate_gif_url "https://api.giphy.com/v1/gifs/translate" @api_key Application.get_env(:ex...
088b2ac88f67eb131b29f59947cb7fa4f2e4ea11
1,958
[ 57046516 ]
[ "phoenix" ]
require IEx defmodule PhoenixBenchmark.BenchmarkController do use PhoenixBenchmark.Web, :controller def index(conn, _params) do :ibrowse.set_dest(Dotenv.get("API_SERVER"), 80, [{:max_sessions, 1000}, {:max_pipeline_size, 5}]) async_output = [&detectors/0, &app_...
088c5e525fe0e91f49c8a6c91fc3cfc82b2d1243
2,739
[ 161566511 ]
[]
defmodule ExDocRefined.V1WebSocketHandler do @behaviour :cowboy_websocket_handler alias ExDocRefined.Retriever def init(_, req, _opts) do opts = %{idle_timeout: 60000} {:upgrade, :protocol, :cowboy_websocket, req, opts} end def websocket_init(_transport, req, state) do message = %{modules: Retr...
088cb14d024a82f5552232674f9bd96ae007689a
5,456
[ 560908546 ]
[ "typespec" ]
defmodule Conversion.Content.Writers.Writer do alias Conversion.Content.Model.Document alias Conversion.Content.Model.Block alias Conversion.Content.Model.Inline alias Conversion.Content.Model.Text alias Conversion.Content.Model.Organization alias Conversion.Content.Model.Package alias Conversion.Content....
088cea446de41065791375bc9da79f9914a9bf5f
3,728
[ 262815949 ]
[ "liveview", "test" ]
defmodule ChirpWeb.PostLiveTest do use ChirpWeb.ConnCase import Phoenix.LiveViewTest alias Chirp.Timeline @create_attrs %{body: "some body", likes_count: "some likes_count", reposts_count: "some reposts_count", username: "some username"} @update_attrs %{body: "some updated body", likes_count: "some updated...
088d4cd7415145c61c2593e726012331b0c43496
1,759
[ 93765520, 71608796, 47486383, 54967115, 99250164 ]
[ "test" ]
Code.require_file "../../test_helper.exs", __DIR__ defmodule Mix.Tasks.LoadconfigTest do use MixTest.Case @tag apps: [:my_app] test "reads and persists project configuration", context do Mix.Project.push MixTest.Case.Sample in_tmp context.test, fn -> write_config """ [my_app: [key: :project...
088d4d82a977d11c7418ba7a85be38d63ae8a1f0
2,432
[ 149496895 ]
[]
defmodule Studio54.DbSetup do require Logger def delete_schema do :stopped = :mnesia.stop() case :mnesia.delete_schema([node()]) do :ok -> Logger.warn("database schema deleted.") end :ok = :mnesia.start() end def create_schema do :stopped = :mnesia.stop() case :mnesia....
088d643433a216568ebc84f8fa1072d5b0f367bb
3,697
[ 325784505 ]
[ "test", "documented" ]
defmodule Snap.SearchResponseTest do @moduledoc false use ExUnit.Case, async: true alias Snap.SearchResponse test "new/1 without extra fields" do json = fixture_json("search_response") response = SearchResponse.new(json) assert response.took == 5 assert response.timed_out == false assert ...
088da2b50fc020121d74587ed865fd3ef5010797
2,156
[ 409417669 ]
[ "typespec", "documented" ]
defmodule Mrgr.Notification.Dormant do use Mrgr.Notification.Event @moduledoc """ These notifications assume there will be at least one PR in them, that is, that many PRs will go dormant 'at one time' - within the hour that the dormancy alarm runs - and the user will get a single notification for all of the ...
088e5a5617f2d9272f6d84e40ec6d359423cf2af
1,925
[ 825502772 ]
[]
# 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...
088e64bcdbe1ff9e8c04e4469a6ede3ba99dba27
1,777
[ 630643619 ]
[]
defmodule Kafka do use Maelstrom def handle_message(_src, _dest, %{"type" => "send", "key" => key, "msg" => msg}, %{logs: logs} = state, _node_state) do {offset, list} = logs |> Map.get(key, []) |> case do [] -> {1000, [{1000, msg}]} [{hd_offset, _}|_] = other -> ...
088ed0a02a7061b95be28fc9cd04bc0788b46f15
3,057
[ 692859244 ]
[ "documented" ]
defmodule ErlangToElixir do @moduledoc """ Documentation for `ErlangToElixir`. """ @doc """ Hello world. ## Examples iex> ErlangToElixir.hello() :world """ def hello do :world end def do_it do string = "fun(A) -> io:format(\"blah~n\") end." # {:ok, tokens, _} = :erl_scan...
088eed1d63b9c8c610b8eab0401149ef12323011
1,923
[ 657799110, 679652486, 725959680, 541841921 ]
[ "documented" ]
defmodule Credo.Check.Warning.Dbg do use Credo.Check, id: "EX5026", base_priority: :high, elixir_version: ">= 1.14.0-dev", explanations: [ check: """ Calls to dbg/0 and dbg/2 should mostly be used during debugging sessions. This check warns about those calls, because they probably h...
088ef21e6a9331cfad730832846dd849c3f0025e
4,557
[ 343976956 ]
[ "macro", "documented" ]
defmodule ExtraEnum.Mailbox do @moduledoc """ Enumerates against the mailbox by matching. Can match a single pattern or multiple patterns. Arbitrary code can be executed when using the multiple pattern syntax, giving feature parity with `Kernel.SpecialForms.receive/1`. Stops enumerating when the end of t...
088f5717ab0660badd9e694703a56cd6a8987c9b
9,373
[ 803462259 ]
[]
%{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "castore": {:hex, :castore, "1.0.7", "b651241514e5f6956028147fe6637f7ac13802537e895a724f90bf3e36ddd1dd", [:mix], [], "hexpm"...
089020a8a79067515a427312d440d1f5c43bfa4c
2,338
[ 387089661 ]
[ "typespec", "ecto" ]
defmodule History.CandleHistoryChunks do require Ecto.Query require Indifferent import Ecto.Query alias History.{DataAdapter, Repo} alias History.Candles.CandleHistoryChunk, as: Chunk @spec get!(Chunk.id()) :: Chunk.t() def get!(id) do Repo.get!(Chunk, id) end @default_latest_page 1 @default_l...
0890ec8d6f49e0cfdf9aa656708c11bcd81adbdb
2,062
[ 87623793 ]
[ "test", "ecto" ]
defmodule Podcatcher.CategoriesTest do use Podcatcher.DataCase import Podcatcher.Fixtures alias Podcatcher.Categories alias Podcatcher.Categories.Category @create_attrs %{name: "some name"} @update_attrs %{name: "some updated name"} @invalid_attrs %{name: nil} test "fetch_categories/1 should fetch c...
08911549d43043e9b0b88dc23a611f25327b2f9a
1,619
[ 131128641 ]
[ "test" ]
defmodule Apus.PlivoAdapterTest do use ExUnit.Case use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney, options: [clear_mock: true] alias Apus.Message alias Apus.PlivoAdapter describe "message delivery" do test "deliver/2 should deliver a message" do config = %{ auth_id: "fake-auth-id", ...
089159220f4e5667d144f17aff85d137a39019f3
2,750
[ 571778780 ]
[]
defmodule KitchenCalculator do def get_volume(volume_pair) do elem(volume_pair, 1) end def to_milliliter(volume_pair) do cond do volume_pair == {:milliliter, get_volume(volume_pair)} -> volume_pair volume_pair == {:cup, get_volume(volume_pair)} -> {:milliliter, elem(volume_pair...
08916db9a5bc8de1c75bdfdf5db7913b90d26d46
6,641
[ 843505444 ]
[ "typespec", "documented" ]
defmodule LiqPayAPI.InternetAcquiring.Subscription.Create.Response do @moduledoc """ Provides struct and type for a InternetAcquiring.Subscription.Create.Response """ @behaviour OpenAPIClient.Schema @type t :: %__MODULE__{ acq_id: integer | nil, action: :auth | :h...
08916f40bd4999523f8c0eb9ec011c3d25f1f103
2,914
[ 172546611 ]
[ "documented" ]
defmodule PhoneDictonary do @directory %{"2" => ["A", "B", "C"], "3" => ["D", "E", "F"], "4" => ["G", "H", "I"], "5" => ["J", "K", "L"], "6" => ["M", "N", "O"], "7" => ["P", "Q", "R", "S"], "8" => ["T", "U", "V"], "9" => ["W", "X", "Y", "Z"]} @moduledoc """ PhoneDictonary module for mapping phone number to g...
08917ee3537a8bfd0ac20a214aab02bbb00aacf6
2,524
[ 200448964 ]
[ "documented", "ecto" ]
defmodule NflRushing.Player.Statistics do use Ecto.Schema import Ecto.Changeset schema "player_statistics" do field :att, :integer field :att_per_game, :float field :first, :integer field :first_percentage, :float field :fourty_plus, :integer field :fum, :integer field :long, :intege...
0891ab10489290bf97347c7c1059e74345770037
2,762
[ 106712767 ]
[ "typespec" ]
defmodule Sanbase.SocialData.TrendingStories do import Sanbase.DateTimeUtils, only: [str_to_sec: 1] import Sanbase.Metric.SqlQuery.Helper, only: [to_unix_timestamp: 3, dt_to_unix: 2] @type slug :: String.t() @type interval :: String.t() @spec get_trending_stories( from :: DateTime.t(), t...
0891c122dc0cb885774b777070d75e6fdeaba6c5
2,741
[ 29387790 ]
[ "liveview", "documented" ]
defmodule BrandoAdmin.Components.FilePicker do @moduledoc false use BrandoAdmin, :live_component use Gettext, backend: Brando.Gettext alias Brando.Utils alias BrandoAdmin.Components.Content def update( %{config_target: config_target, event_target: event_target, multi: multi, selected_files: select...
0891e2ea30f9fafd1ee7a5669e2d75eab74bd2d1
5,849
[ 85426732 ]
[ "documented" ]
defmodule ExAdServer.Indexes.GeoKeyProcessor do @moduledoc """ Geo key processor implementation. """ @behaviour ExAdServer.Indexes.BehaviorKeysProcessor require Logger import ExAdServer.Utils.Storage alias :ets, as: ETS ## Sorted array giving for a bit precision the approximation radius in meters of ...