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
0ad027333ede146d65ce1332f53eedac454a33e9
17,412
[ 719422627 ]
[ "genserver", "typespec", "documented" ]
defmodule Sparrow.H2Worker do @moduledoc false use GenServer use Sparrow.Telemetry.Timer require Logger alias Sparrow.H2ClientAdapter alias Sparrow.H2Worker.Config alias Sparrow.H2Worker.RequestSet alias Sparrow.H2Worker.RequestState, as: InnerRequest alias Sparrow.H2Worker.State @type gen_server...
0ad05aa81e3f9f280286d725b09dcbe13e7e39ec
1,890
[ 41367582 ]
[ "test" ]
defmodule Nova.ProductPropertyTest do use Nova.ModelCase alias Nova.ProductProperty @valid_attrs %{property_id: 1, value: "test"} @invalid_attrs %{property_id: -1, product_id: -1, value: "test" } @long_str String.duplicate("a", 201) setup do product = fixtures(:products).products.base property = f...
0ad0854d0e57b5c32a91d82dcca8324e31cb357a
9,021
[ 996920193 ]
[ "test" ]
defmodule Foundation.Protocols.RegistryETSTest do use ExUnit.Case, async: false alias Foundation.Protocols.RegistryETS setup do # Stop any existing GenServer case Process.whereis(RegistryETS) do nil -> :ok pid -> GenServer.stop(pid, :normal) # Wait for it to stop ...
0ad08a5eaa60c91c014bfdc731035709c2723a89
1,526
[ 100082895 ]
[]
defmodule FexrYahoo.Mixfile do use Mix.Project @version "0.2.3" def project do [ app: :fexr_yahoo, version: @version, elixir: "~> 1.5", start_permanent: Mix.env == :prod, deps: deps(), # Hex description: description(), package: package(), #Docs na...
0ad0bee6c69ea7743b0a39058bfbe90dd77cc131
1,689
[ 668860566 ]
[]
defmodule BestEffortBC do def start(name, neighbours, upper) do pid = spawn(BestEffortBC, :init, [name, neighbours, upper]) # :global.unregister_name(name) case :global.re_register_name(name, pid) do :yes -> pid :no -> :error end IO.puts "registered #{name}" pid end def in...
0ad11a0a462927be25c5129ad5335946c62b1f69
6,085
[ 364038679 ]
[ "test" ]
defmodule Playwright.ClickTest do use Playwright.TestCase, async: true alias Playwright.{ElementHandle, Frame, Page} describe "Frame.click/3" do test "with a button inside an iframe", %{assets: assets, page: page} do :ok = Page.set_content(page, "<div style='width:100px; height:100px'>spacer</div>") ...
0ad11f8a720887a9e28c799d38ecd47da93fa399
10,481
[ 255161586 ]
[ "test" ]
defmodule Pontinho.CollectionTest do use ExUnit.Case, async: 2 alias Pontinho.Collection describe "validate/2" do test "returns error when there are less than 3 cards" do cards = [ %{"value" => "2", "suit" => "hearts", "deck" => 1}, %{"value" => "3", "suit" => "hearts", "deck" => 1} ...
0ad1dadc66cf19c4814ddcf505dd4d36630d1892
2,304
[ 678777019 ]
[ "ecto" ]
defmodule Ipncore.Migration do alias Ipncore.{Channel, Repo} alias Ipncore.Migration.{ Blockchain, System } @prefix "sys" @otp_app :ipncore def start do migration_version = Application.get_env(@otp_app, :migration_version) channel = Default.channel() if not Repo.schema_exists?(@prefi...
0ad2038ff0bbffab68e1391c021d9d22d15ce731
4,559
[ 748496389 ]
[ "liveview" ]
defmodule LivebooksWeb.RenderLive do use LivebooksWeb, :live_view def mount(_url, _session, socket) do {:ok, assign(socket, md: "sql")} end def render(assigns) do ~H""" <div class="main w-full flex flex-col items-center"> <.heading /> <.main md={@md}/> </div> """ end def h...
0ad23732c1a8c473f2670870230397120fdbbb2a
1,679
[ 160466628 ]
[ "macro", "documented", "phoenix" ]
defmodule CpcopServerWeb 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 CpcopServerWeb, :controller use CpcopServerWeb, :view The definitions below will be executed for every view, ...
0ad23b97bd8056d5b56b78c8276557236b1ac6fc
4,752
[ 209495464 ]
[]
defmodule SwitchWeb.SwitchesService do alias SwitchWeb.{ SwitchesRepository, SwitchesCachedRepository, UsersRepository, UsersCachedRepository, FeatureTogglesRepository, FeatureTogglesCachedRepository } def get_or_create( user_external_id: user_external_id, user_source: use...
0ad27968c047bde1b3f2c927ea98168c9749188d
2,055
[ 130546604 ]
[]
# string string = "string" # define string IO.puts string # string IO.puts is_binary string # true # utf-8 string = "hełło" IO.puts string # hełło IO.puts byte_size string # 7 (because ł is 2 bytes) IO.puts String.length string # 5 IO.puts ?a # 97 IO.puts ?ł # 322 IO.inspect String.codepoints("hełło") # ["h", "e", "ł"...
0ad2be9235e229a8af3d433996d1bc7e93d4cfa0
4,719
[ 579908068 ]
[ "genserver" ]
defmodule Chessh.SSH.Tui do alias Chessh.{Repo, PlayerSession, Utils, Player} alias Chessh.SSH.Client alias IO.ANSI require Logger @behaviour :ssh_server_channel @session_closed_message [ ANSI.clear(), ["This session has been closed"] ] defmodule State do defstruct channel_id: nil, ...
0ad2ddc54d0ed6e5828f3dc7054679fbdf7ae14a
24,396
[ 256636071 ]
[ "test", "phoenix" ]
defmodule Phoenix.Controller.ControllerTest do use ExUnit.Case, async: true use RouterHelper import Phoenix.Controller alias Plug.Conn setup do Logger.disable(self()) :ok end defp get_resp_content_type(conn) do [header] = get_resp_header(conn, "content-type") header |> String.split(";"...
0ad33db2c993f591808d6284e3f90362a4314dbb
4,483
[ 185558207, 213229236, 1000104078, 982054619, 882572863, 217320195, 174991383, 807904878, 540729553, 771023416, 887377354 ]
[ "genserver", "typespec", "macro", "documented" ]
defmodule Pleroma.Emoji do @moduledoc """ This GenServer stores in an ETS table the list of the loaded emojis, and also allows to reload the list at runtime. """ use GenServer alias Pleroma.Emoji.Combinations alias Pleroma.Emoji.Loader require Logger @ets __MODULE__.Ets @ets_options [ :ordere...
0ad38b4a0e81220e51bb49d541f4236fc05e09df
11,983
[ 104223581 ]
[]
defmodule IcdCode.ICDCode.Codes_E71 do alias IcdCode.ICDCode def _E710 do %ICDCode{full_code: "E710", category_code: "E71", short_code: "0", full_name: "Maple-syrup-urine disease", short_name: "Maple-syrup-urine disease", category_name: "Maple-syrup-urine disease...
0ad3ab1c5c423d3b7bde444135f2e61cdc89695e
1,805
[ 165333072 ]
[ "macro", "documented", "phoenix" ]
defmodule FechgoWeb 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 FechgoWeb, :controller use FechgoWeb, :view The definitions below will be executed for every view, controller, etc...
0ad4572e226dbc58532503c4586b8cde67ce9f24
4,093
[ 151164622 ]
[ "test" ]
defmodule Exnem.KeyPairTest do use ExUnit.Case import Exnem alias Exnem.Crypto.KeyPair, as: KeyPair setup_all do {:ok, private_keys: [ "8D31B712AB28D49591EAF5066E9E967B44507FC19C3D54D742F7B3A255CFF4AB", "15923F9D2FFFB11D771818E1F7D7DDCD363913933264D58533CB3A5DD2DAA66A", "A9323CEF...
0ad4e24610bc7af7b815bde264c64e3d9ca9c8ae
2,612
[ 837289858 ]
[]
import Config # Configure your database config :miniai, Miniai.Repo, username: System.get_env("DB_USERNAME") || "guest", password: System.get_env("DB_PASSWORD") || "guest", hostname: System.get_env("DB_HOST") || "localhost", port: System.get_env("DB_PORT") || "5324", database: System.get_env("DB_NAME") || "m...
0ad506279d9a1bc6696ab42930d0cdf9ab5ad015
2,952
[ 50220343 ]
[ "phoenix" ]
defmodule PhoenixChat.RoomChannel do use Phoenix.Channel def join("rooms:lobby", _message, socket) do room_server = PhoenixChat.RoomServer.start_single entries = PhoenixChat.RoomServer.entries(room_server, :present) users = PhoenixChat.RoomList.room_list(entries) {:ok, %{:user_id => socket.assign...
0ad5490b08ec360f39e161990da0638116a2a1d6
16,115
[ 44513947 ]
[]
%{ "bandit": {:hex, :bandit, "1.5.7", "6856b1e1df4f2b0cb3df1377eab7891bec2da6a7fd69dc78594ad3e152363a50", [:mix], [{:hpax, "~> 1.0.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", opti...
0ad558ad5b8ecf59cc40cab5f0f4c837194e893a
2,080
[ 55327297 ]
[ "phoenix" ]
defmodule Trucksu.ScreenshotController do use Trucksu.Web, :controller require Logger alias Trucksu.{ Session, Screenshot, } @screenshot_file_bucket Application.get_env(:trucksu, :screenshot_file_bucket) plug :authenticate when action in [:create] defp authenticate(%Plug.Conn{params: %{"u" => ...
0ad592b4f001c977b0b0bbb3aaba35ae3d989fa5
1,945
[ 111937644 ]
[ "test" ]
defmodule ExjpetTest do use ExUnit.Case doctest Exjpet test "decode with :poison.decode/1" do text = "[1, 2, 3]" {:ok, json} = Poison.decode(text) assert :poison.decode(text) == json end test "encode with :poison.encode/1" do json = [1, 2, 3, %{a: 42}] {:ok, text} = Poison.encode(json) ...
0ad5a31b7879e1464459ddc527fdddd42b0fcac4
1,548
[ 132073852 ]
[ "typespec" ]
defmodule Transferwise.BorderlessAccount do import Transferwise.HTTP @endpoint "/v1/borderless-accounts" defstruct [ id: nil, profileId: nil, recipientId: nil, creationTime: nil, modificationTime: nil, active: nil, balances...
0ad5fb03865dd5dad39464169c5f30e4d7f948cf
3,083
[ 612796230 ]
[ "macro", "documented" ]
defmodule PhoenixStorybook.Stories.StorySource do @moduledoc false require Logger # Injecting __component_source__ & __file_path__ functions to the story module. # To fetch component source, we need to either call function() or component() on the story # module, which are not yet compiled. defmacro __befo...
0ad6741e79ce723a65c2176fc603d07cd6760ff4
3,258
[ 997730042 ]
[ "typespec", "documented" ]
defmodule JsonRemedy do @moduledoc """ Repairs malformed JSON strings. This library provides functions to parse and repair JSON data that may be syntactically incorrect, often the case with output from Large Language Models (LLMs). """ alias JsonRemedy.Parser @type json_term :: map | list | String.t() ...
0ad67488493d1fdd1bb232ef3f9a491c5d692e21
2,331
[ 882758430 ]
[ "documented", "ecto" ]
defmodule AirbnbApp.Bookings do @moduledoc """ The Bookings context. """ import Ecto.Query, warn: false alias AirbnbApp.Repo alias AirbnbApp.Bookings.Booking @doc """ Returns the list of bookings. ## Examples iex> list_bookings() [%Booking{}, ...] """ def list_bookings do Rep...
0ad754abedbc40387a49c49820a5a59d65037279
2,022
[ 484849633 ]
[ "phoenix" ]
defmodule AlfredWeb.Router do use AlfredWeb, :router pipeline :browser do plug Ueberauth plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {AlfredWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline ...
0ad75e3da65b7faf8382f50e7a95a74021d8e8f0
3,261
[ 537623152 ]
[ "typespec", "documented" ]
defmodule Gameoflife.World do @moduledoc """ A world is a grid of cells The x-axis represents the horizontal axis and the y-axis represents the vertical axis. The zero location is the top-left corner of the grid. """ alias Gameoflife.Events.{Alive, Crashed, Dead, Tick, Tock} alias Gameoflife.{CellServer,...
0ad77e50f33536a2dc3d9470fb250b070357bd8b
3,074
[ 992629081 ]
[ "documented" ]
defmodule MCPAgent.Test.MCPTestHelper do @moduledoc """ Test helper for mocking MCP client behavior in tests. This module provides utilities for testing AgentServer functionality without requiring real MCP servers or embedding mock logic in production code. """ @doc """ Creates a mock MCP client that ...
0ad79f6494fbcc7ec8ccd8b23b390d2f6e913b16
1,632
[ 868276122 ]
[]
defmodule SAT do def read_file(file_path) do {num_vars, clauses} = File.read!(file_path) |> String.split("\n") |> Enum.reduce({0, []}, fn line, {num_vars, clauses} -> cond do String.starts_with?(line, "p cnf") -> # Capturamos el número de variables de la línea p cnf...
0ad7c3229aaa89108ea157b90ec06c4bc644c42e
2,970
[ 154873937, 82234621, 130057228 ]
[ "documented", "ecto", "phoenix" ]
defmodule ExAdmin.AdminAssociationController do @moduledoc false use ExAdmin.Web, :controller import ExAdmin.Gettext require Logger def action(conn, _options) do defn = get_registered_by_controller_route!(conn, conn.params["resource"]) resource = repo().get!(defn.resource_model, conn.params["id"]) ...
0ad7ebd3ff95addd44e844ce24a2bf775f0b82db
3,395
[ 435414739 ]
[]
defmodule AOC16 do import Enum, only: [at: 2] def solve_first(hex) do Base.decode16!(hex) |> decode_seq() end def solve_second(hex) do solve_first(hex) |> execute() end def execute([packet]) do execute(packet) end def execute(%{type: 4, data: data}), do: data def execute(%{typ...
0ad8484233bc9233bbb7d79eb3c097e44c953629
4,683
[ 139688101 ]
[ "phoenix", "ecto" ]
defmodule PhoenixadminWeb.UserController do use PhoenixadminWeb, :controller alias Phoenixadmin.Logging alias Phoenixadmin.Account alias Phoenixadmin.Account.User alias Phoenixadmin.Auth.Guardian def index(conn, _params) do user = Account.list_user() render(conn, "index.html", user: user) end ...
0ad894271c1f2900ad7afe29915f9179f7d8b326
3,354
[ 961461661 ]
[]
defmodule Moly.MixProject do use Mix.Project def project do [ app: :moly, version: "0.1.0", elixir: "~> 1.14", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, consolidate_protocols: Mix.env() != :dev, aliases: aliases(), deps: deps()...
0ad8d35a458b095e1a7f649bb44e6d20e329770f
1,972
[ 49213530 ]
[ "test", "documented" ]
defmodule Api.AppTest.SearchTest do @moduledoc """ For these tests, when the api is queried, Api.Documents.MockIndexAdapter will provide the test data. """ use ExUnit.Case, async: true use Plug.Test alias Api.AppTest.Support.AppTestHelper @api_path AppTestHelper.api_path @documents_path @api_path...
0ad8f99e3b9f0a7d9948b4fde658dabb3351b75e
2,557
[ 412632347 ]
[]
defmodule PhoenixSvelteAdminlte.Tree do alias PhoenixSvelteAdminlte.Models.Node def get_init_tree() do [ %Node{ node_path: "4", title: "My team", has_children: true, priority: 0, is_draggable: false, insert_disabled: true, nest_disabled: true ...
0ad97106b8eb39ec3068e042f7a6e15c2878ca10
2,491
[ 905008845 ]
[]
import Config # Configure your database config :redezvous, Redezvous.Repo, username: "postgres", password: "postgres", hostname: "localhost", database: "redezvous_dev", stacktrace: true, show_sensitive_data_on_connection_error: true, pool_size: 10, migration_primary_key: [type: :binary_id], migration...
0ada13e53319e6c41c4d51d5b193e913377de016
5,281
[ 340654506 ]
[ "genserver", "ecto" ]
defmodule FsetWeb.MainChannel do use FsetWeb, :channel alias Fset.Projects alias Fset.Payments @diffed_topic "project_diffs_result:" def join("project:" <> project_name, params, socket) do case Phoenix.Token.verify(socket, "project name", project_name) do {:ok, project_name} -> joined(proj...
0ada14ffa2a29c276260193f4d7021d5d0ba17ef
12,432
[ 559744925, 789802355, 744142491, 670103538, 710840412, 713860590, 734242561, 771989527, 773846987, 718072585, 747581658, 710549260, 731178722, 718071371, 744563910, 771499012, 712404127, 748403186, 734711585, 745341889, 711958001, 750475301, 783455020, 755849138 ]
[ "typespec", "documented" ]
defmodule Plug.Crypto do @moduledoc """ Namespace and module for crypto-related functionality. For low-level functionality, see `Plug.Crypto.KeyGenerator`, `Plug.Crypto.MessageEncryptor`, and `Plug.Crypto.MessageVerifier`. """ alias Plug.Crypto.{KeyGenerator, MessageVerifier, MessageEncryptor} @doc """...
0adb634385bf2506302d93a70809453623081b38
1,636
[ 523525903 ]
[ "phoenix", "ecto" ]
defmodule FinancerWeb.DespesasController do use FinancerWeb, :controller alias Financer.Despesas import Ecto.Query def get_all(conn, _) do lista = Despesas.get_all() resp(conn, :ok, JSON.encode!(lista)) end def get_by_id(conn, %{"id" => id}) do retorno = Despesas.get_by_id(id) resp(conn, :...
0adc9c4798a953d195ae9823ebe48768d5850a06
3,246
[ 387452453 ]
[ "phoenix" ]
defmodule SoEatWeb.ApiController do use SoEatWeb, :controller require Logger alias SoEat.SoPostApi def products(conn, _params) do SoPostApi.activity_products() |> case do {:ok, products} -> response = Enum.map(products, fn %{"name" => name, "skus" => skus} -> %{ ...
0adcc5831a31a60de016199b2d2ad5ac28405a0b
3,089
[ 79828701 ]
[]
# Protocols are a means of achieving polymorphism in Elixir. # Dispatching on a protocol is available to any data type as long as it implements the protocol. # One pain of Erlang is extending an existing API for newly defined types. # To avoid this in Elixir the function is dispatched dynamically based on the value’s...
0add079ac428cb36d39755ab602ba5149c347d22
13,678
[ 178028312 ]
[ "test" ]
defmodule SlackAPI.Web.ChatTest do use ExUnit.Case alias SlackAPI.Web alias SlackAPI.Web.Chat setup _ do bypass = Bypass.open(port: 51346) client = Web.new(token: "token", url: "http://localhost:51346") {:ok, bypass: bypass, client: client} end test "scheduled_messages" do assert Chat.sc...
0add19ff536125d278d2fed719fc98ce4f996373
2,290
[ 927305029 ]
[ "test", "ecto" ]
defmodule Payment.PaymentGatewaysTest do use Payment.DataCase alias Payment.PaymentGateways describe "payment_gateways" do alias Payment.PaymentGateways.PaymentGateway import Payment.PaymentGatewaysFixtures @invalid_attrs %{} test "list_payment_gateways/0 returns all payment_gateways" do ...
0adda47291aefbfa202dd56009b8cf0bd908800d
1,526
[ 159928049 ]
[ "documented" ]
defmodule ExdStreams.Store.RedisStore do @moduledoc """ A redis-based state store The Redis store implementation uses the Redis set datastructure to store and retrieve records """ alias ExdStreams.Store.BaseStore alias ExdStreams.Store.KeyValueStore use KeyValueStore defstruct [:prefix, :conn] @i...
0addc808843902520f9759cdfeeeef8d15ec4857
12,673
[ 185530842, 524768513 ]
[ "test" ]
defmodule Mechanize.QueryTest do use ExUnit.Case, async: true alias Mechanize.Page.Element alias Mechanize.Query alias Mechanize.Test.Support.{ElementableFake1, ElementableFake2} import TestHelper doctest Mechanize.Query setup_all do stub_requests("/test/htdocs/query_test.html") end describe "...
0adddd93087b80e9128af3c9d8b354f9c08bb817
4,865
[ 574260900 ]
[]
defmodule NervesSystemRpi0.MixProject do use Mix.Project #@github_organization "ejc123" @app :modem_rpi0 #@source_url "https://github.com/#{@github_organization}/#{@app}" @version Path.join(__DIR__, "VERSION") |> File.read!() |> String.trim() def project do [ app: @app, ...
0ade53ec54512d5ece0f37da1b1164a634526137
1,533
[ 646222755 ]
[ "liveview", "phoenix" ]
defmodule ClientesWeb.Endpoint do use Phoenix.Endpoint, otp_app: :clientes # 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: "_cliente...
0ade576a01773dcc56ca0b7cb186b8b5a416b636
15,324
[ 351908030 ]
[]
%{ "dns": {:hex, :dns, "2.2.0", "4721a79c2bccc25481930dffbfd06f40851321c3d679986af307111214bf124c", [:mix], [{:socket, "~> 0.3.13", [hex: :socket, repo: "hexpm", optional: false]}], "hexpm", "13ed1ef36ce896211ec6ce5e02709dbfb12aa61d6255bda8d531577a0a5a56e0"}, "elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77d...
0ade88b208c0e935a031025ac6496c802f35931f
12,477
[ 432590545 ]
[ "test", "phoenix" ]
defmodule LawadvisorWeb.TaskControllerTest do use LawadvisorWeb.ConnCase import Lawadvisor.{UserFixtures, TaskFixtures} @valid_user_attrs %{ username: "joeffreygarcia", password: "P@ssw0rd" } @invalid_user_attrs %{ username: "garciajoeffrey", password: "P@ssw0rd" } setup %{conn: conn} d...
0adf08834550a9277393b3d653a36f262cf84635
2,401
[ 726271191 ]
[ "documented" ]
defmodule Advent2023.Day06 do @moduledoc """ Day 6: Wait For It """ @doc """ Part 1: Number of ways you can beat the record for each race iex> Advent2023.Day06.part1(Util.read_input!(2023, 6)) 2612736 """ def part1(input) do input |> parse_input1() |> Enum.map(fn {time, record} -...
0adf23f85ad5dff3adfa40f94ac03d1c3c905c30
11,829
[ 111415024 ]
[ "test", "documented" ]
defmodule GroupherServer.Test.Accounts.CollectFolder do @moduledoc false use GroupherServer.TestTools alias Helper.ORM alias GroupherServer.{Accounts, CMS} alias CMS.Model.ArticleCollect alias Accounts.Model.{Embeds} @default_meta Embeds.CollectFolderMeta.default_meta() setup do {:ok, user} = d...
0adf89054ad1999cbf052a439f7c64f4c2b90a90
1,623
[ 483910748 ]
[ "phoenix" ]
defmodule MidtermWeb.Router do use MidtermWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {MidtermWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api do plug...
0ae00353899c43baa4128df7e41218f9d4f117d7
1,983
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Memcache.V1beta2.Model.GoogleCloudSaasacceleratorManagementProvidersV1NodeSloMetadata do @moduledoc """ Node information for custom per-node SLO implementations. SSA does not support per-node SLO, but producers can populate per-node information in SloMetadata for custom precomputations. SSA Elig...
0ae032ea9c2055d18d77f4d952a8f2a2f04ceac8
2,913
[ 200894509, 207339366 ]
[ "genserver", "documented" ]
defmodule Nookal.Uploader.Connection do @moduledoc false use GenServer require Logger defstruct [:conn, :request_ref, :from, response: %{}] def start_link(_options) do GenServer.start_link(__MODULE__, nil, []) end def init(nil) do {:ok, %__MODULE__{}} end def upload(pid, uploading_url, f...
0ae03776a5333aa655b24880c6aaf131f94496a0
2,844
[ 256574281, 727933089 ]
[ "genserver" ]
defmodule Assignment.CoindataRetriever do use GenServer defstruct [ pair: "", history: [] ] def start_link(args) do pair = args[:pair] || raise "Created a CoindataRetriever worker without pair information!" GenServer.start_link(__MODULE__, args, name: {:via, Registry, {Assignment.Coindata.Regi...
0ae0903b3261bf5ce98041662ad7608b1e323192
5,928
[ 450737780 ]
[ "liveview", "test" ]
defmodule SupacWeb.ConLiveTest do use SupacWeb.ConnCase, async: true import Phoenix.LiveViewTest import Supac.SupFixtures alias Supac.Sup.Con alias Supac.Sup alias Supac.His setup :register_and_log_in_confirmed_user @create_attrs %{ email: "<EMAIL>", name: "some name", position: Enum.ran...
0ae0e3659b7f2b04992e136edd62bb5ee82e1ae1
1,891
[ 562069802 ]
[ "test", "phoenix" ]
defmodule Server.AdminUserRegistrationControllerTest do use Server.ConnCase, async: true @moduletag :skip import U7406.AdminFixtures describe "GET /admin_users/register" do test "renders registration page", %{conn: conn} do conn = get(conn, Routes.admin_user_registration_path(conn, :new)) res...
0ae140ef84d38b6c88d67bd3e45b0c3b2a1a7abd
3,023
[ 279312839 ]
[ "test" ]
defmodule Plumbapius.Coverage.Report.MultiChoiceSchemaTest do use ExUnit.Case alias Plumbapius.Coverage.Report.MultiChoiceSchema alias Plumbapius.Request.Schema, as: RequestSchema alias Plumbapius.Response.Schema, as: ResponseSchema @one_of_schema %{ "type" => "object", "properties" => %{ "roo...
0ae1b5e50ebc16f392abaf8caa1f8d9dd584a29e
2,137
[ 206337691 ]
[]
defmodule Restfid.API.Mixfile do use Mix.Project def project do [app: :api, version: "0.0.1", build_path: "../../_build", config_path: "../../config/config.exs", deps_path: "../../deps", lockfile: "../../mix.lock", elixir: "~> 1.4", elixirc_paths: elixirc_paths(Mix.env), ...
0ae202ccfbcb34be7178adc199d0577682474e76
1,801
[ 129970354 ]
[ "test" ]
defmodule VirtualMachineTest do use ExUnit.Case doctest VirtualMachine import VirtualMachine setup do VirtualMachine.reset() :ok end test "running the example program outputs the character in register 0 incremented by 4" do program = [9, 32768, 32769, 4, 19, 32768] load_program(program) ...
0ae29596e1ff72064542d04a495f9d00c3eb64ab
1,767
[ 181081888 ]
[ "liveview" ]
defmodule HangmanWeb.PageLiveView do use Phoenix.LiveView alias Diet.Stepper def render(assigns) do HangmanWeb.PageView.render("index.html", assigns) end def mount(_session, socket) do {:ok, socket |> assign_game()} end def handle_event("guess", %{"letter" => l}, socket) do {r, s} = Stepper...
0ae296b7a673b46aa65da3bf361b624388864033
2,788
[ 719164494 ]
[ "liveview" ]
defmodule PentoWeb.Admin.SurveyResultsLive do use PentoWeb, :live_component alias Pento.Catalog alias PentoWeb.BarChart def update(assigns, socket) do {:ok, socket |> assign(assigns) # |> assign(%{products_with_avg_ratings: Catalog.products_with_avg_ratings()}) |> assign_gender_filter...
0ae2db22db11cb6b3f48308e1caa68065df7fa70
2,247
[ 170767314 ]
[ "test", "ecto" ]
defmodule QuickcourtBackend.AuthTest do use QuickcourtBackend.DataCase alias QuickcourtBackend.Auth describe "users" do alias QuickcourtBackend.Auth.User @valid_attrs %{email: "some email", password_hash: "some password_hash", role: "some role"} @update_attrs %{ email: "some updated email", ...
0ae31928ab6efddc848a8a0b87216255eb4c1020
3,474
[ 465176233 ]
[ "typespec" ]
defmodule ABX.Encoder do require Logger @spec encode(term(), ABX.types()) :: binary() def encode(value, type) def encode(address, :address) do {:ok, %{bytes: bytes}} = ABX.Types.Address.cast(address) <<0::96, bytes::bytes()>> end def encode(switch, :bool) do case switch do true -> <<1::...
0ae340a984a1c2f3ecfc6575c6ff0bf555239943
2,276
[ 303697704 ]
[ "test", "ecto" ]
defmodule GSearcherWeb.AuthenticationControllerTest do use GSearcherWeb.ConnCase alias GSearcher.Accounts alias GSearcher.Accounts.User alias GSearcher.Repo describe "get /:provider" do test "redirects to oauth page", %{conn: conn} do conn = conn |> get(Routes.authentication_path(c...
0ae371fdc5a01054e2c6477083cc29dea0741093
2,608
[ 967831208 ]
[ "test" ]
defmodule WebsockexNova.Examples.AdapterDeribitTest do use ExUnit.Case, async: true alias WebsockexNova.Examples.AdapterDeribit describe "connection_info/1" do test "returns all required default keys" do {:ok, info} = AdapterDeribit.connection_info(%{}) assert is_map(info) assert info[:hos...
0ae3be17c0517cefabbb079a6cc4358432068a5c
9,063
[ 183908544 ]
[]
defmodule ExKcal.Data do alias ExKcal.Product, as: Product alias ExKcal.Carbs, as: Carbs alias ExKcal.Fats, as: Fats alias ExKcal.Minerals, as: Minerals @products [ %Product{ kcal: 729.0, amount: {100.0, :g}, proteins: {11.0, :g}, carbs: %Carbs{ total: {4.4, :g} }, ...
0ae3d20a0f068f08f558e088ea2e16c88c2864f7
3,551
[ 287283343 ]
[ "test", "ecto" ]
import ExUnit.Assertions import ExUnit.CaptureIO alias Ecto.{Multi, Changeset} alias MusicDB.{Repo, Artist, Genre} Repo.insert!(%Artist{name: "Johnny Hodges"}) artist = Repo.get_by(Artist, name: "Johnny Hodges") artist_changeset = Artist.changeset( artist, %{name: "John Cornelius Hodges"} ) invalid_cha...
0ae4a3cf458431a383b316b05907ffbe58f35455
3,631
[ 865072178 ]
[ "test" ]
defmodule Mudbrick.MetadataTest do use ExUnit.Case, async: true import Mudbrick import Mudbrick.Predicates import Mudbrick.TestHelper alias Mudbrick.Document alias Mudbrick.Stream test "gets compressed" do rendered = new(compress: true) |> render() |> IO.iodata_to_binary() refute rendered =~ "x...
0ae4ac9a2f8e3b2d3679755b23192749000eb04c
3,468
[ 217272064 ]
[ "genserver", "typespec", "documented" ]
defmodule Stargate.Receiver.Acknowledger do @moduledoc """ Defines the `Stargate.Receiver.Acknowledger` GenStage process that acts as the final consumer in the receive pipeline to acknowledge successful processing of messages back to Pulsar to allow more messages to be sent and for the cluster to delete mes...
0ae59df1a80a18cd556c31f148d2ce8a8c7b4246
2,004
[ 212487543 ]
[ "documented" ]
defmodule Ash.Test.Support.PolicySimple.Post do @moduledoc false use Ash.Resource, domain: Ash.Test.Support.PolicySimple.Domain, data_layer: Ash.DataLayer.Ets, authorizers: [ Ash.Policy.Authorizer ] policies do policy action_type(:read) do description "You can read a post if you c...
0ae5b5ccdec780cdc9262d38240945fc060ee0aa
1,509
[ 382920816 ]
[ "documented", "ecto" ]
defmodule HubLedger.Ledgers.EntryBuilder do use Ecto.Schema import Ecto.Changeset schema "entry_builders" do field :active, :boolean, default: true field :json_config, :map field :name, :string field :string_config, :string, virtual: true field :uuid, :string timestamps() end @doc f...
0ae6800ce21c695fad74fc91ecf700b5e890d15f
2,853
[ 41934385 ]
[ "documented" ]
# Taken in part from the Phoenix HTML project, # https://github.com/phoenixframework/phoenix_html defprotocol Iona.Template.Safe do @moduledoc """ Defines the LaTex safe protocol. In order to promote LaTex safety, Phoenix templates do not use `Kernel.to_string/1` to convert data types to strings in templates...
0ae691ecdf7e8b51a1eaedd7d585f061f4d0820a
6,392
[ 137380718 ]
[ "typespec", "documented" ]
defmodule RecoverableStream do @moduledoc """ By extracting evaluation of the source stream into a separate process `RecoverableStream` provides a way to isolate upstream errors and recover from them. This module contains public API. """ defmodule TasksPool do @moduledoc """ A default `Supervis...
0ae697d03afeb1ff801e18f2fca8668041cd0641
1,531
[ 341646909 ]
[ "liveview", "phoenix" ]
defmodule ArcanumpayWeb.Endpoint do use Phoenix.Endpoint, otp_app: :arcanumpay # 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: "_arc...
0ae6ecb32be859b42cc2d176b1ef6d6387d03150
1,569
[ 92774039, 92773715 ]
[ "ecto" ]
defmodule Gt.Model.ProcessedEvent do use Timex use Gt.Model @collection "processed_events" def collection, do: @collection schema @collection do field :item_id, :string field :added_at, :integer field :processed_at, :integer field :name, :string field :data...
0ae774c743f88502bd0fe0659476d1448c28e0c0
1,841
[ 484791059, 471406145 ]
[]
import Config # Print only errors during test, add :console to print logs config :logger, level: :warning, backends: [] # --- Core Configs --- config :core, Core.Domain.Ports.Commands, adapter: Core.Commands.Mock config :core, Core.Domain.Ports.Cluster, adapter: Core.Cluster.Mock config :core, Core.Domain.Ports.Telem...
0ae7aa23fe3c42b4d9247cbe7c51a4b0d6a539a3
2,005
[ 376887841 ]
[ "documented", "ecto" ]
defmodule MyApp.Todos do @moduledoc """ The Todos context. """ import Ecto.Query, warn: false alias MyApp.Repo alias MyApp.Todos.Todo alias MyApp.Accounts.User @doc """ Returns the list of todos. ## Examples iex> list_todos() [%Todo{}, ...] """ def list_todos(%User{} = user) do...
0ae800213eae345b8028e1da692f9cfcc35e68d7
3,322
[ 175927787 ]
[ "test" ]
defmodule DS.ParserTest do use DS.UACase, async: true alias DS.Parser test "parse/1 for web client" do ua = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15" assert Parser.parse(ua) == %DS{ is_bot?: false, ...
0ae8eb03e4e6aed785a702ebd51b2fd996855060
1,930
[ 73356148 ]
[ "genserver" ]
defmodule Metex.Worker do use GenServer # Client def start_link(opts \\ []) do GenServer.start_link(__MODULE__, :ok, [name: __MODULE__]) end def get_temperature(location) do GenServer.call(__MODULE__, {:location, location}) end def get_stats do GenServer.call(__MODULE__, :get_stats) end ...
0ae8fc234453c877b21db7e12c17586617f993f8
4,247
[ 214379874 ]
[ "test", "ecto" ]
defmodule TaeyAPI.DataTest do use TaeyAPI.DataCase alias TaeyAPI.Data describe "projects" do alias TaeyAPI.Data.Project @valid_attrs %{name: "some name", price: 42} @update_attrs %{name: "some updated name", price: 43} @invalid_attrs %{name: nil, price: nil} def project_fixture(attrs \\ %{...
0ae92b5cade2939106b52b5dcfc7af96133f05be
1,863
[ 74237184 ]
[ "test" ]
defmodule Once.AESTest do use Once.ConnCase alias Once.AES describe ".encrypt" do test "should return nil if no plain text is provided" do assert AES.encrypt(nil) end test "should generate an cipher text and a key if plain text is provided" do message = "Hello, World" map = AES.e...
0ae92f22717802a26398282057a4004f1970acbc
2,997
[ 104791247 ]
[]
defmodule MicroblogWeb.LiveFeedChannel do use MicroblogWeb, :channel alias Microblog.Posts alias Microblog.Accounts alias Microblog.Connections def get_channels_to_post(posting_user_id) do follows = Connections.get_follows_to_user(posting_user_id) user_ids = Enum.map(follows, fn(f)-> f.from_user_id ...
0ae99853339dd9c83c98d7c05043fe679126ded0
2,549
[ 752181040 ]
[]
%{ "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, "earmark_parser": {:hex, :earmark_parser, "1.4.39...
0ae9d05782ace332bf75f4c603ad026500c96ca2
12,308
[ 514185190, 597605354, 254554757, 565030406, 528305856, 516225002 ]
[ "test" ]
defmodule TeslaMateWeb.ChargeLive.CostTest do use TeslaMateWeb.ConnCase, async: false use TeslaMate.VehicleCase, async: false alias TeslaMate.Log.ChargingProcess alias TeslaMate.{Log, Locations, Repo} import TestHelper, only: [decimal: 1] describe "metadata" do test "hides the date if the charge has ...
0ae9d3e92095c1f17ce176e8216683c17d7a705c
2,648
[ 82618232 ]
[]
%{"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], []}, "certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0df0979153cbafcd853ababaf", [:rebar3], []}, "credo": {:hex, :credo, "0.6.1", "a941e2591bd2bd2055dc92b810c174650b40b8290459c89...
0aea3223ac24021dc181d81c9477aefcf05a35bd
2,352
[ 901892205 ]
[ "liveview", "ecto" ]
defmodule ChoreDoWeb.HouseholdLive.FormComponent do use ChoreDoWeb, :live_component alias ChoreDo.Households @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> <:subtitle>Use this form to manage household records in your database.</:subtitle> </.header> ...
0aea4a8725216581b4ba26b839f7da56b36aa876
12,274
[ 395653115 ]
[ "test" ]
defmodule Vimond.Client.VoucherTest do use ExUnit.Case, async: true import Vimond.Client import Hammox setup :verify_on_exit! @config %Vimond.Config{base_url: "https://vimond-rest-api.example.com/api/platform"} describe "valid vouchers" do test "with a voucher with existing data" do Vimond.HTTP...
0aea7bc8928c5675606c542147112a45bb92680b
3,205
[ 62610235, 142023906 ]
[ "test" ]
defmodule Omise.TransactionTest do use Omise.TestCase, async: true alias Omise.Transaction setup do: set_fixture_dir("transaction") describe "list/2" do test "lists all transactions" do use_cassette "list_transactions" do assert Transaction.list(from: "2017-11-01", to: "2017-11-03") == ...
0aeac82ab31cb2f61b381959fdc89bec94c45395
4,530
[ 79828701 ]
[ "macro" ]
# metaprogramming is the process of using code to write code.this gives us the ability to extend the language to fit our needs and dynamically change the code. We’ll start by looking at how Elixir is represented under the hood, then how to modify it, and finally we can use this knowledge to extend it. # Quote ...
0aeb0c23f559cf8675ddd2b49525d2fba72bc58c
1,695
[ 969141422 ]
[ "typespec", "documented" ]
defmodule Vincent.AI.Models.Claude do @moduledoc """ A functional wrapper around LangChain's LLMChain specifically for Claude interactions. Provides a clean interface for Claude-specific configurations and operations. """ alias LangChain.ChatModels.ChatAnthropic alias Vincent.AI.Chain @doc """ Creates...
0aeb0e514b7851b9672f95d1d1c5b1a45bc81224
16,143
[ 132670620 ]
[ "test", "phoenix", "ecto" ]
defmodule BlueJetWeb.CustomerControllerTest do use BlueJetWeb.ConnCase alias BlueJet.Identity.User alias BlueJet.Identity.RefreshToken alias BlueJet.Identity.Customer alias BlueJet.Repo @valid_attrs %{ "firstName" => "Roy", "lastName" => "Bao", "customData" => %{ "kind" => "Good Person"...
0aec062cbc38028ac660d80d6968959a9221fdca
2,250
[ 79510316 ]
[]
%{"cowboy": {:git, "https://github.com/ninenines/cowboy.git", "238ac3afc661046fb554a8bbb62d2b9912023247", [ref: "2.0.0-rc.1"]}, "cowlib": {:git, "https://github.com/ninenines/cowlib.git", "11e07d3c2b164d06ad35188d83ad70e7501396db", [ref: "2.0.0-rc.1"]}, "fs": {:hex, :fs, "2.12.0", "ad631efacc9a5683c8eaa1b274e24fa64...
0aec5a0b107e18c8eea80cc1381b86b84a4f8860
4,533
[ 131444880 ]
[]
%{ "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"}, "cowboy": {:hex, :cowboy, "2.5.0", "4ef3ae066ee10fe01ea3272edc8f024347a0d3eb95f6fbb9aed556dacbfc1337", [:rebar3], [{:cowlib, "~> 2.6.0", [hex: :cowlib, repo: "hexpm", optional: fal...
0aecdabe0d30178a3ff4f75095087fc056381b03
2,019
[ 191614124 ]
[ "documented", "ecto" ]
defmodule Core.Repo.Migrations.MigrateAdresses do @moduledoc """ copy addresses to person_addresses table """ import Ecto.Query use Ecto.Migration alias Core.Person alias Core.PersonAddress alias Core.Repo alias Ecto.UUID @disable_ddl_transaction true def make_person_addresses(persons) do p...
0aed0c18ecfcdf3bde6e8204f8482289867a192b
2,168
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1BigtableOptionsBigtableColumn do @moduledoc """ The column of the Bigtable. ## Attributes * `encoding` (*type:* `String.t`, *default:* `nil`) - The encoding mode of the values when the type is not `STRING`. Acceptable encoding values a...
0aed3246ece0c41f9ee73ed3354d362ce2780e67
3,165
[ 334518318 ]
[ "genserver", "macro", "documented", "liveview" ]
defmodule Toastr.Notifier do @moduledoc """ Helper to make useful notifications to be used in LiveView. It implements the to_flash/2 function to put flashes on the socket. ## Examples ```elixir defmodule MyWeb.Notifier do use Toastr.Notifier, MyWeb.Gettext defp model_name(%My.Accounts.User{name:...
0aed5106116b35bb82bf2f12e4463c4dbb9f4fed
3,492
[ 371381231 ]
[ "documented" ]
defmodule Rfx.Change.Request do @moduledoc """ ChangeReq struct and support functions. A datastructure that represents the atomic refactoring changes to be made as part of a refactoring operation. The `Change.Req` struct has three elements: - *text_req* (`Rfx.Change.Req.TextReq`) - the text edit request ...