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
0290161972299ef3534e0a91869b4f6de10add88
13,517
[ 389721503, 922960360, 188736579 ]
[ "typespec", "documented" ]
defmodule(Kayrock.SyncGroup) do @api :sync_group @moduledoc "Kayrock-generated module for the Kafka `#{@api}` API\n" _ = " THIS CODE IS GENERATED BY KAYROCK" ( @vmin 0 @vmax 1 ) defmodule(V0.Request) do @vsn 0 @api :sync_group @schema group_id: :string, generation_id: :int3...
029089fe300c4f4ac4dff4993c5f59d88517f6f6
2,848
[ 620430486 ]
[ "phoenix" ]
defmodule GoalmaticExAs1036Web.Router do use GoalmaticExAs1036Web, :router import GoalmaticExAs1036Web.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {GoalmaticExAs1036Web.Layouts, :root} plug :protect_from_forgery ...
0290ef37962be8524d03ddc95722f6fe2aa7b8bd
1,959
[ 315667321 ]
[ "macro", "documented", "phoenix" ]
defmodule PortfolioInvestmentWeb 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 PortfolioInvestmentWeb, :controller use PortfolioInvestmentWeb, :view The definitions below will be exe...
0291082a447eeba2a6b6e2cd52aa15592275f87f
1,648
[ 237725241 ]
[ "documented" ]
defmodule Binoculo.Api.Service do @moduledoc """ Service to handle API requests """ alias Binoculo.{Util, Worker} def get_banners(host_notation, ports, read, page \\ 1, page_size \\ 10) do {:ok, range} = Util.parse_range_or_cidr_notation(host_notation) {:ok, ports} = Util.parse_ports_notation(ports)...
0291ebf594dc9c4a42c3967e912928492e0290c3
2,240
[ 433850470 ]
[ "test" ]
defmodule DayNine.KnotsAreTouchingTest do use ExUnit.Case, async: true use ExUnit.Parameterized test "knots are touching when overlapping" do assert DayNine.knotsAreTouching({0, 0}, {0, 0}) == true end test "knots are touching when head is directly left" do assert DayNine.knotsAreTouching({-1, 0}, {...
029220fedabdfb4704f60db09dfc995e76ee3412
1,693
[ 573190552 ]
[]
defmodule AdventOfCode.Day05 do @stacks [ ["T", "P", "Z", "C", "S", "L", "Q", "N"], ["L", "P", "T", "V", "H", "C", "G"], ["D", "C", "Z", "F"], ["G", "W", "T", "D", "L", "M", "V", "C"], ["P", "W", "C"], ["P", "F", "J", "D", "C", "T", "S", "Z"], ...
02927f71c7c86fa5864a85f755a50fd4347c36b8
1,863
[ 600920760 ]
[ "genserver" ]
defmodule Protohackers.UDPServer do use GenServer require Logger @port 5005 def start_link([] = _opts) do GenServer.start_link(__MODULE__, :no_state) end defstruct [:socket, store: %{"version" => "UDP Server 1.0"}] @impl true def init(:no_state) do address = case System.fetch_env("FLY...
0293616e2dca2219b098d29124107690a8a5ab68
1,912
[ 435204539 ]
[ "genserver", "liveview" ]
defmodule TeamThinkWeb.TeamLive.Show do use TeamThinkWeb, :live_view alias TeamThink.Teams alias TeamThink.Projects alias TeamThinkWeb.TeamLive.FormComponent alias TeamThinkWeb.Components.Ui.Breadcrumbs alias TeamThinkWeb.Components.ResourceShow @impl true def mount(%{"project_id" => project_id, "team...
029365f1241e87fc3674e58dd230fa0cea35920d
1,627
[ 207667653 ]
[ "ecto" ]
defmodule Elixirgraphql.Conversation do use Elixirgraphql.Model alias Elixirgraphql.{Repo, ConversationUser, Message, User} schema "conversations" do field :title, :string has_many :messages, Message many_to_many :users, User, join_through: "conversation_users" timestamps() end def all_fo...
02938cdf5d8650f3330468b1a05476ae8289b675
1,589
[ 897656968 ]
[]
defmodule Day3a do def parse_line(line) do line |> String.to_charlist() |> Enum.map(fn ch when ch in ?0..?9 -> ch - ?0 ch when ch in [?., ?\n] -> :empty _ -> :symbol end) |> List.to_tuple() end def get(grid, x, y) when 0 <= y and y < tuple_size(grid) and 0 <= x and x <...
02944b605127ecc64c508e446c2cb4d6eb855834
1,706
[ 661911751 ]
[ "documented" ]
defmodule Mastery do @moduledoc """ Documentation for `Mastery`. """ alias Mastery.Boundary.{ QuizSession, QuizManager, TemplateValidator, QuizValidator, Proctor } alias Mastery.Core.Quiz @persistence_fn Application.compile_env(:mastery, :persistence_fn) @doc """ Build a quiz vi...
02948460a6a41b400c1c5fa709df120a6636f597
2,697
[ 288028779 ]
[ "phoenix" ]
defmodule JITJerkyWeb.Router do use JITJerkyWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {JITJerkyWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api do p...
029489c0ea72840210cada6102825b4fe65f6c92
1,737
[ 76759409 ]
[ "test" ]
defmodule PokerExWeb.AuthTest do use ExUnit.Case, async: false alias PokerEx.Repo alias PokerExWeb.Auth setup do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo) Ecto.Adapters.SQL.Sandbox.mode(Repo, {:shared, self()}) end test "check_oauth/2 returns true when the given oauth data is contained insid...
0294f9a5b2e7c51af51df5e092b8ccc8d4d8f35e
3,246
[ 805463397 ]
[ "liveview", "test" ]
defmodule MomentumHqWeb.AreaLiveTest do use MomentumHqWeb.ConnCase import Phoenix.LiveViewTest import MomentumHq.ConstructorFixtures @create_attrs %{name: "some name", content: %{}} @update_attrs %{name: "some updated name", content: %{}} @invalid_attrs %{name: nil, content: nil} defp create_area(_) do...
029521c9f6036f36792eabf71e56497f415e3128
1,591
[ 706841337 ]
[ "typespec", "documented" ]
defmodule CDPotion.Domain.Media do use CDPotion.Utils @typedoc "Corresponds to kMediaError" @type player_error :: %{ cause: list(CDPotion.Domain.Media.player_error()), code: integer(), data: map(), errorType: String.t(), stack: list(CDPotion.Domain.Media.player_er...
02952c3e8282f37c243bb19af899bb822b1ea525
17,863
[ 996920193 ]
[ "genserver", "test" ]
defmodule JidoFoundation.SignalRoutingTest do # Using signal routing isolation mode for comprehensive isolation use Foundation.UnifiedTestFoundation, :signal_routing alias JidoFoundation.Bridge # Mock Signal Router that manages signal subscriptions and routing defmodule SignalRouter do use GenServer ...
0295308b7fcd6be5387031861f0890a964b08c3c
3,276
[ 924786497 ]
[ "liveview", "documented" ]
defmodule ZoonkWeb.AppFeedbackLive do @moduledoc false use ZoonkWeb, :live_view alias Zoonk.Support @impl Phoenix.LiveView def render(assigns) do ~H""" <ZoonkWeb.SettingsLayout.render flash={@flash} scope={@scope} current_page={:feedback} has_form={true} form_id="feedba...
029564c1ff33bc033b3f330b6a3514dfaa6e0d27
5,746
[ 376928281, 377273858 ]
[ "documented" ]
defmodule JSONAPI.Serializer do @moduledoc """ Serialize a map of data into a properly formatted JSON API response object """ import JSONAPI.Ecto, only: [assoc_loaded?: 1] alias JSONAPI.Utils.Underscore @doc """ Takes a view, data and a optional plug connection and returns a fully JSONAPI Serialized doc...
0295b21fbe1c6679c802d427d83bb0b5e9d1c456
1,805
[ 966376416 ]
[ "liveview", "phoenix" ]
defmodule CesizenWeb.Endpoint do use Phoenix.Endpoint, otp_app: :cesizen # 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: "_cesizen_k...
0295ff601599e49fe1aff48f6a0c4b9ada605b90
6,346
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CloudSearch.V1.Api.Operations do @moduledoc """ API calls for all endpoints tagged `Operations`. """ alias GoogleApi.CloudSearch.V1.Connection alias GoogleApi.Gax.{Request, Response} @library_version Mix.Project.config() |> Keyword.get(:version, "") @doc """ Gets the latest state ...
0296096aaa4ddad1616eaa7f2efd14945f4c3df7
2,489
[ 68030709 ]
[ "test" ]
defmodule Wynterque.StudentControllerTest do use Wynterque.ConnCase alias Wynterque.Student @valid_attrs %{email: "some content", github: "some content", name: "some content"} @invalid_attrs %{} test "lists all entries on index", %{conn: conn} do conn = get conn, student_path(conn, :index) assert ht...
029630ae86954fd7dea64452c2d0179b00c6011d
2,415
[ 1016376851 ]
[ "macro", "documented" ]
defmodule Drops.Relation.Plugins.AutoRestrict.SchemaCompiler do @moduledoc """ Compiler for generating get_by_* finder functions from Drops.Relation.Schema structures. This module follows the visitor pattern similar to CodeCompiler but focuses specifically on generating quoted expressions for index-based finde...
02964d4cbbe06a342fe66877ecdabecc3cfb6780
1,528
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Dataplex.V1.Model.GoogleCloudDataplexV1ListAspectTypesResponse do @moduledoc """ List AspectTypes response. ## Attributes * `aspectTypes` (*type:* `list(GoogleApi.Dataplex.V1.Model.GoogleCloudDataplexV1AspectType.t)`, *default:* `nil`) - AspectTypes under the given parent location. * ...
029652afef6cd78d35223dfe40b35c27c3f0e59a
1,831
[ 56946191 ]
[ "test", "supervisor", "phoenix" ]
defmodule Ravenex.LoggerParserTest do use ExUnit.Case setup_all do if Process.whereis(RavenexSupervisor) == nil do Application.put_env(:ravenex, :scrubbers, nil) RavenexSupervisor.start_link([max_restarts: 20]) end :ok end test "should parse exception from logs" do exception = """ ...
02969cb83add08173a14cd15b1c6e8ee9da41ae9
2,213
[ 329355024 ]
[]
defmodule Pleroma.Web.ApiSpec.Helpers do alias OpenApiSpex.Operation alias OpenApiSpex.Schema alias Pleroma.Web.ApiSpec.Schemas.BooleanLike def request_body(description, schema_ref, opts \\ []) do media_types = ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"] content = ...
0296d9d9d18f230356fe00497ae3e2c8944de4be
4,128
[ 318617659 ]
[]
defmodule AdventOfCode.Puzzle12 do use AdventOfCode.Puzzle, no: 12 @cardinal_directions [:north, :east, :south, :west] @rotations [:left, :right] def parse_input do get_input() |> Stream.map(fn direction_and_value -> {direction, value} = String.split_at(direction_and_value, 1) {case direc...
0297123754c5c5fd8cd49dd3beb3b6bcb8932cf7
1,905
[ 522078795, 540427835 ]
[]
%{ "earmark": {:hex, :earmark, "1.3.2", "b840562ea3d67795ffbb5bd88940b1bed0ed9fa32834915125ea7d02e35888a5", [:mix], [], "hexpm", "e3be2bc3ae67781db529b80aa7e7c49904a988596e2dbff897425b48b3581161"}, "earmark_parser": {:hex, :earmark_parser, "1.4.12", "b245e875ec0a311a342320da0551da407d9d2b65d98f7a9597ae078615af3449"...
0298b40486f8f92bfc3627bacc4c7d28fddb1b36
2,665
[ 777920933 ]
[]
defmodule Hello.MixProject do use Mix.Project def project do [ app: :hello, version: "0.1.0", elixir: "~> 1.16", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps() ] end # Configuration for the OTP ap...
0299431b49f5fe8c6bd407008bb8f8aed1be13fc
1,991
[ 658962154 ]
[ "liveview" ]
defmodule BmvpWeb.OverviewLive do use BmvpWeb, :live_view alias Bmvp.Accounts alias Bmvp.Articles def render(assigns) do ~H""" <div class="bg-white py-24 sm:py-32"> <div class="mx-auto max-w-7xl px-6 lg:px-8"> <div class="mx-auto max-w-2xl lg:mx-0"> <h2 class="text-3xl font-bol...
02997a1dafc11301f0e5e6cb885fc8762338407d
5,159
[ 67077833 ]
[ "macro", "documented" ]
defmodule(Thrift.Generated.ServiceFeatureParameterized) do @moduledoc("Auto-generated Thrift enum snappydata.ServiceFeatureParameterized") defmacro(unquote(:transactions_support_isolation)()) do 1 end defmacro(unquote(:resultset_type)()) do 2 end defmacro(unquote(:resultset_concurrency_read_only)())...
02997cb0befdfaf5c52810e3996a9001dfa740e5
11,836
[ 825186621 ]
[]
%{ "amqp": {:hex, :amqp, "3.3.0", "056d9f4bac96c3ab5a904b321e70e78b91ba594766a1fc2f32afd9c016d9f43b", [:mix], [{:amqp_client, "~> 3.9", [hex: :amqp_client, repo: "hexpm", optional: false]}], "hexpm", "8d3ae139d2646c630d674a1b8d68c7f85134f9e8b2a1c3dd5621616994b10a8b"}, "amqp_client": {:hex, :amqp_client, "3.12.14", ...
0299a135abcde5142e0b66d97a523289cf6a2615
1,926
[ 187965510 ]
[ "documented" ]
defmodule Monitrage.Kucoin do @moduledoc """ Documentation for Monitrage. """ @domain "https://openapi-v2.kucoin.com" def fetch_available_coins do case HTTPoison.get(@domain <> "/api/v1/symbols") do {:ok, %{body: body, status_code: 200}} -> case Jason.decode(body) do {:ok, %{"dat...
0299d3794065f276f540b65134497823657941e7
1,710
[ 62990592 ]
[ "phoenix" ]
defmodule OauthenatorApp.Auth do import Plug.Conn import Phoenix.Controller alias OauthenatorApp.Router.Helpers alias OauthenatorApp.User def init(opts) do Keyword.fetch!(opts, :repo) end def call(conn, repo) do case conn.assigns do %{current_user: _} -> conn _ -> use...
029a32ab9afd754c6561aa21a6e8be0408ca0e5a
2,678
[ 260136764 ]
[ "genserver" ]
defmodule SatPos do use GenServer require IEx # Client API # def start_link(data) do GenServer.start_link(__MODULE__, data, []) end # # Server Callbacks # def init(data) do name = Map.get(data, :name) pos_url = "http://localhost:5000/sat/position/" <> name base_state = %{ :url...
029a44d7ef99ea5ce054eba25f294f4f15860291
6,379
[ 48769770 ]
[ "test" ]
defmodule Yggdrasil.UserTest do use ExUnit.Case, async: false alias Yggdrasil.Repo alias Yggdrasil.User alias Comeonin.Bcrypt @min_len 4 @password "password" @short_password String.slice(@password, 1..(@min_len - 1)) @valid_attrs %{username: "tester", password: @password, password_confirmation: @passw...
029a6b6ca9e5acfd192635973633d56e88688222
9,005
[ 631648512 ]
[ "genserver" ]
defmodule Octopus.Apps.TenLetters do use Octopus.App, category: :animation, output_type: :grayscale use Octopus.Params, prefix: :tla alias Octopus.Font alias Octopus.Transitions alias Octopus.Canvas alias Octopus.Animator require Logger defmodule Words do defstruct [:words, :lookup] def load...
029aa8f4986700828d1c191fb83ec905ec6983ad
10,061
[ 295563804 ]
[ "test", "ecto" ]
defmodule Get5Api.StatsTest do use Get5Api.DataCase alias Get5Api.Stats describe "map_stats" do alias Get5Api.Stats.MapStats import Get5Api.StatsFixtures @invalid_attrs %{ end_time: nil, map_name: nil, map_number: nil, start_time: nil, team1_score: nil, team2_sc...
029ab6f024c9042955da8524f6be7feb1feafd07
1,844
[ 202742855 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule PixelArtWeb 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 PixelArtWeb, :controller use PixelArtWeb, :view The definitions below will be executed for every view, controlle...
029b79503406d508d03601ff5744fb2a8660d1c8
13,263
[ 355918558 ]
[ "genserver", "typespec", "documented" ]
defmodule AMQPHelpers.Reliability.Consumer do @moduledoc """ A consumer for dealing with reliability scenarios. A `AMQPHelpers.Reliability.Consumer` is process which manages a reliable consume operation over *AMQP*, where messages are acknowledge to the broker after processing them. Pair this process with a ...
029b96627d3e6bd1def4715376c82c3f175fe442
2,274
[ 194750185 ]
[ "documented" ]
defmodule Erlef.HTTP do @moduledoc """ Erlef.HTTP - Lightweight wrapper around hackney with a few json encoding/decoding conveniences """ @success_range 200..299 @json_mimes ["application/json", "application/json; charset=utf-8", "application/vnd.api+json"] def perform(method, url, headers, body, opts) do...
029bc1b9c198ce575c6599cea2467178a909c37e
2,955
[ 307413550 ]
[]
defmodule Sum do @cores System.schedulers_online @arr Enum.to_list(0..1_00_000) def seq_sum do List.foldl(@arr, 0, fn x, acc -> x + acc end) end def seq_par_sum do @arr |> Enum.map(fn elem -> Task.async(fn -> elem end) end) |> Enum.map(&Task.await/1) |> List.foldl(0, fn x, acc -> x +...
029cd68eae8c3944f7e21be97c072f6481486ec5
2,869
[ 153937532 ]
[ "documented" ]
defmodule Day2 do @moduledoc """ Documentation for Day2. """ @doc """ iex> Day2.part_2([ ...> "ULL", ...> "RRDDD", ...> "LURDL", ...> "UUUUD" ...> ]) "5DB3" """ def part_2(lines) do lines |> Enum.reduce({[], {0, 2}}, fn line, {acc, pos} -> p...
029d5150450c467161991ead8307f54d80916841
3,249
[ 167625143 ]
[ "typespec", "documented" ]
defmodule RobotSimulator do @valid_directions [:north, :east, :south, :west] @invalid_direction {:error, "invalid direction"} @invalid_position {:error, "invalid position"} # def create() do # robot = %{"direction" => :north, "position" => {0, 0}} # end @doc """ Create a Robot Simulator given an ini...
029d83237a4e2bd3e37d3c45c6f122db3538c62a
2,315
[ 68054493 ]
[ "test" ]
defmodule Extacct.RequestWorkerTest do use ExUnit.Case alias Extacct.RequestWorker doctest Extacct.RequestWorker @results_report_name "GenServer Test Report Results" @completed_report_name "GenServer Test Report End" @report_id_key "REPORTID" @report_id_value_1 "first_result" @report_id_v...
029d9241f548a1b1ede2ea736e87593111a16978
10,096
[ 766691019 ]
[ "macro", "liveview", "documented" ]
defmodule LiveUI.Components.Core do @moduledoc """ Core components. """ use Phoenix.Component alias Phoenix.LiveView.JS # external components @components_provider PetalComponents components = [ Typography: [:h1, :h2, :h4, :h3, :h5, :p, :ul], Button: [:button, :icon_button], Badge: [:badg...
029df8fdfef099473ac0e40dae867af207118482
2,554
[ 1015669945 ]
[ "test", "phoenix" ]
defmodule OtpSupervisorWeb.Api.V1.SystemControllerTest do use OtpSupervisorWeb.ConnCase, async: true describe "GET /api/v1/system/health" do test "returns system health information", %{conn: conn} do conn = get(conn, "/api/v1/system/health") assert %{ "data" => %{ "...
029e0977413a90b59125cda3c045723d4854f1c4
4,098
[ 206297200 ]
[ "typespec", "documented" ]
defmodule Google.Ads.Googleads.V8Availabilities.Services.GetCampaignExtensionSettingRequest do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ resource_name: String.t() } defstruct [:resource_name] field :resource_name, 1, type: :string end defmodule Google.Ads.Goo...
029ecf7a19523d6b3c9c74b9582b8705f0b7dc0d
4,842
[ 726271191 ]
[ "documented" ]
defmodule Advent2023.Day19 do @moduledoc """ Day 19: Aplenty """ defmodule InputParser do import NimbleParsec import ParserUtil label = ascii_string([?a..?z, ?A, ?R], min: 1) rule = empty() |> unwrap_and_tag(ascii_char([?x, ?m, ?a, ?s]), :prop) |> unwrap_and_tag(ascii_char([...
029ed63cbe37da017a679762537f05d4e0e1304d
2,722
[ 762143797 ]
[ "documented", "ecto" ]
defmodule Amagami.Characters do @moduledoc """ The Characters context. """ import Ecto.Query, warn: false alias Amagami.Repo alias Amagami.Characters.Character @doc """ Returns the list of characters. ## Examples iex> list_characters() [%Character{}, ...] """ def list_characters ...
029ef59b46131c480d534b8dec42ecffcf8d71f3
4,887
[ 107275007 ]
[ "genserver" ]
defmodule Worker.Counter do use GenServer def start_link(args) do #IO.puts "2. Starting Counter Server" GenServer.start_link(__MODULE__, args,name: :counter_server) #IO.puts "End - Counter Server Started" end def init(args) do {:ok, %{"counter"=>0,"num_nodes"=...
029f60f0ce380d54d2d118c43da1bc98fb06b5b6
1,755
[ 524713310 ]
[ "test", "ecto" ]
defmodule PlaywrightTests.TodosTest do use PlaywrightTests.DataCase alias PlaywrightTests.Todos describe "todos" do alias PlaywrightTests.Todos.Todo import PlaywrightTests.TodosFixtures @invalid_attrs %{title: nil} test "list_todos/0 returns all todos" do todo = todo_fixture() ass...
029f655ed758cf3d02442445905e112a049a1b22
1,727
[ 924080836 ]
[ "test" ]
defmodule BankingService.AccountsTest do use BankingService.DataCase alias BankingService.Accounts alias BankingService.Repo alias BankingService.Accounts.Account alias Decimal setup do {:ok, from_account} = Repo.insert(%Account{ name: "Sender", email: "<EMAIL>", balance:...
029fde0a2f273776c5dcce40a6d80036fd334b1c
2,212
[ 749330106 ]
[ "typespec" ]
defmodule Redis.RESP do alias Redis.Response alias Redis.Types.{Array, BulkString, SimpleString} require Logger def encode(data) do case data do %Response{data: data} -> encode(data) %SimpleString{data: data} -> simple_string(data) %BulkString{data: data} -> bulk...
02a02db0baab1505c3c7ae9710c5cda16efcdfa8
3,484
[ 351911000 ]
[ "phoenix", "ecto" ]
defmodule EventsSpaWeb.EventController do use EventsSpaWeb, :controller alias EventsSpa.Events alias EventsSpa.Events.Event alias EventsSpaWeb.Plugs action_fallback EventsSpaWeb.FallbackController plug Plugs.RequireAuth when action in [:create] plug :inviteOrOwnerRequired when action in [:show] plug ...
02a0343e36ef54b9569fec533364c0a49c8458e9
1,570
[ 139524332 ]
[ "test" ]
defmodule Instacart.TimeMapTest do use ExUnit.Case alias Instacart.TimeMap setup do TimeMap.new("foo") :ok end test "the foo table exists" do assert :ets.info(:foo) != :undefined end test "set the value of 'foo' to 'bar,' wait 3 seconds, and then set the value to 'baz'" do TimeMap.set(...
02a03bcb262f1fc00f091e8a96445a0a7e43a17b
1,936
[ 192407200 ]
[ "typespec", "documented" ]
defmodule Reaper.UrlBuilder do alias Reaper.Collections.Extractions @moduledoc """ This module builds a URL to download a source file """ @spec decode_http_extract_step(%{assigns: any, context: %{queryParams: any, url: binary}}) :: binary def decode_http_extract_step(%{context: %{url: url, query...
02a0f4059a9f14cabcf0f75053af22d5924e0394
3,966
[ 49292670 ]
[ "documented" ]
defmodule Cog.Pipeline.Tracker do @pipelines :cog_pipelines @max_records 500 @short_id_length 15 alias Cog.Events.Util require Record Record.defrecordp :pipeline, [id: nil, pid: nil, user: nil, text: nil, count: 0, state: :running, started: nil, finished: nil] @doc "Configures ETS tables" def init(...
02a13e27b7ec8fd2a4360fea959bacccf3276413
1,972
[ 122000798, 316806220 ]
[ "documented", "ecto" ]
defmodule RentBot.Subscribers do @moduledoc """ The Subscribers context. """ import Ecto.Query, warn: false alias RentBot.Repo alias RentBot.Subscribers.Subscriber @doc """ Returns the list of subscribers. ## Examples iex> list_subscribers() [%Subscriber{}, ...] """ def list_subs...
02a165803b1205f8610a2061b6245e181fb9b402
2,213
[ 587813687 ]
[ "macro", "ecto" ]
defmodule Test.Option do defmacro some(x), do: {:some, x} defmacro none, do: :none def bind(none(), _), do: none() def bind(some(x), f), do: f.(x) end defmodule Test.Trace do import Test.Option, only: [ some: 1, none: 0, ] def bind(m, f) do _ = case m do none() -> IO.puts("Bin...
02a278892984083c8ff594cef358409399855af4
1,878
[ 190118965 ]
[ "genserver" ]
defmodule WeatherKv.Index do use GenServer def start_link(initial) do GenServer.start_link(__MODULE__, initial, name: __MODULE__) end def update(timestamp, offset, size) do GenServer.call(__MODULE__, {:update, timestamp, offset, size}) end def lookup(key) do GenServer.call(__MODULE__, {:looku...
02a2a1ac70ae235c841bf18f07cd14787a0ee43f
1,526
[ 322345781 ]
[]
defmodule VideoTutorialsServices.MixProject do use Mix.Project def project do [ app: :video_tutorials_services, name: "Video Tutorials Services", homepage_url: "../index.html", version: "0.1.0", build_path: "../../_build", config_path: "../../config/config.exs", deps_p...
02a2fd2b1669fed45777d8d84689b48695cd34df
2,277
[ 751586133 ]
[]
defmodule Rocks do defstruct width: 0, height: 0, data: %{} def run do "input.txt" |> File.read!() |> String.trim() |> String.split("\n") |> solve() |> IO.puts() end defp solve(input) do grid = build_grid(input) grid = shift_rocks(grid, {0, -1}) calculate_load(grid) end ...
02a3264f53a3de2db7d6aae104403785403be0aa
2,033
[ 64244189 ]
[]
defmodule RedixPubsubFastlane.Mixfile do use Mix.Project @project_url "https://github.com/cnsa/redix_pubsub_fastlane" @version "0.3.4" def project do [app: :redix_pubsub_fastlane, version: @version, elixir: "~> 1.3", elixirc_paths: elixirc_paths(Mix.env), build_embedded: Mix.env == :pr...
02a3585aff21afdc1992eca9795f263177e6d42c
2,160
[ 902870167 ]
[]
defmodule LangChainJsonProcessor do alias LangChain.Function alias LangChain.Message alias LangChain.Chains.LLMChain alias LangChain.ChatModels.ChatOpenAI alias LangChain.Utils.ChainResult alias LangChain.MessageProcessors.JsonProcessor def run() do # map of data we want to be passed as `context` to ...
02a3aa8a891b4bf9727a18df13984600f3b5eb63
1,766
[ 237772351 ]
[ "phoenix" ]
defmodule SpiderWeb.VehicleController do use SpiderWeb, :controller alias Spider.Vehicles alias Spider.Vehicles.Vehicle alias Spider.Repo action_fallback SpiderWeb.FallbackController def index(conn, _params) do vehicles = Vehicles.list_vehicles() |> Repo.preload(:vroles) render(conn, "index.json"...
02a3c70cb541391c5b2b4db262534beebd78f46c
5,215
[ 135832997 ]
[ "liveview" ]
defmodule Data.Article.Static.BrNordN9 do use Article.Static def id(), do: "br-nord-n9" def display_id(), do: "N9" def route_group(), do: :bezirk def title(), do: "Bezirksroute Nord – N9 – Langenhorner" def color(), do: "#b482ff" def color_faded(), do: "#dac2ff" def summary(), do: "Der Vors...
02a3f84900a5cc65952d3f6048361a07851fbc06
1,596
[ 211522608 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. # General application configuration use Mix.Config config :moneybear, ecto_repos: [Moneybear.Repo...
02a43d04289a4d199033b341d2cb9624e7c6ad57
5,766
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Domains.V1alpha2.Model.Binding do @moduledoc """ Associates `members`, or principals, with a `role`. ## Attributes * `condition` (*type:* `GoogleApi.Domains.V1alpha2.Model.Expr.t`, *default:* `nil`) - The condition that is associated with this binding. If the condition evaluates to `true...
02a483e170ff1ae337c36e6b523561b1bde95262
3,624
[ 164501186 ]
[ "test", "ecto" ]
defmodule PgRanges.PgRangesTest do use PgRanges.BaseCase import Ecto.Query alias PgRanges.{ Repo, Model, DateRange, TsRange, TstzRange, Int4Range, Int8Range, NumRange, DateMultirange, TsMultirange, TstzMultirange, Int4Multirange, Int8Multirange, NumMultira...
02a4a8e1a3b74db61a0f1dbc619e6e9dc39be613
1,925
[ 235507218 ]
[ "liveview" ]
defmodule BalderdashWeb.AskQuestionView do use Phoenix.LiveView alias Balderdash.Questions alias Timex def render(assigns) do BalderdashWeb.QuestionView.render("ask_live.html", assigns) end def mount(_params, session, socket) do {:ok, assign(socket, question: session["question"], ...
02a4e2a33df42775ca30d866043ff24ad8e76806
2,122
[ 305091318 ]
[ "documented", "ecto" ]
defmodule RiddlerAdmin.ContentBlocks do @moduledoc """ The ContentBlocks context. """ import Ecto.Query, warn: false alias RiddlerAdmin.Repo alias RiddlerAdmin.ContentBlocks.ContentBlock def list_workspace_content_blocks(workspace_id) do ContentBlock |> where(workspace_id: ^workspace_id) |>...
02a56f5e7a4a1f1da4d8c43f057ad768d6baf55b
2,118
[ 145983988 ]
[ "test" ]
defmodule ParserTest do use ExUnit.Case doctest Parser describe "peeks at tokentype at specified index (default 0) in list; true or false" do test "first and second token" do assert Parser.peek(:num, [{:num, "2"}, {:var, "x"}]) == true assert Parser.peek(:num, [{:opar, "("}, {:var, "x"}]) == fals...
02a5a2de6cbc817e6cd132c7fdf3bccf392396d6
2,027
[ 975192534 ]
[ "documented", "ecto" ]
defmodule Api.Translations do @moduledoc """ The Translations context. """ import Ecto.Query, warn: false alias Api.Repo alias Api.Translations.Translation @doc """ Returns the list of translations. ## Examples iex> list_translations() [%Translation{}, ...] """ def list_translati...
02a5b34524d39099cdd0de5820eaa596c05fe255
1,912
[ 43597414 ]
[ "test" ]
defmodule Alambic.BlockingCollection.Tests do use ExUnit.Case alias Alambic.BlockingCollection alias Alambic.BlockingQueue test "simple enumeration" do c = BlockingQueue.create() 1..10 |> Enum.each(&BlockingCollection.add(c, &1)) BlockingCollection.complete(c) assert 10 == Enum.count(c) a...
02a5ba5255da8a263102acd265c0b31521443055
1,881
[ 630404383 ]
[]
# 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 :nieustraszony, ecto_repos: [Nieustraszony.R...
02a71061ee905985e88def12c58e88139076def4
1,618
[ 666038222 ]
[ "liveview", "phoenix" ]
defmodule PhoenixDirectusBlogWeb.Endpoint do use Phoenix.Endpoint, otp_app: :phoenix_directus_blog # 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: :co...
02a71072f51ee785a09693674d1eb884504c8a58
1,653
[ 157791196 ]
[ "documented" ]
defmodule Calculadora do alias Entidades.Estudante, as: Estudante @moduledoc """ Define a caculadora e funcoes para executar """ @doc """ Inicia sistema """ def start() do #criando estudantes joao = %Estudante{nome: "Emerson de Andrade", resultados: build_materias([5.2, 3...
02a7580ee5e60340d493a4f1b39f1c64e8fd8e99
2,947
[ 113069881 ]
[ "documented" ]
defmodule Day07 do def part1(input) do input |> parse_input |> find_root end def part2(input) do nodes = input |> parse_input nodes |> build_tree(find_root(nodes)) |> weigh_tree |> find_unbalanced_node |> correction e...
02a788065f9578fda13bf2dde77e6379f93e063b
2,220
[ 91542742 ]
[ "test", "ecto" ]
defmodule Newline.Accounts.ValidationHelpersTest do use Newline.DataCase # alias Newline.Repo alias Ecto.{Changeset} import Newline.Factory import Newline.Helpers.Validation describe "validate_email_format/2" do setup [:create_cs] test "with @ is a valid email format", %{cs: cs} do cs = cs ...
02a80bef117427a4c60465f16ed5d8ae1802bcca
3,554
[ 60212770 ]
[]
%{"cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:rebar, :make], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.0", [hex: :ranch, optional: false]}]}, "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23de...
02a8e948b6c6514017de9388be8ed0482770fb11
1,671
[ 517330594 ]
[ "liveview", "documented", "ecto" ]
defmodule FacturacionWeb.ClienteLive.FormComponent do @moduledoc """ Module for live form component to insert new clients """ use FacturacionWeb, :live_component alias Facturacion.Clientes @impl true def update(%{cliente: cliente} = assigns, socket) do changeset = Clientes.change_cliente(cliente) ...
02a8f43d1eed51930f038e0ec21f7d47b190dbcc
10,228
[ 289239889 ]
[]
%{ "cachex": {:hex, :cachex, "4.0.3", "95e88c3ef4d37990948eaecccefe40b4ce4a778e0d7ade29081e6b7a89309ee2", [:mix], [{:eternal, "~> 1.2", [hex: :eternal, repo: "hexpm", optional: false]}, {:ex_hash_ring, "~> 6.0", [hex: :ex_hash_ring, repo: "hexpm", optional: false]}, {:jumper, "~> 1.0", [hex: :jumper, repo: "hexpm", o...
02a90fdd314c2b2713850bf274b97e1b6ccb929a
1,641
[ 423293029 ]
[ "documented" ]
defmodule Pane.Cache do use Agent @doc """ Starts a new cache. """ def start_link(path) do {:ok, persistence_pid} = Pane.Persistence.start_link(path) Agent.start_link(fn -> data = Pane.Persistence.get_cache(persistence_pid) cond do !Enum.empty?(data) -> %{persistence: ...
02a91e2220e5c5afcf06d8e0df6375943bc86f6c
5,945
[ 419820423 ]
[ "typespec", "documented", "ecto" ]
defmodule Velocity.Contexts.Pto.UserPolicies do @moduledoc "context for user policies" require Logger alias Ecto.Multi alias Velocity.Contexts.Employments alias Velocity.Contexts.Pto.Levels alias Velocity.Repo alias Velocity.Schema.Pto.AccrualPolicy alias Velocity.Schema.Pto.Ledger alias Velocity.Sc...
02a91e58ba9447ad3d59d9b445d1a1d7c58df59b
2,535
[ 991558805 ]
[ "typespec", "documented" ]
defmodule NodeActivator do @moduledoc """ This module provides functionality to turn a non-distributed Erlang node into a distributed node. It handles the entire process of node activation, including: * Ensuring the EPMD (Erlang Port Mapper Daemon) is running * Generating unique node names * Starting the d...
02a93c30541911bc016ba62ab263a358d9169d9c
2,983
[ 70551591 ]
[ "typespec", "documented" ]
defmodule RobotSimulator do defstruct direction: :north, position: {0,0} @doc """ Create a Robot Simulator given an initial direction and position. Valid directions are: `:north`, `:east`, `:south`, `:west` """ @spec create(direction :: atom, position :: { integer, integer }) :: any def create(directio...
02a9ca4c7f7f1669303251d10dca2d9923c65801
7,734
[ 561063308 ]
[ "genserver", "macro", "documented" ]
defmodule AxonInterp do @moduledoc """ The thin wrapper for Axon inference. It is a Deep Learning inference framework that can be used in the same way as my *Interp. """ @basic_usage """ ## Basic Usage You get the trained axon model or onnx model and save it in a directory that your application can read....
02a9cdd48524e5b3bc4443d3fbca502b5e68821c
2,713
[ 564777585 ]
[]
defmodule RabbitMQ.CLI.Diagnostics.Commands.MemoryBreakdownCommand do alias RabbitMQ.CLI.InformationUnit, as: IU import RabbitMQ.CLI.Core.Memory @behaviour RabbitMQ.CLI.CommandBehaviour def switches(), do: [unit: :string, timeout: :integer] def aliases(), do: [t: :timeout] def merge_defaults(args, opts) ...
02aa56d36f5208e73b16a0cb8878a340b5b4793b
2,178
[ 476843035 ]
[ "documented" ]
defmodule ArslaneToNarnia.Accounts.UserNotifier do @moduledoc """ When sending an email we use the functions in ArslaneToNarnia.Email to generate the Email struct ready for Swoosh to send off. Here we generate an Email struct based on a user and then deliver it. For some emails, we also filter which users can a...
02aa7df725fc90cf238713a4004fe64d8fd9f75e
5,494
[ 183291557 ]
[ "test", "documented", "ecto" ]
defmodule Acknowledgements do @moduledoc """ As Elixir has evolved over the past five years, we have grown idiomatic standards of how to express acknowledgements as atoms of `:ok` or `:error` throughout our code. However, by using pattern matching many implementations in many libraries result in repetitive `Ackn...
02aaa667801ac369b8d2e825da1e7a01cb936d76
7,886
[ 924851250 ]
[ "genserver" ]
defmodule BitUtils do def chunks(binary, n) do do_chunks(binary, n, []) end defp do_chunks(binary, n, acc) when bit_size(binary) <= n do Enum.reverse([binary | acc]) end defp do_chunks(binary, n, acc) do <<chunk::size(n), rest::bitstring>> = binary do_chunks(rest, n, [<<chunk::size(n)>> | ac...
02aaca98d5e6d8dda467aabed88f39965d96f0f3
3,611
[ 202838254 ]
[ "genserver", "typespec", "documented" ]
defmodule RateLimiter do @moduledoc """ A worker to output incoming messages at a rate. This Elixir application accepts messages via an HTTP endpoint and processes the messages in the order that they are received, and no more than one per second. The application should be able to handle multiple queues bas...
02ab18f4bb75047454170996ae1e16a0051429ae
4,942
[ 227906739 ]
[ "phoenix", "documented" ]
defmodule Web.FormView do use Web, :view @doc """ Label helper to optionally override the label text """ def field_label(form, field, opts) do case Keyword.get(opts, :label) do nil -> label(form, field, class: "label") text -> label(form, field, text, class: "label") end ...
02ab2d654a511741565ffea04eb31599bb05db62
4,066
[ 310810277 ]
[ "genserver", "liveview" ]
defmodule :m_log_mf_h do use Bitwise @behaviour :gen_event require Record Record.defrecord(:r_state, :state, dir: :undefined, maxB: :undefined, maxF: :undefined, curB: :undefined, curF: :undefined, cur_fd: :undefined, index: [], pred: :undefined ) def init(dir, maxB, maxF) ...
02ab6e20001a9126902aabd46c014346b3c82d67
17,160
[ 212487543 ]
[]
%{ "benchee": {:hex, :benchee, "1.4.0", "9f1f96a30ac80bab94faad644b39a9031d5632e517416a8ab0a6b0ac4df124ce", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm",...
02ac3d605bd55f9f29a2cb2d944191be0544189f
4,975
[ 722898238, 720560156 ]
[]
%{ "castore": {:hex, :castore, "1.0.4", "ff4d0fb2e6411c0479b1d965a814ea6d00e51eb2f58697446e9c41a97d940b28", [:mix], [], "hexpm", "9418c1b8144e11656f0be99943db4caf04612e3eaecefb5dae9a2a87565584f8"}, "earmark_parser": {:hex, :earmark_parser, "1.4.38", "b42252eddf63bda05554ba8be93a1262dc0920c721f1aaf989f5de0f73a2e367"...
02ac7078d40d6ccc2107c150b35d5e04b2028463
9,915
[ 48874454 ]
[ "typespec", "ecto", "genserver", "macro", "documented" ]
# This is a module Elixir responsible for tracking # calls in order to extract Elixir modules' behaviour # during compilation time. # # ## Implementation # # The implementation uses the digraph module to track # all dependencies. The graph starts with one main vertice: # # * `:local` - points to local functions # # We ...
02aca8a92395abc8c50ecafcd3a480d40bdb2038
2,025
[ 241050825 ]
[ "test", "ecto" ]
defmodule Culinary.PartnerTest do use Culinary.DataCase alias Culinary.Partner describe "shops" do alias Culinary.Partner.Shop @valid_attrs %{address: "some address", name: "some name"} @update_attrs %{address: "some updated address", name: "some updated name"} @invalid_attrs %{address: nil, na...
02acc3780834e35f24b9caa077c64d49546d51e7
2,578
[ 119053755 ]
[]
defmodule SimpleQueue.Reader do alias __MODULE__ @extension Application.get_env(:simple_queue, :timed_extension) @chunk Application.get_env(:simple_queue, :chunk) defstruct [:descriptor, :dir, :file, chunk: <<>>] def new(dir) do %Reader{dir: dir} end def get(%Reader{chunk: <<>>} = reader) do c...
02ad431a55456603784d9c70be8bc9166434a92e
2,733
[ 943997606 ]
[]
import Config # Configure your database config :notion_clone, NotionClone.Repo, username: "postgres", password: "postgres", hostname: System.get_env("POSTGRES_HOST", "localhost"), database: "notion_clone_dev", stacktrace: true, show_sensitive_data_on_connection_error: true, pool_size: 10 # For developme...