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
0b0aa79e8701fc6a35f78eb19a77092773b9f22f
2,849
[ 161375033 ]
[ "genserver" ]
# credo:disable-for-this-file Credo.Check.Readability.Specs defmodule FakeMC do use SMPPEX.Session require Logger alias SMPPEX.Pdu alias SMPPEX.Pdu.Factory, as: PduFactory @name_prefix "fake_mc_" def all_session_names(port) do Process.registered() |> Enum.filter(fn atom -> String.contains?(to_string(...
0b0b8e6b7dd9f1ca977930e4c1ce6b27dbd7fec0
5,861
[ 820192032 ]
[ "genserver", "liveview", "documented" ]
defmodule SequinWeb.SinkConsumersLive.Index do @moduledoc false use SequinWeb, :live_view alias Sequin.Consumers alias Sequin.Databases alias Sequin.Health alias Sequin.Metrics alias SequinWeb.RouteHelpers @smoothing_window 5 @timeseries_window_count 60 @page_size 50 @impl Phoenix.LiveView de...
0b0bb2259ef5b64e25a66360a290668f73bbf232
10,413
[ 132878376 ]
[ "macro", "documented" ]
defmodule ExAliyunOts.Timeline.Meta do @moduledoc """ Tablestore Timeline meta implements. """ use ExAliyunOts.Constants import ExAliyunOts.Utils.Guards import ExAliyunOts.DSL, only: [condition: 1] require Logger alias ExAliyunOts.{Client, Var, Utils} alias ExAliyunOts.Var.Search alias __MODULE__ ...
0b0c1dc16caac3f65dc54c78254e8ed73830720d
2,550
[ 16667691 ]
[ "genserver", "documented" ]
defmodule EnvConf.Server do @moduledoc """ The EnvConf Server is the main config service. It provides a few functions for getting and setting Config Values. The current behavior for setting values requires that both the key and value be binaries. However there are get functions that will return a value of ...
0b0c2eccd083531073e2387e4fde4316dedaaa9c
5,566
[ 19643959 ]
[ "typespec", "documented" ]
defmodule Function do @moduledoc """ A set of functions for working with functions. Anonymous functions are typically created by using `fn`: iex> add = fn a, b -> a + b end iex> add.(1, 2) 3 It is also possible to capture module functions and pass them around as if they were anonymous fun...
0b0c90780e6dc837d7607e615c2bff968d70060c
2,175
[ 320129980 ]
[ "macro", "documented" ]
defmodule Aoc2022 do @moduledoc """ Documentation for `Aoc2022`. """ @callback handle_input(input :: String.t()) :: term @callback handle_part_2_input(input :: String.t()) :: term @callback do_part_1(term) :: term @callback do_part_2(term) :: term @optional_callbacks handle_part_2_input: 1 defmacro...
0b0d2c327a0024308e043a09ca195c5934b22aa7
1,720
[ 880553327 ]
[ "supervisor", "documented" ]
defmodule VoxDialog.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false use Application require Logger @impl true def start(_type, _args) do children = [ VoxDialogWeb.Telemetry, VoxDialog.Repo, {DNSCluster, ...
0b0d88040ccae86bd6cab62a35e88c2baf77aa1a
9,993
[ 219212893 ]
[ "documented", "ecto" ]
defmodule JsonApi.Models do @moduledoc """ The Models context. """ import Ecto.Query, warn: false alias JsonApi.Repo alias JsonApi.Models.Users alias JsonApi.Models.Clock alias JsonApi.Models.Workingtime def get_users_by_infos!(username, email) do Repo.get_by(Users, username: username, email: e...
0b0d9bea3e579fc000c354e449c1876d5bd3c5a3
10,793
[ 626302354 ]
[ "test" ]
defmodule Iso8583ParserBuildHeaderBinDataTypeBinaryTest do use ExUnit.Case, async: true doctest Iso8583Parser # header size 1 test "build header bin (header size 1) (data type binary) (data size 1)" do assert(Iso8583Parser.build_header(1, :x, 8, <<128>>, :bin) == <<8>>) end test "build header bin (he...
0b0da39410d58bf3b4104c4ce1871e499a9e44e1
18,230
[ 949664843 ]
[ "genserver", "typespec", "documented" ]
defmodule Raxol.Terminal.Script.UnifiedScript do @moduledoc """ Unified scripting system for the Raxol terminal emulator. Handles script execution, management, and integration with the terminal. """ use GenServer import Raxol.Guards require Logger @type script_id :: String.t() @type script_type :: :...
0b0e3ec30043d325782a1a60ed6da92ffeb0ffc3
9,208
[ 48860943 ]
[ "test" ]
defmodule Absinthe.Relay.NodeTest do use Absinthe.Relay.Case, async: true import ExUnit.CaptureLog alias Absinthe.Relay.Node defmodule Schema do use Absinthe.Schema use Absinthe.Relay.Schema, :classic @foos %{ "1" => %{id: "1", name: "Bar 1"}, "2" => %{id: "2", name: "Bar 2"} } ...
0b0e53f4cd3a21e2bf6a28f4de3ccda9429ff2e7
2,628
[ 152887449 ]
[ "genserver", "liveview" ]
defmodule DemoWeb.RainbowLive do use Phoenix.LiveView use Phoenix.HTML @fps 100 @inner_window_width 1200 def render(assigns) do ~L""" <h1>Silky Smooth SSR</h1> <h3>Fast enough to power animations <em>[on the server]</em> at <%= @fps %>FPS</h3> <form phx-change="update_fps"> <input type...
0b0e8216de61516e58539ada1f3e624a58d29d70
2,493
[ 536274297 ]
[ "test", "ecto" ]
defmodule BeaconBall.RunsTest do use BeaconBall.DataCase alias BeaconBall.Runs describe "runs" do alias BeaconBall.Runs.Run import BeaconBall.RunsFixtures @invalid_attrs %{max_capacity: nil, message: nil, starts_at: nil} test "list_runs/0 returns all runs" do run = run_fixture() a...
0b0ed48575574a4a881c7a977d91a41551198efe
6,284
[ 116840131 ]
[ "documented", "ecto" ]
defmodule SimpleStatEx do @moduledoc """ SimpleStatEx is a lightweight library that supports logging simple statistics for any elixir project, including the Phoenix Framework. Stats are stored via ecto to your data store or in memory. They are rolled up by category and time window and can be queried convenie...
0b0f195e6a25244d65b6bab67c830061dd5198fe
2,534
[ 49509075 ]
[ "test" ]
defmodule Cazoc.ArticleControllerTest do use Cazoc.ConnCase alias Cazoc.Article @valid_attrs %{body: "some content", cover: "some content", published_at: Timex.Date.now, title: "some content"} @invalid_attrs %{} test "lists all entries on index", %{conn: conn} do conn = get conn, article_path(conn, :ind...
0b0f387c2c491edf2748d8b5200402a71eb47d01
2,791
[ 490657607 ]
[ "typespec" ]
defmodule TakeANumberDeluxe.State do defstruct min_number: 1, max_number: 999, queue: nil, auto_shutdown_timeout: :infinity @type t :: %__MODULE__{} alias TakeANumberDeluxe.Queue @spec new(integer, integer, timeout) :: {:ok, TakeANumberDeluxe.State.t()} | {:error, atom} def new(min_number, max_number, auto_...
0b0f4b77c5b289e074868c315673492646dda37d
5,630
[ 1019126840 ]
[ "typespec", "documented" ]
defmodule DSPex.Python.Bridge do @moduledoc """ Bridge between DSPex operations and Snakepit Python pools. Handles request/response protocol, error handling, and streaming support. """ require Logger @default_timeout 30_000 @doc """ Execute a Python operation through Snakepit. """ @spec execute(...
0b0f726bc39397e23858a6b6e500e88caaa80f25
1,620
[ 91399852 ]
[ "genserver" ]
defmodule Sequence.Server do use GenServer require Logger @vsn "1" defmodule State do defstruct current_number: 0, stash_pid: nil, delta: 1 end # External API def start_link(stash_pid) do {:ok, _pid} = GenServer.start_link(__MODULE__, stash_pid, name: __MODULE__) end def clear do GenSe...
0b103bed6643ca0c49bf79333633b98e99ddafa7
4,096
[ 126800827 ]
[ "documented" ]
defmodule Mix.Tasks.Hoplon.Fetch do use Mix.Task alias Hoplon.CLI.GenericTask alias Hoplon.CLI.Prompt alias Hoplon.Crypto alias Hoplon.CLI.Tools alias Hoplon.CLI.ConfigFile require Hoplon.Data alias Hoplon.Data.Encoder alias Hoplon.Data @behaviour GenericTask @shortdoc "fetch audits from the tr...
0b10518f33afb46b1b268cda699df773d8ebda4f
5,945
[ 725804544, 713113704 ]
[ "typespec", "documented" ]
defmodule Routes.Repo do @moduledoc "Repo for fetching Route resources and their associated data from the V3 API." @behaviour Routes.RepoApi require Logger use RepoCache, ttl: :timer.hours(1) import Routes.Parser alias JsonApi # alias Routes.{Route, Shape} alias Routes.Route # alias MBTAV3API.{Sha...
0b109e841db67a3ed537f33adcf43c81b23f4671
2,400
[ 156872962 ]
[ "documented" ]
defmodule ClickhouseEcto.HTTPClient do @moduledoc false alias ClickhouseEcto.Types @selected_queries_regex ~r/^(SELECT|SHOW|DESCRIBE|EXISTS)/i @req_headers [{"Content-Type", "text/plain"}] def send(query, base_address, timeout, username, password, database, method) when username != nil do # TODO change...
0b10b4110406f33a7e0b31052bed3ab80ce64fb5
11,709
[ 82957477 ]
[ "macro", "test" ]
defmodule PlymioAstEvalHelper do require Plymio.Option.Utility, as: POU alias Plymio.Ast.Utility, as: PAU @helper_opts_key_transform :transform @helper_opts_key_binding :binding @helper_opts_key_expect_error :expect_error @helper_opts_key_expect_value :expect_value @helper_opts_key_expect_text :expect_t...
0b1104784179319549a82406ba79766a05c9e058
1,734
[ 244371345 ]
[ "typespec", "phoenix" ]
defmodule PowApiWeb.API.V1.ConfirmEmailController do use PowApiWeb, :controller alias Plug.Conn @spec confirm(Conn.t(), map()) :: Conn.t() def confirm(conn, %{"token" => token}) do case PowEmailConfirmation.Plug.confirm_email(conn, token) do {:ok, _user, conn} -> conn |> json(%{data:...
0b11214a7d292c4e4ccd82fe535892d5f5bd1bb3
10,578
[ 834136411 ]
[ "typespec", "liveview", "documented" ]
defmodule AshPagify.Components.Table do @moduledoc """ Table component for AshPagify. """ use Phoenix.Component alias AshPagify.Components alias AshPagify.Meta alias AshPagify.Misc alias Phoenix.LiveView.JS @spec default_opts() :: [Components.table_option()] def default_opts do [ contai...
0b112ecea8fed749cc1b8ad3402df1e2c9ccbe56
1,694
[ 224893831 ]
[ "macro", "test" ]
defmodule Fmt.ParserTest do use ExUnit.Case @subject Fmt.Parser doctest @subject # Test sigil to simplify the test declarations. # # It is equivalent of doing: # # @subject.parse(~S(input)) # defmacrop sigil_P({:<<>>, _, [input]}, _) do quote do @subject.parse(unquote(input)) en...
0b11b4da8197f22c17eccd106d6c7c2df39b490a
2,586
[ 722641921 ]
[ "genserver" ]
defmodule SimpleEmbedder.CLIP.PythonEmbedder do use GenServer @behaviour SimpleEmbedder.EmbedderAPI alias SimpleEmbedder.EmbedderAPI @supported_models %{ "openai/clip-vit-base-patch32" => %{ name: "openai/clip-vit-base-patch32", vector_size: 512 }, "laion/CLIP-ViT-H-14-laion2B-s32B-b79k...
0b11bd8dee2ce359058c2ccbcbde057bfbe1f73d
6,448
[ 890414459 ]
[ "genserver", "typespec", "documented" ]
defmodule SRCache.Cache do @moduledoc """ Periodic Self-Rehydrating Cache. """ use GenServer require Logger @default_timeout 30_000 @type result :: {:ok, any()} | {:error, :timeout} | {:error, :not_registered} | {:error, :timeout_must_be_integer} | {:err...
0b11ef91e096a869a2b0d5daed8204fac7e11f50
2,467
[ 118723658 ]
[ "genserver" ]
defmodule War.GamePlay.Server do use GenServer alias War.GamePlay.{Game, Deck} @name __MODULE__ # Client API def start_link(id) do GenServer.start_link(__MODULE__, :ok, name: @name) end def battle(pid) do GenServer.call(pid, :battle) end def read(pid) do GenServer.call(pid, :read) end # Serve...
0b12113cd89ec78065cc7317cad864f8942560d1
2,371
[ 179918085, 157010549 ]
[ "test", "ecto" ]
defmodule Studor.RatingsTest do use Studor.DataCase alias Studor.Ratings describe "ratings" do alias Studor.Ratings.Rating @valid_attrs %{date: "2010-04-17T14:00:00Z", description: "some description", stars: 42} @update_attrs %{date: "2011-05-18T15:01:01Z", description: "some updated description", ...
0b12af55cddcd62a6c6c9c11a6940539937cbca7
1,746
[ 571776611 ]
[ "test" ]
defmodule Pleroma.Web.OAuth.AppTest do use Pleroma.DataCase, async: true alias Pleroma.Web.OAuth.App import Pleroma.Factory describe "get_or_make/2" do test "gets exist app" do attrs = %{client_name: "Mastodon-Local", redirect_uris: "."} app = insert(:oauth_app, Map.merge(attrs, %{sco...
0b12f53fc69ba476f10b4b246bf3cd9bdfc1fa0d
2,645
[ 829321800 ]
[]
defmodule Stats do use Prometheus.Metric def setup() do Gauge.declare( name: :user_running, help: "User running" ) Gauge.declare( name: :messages, labels: [:kind, :status], help: "Messages counter" ) Gauge.declare( name: :reconnect, help: "Reconnectio...
0b12f87ece8bb1f6e79e8a9a777eebd803079522
2,802
[ 79900140 ]
[ "typespec", "macro", "documented" ]
defmodule Bundlex do @moduledoc """ Some common utility functions. """ alias Bundlex.Helper.MixHelper alias Bundlex.Platform @type platform_t :: :linux | :macosx | :windows32 | :windows64 | :nerves | :custom @typedoc """ A map containing four fields that describe the target platform. It consists o...
0b13139d85364e46e248f08a94eaf3ec2fd42fc3
2,376
[ 861161192 ]
[ "phoenix" ]
defmodule HelloWeb.Router do use HelloWeb, :router pipeline :browser do plug :accepts, ["html", "json"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {HelloWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug HelloWeb.Plugs.Local...
0b132c0fbe43c351d35b22df6f6354c653635443
1,600
[ 933125618 ]
[ "liveview", "phoenix" ]
defmodule MediaLabWeb.Endpoint do use Phoenix.Endpoint, otp_app: :media_lab # 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: "_media_...
0b1385378c13ad5dddbeca962e6160252cf2e88c
17,468
[ 672062856 ]
[ "test", "ecto" ]
defmodule Lanttern.GradingTest do use Lanttern.DataCase alias Lanttern.Grading describe "grade_components" do alias Lanttern.Grading.GradeComponent import Lanttern.GradingFixtures alias Lanttern.GradesReportsFixtures @invalid_attrs %{position: nil, weight: nil} test "list_grade_components...
0b1401133403fa762f426315bd5b9fdb1c20822c
1,546
[ 331437459 ]
[]
# distributed algorithms, n.dulay, 4 jan 21 # various helper functions defmodule Helper do def lookup(name) do addresses = :inet_res.lookup(name,:in,:a) {a, b, c, d} = hd(addresses) # get octets for 1st ipv4 address :"#{a}.#{b}.#{c}.#{d}" end def node_ip_addr do {:ok, interfaces} = :inet.getif() # get ...
0b142a99c8eb5fd00e274f845e6b86d8b55bc861
4,186
[ 898627314 ]
[]
defmodule Day16 do defmodule NodePartTwo do defstruct x: 0, y: 0, dir: 0, score: 0 end """ defmodule PriorityQueue do defstruct queue: [] def new(), do: %PriorityQueue{} def push(%PriorityQueue{queue: queue} = pq, item) do %PriorityQueue{pq | queue: :lists.sort([item | queue], &(&1.sco...
0b143bad279f439ab3fe5a6f45a55aa99328e000
1,895
[ 163319904 ]
[ "ecto" ]
defmodule Exchange.Order do use Ecto.Schema import Ecto.Changeset alias Exchange.Utils alias Exchange.Balance @derive {Jason.Encoder, only: [:id, :maker_id, :market_id, :side, :kind, :price, :amount, :amount_filled, :active, :updated_at, :inserted_at]} schema "orders" do field :maker_id, :integer ...
0b144dcf085c90f19abad0cac3b92bb03fda7e1e
17,432
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CloudSupport.V2beta.Api.Media do @moduledoc """ API calls for all endpoints tagged `Media`. """ alias GoogleApi.CloudSupport.V2beta.Connection alias GoogleApi.Gax.{Request, Response} @library_version Mix.Project.config() |> Keyword.get(:version, "") @doc """ Download a file attach...
0b145189e9ee928497dd625e5385d2cc3fbb979f
1,836
[ 508714397 ]
[ "documented", "ecto" ]
defmodule BiddingApi.Listings do @moduledoc """ The Listings context. """ import Ecto.Query, warn: false alias BiddingApi.Repo alias BiddingApi.Listings.Listing @doc """ Returns the list of listings. ## Examples iex> list_listings() [%Listing{}, ...] """ def list_listings do ...
0b14851faa9f7b440f4182dbdcc98485b2cd1267
17,107
[ 16328245 ]
[ "test" ]
defmodule Hexpm.Repository.ReleaseTest do use Hexpm.DataCase, async: true alias Hexpm.Repository.Release setup do publisher = insert(:user) [_, _, package3] = packages = insert_list(3, :package) |> Hexpm.Repo.preload(:repository) Release.build( package3, publisher, ...
0b148fd1b87fc84480b80d278886c10181e670c1
4,706
[ 50945543 ]
[ "test" ]
defmodule Review.CommitsTest do use Review.AcceptanceCase import Review.Factory test "shows a list of commits, with the newest on top" do commit1 = insert(:commit) commit2 = insert(:commit) commit3 = insert(:commit) navigate_to_commits_page() elements = find_all_elements(:css, ".test-commit...
0b14944ccc0a1a5df5a075329d157e7e4e219fae
4,149
[ 661032488 ]
[ "documented", "ecto" ]
defmodule MayIsBikeMonth.Competitions do @moduledoc """ The Competitions context. """ import Ecto.Query, warn: false alias MayIsBikeMonth.Repo alias MayIsBikeMonth.Competitions.Competition @doc """ Returns the list of competitions. ## Examples iex> list_competitions() [%Competition{},...
0b14e3e8467f534b23d121a2defef525b9b0dde9
3,317
[ 930399878 ]
[ "documented" ]
# Pour insérer ces données minimales : # # mix run priv/repo/seeds/minimal.exs ExUnit.start() Code.require_file("data_case.ex", "./test/support") Code.require_file("random_methods.ex", "./test/support/fixtures") Code.require_file("tache_fixtures.ex", "./test/support/fixtures") Code.require_file("projet_fixtures....
0b150c1e919f275a5afeeea43f2fb395ba04518a
2,231
[ 290630840 ]
[ "typespec", "phoenix", "ecto" ]
defmodule BangtanWeb.SongController do use BangtanWeb, :controller alias Bangtan.Artists @spec index(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() def index(conn, _params) do songs = Artists.list_songs() render(conn, "index.html", songs: songs) end @spec new(Plug.Conn.t(), Map.t()) :: Plug.Conn.t() d...
0b15903d570f1c5ba69646bb4c8881fe95ae26f5
3,712
[ 60716862, 46792347, 52610080, 54606771, 75659168, 46581093, 47783914, 48197916, 51232718, 54068570, 44308112, 51866787, 48748961, 52946417, 53535974, 52439335, 56011329, 56479386, 51879967, 43259887, 56457926, 59367090, 44181278, 51054054, 61923005, 75696014, 8162...
[ "typespec", "documented" ]
defprotocol Phoenix.HTML.FormData do @moduledoc """ Converts a data structure into a `Phoenix.HTML.Form` struct. """ @doc """ Converts a data structure into a `Phoenix.HTML.Form` struct. The options are the same options given to `form_for/4`. It can be used by implementations to configure their behaviou...
0b15ed53854f0f8d65d598d8b825c08113719220
5,602
[ 686920461 ]
[ "test", "phoenix" ]
defmodule FinAnalyzerWeb.TransactionsTest do use FinAnalyzerWeb.ConnCase import FinAnalyzer.TransactionsFixtures describe "transactions api" do setup :register_and_log_in_user test "uploads transactions via input file", %{conn: conn} do transactions = %Plug.Upload{ path: "test/assets/tran...
0b16503c5a621c25f7314b6d3fe91e9ecfbdb5b1
1,999
[ 696124997 ]
[ "documented", "ecto" ]
defmodule QuizGame.Users.UserNotifier do @moduledoc "The UserNotifier context." import Swoosh.Email alias QuizGame.Mailer defp deliver(recipient, subject, body) do # deliver email using the application mailer email = new() |> to(recipient) |> from( {Application.get_env(:quiz_g...
0b1659a3390015bdb83d8683641f1b4cd6209846
2,454
[ 822944726 ]
[ "liveview", "ecto" ]
defmodule DietProWeb.FoodCategoryLive.FormComponent do use DietProWeb, :live_component alias DietPro.Diets @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> <:subtitle>Use this form to manage food_category records in your database.</:subtitle> </.header>...
0b169e93ce0795c5c98e565cbac504e9de9d2c38
3,100
[ 804813440 ]
[ "genserver", "typespec", "documented" ]
defmodule SyslogReader do @moduledoc """ Módulo encargado de leer logs de un archivo de registro y enviarlos al Repositorio. Este módulo se utiliza para leer logs de un archivo de registro, formatearlos y enviarlos al Repositorio para su almacenamiento y procesamiento posterior. Formato correcto de log: 'Mo...
0b16b8875f677d0cdc182041b821a9f6f245940c
1,560
[ 185452263 ]
[ "test" ]
defmodule Store.Products.ReportTest do use Store.DataCase use Store.MongoCase alias Store.{Products.Report, Products.Product, Products, Repo} def product_fixture(attrs \\ %{}) do {:ok, product} = Products.create_product(attrs) product end def create_products do for n <- 1..3 do product_...
0b16e46559f6db7329a63006073f43cab7e93da2
5,071
[ 309792168 ]
[ "test" ]
defmodule OpentelemetryCommanded.EventHandlerTest do use OpentelemetryCommanded.CommandedCase, async: false import ExUnit.CaptureLog alias OpentelemetryCommanded.DummyApp.Commands, as: C alias OpentelemetryCommanded.DummyApp.Events, as: E describe "dispatch command when Telemetry attached" do setup _ d...
0b1706429f19e5a8953d162545205259895cda75
2,336
[ 315533589 ]
[ "test", "ecto" ]
defmodule Changkwang.SermonsTest do use Changkwang.DataCase alias Changkwang.Sermons describe "sermons" do alias Changkwang.Sermons.Sermon @valid_attrs %{date: "some date", share_code: "some share_code", titie: "some titie"} @update_attrs %{date: "some updated date", share_code: "some updated share...
0b17156a7bc53c70ab18f063364137e11d22fb0d
4,266
[ 261811919 ]
[ "genserver", "liveview" ]
defmodule TrademarkFreeStrategicLandWarfareWeb.StrategoLive do use TrademarkFreeStrategicLandWarfareWeb, :live_view alias TrademarkFreeStrategicLandWarfare.{Board, Tournament} @impl true def mount(_params, _session, socket) do pieces = [ {"marshall", 10}, {"general", 9}, {"colonel", 8}, ...
0b1723ea83757eeafacc8cdcce9718b07e0e9d57
9,181
[ 99139447 ]
[ "macro", "supervisor", "documented" ]
defmodule ExternalService.Gateway do @moduledoc """ Defines a gateway to an external service. `ExternalService.Gateway` allows for defining module-based gateways to external services. Instead of explicitly starting a fuse with its configuration and separately passing in retry options on each call to the serv...
0b180fd7026cbac4c4b52f5cc762ac36e1ccbb4b
2,991
[ 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.SQLAdmin.V1.Model.OnPremisesConfiguration do @moduledoc """ On-premises instance configuration. ## Attributes * `caCertificate` (*type:* `String.t`, *default:* `nil`) - PEM representation of the trusted CA's x509 certificate. * `clientCertificate` (*type:* `String.t`, *default:* `nil...
0b182246a851666fceda993c920498acbdff979e
1,659
[ 39973486 ]
[]
%{"base62": {:hex, :base62, "1.1.0"}, "comeonin": {:hex, :comeonin, "3.0.2", "8b213268a6634bd2e31a8035a963e974681d13ccc1f73f2ae664b6ac4e993c96", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, optional: false]}]}, "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6...
0b18a531bbf3c5308396ed3ce0ae38835b878031
2,021
[ 726091607 ]
[]
defmodule DAY1 do def find_first_digit(line, digits) do unless String.length(line) == 0 do if String.starts_with?(line, digits |> Map.keys()) do matching_key = find_start_matching_key(line, digits |> Map.keys()) digits[matching_key] else find_first_digit(elem(String.split_at(li...
0b191e29e4a7900f0737311cd7ed85abd59b7418
1,664
[ 217214351 ]
[ "liveview" ]
defmodule LiveViewWeb.Element.Form do use Phoenix.LiveView use Phoenix.HTML alias LiveViewWeb.Version alias LiveViewWeb.InputHelpers require Logger def render(assigns, changeset, parent_id) do f = form_for(changeset, '#', [ ]) Logger.debug("Rendering Element Form") content_tag(:form, [phx_su...
0b19240bd606e95100e266f91707f79c2f193730
3,807
[ 118831655 ]
[]
%{ cachex: {:hex, :cachex, "3.0.2", "1351caa4e26e29f7d7ec1d29b53d6013f0447630bbf382b4fb5d5bad0209f203", [:mix], [ {:eternal, "~> 1.2", [hex: :eternal, repo: "hexpm", optional: false]}, {:unsafe, "~> 1.0", [hex: :unsafe, repo: "hexpm", optional: false]} ], "hexpm"}, certifi: {:he...
0b1985399eac0b321638c9a7d8df3e0ac20c7e57
2,567
[ 283776288 ]
[ "typespec", "documented" ]
defmodule Blanton.Dataset do import Blanton.Connection import Blanton.Utils @moduledoc """ Controllable BigQuery dataset You can get a list, create, delete. """ @doc """ Get a dataset struct ## Full docs https://hexdocs.pm/google_api_big_query/GoogleApi.BigQuery.V2.Api.Datasets.html#content """...
0b1999c7b9f04c170b503d2c8d974a5fe8022253
3,864
[ 314315120 ]
[ "typespec", "documented", "ecto" ]
defmodule Smokex.Integrations.Slack do @moduledoc """ Provides context to work with Slack integrations. """ require Logger alias Smokex.Integrations.Slack.SlackIntegrationPreferences alias Smokex.Integrations.Slack.SlackIntegration alias Smokex.Repo alias Smokex.Organizations.Organization @doc """ ...
0b19c1f51f20af105e1aa3b560eecbbe6ea1576e
3,792
[ 789802355, 872091867, 913995146, 915448704, 934044764, 962529983, 1017248001, 744142491, 828087786, 734242561, 1002277727, 1017741371, 1019465249, 882758430, 884344453, 1010134902, 771989527, 773846987, 924963573, 747581658, 800967832, 803459398, 805634608, 1018026088, ...
[ "typespec", "documented" ]
defmodule Expo.Messages do @moduledoc """ A struct that represents lists of `Expo.Message.Singular` and `Expo.Message.Plural` structs for MO and PO files. All fields in the struct are public. See [`%Expo.Messages{}`](`__struct__/0`). """ alias Expo.{Message, Util} @typedoc """ The type for this struc...
0b1a1b64dcdbeefea25225756d1226ae0c637efb
3,896
[ 82466631 ]
[ "macro", "documented", "ecto" ]
defmodule Curator.Registerable do @moduledoc """ TODO Options: * `curator` (required) * `actions` (optional) default: [:new, :create, :show, :edit, :update, :delete] Extensions: N/A """ use Curator.Extension import Ecto.Changeset defmacro __using__(opts \\ []) do quote do use Cura...
0b1b234413a22819ef0568919025910991ba6c21
7,805
[ 118915460 ]
[ "documented", "ecto" ]
defmodule Api.Profile do @moduledoc """ The Profile context. """ import Ecto.Query, warn: false alias Api.Repo alias Api.Profile.UserProfile @doc """ Returns the list of user_profiles. ## Examples iex> list_user_profiles() [%UserProfile{}, ...] """ def list_user_profiles do R...
0b1c1c7c99e1cb8620bef19a5f0ee1be4ebb4336
1,505
[ 389613302 ]
[ "documented" ]
defmodule AstraeaVirgo.Cache.Problem do @moduledoc """ Implement Problem operation for cache ## Problem ID set A collection of Problem IDs, used to cache the IDs of existing problems. - key: `Astraea:Problems:Category:<category_id>` - type: set ## Problem Info A key-value mapping the problem infor...
0b1c5256337270adfe4699127b7ced1a9d4ff359
2,074
[ 322670346 ]
[]
defmodule Hangman.Game do defstruct [ turns_left: 7, state: :initializing, letters: [], used: MapSet.new(), word: "", ] def new_game(word) do %Hangman.Game{ word: word, letters: word |> String.codepoints(), } end def new_game() do Dictionary.get_random_word() ...
0b1c7678675398e6602e00377fe60864625f4854
3,439
[ 154597062 ]
[ "test", "ecto" ]
defmodule GameServices.IdentityTest do use GameServices.DataCase alias GameServices.Identity describe "credentials" do alias GameServices.Identity.Credential {:ok, user} = GameServices.Account.create_user() @valid_attrs %{ email: "some email", name: "some name", password: "some p...
0b1d6ca4584ba538756a0af5e06188535f26ca83
2,401
[ 134417548 ]
[ "documented" ]
defmodule TwitterApiClient.API.Tweets do @moduledoc """ Provides Tweets API interfaces. """ import TwitterApiClient.API.Base def retweets(id, options \\ []) do params = TwitterApiClient.Parser.parse_request_params(options) request(:get, "1.1/statuses/retweets/#{id}.json", params) |> Enum.map(&Tw...
0b1de808809421529a04083a32ecc4d3b37aad88
1,994
[ 82337819 ]
[ "documented" ]
defmodule Materialize do @assets_struct """ project_dir ... |--assets |--static |--fonts |--*** |--vendor |--materialize |--css |--materialize.css |--materialize.min.css |--js |--materialize.js |--mat...
0b1e2556787f923314c0743b69e68568d79f99b9
4,314
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_ReplicaConfig do @moduledoc """ Represents the configuration for a replica in a cluster. ## Attributes * `acceleratorConfig` (*type:* `GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_AcceleratorConfig.t`, *default:* `nil`) - Represents the type...
0b1e35f0dbdf2104ae34f6b308166635953b1b75
1,797
[ 471864469 ]
[ "genserver", "typespec" ]
#lib/poeticoins/historical.ex defmodule Poeticoins.Historical do use GenServer alias Poeticoins.{Product, Trade, Exchanges} @type t() :: %__MODULE__{ products: [Product.t()], trades: %{Product.t() => Trade.t()} } defstruct [:products, :trades] #interface @...
0b1e3e5e112574db26317e9820f28e9603c324d5
3,284
[ 66751605 ]
[]
%{"arc": {:hex, :arc, "0.6.0", "f4ef95b4e72ec5bce8db3474245e8202938b45e431adb34b20a8cda18d98373b", [:mix], [{:ex_aws, "~> 1.0.0", [hex: :ex_aws, optional: true]}, {:httpoison, "~> 0.8", [hex: :httpoison, optional: false]}, {:poison, "~> 2.0 or ~> 3.0", [hex: :poison, optional: true]}, {:sweet_xml, "~> 0.5", [hex: :swee...
0b1e573e9139ccc086b65844a1a3e69acc4c2325
3,265
[ 433034488 ]
[]
defmodule Y2023.Day03 do use Advent.Day, no: 03 def part1(%{numbers: numbers, symbols: symbols}) do symbol_positions = Map.keys(symbols) numbers |> Enum.filter(&next_to_symbol?(&1, symbol_positions)) |> Enum.map(fn {_, %{number: number}} -> number end) |> Enum.sum() end defp next_to_symbo...
0b1e7f94c5404024739ee4f38a274d4c3f5041bd
3,047
[ 93802975 ]
[]
%{"absinthe": {:hex, :absinthe, "1.3.1", "3e4f4c780230db74ee198a7cb105c06ca61dd745a75125115dcb65310865b925", [:mix], []}, "absinthe_ecto": {:hex, :absinthe_ecto, "0.1.0", "c7c670f0d1a77f98dba4912fe067cebc4f68c1c9875c8f110a0548619e758482", [:mix], [{:absinthe, "~> 1.3.0", [hex: :absinthe, optional: false]}, {:ecto, ">...
0b1e8e5a79922b4d90abb7b36f1a0e378981ee5c
3,028
[ 109189046 ]
[ "typespec", "documented" ]
defmodule Atrium.Transactions do @moduledoc """ Functions that allow you to interact with the transaction atrium endpoint """ alias Atrium.{JSON, Request, Response} @doc """ Required Parameters: user_guid, transaction_guid Optional Parameters: None https://atrium.mx.com/docs#read-a-transaction """ ...
0b1edb02b9177659ae8536e7bc848177891bcfe9
2,197
[ 192014016 ]
[ "test" ]
defmodule ConsoleWorldTest do use ExUnit.Case test "returns an empty world of size 3 as text" do assert ConsoleWorld.empty_world(%{size: 3}) == "|-|-|-| |-|-|-| |-|-|-|" end test "returns an empty world of size 2 as text" do assert ConsoleWorld.empty_world(%{size: 2}) == "|-|-| |-|-|" end test "r...
0b1efba2bea1be56a678727dce1acfd217c151a6
3,308
[ 149645251 ]
[]
defmodule IndacoinFixtures do def eth_fixture(attrs \\ %{}) do attrs |> Enum.into(%{ "cur_id" => 248, "ext_market" => 2, "ext_market_id" => 0, "txfee" => 0.006, "short_name" => "ETH", "name" => "Ethereum", "cointype" => "ETH", "imageurl" => "/api/coinimage/ETH/"...
0b211232daa844d6c4ed5ebcfcae80a73e3be11a
1,848
[ 111865371 ]
[]
%{ "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, "hackney": {:git, "https://github.com/benoitc/hackney.git", "5b7363c14071abe92d4039a7fc96371bd6eee91e", []}...
0b213fc74877416b874f75fc0afebb20a8e89e1f
4,563
[ 937693866 ]
[ "test" ]
defmodule Quenta.ExpensesTest do use Quenta.DataCase, async: true alias Quenta.Expenses describe "change_expense/2" do test "returns a changeset for an existing expense" do expense = %Quenta.Expenses.Expense{ id: 1, description: "Test Expense", amount_dollars: 10.00, dat...
0b21676eb4013878a54d9cbc04380d1a9cd84ca4
3,239
[ 616660034 ]
[]
defmodule Qdrantex.Qdrant.GetCollectionInfoRequestInternal do use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 field :get_collectionInfoRequest, 1, type: Qdrantex.Qdrant.GetCollectionInfoRequest, json_name: "getCollectionInfoRequest" field :shard_id, 2, type: :uint32, json_name: "shard...
0b216f6d4238d71095a2d1d29415750d8da68b3b
1,519
[ 803809623 ]
[]
defmodule OperatelyEE.AccountOnboardingJob do use Oban.Worker alias Operately.People.Account def perform(job) do if Application.get_env(:operately, :send_onboarding_emails) == true do send_onboarding_email(job.args["account_id"]) end end def send_onboarding_email(account_id) do with( ...
0b21ea8e42d676e5719cf18b5267a94e3a693bc2
1,554
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Admin.Reports_v1.Model.UsageReportsWarnings do @moduledoc """ ## Attributes * `code` (*type:* `String.t`, *default:* `nil`) - Machine readable code or warning type. The warning code value is `200`. * `data` (*type:* `list(GoogleApi.Admin.Reports_v1.Model.UsageReportsWarningsData.t)`, ...
0b221db37133e012cd1f2ec9e30a4cb7cd40bcbf
2,110
[ 559242657 ]
[ "liveview" ]
defmodule BandwidthHeroWeb.ContractorOpportunityLive.Show do use BandwidthHeroWeb, :live_view on_mount BandwidthHeroWeb.UserLiveAuth alias BandwidthHero.ContractorOpportunities alias BandwidthHero.Opportunities import BandwidthHeroWeb.ContractorOpportunityLive.Components import BandwidthHeroWeb.Opportunity...
0b223cd557b336640b8401d620bfd76958b4a08c
2,016
[ 68884282 ]
[ "phoenix" ]
defmodule Scaler.PageController do use Scaler.Web, :controller def index(conn, _params) do render conn, "index.html" end def preview(conn, params) do path = params["image"].path # # we can assume that ImageMagick will always work for now # n.b. this may very well not be the case ...
0b2279a260c65e8e5cb5bab91ac61c74277710f2
2,643
[ 322747972 ]
[ "documented" ]
defmodule QueromongoApi.Users do @moduledoc """ module has functions to create a user, validate, email, password, encrypt the password, water a user structure and authentication. """ def run(params) do params = validate_params(params) case params do %{email: _, password: _} -> user = Mong...
0b2289507ac180b474f3e7e3b6f1a184ad7e1ae3
1,663
[ 756853525 ]
[ "typespec", "documented" ]
defmodule Angen.TextProtocol.Account.ChangePasswordCommand do @moduledoc false use Angen.TextProtocol.CommandHandlerMacro alias Angen.Account.UserTokenLib @impl true @spec name :: String.t() def name, do: "account/change_password" @impl true @spec handle(Angen.json_message(), Angen.ConnState.t()) :: ...
0b2294c55b6986b752454361de43688c1f53a4bc
2,284
[ 712036559 ]
[ "phoenix" ]
defmodule MobileAppBackendWeb.Router do use MobileAppBackendWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {MobileAppBackendWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers en...
0b22e3b2e0f032fd7aea8ada0c32541449eed9ce
4,069
[ 268581580 ]
[]
%{ "broadway": {:hex, :broadway, "1.0.3", "04014322955d46c97d0608dbac2a76522d8a558245422fb6b3a6157ff7a0e36c", [:mix], [{:gen_stage, "~> 1.0", [hex: :gen_stage, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.3.7 or ~> 0.4.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or...
0b23548f4a0f8c0633ab4aa7ab6af083f384a8f1
2,816
[ 239902301 ]
[]
defmodule Lexer do defstruct [:input, :grapheme, :previous] import Macros def new(input) do [grapheme | input] = String.graphemes(input) %Lexer{grapheme: grapheme, input: input} end def next_token(lex) do case lex.grapheme do "=" -> {next_grapheme(lex), Token.match()} "+" -...
0b238f8f2a05b3470f46626f69a449f03f2a8cf9
3,103
[ 163692887 ]
[ "documented" ]
# # Part 2 is a bit slow, but finishes in about 4 minutes on my computer. # defmodule Day11 do @doc """ Calculate square of any size with the largest power. ## Examples iex> Day11.largest_total_square(7803) {{230, 272, 17}, 125} """ def largest_total_square serial do grid = build_grid ser...
0b2420149fab15d5db8c5a04a0b7833bbd1d372d
4,896
[ 602310749 ]
[]
%{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "cachex": {:hex, :cachex, "3.6.0", "14a1bfbeee060dd9bec25a5b6f4e4691e3670ebda28c8ba2884b12fe30b36bf8", [:mix], [{:eternal, "...
0b25a9250f454d70612e6a3c72259f6e0f49d9e9
2,549
[ 129697834 ]
[ "test" ]
defmodule Antikythera.FastJasonEncoderTest do use Croma.TestCase use ExUnitProperties defp assert_compatible_with_poison(value) do assert_compatible_with_poison(value, value) end defp assert_compatible_with_poison(source, expected) do {:ok, json} = FastJasonEncoder.encode(source) assert json == ...
0b25c5d284d5e1acb6e4d939d559a6ab58efca7d
2,267
[ 23197569 ]
[ "documented" ]
defmodule OAuth2Ex.Token do @moduledoc """ Provides token stucture and operational methods. """ defstruct access_token: nil, expires_in: nil, refresh_token: nil, token_type: nil, expires_at: nil, auth_header: "Bearer", storage: nil, config: nil @doc """ Set storage information to the Token str...
0b25f34954c9a0b1bcdb66049041fcb72f24e6f2
2,771
[ 222477954 ]
[ "test", "ecto" ]
defmodule CashHold.AccountsTest do use CashHold.DataCase alias CashHold.Accounts describe "users" do alias CashHold.Accounts.User @valid_attrs %{avatar: "some avatar", email: "some email", first_name: "some first_name", is_deleted: true, last_name: "some last_name", password_hash: "some password_hash"}...
0b267bff37ee153a5b812c9cc98b39b3e66e993f
3,346
[ 395289414 ]
[]
# Quick Speed Test for Record Specialization # Test data a_record = %{addr: {192, 168, 1, 1}} aaaa_record = %{addr: {0x2001, 0x4860, 0x4860, 0x0, 0x0, 0x0, 0x0, 0x8888}} txt_record = %{txt: "v=spf1 include:_spf.google.com ~all"} IO.puts("Quick Speed Test - Record Specialization") IO.puts("============================...
0b269954eb598d6dfc137fbbc85a4fb81e690299
1,747
[ 504958756 ]
[]
# credo:disable-for-this-file defmodule Mix.Tasks.DumpStyleTable do @shortdoc "dump the table with the default styles used in the docs" use Mix.Task @impl true def run(_) do LiveSelect.Component.styles() |> Enum.map(fn {style, styles} -> Enum.map(styles, fn {el, class} -> {el, style, class} end)...
0b270b192527771a18211525787a6b6471441fa5
3,285
[ 603527578 ]
[ "documented", "ecto" ]
defmodule Lynx.Context.StateContext do @moduledoc """ State Context Module """ import Ecto.Query alias Lynx.Repo alias Lynx.Model.{StateMeta, State} @doc """ Get a new state """ def new_state(attrs \\ %{}) do %{ name: attrs.name, value: attrs.value, environment_id: attrs.env...
0b27ae537cbc26fb7b6b7c88894f16a305445e6d
15,139
[ 950464954 ]
[ "documented" ]
defmodule Kylix.Query.SparqlParser do @moduledoc """ SPARQL Parser for Kylix blockchain queries using NimbleParsec. """ import NimbleParsec require Logger def add_prov_prefix(id), do: "prov:" <> id def apply_default_order_direction({:variable, var}), do: %{variable: var, direction: :asc} whitespace =...
0b27b6edfdbd7277f3dfb01434010b6d0164c842
1,803
[ 147819841 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. use Mix.Config config :bank_mvp, BankMailer.Mailer, adapter: Swoosh.Adapters.SMTP, api_key: "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", relay: "smt...