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
0c3c0d18dbea333b510ce57086d9dd22dc96e94f
5,014
[ 902940488 ]
[ "documented" ]
defmodule ScroogeCoin.Account do @moduledoc """ Functions for managing accounts. Accounts are simply an ED25519 keypair. The account identifier is the public key ([base58 encoded](https://learnmeabitcoin.com/technical/keys/base58/)), and the sender's private key is used to sign transactions. You can't spend ...
0c3c21246654f8a6f137b4e7baccabf8776a6577
2,669
[ 367278931 ]
[ "documented" ]
defmodule Google.Ads.Googleads.V18.Services.MutateAssetGroupListingGroupFiltersRequest do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :customer_id, 1, type: :string, json_name: "customerId", deprecated: false field :operations, 2, repeated: true, type: Go...
0c3c3885cbfadd0b4b94f18ee00e403ede028d77
2,077
[ 377663609, 236694180 ]
[ "typespec", "documented" ]
defprotocol Realm.Semigroupoid do @moduledoc """ A semigroupoid describes some way of composing morphisms on between some collection of objects. ## Type Class An instance of `Realm.Semigroupoid` must define `Realm.Semigroupoid.compose/2`. Semigroupoid [compose/2] """ @doc """ Take two morphisms a...
0c3c775e02243ebc9df9155c0d6c439c6d1a4107
7,823
[ 86130643, 595130052 ]
[]
%{"bunt": {:hex, :bunt, "0.1.6", "5d95a6882f73f3b9969fdfd1953798046664e6f77ec4e486e6fafc7caad97c6f", [:mix], [], "hexpm"}, "certifi": {:hex, :certifi, "0.4.0", "a7966efb868b179023618d29a407548f70c52466bf1849b9e8ebd0e34b7ea11f", [:rebar3], [], "hexpm"}, "combine": {:hex, :combine, "0.9.2", "cd3c8721f378ebe032487d8a4...
0c3c9231fb1ad7682910676d6af10d3a28848058
7,251
[ 837319868 ]
[ "typespec", "documented" ]
defmodule K8s.Client.Runner.Base do @moduledoc """ Base HTTP processor for `K8s.Client`. """ @type error_t :: {:error, K8s.Middleware.Error.t()} | {:error, K8s.Operation.Error.t()} | {:error, K8s.Client.APIError.t()} | {:error, K8s.Discovery.Error.t()} | {:erro...
0c3cac086957516120750779dd6d8e1613cd3e41
2,242
[ 160276830 ]
[ "test" ]
defmodule Claim do @claim_regex ~r/#(\d+) @ (\d+),(\d+): (\d+)x(\d+)/ def parse(value) do [id, x, y, w, h] = Regex.run(@claim_regex, value, capture: :all_but_first) %{ id: id, x: String.to_integer(x), y: String.to_integer(y), w: String.to_integer(w), h: String.to_integer(h) ...
0c3cd5eb144cca9c60ba4f9f75a91df65fd15873
1,944
[ 245905858 ]
[]
defmodule Minefield.MixProject do use Mix.Project @app :minefield @version "0.1.0" @all_targets [:rpi0, :x86_64, :custom_rpi0] def project do [ app: @app, version: @version, elixir: "~> 1.9", archives: [nerves_bootstrap: "~> 1.7"], start_permanent: Mix.env() == :prod, ...
0c3d69a6f735f41b69cb735d9f2f9d168329a013
1,651
[ 624995736 ]
[ "test" ]
defmodule Virtual8086Test do use ExUnit.Case doctest Virtual8086 describe "register to register mov" do test "listing 37" do fixture = "./lib/listing_0037_single_register_mov" answer = File.read!("./lib/listing_37.txt") binary = fixture |> Path.expand() |> File.read!() assert Virtual8...
0c3dbfae8f844ec43f5298df559fc5cba382517e
8,090
[ 226522323 ]
[]
defmodule Day19 do @program Cpu.parse_intcodes( "109,424,203,1,21102,1,11,0,1106,0,282,21101,0,18,0,1105,1,259,1201,1,0,221,203,1,21102,31,1,0,1105,1,282,21101,38,0,0,1106,0,259,20101,0,23,2,22102,1,1,3,21101,0,1,1,21101,0,57,0,1106,0,303,2101,0,1,222,21001,221,0,3,20102,1,221,2,21102,1,259,1,21102,1,80,...
0c3deb20e46e74aefd212810729f1adc2ec65cb9
4,766
[ 660807464 ]
[ "test" ]
defmodule JcsTest do use ExUnit.Case doctest Jcs test "OTP 25 Ryu" do assert :erlang.float_to_binary(1.0e+30, [:short]) == "1.0e30" end describe "sorting with UTF-16" do test "G-clef U+1D11E" do input = "𝄞" encoded = Jcs.to_utf16(input) assert encoded == [0xD834, 0xDD1E] end ...
0c3e1d20af28390770bccb5baf0c56e2b5aed9da
2,570
[ 770354813 ]
[ "liveview", "ecto" ]
defmodule BookshelfExWeb.BooksLive.Form do use BookshelfExWeb, :live_component alias BookshelfEx.Books @impl true def mount(socket) do {:ok, socket} end @impl true def render(assigns) do ~H""" <div> <.simple_form for={@form} id="book-form" phx-change="validate"...
0c3ecc43b81e356ba3db89f2fa7e5cb70d25929c
3,773
[ 164338288 ]
[ "phoenix" ]
defmodule Proj42Web.PageController do use Proj42Web, :controller def index(conn, _params) do chain = Blockchain.init() Enum.each(1..100, fn actor_no -> Node.start_link(actor_no) end) create_transaction(144, 5, chain, [], conn) end def create_transaction(num, block_size, chain, nonce_li...
0c3f2e668019702ca89198a133c9f0f6613c6f44
1,917
[ 350206900 ]
[ "test" ]
defmodule Gscraper.Search.Schemas.KeywordFileTest do use Gscraper.DataCase, async: true import GscraperWeb.FixtureHelpers alias Gscraper.Search.Schemas.KeywordFile describe "create_changeset/1" do test "returns valid changeset given the file exists in the params" do attrs = %{file: upload_file_fixt...
0c3f37b98aad9a7230e63003301631f43f86d8a4
2,884
[ 692643731 ]
[ "documented" ]
defmodule Uuid.Redact.Parse do @moduledoc """ This module is used to extract and replace UUIDs from a binary string. """ @hex_chars ~w(- 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f) @doc """ Returns a tuple containing the binary string with UUIDs replaced and a list of UUIDs found. ## Parameters - b...
0c3fa95033c032871e0ab7568f1cf4e674153fa1
2,018
[ 433408564 ]
[]
defmodule AdventOfCode.Day14 do def part1(args) do {template, rules} = parse(args) rules = Map.new(rules) Stream.iterate(template, &next_part1(&1, rules)) |> Stream.drop(10) |> Enum.take(1) |> hd |> Enum.frequencies() |> Enum.min_max_by(fn {_, freq} -> freq end) |> result end ...
0c3fc0d0e17746d140de40cc4c97eabfaac7d3e6
20,909
[ 994438838 ]
[ "typespec", "documented" ]
defmodule Dspy.ModelSaturationFramework do @moduledoc """ Advanced model saturation testing framework that systematically explores model capabilities across multiple dimensions to find performance limits and capability boundaries. """ defstruct [ :capability_dimensions, :saturation_metrics, :ex...
0c4040ecad2c0b305e64792b7f7ab4e423cddfc3
4,574
[ 361521746 ]
[]
%{ "alpaca_elixir": {:git, "https://git.sr.ht/~dcrck/alpaca-elixir", "a4816edc622b1ced18ad52427c5244ae2ac146ae", []}, "axil": {:git, "https://git.sr.ht/~dcrck/axil", "b418baf8e3d5bf41cc6f74823bf19e087db5b346", []}, "castore": {:hex, :castore, "0.1.9", "eb08a94c12ebff92a92d844c6ccd90728dc7662aab9bdc8b3b785ba653c49...
0c408c9f0037edd2db537f86d0457c3298f5c508
2,286
[ 290853859 ]
[ "test", "ecto" ]
defmodule GoodBread.Accounts.UsersTest do use GoodBread.DataCase alias GoodBread.Accounts alias GoodBread.Repo describe "users" do alias GoodBread.Accounts.User @valid_attrs %{name: "Zach Holcomb", email: "<EMAIL>", address: "900 E. 8th Ave."} @update_attrs %{name: "Zerch Holcomb", email: "<EMAIL...
0c409d806d9167b1f83123b7558e34b0da7eee39
3,246
[ 430504177 ]
[ "typespec", "documented" ]
defmodule Highline.Core.Http do @moduledoc """ Provides an interface to the Slack HTTP API. """ @type response :: {:ok, %{String.t() => any()}} | {:error, any()} @doc """ Calls the [apps.connections.open](https://api.slack.com/methods/apps.connections.open) method with the app token to retrieve a Socket...
0c40d901c8b55b035f76bb235510b40c248177a4
5,539
[ 896502967 ]
[ "typespec", "ecto", "genserver", "supervisor", "documented" ]
defmodule CachedConn do @enforce_keys [:conn, :cache] defstruct [:conn, :cache] @type t :: %__MODULE__{ conn: Exqlite.Sqlite3.db(), cache: :ets.table() } alias Exqlite.Sqlite3 @spec prepare(t(), String.t()) :: {:error, Sqlite3.reason()} | {:ok, Sqlite3.statement()} def prepare...
0c40e81c1e634323b66f42e2ce454e93ed775042
8,206
[ 612062134 ]
[]
defmodule ThamaniWeb.InvoiceRetailCommander do use Drab.Commander alias Thamani.Sales alias Thamani.Invoicing alias Thamani.Dispatches access_session(:drab_test) defhandler fetch_list(socket, sender) do poke(socket, long_process_button_text: "", date: "", date_1: "") id = String.to_integer(sender...
0c40fea93fb5c74caf136737474afa98f8fc57d8
2,798
[ 546227119 ]
[ "typespec", "documented" ]
defmodule DFM.Matrix do @moduledoc """ Functionality for building and working with a Direct Follower Matrix. """ defstruct activities: MapSet.new(), direct_followers: Map.new() @typedoc """ A data structure representing a Direct Follower Matrix. :activities field stores all activities which occurred at ...
0c4182be83d1847b1b0b3bbce392342e49150c22
1,645
[ 184379193 ]
[ "documented" ]
defmodule Ada.HTTP.Handler.Location.Activate do @moduledoc false def init(req, ctx) do {:cowboy_rest, req, {:no_location, ctx}} end def allowed_methods(req, state) do {["PUT", "PATCH"], req, state} end def resource_exists(req, {_maybe_location, ctx} = state) do with repo <- Keyword.fetch!(ctx,...
0c41f3dd36fa86dde8e4ebf468fb08b2a1fa3deb
2,786
[ 137203405 ]
[ "genserver", "typespec" ]
defmodule Tusk.Companion do use GenServer, restart: :transient defstruct task: nil, supervisor: nil, timeout: 5000, timeout_ref: nil, on_success: nil, on_failure: nil, on_error: nil, reason: nil require Logger @spec start_lin...
0c42508047c7f1e8569f2e2fdc716f3e4ff1be51
2,710
[ 541004246 ]
[]
defmodule PlateSlateWeb.Schema.MenuTypes do use Absinthe.Schema.Notation alias PlateSlateWeb.Resolvers import Absinthe.Resolution.Helpers alias PlateSlate.Menu alias PlateSlateWeb.Schema.Middleware @desc "Filtering options for the menu item list" input_object :menu_item_filter do @desc "Matching a na...
0c42d0e899c316b48b2fc97c80554c6587008ded
3,145
[ 318658066 ]
[]
defmodule Day11 do @adjacent_deltas [{-1, -1}, {-1, 0}, {-1, 1}, {1, -1}, {1, 0}, {1, 1}, {0, -1}, {0, 1}] # Part One def recurse(previous_board, false), do: previous_board def recurse(previous_board, true) do Enum.reduce(previous_board, {false, previous_board}, fn {{x,y}, char}, {was_modified, agg_board}...
0c4305b89c8ab5c071fe17b75b10763509d01f13
1,908
[ 887563404 ]
[ "test", "ecto" ]
defmodule Server.MessagesTest do use Server.DataCase alias Server.Messages describe "messages" do alias Server.Messages.Message import Server.MessagesFixtures @invalid_attrs %{body: nil} test "list_messages/0 returns all messages" do message = message_fixture() assert Messages.lis...
0c4354543eda4165ed4b67ec11b75b81db0adf51
3,535
[ 187536272 ]
[ "macro" ]
defmodule Ctf.FileResource do @callback load() :: :ok defmacro __using__(opts) do {opts, _} = Code.eval_quoted(opts, [], __ENV__) manifest = Keyword.fetch!(opts, :manifest) resources = Keyword.fetch!(opts, :resources) resource_kinds = Keyword.keys(resources) files_and_hashes = read_manifest(ma...
0c436bc288856efb7cdb8e2fb8b5af04d222c297
8,295
[ 183075081 ]
[ "genserver", "typespec", "documented" ]
defmodule Convoy.Queue do use GenServer @behaviour Convoy.QueueBehaviour @type stream_identifier :: binary | atom defmodule State do @batch_timeout_ms 5000 @default_service Convoy.Services.Kinesis def batch_timeout_ms(), do: @batch_timeout_ms def default_service(), do: @default_service ...
0c43a4bbdff8a2e4fb4459271fcf78350d705b28
1,607
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DFAReporting.V4.Model.ListPopulationRule do @moduledoc """ Remarketing List Population Rule. ## Attributes * `floodlightActivityId` (*type:* `String.t`, *default:* `nil`) - Floodlight activity ID associated with this rule. This field can be left blank. * `floodlightActivityName` (*ty...
0c43ae109613a2589b85300b1c2c7bee9c7fdefb
12,847
[ 549728394 ]
[]
%{ "castore": {:hex, :castore, "1.0.7", "b651241514e5f6956028147fe6637f7ac13802537e895a724f90bf3e36ddd1dd", [:mix], [], "hexpm", "da7785a4b0d2a021cd1292a60875a784b6caef71e76bf4917bdee1f390455cf5"}, "cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar...
0c43d96692064032d0c2476d394af89845864637
5,287
[ 596771849 ]
[ "genserver", "liveview", "ecto" ]
defmodule GeckoWeb.ChatLive.Index do use GeckoWeb, :live_view alias Gecko.Accounts alias Gecko.GeckoApi def mount(_params, %{"user_token" => user_token}, socket) do socket = assign_new(socket, :current_user, fn -> Accounts.get_user_by_session_token(user_token) end) |> assign(coin_...
0c44474678d4e2f82453cb89c5f8ca085320ea12
1,825
[ 106715281 ]
[ "macro" ]
defmodule PersonnelServer.Lquery do @behaviour Postgrex.Extension # It can be memory efficient to copy the decoded binary because a # reference counted binary that points to a larger binary will be passed # to the decode/4 callback. Copying the binary can allow the larger # binary to be garbage c...
0c447e0f659f1fe81799d805e4676fc214df2dac
2,362
[ 799017395 ]
[ "liveview", "ecto" ]
defmodule ExampleProjectWeb.PostLive.FormComponent do use ExampleProjectWeb, :live_component alias ExampleProject.Posts @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> <:subtitle>Use this form to manage post records in your database.</:subtitle> </.hea...
0c4563f55ae5f091b3abb646fd1ed92a648b7659
14,922
[ 108715208, 71723676 ]
[ "genserver", "typespec", "macro", "documented" ]
defmodule Agent do @moduledoc """ Agents are a simple abstraction around state. Often in Elixir there is a need to share or store state that must be accessed from different processes or by the same process at different points in time. The `Agent` module provides a basic server implementation that allows...
0c4604e35183fb98a81d98f5b46f1c2ae20db3a0
3,456
[ 925721239 ]
[ "test" ]
defmodule Aoc.DayNine.PartOneTest do use ExUnit.Case import Aoc.DayNine.PartOne test "parses char to number" do digits = [?0, ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?a] |> Enum.map(&ascii_to_digit/1) assert digits == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :NaN] end test "parses number into file" d...
0c46226c42f514660efc9a7b554408800253a52f
8,215
[ 180279238 ]
[ "test", "ecto" ]
defmodule Bracketeer.RoomsTest do use Bracketeer.DataCase alias Bracketeer.Rooms describe "brackets" do alias Bracketeer.Rooms.Bracket @valid_attrs %{edit_key: "some edit_key", name: "some name"} @update_attrs %{edit_key: "some updated edit_key", name: "some updated name"} @invalid_attrs %{edit...
0c46db1c9473fc749ebf7a676c168161ac5c6657
3,647
[ 172532184 ]
[ "macro", "test", "documented" ]
defmodule Oban.Case do @moduledoc false use ExUnit.CaseTemplate alias Ecto.Adapters.SQL.Sandbox alias Oban.Integration.Worker alias Oban.Job alias Oban.Test.{DolphinRepo, LiteRepo, Repo, UnboxedRepo} using do quote do import Oban.Case alias Oban.Integration.Worker alias Oban.{Con...
0c473164eab8fb3cd5a534023ee07a204b8b324a
1,777
[ 877048060 ]
[ "documented" ]
defmodule CunweiWong.Content do @moduledoc false alias CunweiWong.Page use NimblePublisher, build: Page, from: "./pages/**/*.md", as: :pages, highlighters: [:makeup_elixir, :makeup_js, :makeup_html], earmark_options: [breaks: true] def site_title() do "無糧不聚兵" end def site_descrip...
0c479357955843f825fb94171a312c1c0a219097
1,880
[ 504973972 ]
[ "liveview", "ecto" ]
defmodule ToryWeb.InventoryLive.FormComponent do use ToryWeb, :live_component alias Tory.Part alias Tory.Location alias Tory.Inventory @impl true def update(%{inventory: inventory} = assigns, socket) do changeset = Inventory.change_inventory(inventory) {:ok, socket |> assign(assigns) ...
0c47f044c9a1f8ddb1cc909573cfb4da146ada9c
2,909
[ 37695766, 86717239 ]
[ "documented" ]
defmodule PhoenixGuardian.Admin.SessionController do @moduledoc """ Provides login and logout for the admin part of the site. We keep the logins seperate rather than use a permission for this because keeping the tokens in separate locations allows us to more easily manage the different requirements between the ...
0c480efd499c12d29263b1cc805fedcc6b412b44
7,612
[ 31273693 ]
[ "ecto" ]
defmodule Peopleware.Profile do use Peopleware.Web, :model alias Peopleware.Repo schema "profiles" do belongs_to :user, Peopleware.User has_one :cv_file, Peopleware.File field :name, :string field :last_name, :string field :second_su...
0c481ea768302619e5988de803028ba8a3896561
1,869
[ 49106611 ]
[ "genserver", "macro" ]
defmodule CasServer do use GenServer def start_link(name) do GenServer.start_link(__MODULE__, :ok, name: name) end def tgt(server) do GenServer.call(server, {:tgt, time_now()}) end def st(server, service) do GenServer.call(server, {:st, service, time_now()}) end def init(:ok) do {:ok...
0c487c4b319230945eec06fd8dbb326d01293ede
1,562
[ 567833001, 66679983, 299848916 ]
[ "typespec", "documented" ]
defmodule Nostrum.Api.Adapter do @moduledoc false @version Nostrum.Mixfile.project()[:version] import Nostrum.Constants, only: [base_route: 0] require Logger @type methods :: :get | :post | :put | :delete @spec request( pid, methods(), String.t(), iodata(), ...
0c49cab9290dd8eb0318c55f5811090ce8872c8d
3,456
[ 920249356 ]
[ "typespec", "macro", "documented" ]
defmodule Spaceboy.Controller do @moduledoc ~S""" Controllers group common functionality and are pointed to by routers. Spaceboy controllers are very similar to Phoenix ones, but unlike Phoenix there is no concept of a separate "view" module. Controllers are related to Connections, and any module that `use`...
0c4a2375666b330890adf4bd952f2d6cb3386141
2,579
[ 549125271 ]
[ "documented" ]
defmodule Identicon do @moduledoc """ Documentation for `Identicon`. """ @doc """ Identicon generates a custom 'identicon' for the user based on an input string. The string is hashed and converted into a series of integers, which generates a unique 'identicon'. Identicons are 250px by 250px, have a 5x5 gri...
0c4a3f59b418bbfd80b6eede0600f47a57bf0b1b
7,892
[ 506799163 ]
[ "typespec" ]
defmodule Peridiod.Binary do use Peridiod.Cache.Helpers, cache_path: "binary", cache_file: "binary" alias Peridiod.{Binary, Cache, Signature} alias PeridiodPersistence.KV import Peridiod.Utils, only: [stamp_utc_now: 0] @kv_bin_installed "peridio_bin_" @kv_bin_stores [:previous, :current, :progress] def...
0c4aa79f34f65f3afff60d027e54256103f7b78b
1,525
[ 89630812 ]
[ "documented" ]
defmodule WebGib.Web.Components.Details.Download do @moduledoc """ This contains the Download details view, shown when the user clicks the Download menu command. """ use Marker use WebGib.MarkerElements import WebGib.Gettext component :download_details do # Download details # This is shown ...
0c4bb25b4edf4dad5785894ba45f082419506cca
2,645
[ 568265485 ]
[]
%{ "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, "db_connection": {:hex, :db_connection, "2.4.2", "f92e79aff2375299a16bcb069a14ee8615c3414863a6fef93156aee8e86c2f...
0c4bd03f9f20e4933db8669a159a0167bca48564
4,140
[ 165744236 ]
[ "documented" ]
defmodule ExCnab.Base.Reader.Register do @moduledoc false import ExCnab.Error alias ExCnab.Base.Reader.Field alias ExCnab.Table defstruct type: nil, type_code: nil, fieldset: nil def new(template, cnab_line, type) do with true <- Enum.all?([template], fn(n) -> not(Enum.empty?...
0c4bf469af296427012df69b4b2e0073e1a20dea
2,412
[ 46620092 ]
[ "test" ]
defmodule Laired.QuestControllerTest do use Laired.ConnCase alias Laired.Quest @valid_attrs %{name: "some content"} @invalid_attrs %{} setup do conn = conn() {:ok, conn: conn} end test "lists all entries on index", %{conn: conn} do conn = get conn, quest_path(conn, :index) assert html_r...
0c4c060c768ab34ad93cfb0bbff2cdfa74bd456f
3,536
[ 253968302 ]
[]
# Script for populating the database. You can run it as: # # mix run priv/repo/seeds.exs # # Inside the script, you can read and write to any of your # repositories directly: # # Siris.Repo.insert!(%Siris.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will fai...
0c4c7dd76d3e7c24a97abd55d86789dd5752084c
1,760
[ 113626486 ]
[ "documented", "ecto" ]
defmodule Gofish.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias Gofish.Repo alias Gofish.Accounts.Player @doc """ Returns the list of players. ## Examples iex> list_players() [%Player{}, ...] """ def list_players do Repo.all(Player) ...
0c4ceffea22c0009c8e2195cbf4718b7c19337cd
2,885
[ 47825542 ]
[]
defmodule Day12 do def part1(input) do input |> navigate_incorrectly() end def part2(input) do input |> navigate_correctly() end def navigate_correctly(directives, ship \\ {0,0}, waypoint \\ {10,1}) def navigate_correctly([], {s_x,s_y}, _), do: abs(s_x)+abs(s_y) def navigate_correctly([{d,m} | directives],...
0c4cffeb6829ac5086be23fb986d8b93564bd8ab
1,797
[ 992894491 ]
[ "phoenix" ]
defmodule PasslessWeb.Router do use PasslessWeb, :router # Define pipelines pipeline :api do plug :accepts, ["json"] end def swagger_info do %{ info: %{ version: "1.0", title: "Passless API" } } end pipeline :browser do plug :accepts, ["html"] plug :fetch...
0c4dd22c728ec59b13331a0b4f0c9730f685f4ff
1,548
[ 589516658 ]
[ "typespec", "documented" ]
defmodule Nostr.Tag do @moduledoc """ Nostr Event tag """ @enforce_keys [:type, :data] defstruct type: nil, data: nil, info: [] @type t() :: %__MODULE__{ type: atom(), data: binary(), info: [binary()] } @doc """ Parse JSON list into Elixir struct """ @spec pa...
0c4e91dddebeb8ce125e8e58c49927a9418777d9
1,634
[ 931131273 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. # General application configuration import Config config :location, generators: [timestamp_type: :utc...
0c4ebce7adb24b1de37b4d2b977e762b68e8ff55
3,504
[ 227657148 ]
[ "typespec", "documented" ]
defmodule ExBanking do @moduledoc """ ExBanking - Simple banking application - User Account. - Deposit : Credit amount of type currency to user account. - Withdraw: Debit amount of type from user account. - Transfer: transfer amount of type between accounts. - Retrieve: Amount of type of the u...
0c4edafb5382e79eb451f2fa7aea640ad760c563
1,667
[ 358940102 ]
[ "phoenix" ]
defmodule GurrenWeb.RoomChannel do use Phoenix.Channel require Logger def join("room:lobby", _message, socket) do {:ok, socket} end def join("room:" <> _private_room_id, _params, _socket) do # Create or subscribe to child room {:error, %{reason: "unauthorized"}} end def handle_in("new_msg",...
0c4f2c3f812dbc026fd99c4b2b27a3e8e3bd76b6
4,301
[ 666867082 ]
[]
defmodule CA.CMS.Test do # S/MIME Working Group: https://datatracker.ietf.org/wg/smime/documents/ # Implementations MUST support key transport, key agreement, and # previously distributed symmetric key-encryption keys, as represented # by ktri, kari, and kekri, respectively. # Implementations MAY support t...
0c4f77b9de9c990bf8a45c6c942ea571fadabaf2
2,356
[ 90565888 ]
[ "genserver" ]
defmodule AblyNg.Frontend.ConnectionMaster do use GenServer use AblyNg.Types.ProtocolMessage alias AblyNg.{ChannelClient, ChannelClientSupervisor, Frontend.WsHandler} require Logger def start_link(opts) do GenServer.start_link(__MODULE__, opts) end def add_transport(connection) do with :ok <- Ge...
0c4f7dd8d1b04c82cbb5c88eee1882f839d5b31b
7,521
[ 439166275 ]
[ "test" ]
defmodule Introspection.ModelTest do use ExUnit.Case, async: true alias Introspection.Model doctest Introspection.Model @user_introspection_result File.read!("static/user-test-introspection.json") |> Jason.decode!() test "adds attrs and types and constraints to a simple user dat...
0c4f90ce13cfdef6d80945c40d14f5f2948b261f
1,569
[ 334387837, 808443482 ]
[ "typespec", "ecto" ]
defmodule Teiserver.Logging.ServerWeekLogLib do use TeiserverWeb, :library alias Teiserver.Logging.ServerWeekLog @spec colours :: atom def colours(), do: :warning2 @spec icon() :: String.t() def icon(), do: "fa-regular fa-bar-chart" @spec get_server_week_logs :: Ecto.Query.t() def get_server_week_lo...
0c4fe0ec7a51a0ba194b64a0ce5f927ce969026a
2,131
[ 961517499 ]
[ "phoenix" ]
defmodule PatternVMWeb.API.PatternController do use PatternVMWeb, :controller def index(conn, _params) do # Get all registered patterns # This would need an API method from PatternVM patterns = PatternVM.get_registered_patterns() json(conn, %{patterns: patterns}) end def create(conn, %{"patter...
0c5000fedc15d0c127157b3f3a5bf1799590aa61
1,691
[ 83829578 ]
[ "genserver", "supervisor", "documented" ]
defmodule ProblemJ do @moduledoc """ ProblemJ. """ alias __MODULE__.{Alice, Bob, Carol} @doc """ Start the GenServers. """ def start_link() do strategy = :one_for_all ## Do not change code below import Supervisor.Spec, only: [worker: 2] children = [worker(Alice, []), worker(Bob, [])...
0c503120ce1a278a130e65f935ee6a6d5badd678
2,226
[ 510640230 ]
[ "phoenix" ]
defmodule JohanAlertsServiceWeb.AlertController do use JohanAlertsServiceWeb, :controller alias JohanAlertsService.{Alert, AlertNotification, HealthCenter, Patient} @alerts_create_params %{ status: :string, api_version: :string, sim_sid: [type: :string, required: true], content: [type: :string, ...
0c514a4559d5448044daf4fd63fedcbd3e1a11e2
2,185
[ 226597249 ]
[ "test" ]
defmodule Aoc2019.Day3Test do use ExUnit.Case alias Aoc2019.Day3 describe "part 1" do test "R8,U5,L5,D3 and U7,R6,D4,L4 gives 6" do assert Day3.part_1(["R8", "U5", "L5", "D3"], ["U7", "R6", "D4", "L4"]) == 6 end test "R75,D30,R83,U83,L12,D49,R71,U7,L72 and U62,R66,U55,R34,D71,R55,D58,R83 gives...
0c52608a6b1f1e513d6ce5170b854df7556da983
8,513
[ 456473237 ]
[ "typespec", "documented" ]
defmodule DiodeClient.EIP712 do @moduledoc """ EIP-712 implementation ## Examples # Example 1: Using separate arguments iex> domain_data = %{ ...> "name" => "Ether Mail", ...> "version" => "1", ...> "chainId" => 1, ...> "verifyingContract" => "0xCcCCccccCCCCcCCCCCCc...
0c52bc5588affeb87ef1c887422d375bd84254e0
19,508
[ 942811655, 920024200 ]
[ "ecto" ]
defmodule Front.Models.Scheduler do use Ecto.Schema alias InternalApi.PeriodicScheduler.{ DeleteRequest, DeleteResponse, DescribeRequest, DescribeResponse, HistoryRequest, HistoryResponse, LatestTriggersRequest, LatestTriggersResponse, ListRequest, ListResponse, PauseReq...
0c52eec5c20c5af82866523777755bd202e5b7ff
1,988
[ 590005282 ]
[]
defmodule RustlerBenchmark.MixProject do use Mix.Project def project do [ app: :rustler_benchmark, version: "0.1.0", elixir: "~> 1.12", elixirc_paths: elixirc_paths(Mix.env()), compilers: Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), d...
0c534a76525df3dc1fcced83b7fb537c43edf103
1,854
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Retail.V2.Model.GoogleCloudRetailV2PinControlMetadata do @moduledoc """ Metadata for pinning to be returned in the response. This is used for distinguishing between applied vs dropped pins. ## Attributes * `allMatchedPins` (*type:* `%{optional(String.t) => GoogleApi.Retail.V2.Model.Googl...
0c53a524abf1baf3e9bd666fd2c267d1b9e371c5
6,421
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.AlertCenter.V1beta1.Api.V1beta1 do @moduledoc """ API calls for all endpoints tagged `V1beta1`. """ alias GoogleApi.AlertCenter.V1beta1.Connection alias GoogleApi.Gax.{Request, Response} @library_version Mix.Project.config() |> Keyword.get(:version, "") @doc """ Returns customer-l...
0c53c285889cce0fa5b8fd906e6e2bfe22a36df6
12,670
[ 1009764698 ]
[ "genserver", "typespec", "supervisor", "documented" ]
defmodule Realtime.Tenants.Connect do @moduledoc """ This module is responsible for attempting to connect to a tenant's database and store the DBConnection in a Syn registry. ## Options * `:check_connected_user_interval` - The interval in milliseconds to check if there are any connected users to a tenant chann...
0c54c597ae1d96b45ec27c0f29e281eebf651850
5,539
[ 58392539 ]
[ "documented" ]
defmodule RedisMap do @moduledoc """ Implements Collectable and Access. Doesn't implement Enumerable, since Redis Key/Value sets should rather not be enumerated. (Its just one big map) """ require Logger alias RedisMap @behaviour Access defstruct __redis_adapter__: nil, __binary_mode__: true def ...
0c54f9a7070a1b5dcfb196c0a988c30d39584343
24,191
[ 151175282, 151203217 ]
[ "genserver" ]
defmodule TopologyStarter do def gossipFull(noNodes) do for i <- 1..noNodes do spawn(fn -> Gossip_Full.start_link(i,noNodes-1,1) end) # spawns new process for each of the nodes end converger(noNodes,"gossip") # starts convergence of the nodes created end def gossip3D(noNodes) do indices =...
0c550fa352b63fac2b266e0c4781d1f3edebf0ac
2,267
[ 48892604 ]
[ "phoenix" ]
defmodule Critter4us.ExclusionRuleController do use Critter4us.Web, :controller alias Critter4us.ExclusionRule plug :scrub_params, "exclusion_rule" when action in [:create, :update] def index(conn, _params) do exclusion_rules = Repo.all(ExclusionRule) render(conn, "index.html", exclusion_rules: exclu...
0c554166b51f91e23c36ff6c9f648e1fae796b9e
2,502
[ 127579565 ]
[ "test" ]
defmodule CoinbaseWeb.Coin_alertControllerTest do use CoinbaseWeb.ConnCase alias Coinbase.Coins alias Coinbase.Coins.Coin_alert @create_attrs %{amount: 120.5} @update_attrs %{amount: 456.7} @invalid_attrs %{amount: nil} def fixture(:coin_alert) do {:ok, coin_alert} = Coins.create_coin_alert(@create...
0c55e4b708acf9037dbf353f0e155781f442a5d2
2,727
[ 992787514 ]
[]
# Test script to debug body content fetching # Get configuration from environment variables confluence_url = System.get_env("CONFLUENCE_URL") || raise "Please set CONFLUENCE_URL environment variable" username = System.get_env("CONFLUENCE_USERNAME") || raise "Please set CONFLUENCE_USERNAME environment variable" api_tok...
0c55f79f09b8f3321b9f32642639bfef628f2153
7,645
[ 968046142 ]
[ "documented" ]
defmodule Tidewave.MCP.SSE do @moduledoc false require Logger import Plug.Conn alias Tidewave.MCP.Connection alias Tidewave.MCP.Server def handle_sse(conn) do session_id = generate_session_id() conn = fetch_query_params(conn) conn |> setup_sse_connection() |> send_initial_message(ses...
0c56961a3569f9f7acb00afd65b019adced36aac
4,526
[ 483460745 ]
[ "test", "documented" ]
defmodule AttributeCollectableTest do @moduledoc """ Test the Collectable protocol implementation for MLIR attributes. """ use Beaver.Case, async: true alias Beaver.MLIR alias MLIR.Type test "arrays", %{ctx: ctx} do opts = [ctx: ctx] # Test collecting into empty array empty = MLIR.Attribute....
0c5717e53e6b458dbd910f42f4b76b0cf0a9eff0
1,623
[ 111415024 ]
[ "test", "documented" ]
defmodule GroupherServer.Test.Mutation.Upvotes.MeetupUpvote do @moduledoc false use GroupherServer.TestTools alias GroupherServer.CMS setup do {:ok, meetup} = db_insert(:meetup) {:ok, user} = db_insert(:user) guest_conn = simu_conn(:guest) user_conn = simu_conn(:user, user) {:ok, ~m(user...
0c5750b02eff38bbff5bd4b753198e79c4fae2d7
2,075
[ 121962401 ]
[ "test" ]
defmodule JsonSchemaTestSuite.Draft6.RequiredTest do use ExUnit.Case import JsonXema, only: [valid?: 2] describe ~s|required validation| do setup do %{ schema: JsonXema.new(%{"properties" => %{"bar" => %{}, "foo" => %{}}, "required" => ["foo"]}) } end test ~s|present r...
0c575615e3e334f056f65bc60d515789842d9041
2,515
[ 357138874 ]
[]
import Config config :toniex, upload_dir: "./priv/uploads" # Configure your database config :toniex, Toniex.Repo, username: "postgres", password: "postgres", database: "toniex_dev", hostname: "localhost", show_sensitive_data_on_connection_error: true, pool_size: 10 # For development, we disable any cache...
0c57951b3c94db8d878d0826387880920423effb
2,161
[ 826157379 ]
[ "typespec" ]
alias AdventOfCode.Y2015.YardGif defmodule AdventOfCode.Y2015.YardGif do @type grid :: [[boolean(), ...], ...] @spec run_step(grid()) :: grid() defp run_step(grid) do padding = for _ <- 1..length(grid), do: false ([padding] ++ grid ++ [padding]) |> Enum.chunk_every(3, 1, :discard) |> Enum.map(f...
0c57d2d70f336093b0947f80613e68e2926bd83d
2,192
[ 17271271, 483729861, 853364797, 185338542, 587895704, 838820381, 150669496, 421395134, 512518687, 345322913, 431618156, 203006831, 27632754, 406967862, 484267130, 271070272, 669079833, 997019831, 449346660, 575507361, 216080783, 487954426, 612949543 ]
[ "test" ]
defmodule AtbashTest do use ExUnit.Case describe "encode" do # @tag :pending test "yes" do assert Atbash.encode("yes") == "bvh" end @tag :pending test "no" do assert Atbash.encode("no") == "ml" end @tag :pending test "OMG" do assert Atbash.encode("OMG") == "lnt" ...
0c583b7c2fd9b78f731b48f6cfd2fd2a60063b05
7,480
[ 456875507 ]
[]
defmodule MiniModules.UniversalModules.YieldMachine do defmodule Context do defstruct components: %{} def from_module(module_body) do components = Map.new(for statement <- module_body, result <- from_statement(statement), do: result) %__MODULE__{components: components} end defp ...
0c586c965945e01663a7ac7970880b43ca89e5e4
2,587
[ 150199538 ]
[ "test" ]
defmodule PhotogWeb.FolderControllerTest do use PhotogWeb.ConnCase alias Photog.Api alias Photog.Api.Folder @create_attrs %{apple_photos_uuid: "some apple_photos_uuid", name: "some name"} @update_attrs %{apple_photos_uuid: "some updated apple_photos_uuid", name: "some updated name"} @invalid_attrs %{apple...
0c587e48c4b8f7207f7ec48629193b9d7f62db1a
1,802
[ 37329309 ]
[]
list = Enum.to_list 1..5 # [1, 2, 3, 4, 5] Enum.concat([1,2,3], [4,5,6]) # [1, 2, 3, 4, 5, 6] Enum.concat([1,2,3], 'abc') # [1, 2, 3, 97, 98, 99] Enum.map(list, &(&1 * 10)) # [10, 20, 30, 40, 50] Enum.map(list, &String.duplicate("*", &1)) # ["*", "**", "***", "****", "*****"] Enum.at(10..20, 3) # 13 Enum.at(10..20, 20)...
0c58aacb2bc47bb623944b11884c195623080700
2,977
[ 372998115 ]
[]
%{ "base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm", "fab09b20e3f5db886725544cbcf875b8e73ec93363954eb8a1a9ed834aa8c1f9"}, "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [...
0c59155773971f93d4496db3b62f10590e78c8e0
3,545
[ 37195022 ]
[ "genserver", "liveview" ]
defmodule Acquirex.Turn do @behaviour :gen_fsm alias Acquirex.Space alias Acquirex.Player alias Acquirex.Corporation alias Acquirex.Bank alias Acquirex.Game def start_link() do :gen_fsm.start_link({:local, __MODULE__}, __MODULE__, :no_args, []) end def move(player, tile) do IO.put...
0c59522c29609adab775a4ababf4fac7ef890493
1,875
[ 100841486 ]
[ "documented", "ecto" ]
defmodule LleCymraeg.Languages do @moduledoc """ The Languages context. """ import Ecto.Query, warn: false alias LleCymraeg.Repo alias LleCymraeg.Languages.Language @doc """ Returns the list of languages. ## Examples iex> list_languages() [%Language{}, ...] """ def list_languages...
0c5967ce4d57fe4c42b8b9e8cab9b3782b94556a
1,808
[ 289263866 ]
[ "documented", "ecto" ]
defmodule Support.Integration.DepositHelper do @moduledoc """ Common helper functions that are useful when integration-testing the child chain and watcher requiring deposits """ alias OMG.Eth alias OMG.Eth.Configuration alias OMG.Eth.Encoding alias OMG.State.Transaction alias Support.DevHelper alias ...
0c598bdc931cefc43cc27ad7785789d972a4c0e8
4,157
[ 128772304 ]
[ "typespec", "documented" ]
defmodule Identicon.Image do @moduledoc """ Creates an image struct to be converted into an identicon. The image struct contains the fields `input`, `dimension`, `chunk_size`, `square_size`, `bytes_length`, `hash_algo`, `bytes`, `color`, `background`, `indexes` and `squares` representing the properties of an...
0c59c3ef8fafab1532d869bb9892a6590918f72f
3,926
[ 117402504 ]
[]
defmodule SolvICFlow.BCInfo do #struct BCInfo #brief represents a boundary condition #! cond_exp fn({float, float, float}) -> boolean end #! value float defstruct cond_exp: nil, value: 0 defp applyBCInfo position, %SolvICFlow.BCInfo{cond_exp: is_in?, value: val} do if is_in?.(position) do val ...
0c5a204b9a77efac7fe7a146d9375aa04e2224ae
2,698
[ 501654880 ]
[ "liveview", "ecto" ]
defmodule HajWeb.SettingsLive.Responsibility.FormComponent do use HajWeb, :live_component alias Haj.Responsibilities @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> <:subtitle>Ändra datan kring ett ansvar i databasen..</:subtitle> </.header> <.s...
0c5a644b514697b2fa5c2f9861e22156f86368c3
2,666
[ 901265679 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule LdQWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, components, channels, and so on. This can be used in your application as: use LdQWeb, :controller use LdQWeb, :html The definitions below will be executed for every controller, component, e...
0c5a689ef2fad00e9ffe481e855098c40b1b1170
1,762
[ 63497734 ]
[ "typespec", "documented", "ecto" ]
defmodule CodeCorps.GithubAppInstallation do @moduledoc ~S""" Represents an installation of the CodeCorps app to a user or an organization on GitHub. """ use CodeCorps.Model @type t :: %__MODULE__{} schema "github_app_installations" do field :access_token, :string field :access_token_expires_at, :...
0c5a749aa4872c272d6563645dc2c24b033ac8d5
1,692
[ 55943968 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule Monitor.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use Monitor.Web, :controller use Monitor.Web, :view The definitions below will be executed for every view, controller, etc, so keep them sho...
0c5a88282ca8dfcbdbf38ac6ebdc7eb16a90c3a7
2,607
[ 598411687 ]
[ "liveview" ]
defmodule TodoWeb.EditCommentLive do use Phoenix.LiveView use Phoenix.HTML use Phoenix.Component alias Todo.Comment alias Todo.Comments alias TodoWeb.Router.Helpers, as: Routes def mount(%{"id" => id}, _url, socket ) do changeset = Comment.changeset(%Comment{}) comment = Comments.get_comment!(...
0c5a94fe5fde2a2acd3b91437fda7c240bc918fc
2,833
[ 837319868 ]
[ "documented" ]
defmodule Nats.Consumer do @moduledoc """ Node subscriber """ use Gnat.Server require Logger def request( %{ body: body, headers: headers, topic: topic } = event ) do Logger.debug("Received request #{inspect(event)}") current_node = to_string(node...