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
04d4e6e3a8df8a938e210ce48d7e8c75d2b1eb84
1,908
[ 173013806 ]
[ "genserver" ]
defmodule Slackclone.RoomChannel do use Slackclone.Web, :channel def join("room:" <> room_id, _params, socket) do room = Repo.get!(Slackclone.Room, room_id) |> Repo.preload([:messages]) |> Repo.preload([:users]) page = Slackclone.Message |> where([m], m.room_id == ^room.id) |> o...
04d5c4aed56d5dcd7f2e9dde7698858897637b6c
3,929
[ 1017248001, 1019465249, 1010134902, 1018026088, 1008064659, 1011149314, 1013128869, 983213709, 981784524, 982459127, 1011444481, 981152162, 976489306, 1006779772, 1009228905 ]
[ "typespec", "liveview", "phoenix", "macro", "documented" ]
defmodule Phoenix.LiveView.Socket.AssignsNotInSocket do @moduledoc false defimpl Inspect do def inspect(_, _) do "#Phoenix.LiveView.Socket.AssignsNotInSocket<>" end end defstruct [:__assigns__] @type t :: %__MODULE__{} end defmodule Phoenix.LiveView.Socket do @moduledoc """ The LiveView s...
04d5dea53da8c39fe0695a791c00899a24e89165
2,856
[ 479722629 ]
[ "documented" ]
defmodule Statistics do @doc """ Compute the mean (or average). iex> mean([1, 2, 3, 4, 5]) 3.0 """ def mean(xs) when is_list(xs) do Enum.sum(xs) / length(xs) end @doc """ Compute the median. iex> median([1, 10, 2, 9, 5]) 5 iex> median([1, 9, 2, 10]) (2 + 9) / 2 """ ...
04d62fc981eb7ba6831f5d8bac0531f4d502314b
4,490
[ 599689212, 710840412, 593129998, 837319868, 449520638, 651155880, 806822991 ]
[ "documented" ]
if Code.ensure_loaded?(Msgpax) do defmodule Tesla.Middleware.MessagePack do @moduledoc """ Encode requests and decode responses as MessagePack. This middleware requires [Msgpax](https://hex.pm/packages/msgpax) as dependency. Remember to add `{:msgpax, ">= 2.3.0"}` to dependencies. Also, you need...
04d70f4f26b622a65c5d25fb9afd02421d7f7c0e
8,369
[ 444767321 ]
[ "test" ]
defmodule Chargebeex.UsageTest do use ExUnit.Case, async: true import Hammox alias Chargebeex.Fixtures.Common alias Chargebeex.Usage setup :verify_on_exit! describe "create" do test "with bad authentication should fail" do unauthorized = Common.unauthorized() expect( Chargebeex....
04d7266df5506687e2c86291522e0c8ffd4294e9
1,797
[ 896849101 ]
[]
defmodule AdventOfCode.Day02 do alias Utils.EnumUtils :asc :desc def parse_line(line) do line |> String.split(" ") |> Enum.map(&String.to_integer/1) end def parse_input(input) do input |> String.split("\n") |> Enum.filter(& &1 != "") |> Enum.map(&parse_line/1) end def line_safe?(line) do l...
04d739f3fe96e24cf51a77ee91f6a7983229fa2e
2,686
[ 350517514 ]
[ "test", "phoenix" ]
defmodule ServerWeb.AuthTokenControllerTest do use ServerWeb.ConnCase alias Server.AuthTokens alias Server.AuthTokens.AuthToken @create_attrs %{ token: "some token" } @update_attrs %{ token: "some updated token" } @invalid_attrs %{token: nil} def fixture(:auth_token) do {:ok, auth_token...
04d7d4144d48bc58252bb8193584868f3db13d70
2,026
[ 163681649 ]
[ "ecto" ]
defmodule PersistentList.Day01 do alias PersistentList.Day01, as: List defstruct head: nil, tail: nil defimpl String.Chars, for: List do def to_string(list), do: "[" <> string_from(list) <> "]" defp string_from(%List{head: nil, tail: nil}), do: "" defp string_from( %List{ ...
04d80e6ff25fa4f1225bdb5c63eddf7f9bb5f075
3,713
[ 788999441 ]
[ "genserver", "test", "documented" ]
defmodule CounterStateTest do use PropCheck, default_opts: &PropCheck.TestHelpers.config/0 use PropCheck.StateM use ExUnit.Case property "Counter GenServer State Test #{:rand.uniform()}" do trap_exit( forall cmds <- commands(__MODULE__) do IO.puts("--------------------------------------------...
04d8522719229fb3c192176d3f49609d17b77e5e
16,137
[ 501627518 ]
[ "documented" ]
defmodule Kernel.CLI do @moduledoc false @compile {:no_warn_undefined, [Logger, IEx]} @blank_config %{ commands: [], output: ".", compile: [], no_halt: false, compiler_options: [], errors: [], pa: [], pz: [], verbose_compile: false, profile: nil } @standalone_opts [...
04d8ce329158897acf9c08c76e7fb3f8f4f0c48c
2,227
[ 83643051 ]
[ "documented" ]
defmodule JWT.Algorithm.Hmac do @moduledoc """ Sign or verify a JSON Web Signature (JWS) structure using HMAC with SHA-2 algorithms see http://tools.ietf.org/html/rfc7518#section-3.2 """ require JWT.Algorithm.SHA, as: SHA @doc """ Return a Message Authentication Code (MAC) ## Example iex> shar...
04d8de61c3864670cd92aecdf99f2834173bbc0a
1,826
[ 282619242 ]
[ "phoenix" ]
defmodule HelloWeb.Router do use HelloWeb, :router pipeline :browser do plug :accepts, ["html", "text"] plug :fetch_session plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers plug HelloWeb.Plugs.Locale, "en" end pipeline :api do plug :accepts, ["json"] ...
04d8f9040aa75cd2f5c0a211ca96c04a32d8579c
2,852
[ 343887251, 369004370 ]
[ "test", "documented" ]
defmodule CatalogTest do use ExUnit.Case, async: true import Test.Support.Helpers alias Catalog.Document @document_jane_doe_1950 %Document{ last_name: "Doe", first_name: "Jane", date_of_birth: ~D[1950-01-01], bucket_name: "TEST BUCKET", path: "TEST PATH 1" } @document_jane_doe_2000 %Do...
04d919794b97694bc197b56f2721ddf4a3d41c87
3,940
[ 32231619 ]
[ "test", "documented" ]
defmodule LibrexTest do use ExUnit.Case, async: true @docx_file Path.join(__DIR__, "fixtures/docx.docx") @odt_file Path.join(__DIR__, "fixtures/odt.odt") @pptx_file Path.join(__DIR__, "fixtures/pptx.pptx") @odp_file Path.join(__DIR__, "fixtures/odp.odp") @xlsx_file Path.join(__DIR__, "fixtures/xlsx.xlsx"...
04d95cd3ee3929c0eca8f2e20ed4dfb58d20765c
11,229
[ 937818017 ]
[]
%{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "burrito": {:hex, :burrito, "1.3.0", "4be8504185250756ff4a8770d0c0d91dbfe518d2faa5f1888f13b00540028c59", [:mix], [{:jason, "...
04d9b924c6c75652844bb357afbb8d02f2b805d4
4,516
[ 902177173 ]
[ "test" ]
defmodule MathTest do use ExUnit.Case alias SpaceDust.Math.Functions, as: Functions alias SpaceDust.Math.Matrix, as: Matrix alias SpaceDust.Math.Matrix.Matrix3x3, as: Matrix3x3 alias SpaceDust.Math.Vector, as: Vector alias SpaceDust.Math.Vector.Vector3D, as: Vector3D # function tests test "evaluate a ...
04d9f238fb402901dfa118c753a4d56681e24de7
7,679
[ 63644191 ]
[]
%{"certifi": {:hex, :certifi, "1.0.0", "1c787a85b1855ba354f0b8920392c19aa1d06b0ee1362f9141279620a5be2039", [:rebar3], []}, "combine": {:hex, :combine, "0.9.6", "8d1034a127d4cbf6924c8a5010d3534d958085575fa4d9b878f200d79ac78335", [:mix], []}, "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3...
04d9f7e1cd964cfa63e9203b3f81131610adab87
2,430
[ 181202121 ]
[ "test", "phoenix" ]
defmodule CampusPoliceWeb.TypeControllerTest do use CampusPoliceWeb.ConnCase alias CampusPolice.Types alias CampusPolice.Types.Type @create_attrs %{ name: "some name" } @update_attrs %{ name: "some updated name" } @invalid_attrs %{name: nil} def fixture(:type) do {:ok, type} = Types.cre...
04da42d7acf1490f0a0f49868294efc474dcbc1d
3,285
[ 553753276 ]
[ "documented" ]
defmodule Ueberauth.Strategy.Fastmail.CalDAV do @moduledoc """ A client for communicating with Fastmail service. """ require Logger import SweetXml @current_user_principal_xpath ~x"//d:multistatus/d:response/d:propstat/d:prop/d:current-user-principal/d:href/text()"s @current_user_email_xpath ~x"//d:mult...
04daaa96c17677d2d72c1105dd13acb73f0712fa
12,573
[ 995944955 ]
[ "liveview" ]
defmodule ShopUxPhoenixWeb.StatusBadgeDemoLive do use ShopUxPhoenixWeb, :live_view import ShopUxPhoenixWeb.Components.StatusBadge def mount(_params, _session, socket) do {:ok, socket |> assign(:page_title, "StatusBadge 状态徽章组件") |> assign(:orders, [ %{id: 1, number: "ORD-2024-001", statu...
04db0f1828c0b5cdadfc5d380c2164f4e6e9bf19
6,951
[ 607729034, 803809623 ]
[ "test" ]
defmodule OperatelyWeb.Api.Mutations.EditProjectNameTest do use OperatelyWeb.TurboCase import Operately.PeopleFixtures import Operately.GroupsFixtures import Operately.ProjectsFixtures alias Operately.Access.Binding describe "security" do test "it requires authentication", ctx do assert {401, _...
04db1e77ac09dfef6a0eeb63fac0724b6977df4e
12,594
[ 206297200 ]
[ "typespec", "documented" ]
defmodule Google.Ads.Googleads.V8.Errors.AdErrorEnum.AdError do @moduledoc false use Protobuf, enum: true, syntax: :proto2 @type t :: integer | :UNSPECIFIED | :UNKNOWN | :AD_CUSTOMIZERS_NOT_SUPPORTED_FOR_AD_TYPE | :APPROXIMATELY_TOO_LONG | :APPROXIMATEL...
04db53d101eb63431149ec78bfe2842bdedfb180
5,774
[ 1009289753 ]
[ "liveview" ]
defmodule CommentThreadWeb.HomeLive do use CommentThreadWeb, :live_view alias CommentThread.{Repo, Message} def mount(_params, _session, socket) do messages = Repo.all(Message) |> Enum.reverse() socket = socket |> assign(:messages, messages) |> assign(:form, to_form(%{"content" => ""})...
04db7de219e444546e14e55980a706a987f4212a
1,627
[ 260816712 ]
[]
# In this file, we load production configuration and secrets # from environment variables. You can also hardcode secrets, # although such is generally not recommended and you have to # remember to add this file to your .gitignore. # # This is calculated at runtime, see here for more details # https://hexdocs.pm/phoenix...
04dc2f1b0adc50a20cd211e9584a5d57e1f70b2f
4,299
[ 664700653 ]
[]
%{ "db_connection": {:hex, :db_connection, "2.5.0", "bb6d4f30d35ded97b29fe80d8bd6f928a1912ca1ff110831edcd238a1973652c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c92d5ba26cd69ead1ff7582dbb860adeedfff39774105a4f1c92cbb654b55aa2"}, "decimal": {:hex, :deci...
04dc4a58c9c5dff1445a28953933b98b44de0c4a
3,374
[ 103440792 ]
[ "documented" ]
defmodule Issues.CLI do @default_count 4 @columns Application.get_env(:issues, :output_columns) @moduledoc """ Handle the command line parsing and the dispatch to the various functions that end up generating a table of the last _n_ issues in a github project """ def main(argv) do argv |> par...
04dc5b721901b78fcdc9d39a6cca0c0e38bdb90f
9,690
[ 752471591 ]
[]
%{ "astro": {:hex, :astro, "0.10.0", "40dbdb5a3c2bf8f630bfdb2ea2253f62a06e3b8865aaeb8fedc8ea93ecfe7148", [:mix], [{:geo, "~> 3.0", [hex: :geo, repo: "hexpm", optional: false]}, {:tz_world, "~> 1.0", [hex: :tz_world, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.0", [hex: :tzdata, repo: "hexpm", optional: false]}]...
04dc9364edfaac243223ab627b1bbc706177187d
2,729
[ 203513840 ]
[ "test" ]
if !System.get_env("EXERCISM_TEST_EXAMPLES") do Code.load_file("sublist.exs", __DIR__) end ExUnit.start() #ExUnit.configure(exclude: :pending, trace: true) defmodule SublistTest do use ExUnit.Case test "empty equals empty" do assert Sublist.compare([], []) == :equal end @tag :pending test "empty is ...
04dd0dcca8d99edb3c89568d8c14fe08dabb7e1a
2,300
[ 797278493 ]
[ "test" ]
defmodule EdixTest do use ExUnit.Case # alias Edix.EdixDocument doctest Edix defp assert_edix_document(edix_document) do assert edix_document.element_delimiter == "*" assert edix_document.segment_delimiter == "~" assert edix_document.sub_element_delimiter == ">" [envelope] = edix_document.en...
04dd204031eae7f5f9ad8a8383cb47a66f8220c3
4,655
[ 593097184 ]
[ "genserver", "liveview" ]
defmodule NewsBiteWeb.NewsBiteLive do alias NewsBite.{Bite, Bites, BiteCache} use NewsBiteWeb, :live_view @impl true def mount(_params, _session, socket) do socket = socket |> assign(modal_shown: nil) |> assign(flash_timer: nil) |> assign_bites() Phoenix.PubSub.subscribe(NewsBi...
04de534b1f1396a035f87a312245bd3a5dcc7f89
13,980
[ 279715065 ]
[ "typespec", "documented" ]
defmodule IEx.Evaluator do @moduledoc false @doc """ Eval loop for an IEx session. Its responsibilities include: * loading of .iex files * evaluating code * trapping exceptions in the code being evaluated * keeping expression history """ def init(command, server, leader, start, opts) do ...
04df13c4c0a7e6dc7b6dc46d9c328b94e4588e98
4,266
[ 515497545 ]
[ "documented" ]
defmodule Keymap do @moduledoc """ A data structure for defining Emacs like key bindings inspired by its elisp counterpart http://www.gnu.org/software/emacs/manual/html_node/elisp/Keymaps.html ## Examples iex> keymap = Keymap.new() |> Keymap.put(?a, "action a name", fn -> "result a" end) iex> ...
04df262ab64715a1060ca4b0188cf6160ac009e1
2,198
[ 164084093 ]
[ "macro", "documented", "phoenix" ]
defmodule EdsWeb 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 EdsWeb, :controller use EdsWeb, :view The definitions below will be executed for every view, controller, etc, so keep...
04df33f4e99cff8e8df6fb3167f900fab87907e0
2,313
[ 690805471 ]
[]
defmodule TakeTurn do def snake_crashed(hit_other_snake, prev_board, snake_id) do old_deads = prev_board.board_deads ran_into = Enum.at(hit_other_snake, 0) new_killed = Map.put(old_deads, snake_id, true) next_board = %ServerBoard{ prev_board | :board_deads => new_killed } {:...
04dfe8e539a37d58fe469d2bfd45ce033b5322a2
3,461
[ 76988518 ]
[ "test" ]
defmodule Db2Kafka.TopicBufferTest do use ExUnit.Case import Mock @tag :unit test "initial state is correct" do num_partitions = 64 {:ok, state} = Db2Kafka.TopicBuffer.init(64) assert state == %Db2Kafka.TopicBuffer{num_partitions: num_partitions, partitions: %{}} end @tag :unit test "record...
04e03ac714c1c93c07ec46033cc077c3761e5bd8
24,858
[ 980133098 ]
[]
%{ "absinthe": {:hex, :absinthe, "1.7.9", "85c5bc9dfcb984fadf632d6e9a9f6daa7770c68d4f751f20cd5f9e77c57be4a1", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [h...
04e0a7f9ea274836287876e0af9540877b6d4068
2,207
[ 749468614 ]
[]
defmodule Lista7 do def separa(0) , do: [] def separa(numero) do ultimo_digito = rem(numero , 10) resto = div(numero , 10) [ultimo_digito | separa(resto)] end def separa_negs(0) , do: [] def separa_negs(numero) when numero > 0 do separa_negs(numero * -1) end def separa_negs(numero)...
04e0c1ecfad277e1d15690e1810492cfd98dbb54
2,003
[ 547614687 ]
[ "genserver", "phoenix" ]
defmodule Estimations.RoomServer do use GenServer alias Estimations.PubSub @timeout 600_000 @impl true def init(_opts) do {:ok, %{users: %{}, name: nil}} end def start_link(opts) do GenServer.start_link(__MODULE__, %{}, opts) end @impl true def handle_call(:get_room, _from, state) do ...
04e0d65b76321b2bb41cebe2dbfdf2e0a7371ed7
3,816
[ 145659084 ]
[ "phoenix" ]
defmodule KlziiChat.ReportView do use KlziiChat.Web, :view @default_field ["gender","city", "state", "country", "postCode"] def render("map_struct.json", %{session: session}) do %{ max_default_fileds_count: 4, types: %{ messages: %{ position: 0, section: "table", ...
04e0df6248d024c28b1219b85bf4b25ca1a01889
2,519
[ 932989880 ]
[ "genserver", "supervisor" ]
defmodule QuizApp.Boundary.QuizSession do use GenServer alias QuizApp.Core.{Quiz, Response} # ########################################################################### # Public API # ########################################################################### def take_quiz(quiz, email) do DynamicSuper...
04e116b879cdc0d9b46ab2442e3ac6b021b08e98
1,669
[ 433672889 ]
[]
defmodule AdventOfCode.Day10 do def part1(args) do Enum.map(args, fn x -> String.split(x, "", trim: true) end) |> Enum.map(&how_bad/1) |> Enum.reject(&is_list/1) |> Enum.sum() end def part2(args) do scores = Enum.map(args, fn x -> String.split(x, "", trim: true) end) |> Enum.map(&...
04e1722e4ed96f09d412ba2b2add2cd57127ee04
2,396
[ 983644520 ]
[ "typespec", "phoenix", "test", "macro", "documented" ]
defmodule DustoffWeb.ConnCase do @moduledoc """ This module defines the test case to be used by tests that require setting up a connection. Such tests rely on `Phoenix.ConnTest` and also import other functionality to make it easier to build common data structures and query the data layer. Finally, if th...
04e1e868592dd396ab0d15a59d43ade834e44ac3
2,042
[ 562077888, 648350300 ]
[ "typespec", "documented" ]
defmodule Bank.PaymentInstruments.Card do @moduledoc """ Represents a virtual credit card used for pyaments. Card numbers have 15 digits, and the linked account number can be derived from the card number. Each time it is used a different card number is generated and provided to merchants for payment. ""...
04e221a7aed4de76f04f349eb02fb96507de53f5
3,987
[ 134017837 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, "credo": {:hex, :credo, "1.7.1", "6e26bbcc9e22eefbff7e43188e69924e78818e2fe6282487d0703652bc20fd62", [:mix], [{:bunt, "~> 0....
04e232a3964bacc22be46de16024c7f303c98b72
2,072
[ 748128332 ]
[ "test" ]
defmodule UsersApiSergueiWeb.Graphql.Subscriptions.UpdateUserPreferencesSubscriptionTest do use UsersApiSergueiWeb.ConnCase use UsersApiSergueiWeb.SubscriptionCase @update_user_preferences_subscription """ subscription($userId: ID!, $likesEmails: Boolean = true, $likesPhoneCalls: Boolean, $likesFaxes: Boolean)...
04e28212da2bf3a5789fa7ac157c88b633ccf3a6
2,603
[ 434035181 ]
[]
defmodule Aoc2021.Day2.Solution do require IEx import Nx.Defn def part(1) do %{"down" => down, "forward" => forward, "up" => up} = traversals() (down - up) * forward end def part(2) do %{"depth" => depth, "forward" => forward} = input() |> Enum.reduce(%{}, &dir_update/2) depth *...
04e2aacad655fb2adf001bac58fdbef1501375f5
6,219
[ 91157211 ]
[ "documented" ]
defmodule Dialyxir.Plt do @moduledoc false import Dialyxir.Output, only: [color: 2] def check(plts) do info("Finding suitable PLTs") find_plts(plts, []) end defp find_plts([{plt, apps} | plts], acc) do case plt_files(plt) do nil -> find_plts(plts, [{plt, apps, nil} | acc]) b...
04e2e65d00fbd5202b190d90074439ca9d213201
2,215
[ 724827491, 638016246, 99027669, 280606635, 948031587, 200856268, 409779960, 115758627, 176335991, 867834303, 904149057, 104682810, 164238413, 186722326, 490104465, 514604379, 118121330, 776969847, 855718809, 631030613, 496790662, 718609993, 398417441 ]
[ "documented" ]
defmodule Servy.Handler do @moduledoc "Handles HTTP requests." alias Servy.Conv alias Servy.BearController @pages_path Path.expand("../../pages", __DIR__) import Servy.Plugins, only: [rewrite_path: 1, log: 1, track: 1] import Servy.Parser, only: [parse: 1] @doc "Transforms the request into a response...
04e3d0240f231a558791cc55a6c37ff9ac9c50e2
2,048
[ 93817528 ]
[ "test" ]
defmodule Generals.CommandQueue.QueueTest do use ExUnit.Case, async: true alias Generals.CommandQueue.Command alias Generals.CommandQueue.Queue setup do {:ok, queue: %Queue{}} end test "initialization provides empty turn mappings", %{queue: queue} do assert Queue.for_turn(queue, 1) == [] asse...
04e47d4053b7342148b54cdbdb3d403de18d5263
2,055
[ 726980114 ]
[]
defmodule Main do def sum_shortest_paths([], sum) do sum end def sum_shortest_paths([h | t], sum) do v = Enum.reduce(t, sum, fn to, acc -> acc + shortest_path(h, to) end) sum_shortest_paths(t, v) end def sum_shortest_paths(l) do sum_shortest_paths(l, 0) end def shortest_path(p1, p2) do ...
04e4af57de259a297c4eeb3aef44863fc5f9c660
3,185
[ 240878015 ]
[ "test" ]
defmodule HexResolverTest do use ExUnit.Case, async: true import HexResolver describe "without dependencies" do test "single requirement, singlepackage" do assert {:error, _} = solve([{:foo, ">= 0.0.0"}], []) assert {:error, _} = solve([{:foo, ">= 0.0.0"}], [{:bar, "1.0.0"}]) assert {:error...
04e4bf226bb36ccc17e3d59b21a367f6a4cf2063
3,906
[ 83989074 ]
[]
# Write a function that takes three arguments. If the first two are zero, # return “FizzBuzz.” # If the first is zero, return “Fizz.” # If the second is zero, # return “Buzz.” # Otherwise return the third argument. # Do not use any lan-guage features that we haven’t yet covered in this book. defmodule Func...
04e4d1ec2a4d9ab025953cdce39937fc92861696
1,727
[ 958231508 ]
[ "ecto" ]
defmodule Elixir.Conduit.QAD.Table.Pvod_det do use Ecto.Schema import Ecto.Changeset schema "qad_pvod_det" do field :pvod_id, :integer field :pvod_id_line, :integer field :pvod_order_type, :string field :pvod_order, :string field :pvod_order_line, :integer field :pvod__qadc04, :strin...
04e50a83d3770ee7ef4caa60b95e960014c1cf52
1,584
[ 709330276 ]
[ "macro", "documented", "phoenix" ]
defmodule OrganizationWeb 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 OrganizationWeb, :controller use OrganizationWeb, :html The definitions below will be executed for every...
04e6095614c825455bfe1445e938aca63f23ba89
2,112
[ 141909613 ]
[ "documented" ]
defmodule Getpocket.Auth do @moduledoc """ Getpocket authentication module """ @base_uri URI.parse("https://getpocket.com") @request_token_uri %{ @base_uri | path: "/v3/oauth/request" } @authorize_uri_base %{ @base_uri | path: "/auth/authorize" } @access_token_uri %{ @base_uri | path: "/v3/oauth/author...
04e6d7eab7f2f597b036a40b70d0a16e7bd5f68a
4,003
[ 76757241 ]
[ "test" ]
defmodule Pxblog.PostControllerTest do use Pxblog.ConnCase alias Pxblog.Post alias Pxblog.User @valid_attrs %{body: "some content", title: "some content"} @invalid_attrs %{} setup do {:ok, user} = create_user conn = build_conn() |> login_user(user) {:ok, conn: conn, user: user} end de...
04e7762fde7e255b455717c683b1515f1600c053
24,224
[ 1008964180 ]
[ "genserver", "typespec", "documented" ]
defmodule RubberDuckEngines.Engine.CacheManager do @moduledoc """ Centralized caching GenServer for the RubberDuck engine system. Provides high-performance caching capabilities for analysis results, engine configurations, task metadata, and other frequently accessed data. Uses ETS for fast native storage wit...
04e79216018637b8174b2b1df18906a99723c11c
7,576
[ 185338542 ]
[ "test" ]
if !System.get_env("EXERCISM_TEST_EXAMPLES") do Code.load_file("scale_generator.exs", __DIR__) end ExUnit.start() #ExUnit.configure(trace: true, exclude: :pending) defmodule ScaleGeneratorTest do use ExUnit.Case @major_scale_pattern "MMmMMMm" @minor_scale_pattern "MmMMmMM" @dorian_scale_pattern "MmMMMmM" ...
04e7df7c7f5374dab3947ebc7b44f478390b1371
1,833
[ 81334878 ]
[ "phoenix", "documented" ]
defmodule LinksApi.Accounts do use LinksApi.Web, :controller @moduledoc """ The boundary for the Accounts system. """ import Ecto.{Query, Changeset}, warn: false alias LinksApi.Repo alias LinksApi.Accounts.User alias LinksApi.Accounts.Session def get_user!(id), do: Repo.get_by!(User, id: id) def...
04e7ea597e8e702bf9481867557f1a0ddffee8e3
1,889
[ 245004645 ]
[ "test", "ecto" ]
defmodule App.UsersTest do use App.DataCase alias App.Users describe "user" do alias App.Users.User @valid_attrs %{age: 42, name: "some name"} @update_attrs %{age: 43, name: "some updated name"} @invalid_attrs %{age: nil, name: nil} def user_fixture(attrs \\ %{}) do {:ok, user} = ...
04e88d462bb0d634eabbe4cbc3d77cba0542161c
10,640
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Compute.V1.Api.InterconnectLocations do @moduledoc """ API calls for all endpoints tagged `InterconnectLocations`. """ alias GoogleApi.Compute.V1.Connection alias GoogleApi.Gax.{Request, Response} @library_version Mix.Project.config() |> Keyword.get(:version, "") @doc """ Returns ...
04e8d110d071c6996eb4df1009be65dc7dc4f19a
2,195
[ 144887510 ]
[ "test", "ecto" ]
defmodule Elixirblog.FeedTest do use Elixirblog.DataCase alias Elixirblog.Feed describe "posts" do alias Elixirblog.Feed.Post @valid_attrs %{description: "some description", title: "some title", user: "some user"} @update_attrs %{description: "some updated description", title: "some updated title",...
04e9ac13be7dc0be0a34634b6a4aa889a05316df
2,258
[ 651319795 ]
[ "documented" ]
defmodule Mix.Tasks.DownloadTablerIcons do @shortdoc "Upgrade the icon set used by the application." @moduledoc """ Upgrade the icon set used by the application. It fetches the most recent icons from [Tabler Icons](https://tabler-icons.io/), extracts them to the `vendor` directory and, then, runs a script t...
04e9e3c97dba56c22acfca823ff6f8f77ec8c2b3
3,601
[ 434376565 ]
[ "documented" ]
defmodule Parser do @doc """ Read in a hexadecimal code and parse it. """ def digest_hex(code) do code |> Base.decode16!() |> to_bitlist([]) |> parse(:start, 1, []) |> elem(0) |> hd() |> execute() end @doc """ Turns a binary into a list of single bits. """ def to_bitlist(<...
04ea5bd467176fcaaf761c6f90d05234d330cc0f
1,501
[ 151450439 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. use Mix.Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this # file won't be loaded nor affect the paren...
04ead02c1ab10a0d02c05e784440c75fa063b97b
4,330
[ 681401334 ]
[ "liveview", "test" ]
defmodule HoaWeb.PersonLiveTest do use HoaWeb.ConnCase import Phoenix.LiveViewTest import Hoa.DirectoryFixtures setup :register_and_log_in_user @create_attrs %{first_name: "some first_name", last_name: "some last_name", mobile_phone: "3345679100", email: "<EMAIL>", mobile_phone_public: true, email_...
04eb00298ba5f4a35db7b90f5a31ca2c2a2c5f83
9,806
[ 249259511 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> ...
04eb20b0d35911488fc510be912995c55f91a72a
2,919
[ 335130438 ]
[ "documented", "phoenix" ]
defmodule SchoolHouseWeb.HtmlHelpers do @moduledoc """ A collection of helpers to assist in working with translations and lessons """ use Phoenix.HTML import SchoolHouseWeb.Gettext alias SchoolHouse.Lessons alias SchoolHouse.LocaleInfo alias SchoolHouseWeb.Router.Helpers, as: Routes def avatar_url(...
04eb735218707adb6e434f24d6783d9b8e5d3141
1,942
[ 223773230 ]
[ "documented" ]
defmodule AOC.Y2019.Day05 do @moduledoc """ @see https://adventofcode.com/2019/day/5 """ import Helper.MyList, only: [to_map: 1] @program "priv/data/2019/day05.txt" |> File.read!() |> String.trim() |> String.split(",") |> Stream.map(&String.to_integer/1) ...
04ebe03c96ccb4352f8a5380d107def86e39832f
3,598
[ 607729034, 803809623 ]
[]
defmodule Operately.Blobs do import Ecto.Query, warn: false alias Operately.Repo alias Operately.Blobs.Blob def list_blobs do Repo.all(Blob) end def get_blob!(id), do: Repo.get!(Blob, id) def create_blob(attrs \\ %{}) do %Blob{} |> Blob.changeset(attrs) |> Repo.insert() end def up...
04ebe6e681a1bf0ee29472b257b0f85a0d667eca
1,904
[ 937373742 ]
[ "genserver", "liveview" ]
defmodule PolishMeWeb.PolishLive.Show do use PolishMeWeb, :live_view alias PolishMe.Polishes alias PolishMeWeb.Helpers.TextHelpers @impl true def render(assigns) do ~H""" <Layouts.app flash={@flash} title={@page_title}> <:actions> <.button navigate={~p"/polishes"}> <.icon nam...
04ec3147e3dff3a3f56f5b96e6cb4a8d3d872ddd
5,084
[ 674504588 ]
[ "liveview", "ecto" ]
defmodule KazipWeb.ArticleLive.FormComponent do use KazipWeb, :live_component alias Kazip.Articles alias Kazip.Articles.Article @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> </.header> <.simple_form for={@form} id="article-form" ...
04ec6136f345a142d3b7cc8571b627f192f49791
4,902
[ 99647743 ]
[]
defmodule AcceptedSpec do use ESpec import ESpec.TestHelpers defmodule SomeModule do def f, do: :f def m, do: :m end |> write_beam describe "expect(module).to accepted(func, args)" do before do allow(SomeModule).to accept(:func, fn(a, b) -> a + b end) SomeModule.func(1, 2) end ...
04ecbb78c9946888aa4b898d1cfad2fe6d781798
3,155
[ 667490780 ]
[ "typespec", "documented" ]
defprotocol Noun.Nounable do @doc """ I turn the transaction into a noun """ @spec to_noun(t()) :: Noun.t() def to_noun(transaction) end defmodule Noun.Nounable.Kind do @doc """ I convert the given `t:Noun.t/0` into the given structure """ @callback from_noun(noun :: Noun.t()) :: {:ok, any()} | :erro...
04ecc2702c4b39f495f42157f8c6b40ab4fc5bcb
2,918
[ 346497884 ]
[]
defmodule ReportsGeneratorParallelism do alias ReportsGeneratorParallelism.Parser @months { :janeiro, :fevereiro, :março, :abril, :maio, :junho, :julho, :agosto, :setembro, :outubro, :novembro, :dezembro } def build_from_many(filenames) when is_list(filenames) d...
04eccdde515e087b0fec49b93d12ff8ee1d4d608
5,429
[ 238266327 ]
[ "documented" ]
defmodule XMLTV.Programme do # According to XMLTV.dtd # Might not have all properties defstruct start: nil, stop: nil, channel: nil, title: [], subtitle: [], desc: [], credits: [], date: nil, category: [], ...
04ed00cc0d1d4166a79d1aa836ade2a051c29dab
2,077
[ 153550303 ]
[ "documented" ]
defmodule DomainLogic.Domain.Filter.FilterDatetime do @moduledoc false def validate_value(_value, op) when op not in [:gt, :ge, :lt, :le, :ne, :eq] do {:error, "Invalid operation : #{op}"} end def validate_value(nil, op) when op in [:ne, :eq] do {:ok, nil} end def validate_value(nil, op) do {...
04ed3b2234de6c78956e764db68d870434479f47
13,472
[ 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.ContainerAnalysis.V1.Model.ContaineranalysisGoogleDevtoolsCloudbuildV1Build do @moduledoc """ A build resource in the Cloud Build API. At a high level, a `Build` describes where to find source code, how to build it (for example, the builder image to run on the source), and where to store the bui...
04ed554c23f4e96db06172d133374de6129fb230
4,271
[ 479519709 ]
[]
%{ "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, "chacha20": {:hex, :chacha20, "1.0.3", "26372176993172260968b36b4e7bc2e007e6b2b397ae08083e4836df67cdf03c", [:mix], ...
04ed8f520622646269ecfe97e07edc4e0cd87f84
2,418
[ 65725537 ]
[ "test" ]
defmodule Traccow.EventControllerTest do use Traccow.ConnCase alias Traccow.Event @valid_attrs %{event_date: "2010-04-17 14:00:00", notes: "some content"} @invalid_attrs %{} test "lists all entries on index", %{conn: conn} do conn = get conn, event_path(conn, :index) assert html_response(conn, 200) ...
04edda8f7a510a7bd8b2286d6ffd4e2548dfbcc9
2,385
[ 156234146 ]
[ "typespec", "documented" ]
defmodule Elixircom do alias Elixircom.Server @moduledoc """ A serial port terminal emulator for IEx Run interactively be starting it from the `IEx` prompt. Here's an example that uses `Elixircom` to interact with a modem: ```elixir iex> Elixircom.run("/dev/tty.usbmodem14103", speed: 115_200) AT OK...
04edfae1052b23f0d50b484a417ba34e80b1aecb
1,916
[ 726047589 ]
[]
defmodule AdventOfCode.Day01 do def part1(input) do input |> String.split("\n") |> Enum.reduce(0, fn "", acc -> acc line, acc -> calibration = line |> String.replace(~r/[^\d]/, "") |> then(&get_calibration(&1)) acc + calibration end) ...
04ee5f63cc9e980c240afe5ef5527e49e7578b79
7,018
[ 796331800 ]
[ "documented" ]
defmodule Playground.Games.SuperHangman do @moduledoc """ A module for a multiplayer hangman game """ @behaviour Playground.Games @game_id "super-hangman" @name "Super Hangman" @min_players 2 @max_players 4 alias Playground.DB.{Game, GameType, Room} alias Playground.Games @impl Playground.Game...
04ee959f35244a197ce452e97c8cda50172e9424
2,927
[ 174182311 ]
[ "documented", "ecto" ]
defmodule IdeaPortal.SupportingDocuments do @moduledoc """ Context for managing supporting documents on a challenge """ alias IdeaPortal.SupportingDocuments.Document alias IdeaPortal.Repo alias Stein.Storage @doc """ Get the storage path for a document """ def document_path(key, extension), do: "/...
04eec22b9995ff7081a4612c9dad06ee93b57ef1
4,535
[ 94608375 ]
[ "typespec", "documented" ]
defmodule MerklePatriciaTree.Trie.Inspector do @moduledoc """ A simple module to inspect and print the structure of tries. """ alias MerklePatriciaTree.Trie alias MerklePatriciaTree.Trie.Node alias MerklePatriciaTree.Trie.Helper require Logger @doc """ Returns all values from a trie. ## Examples...
04ef24849afe3cdcaf1327b10da1d9d23ad2db5d
4,334
[ 651606171 ]
[ "typespec", "documented" ]
defmodule Ockam.Credential.Authenticator.Direct.Client.AddMemberRequest do @moduledoc """ Request data structure for Credential Authority authenticator API add_member """ use TypedStruct typedstruct do plugin(Ockam.TypedCBOR.Plugin) field(:identity_id, String.t(), minicbor: [key: 1]) field(:attri...
04ef25319ea3ef696babf8f93d41d3c4a9ef9ff0
2,794
[ 571776611 ]
[ "liveview", "documented" ]
defmodule Pleroma.Telemetry.Logger do @moduledoc "Transforms Pleroma telemetry events to logs" require Logger @events [ [:pleroma, :connection_pool, :reclaim, :start], [:pleroma, :connection_pool, :reclaim, :stop], [:pleroma, :connection_pool, :provision_failure], [:pleroma, :connection...
04ef80f38ae897e13a95306d2f5bfa68e83a0e35
7,799
[ 267378737 ]
[]
%{ "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :reb...
04ef9fa75c8ffdbf2f4f86f8425206fc69f9dbe4
3,471
[ 767897248 ]
[ "test", "documented" ]
defmodule Wayfarer.Target.SelectorTest do @moduledoc false use ExUnit.Case, async: false use Plug.Test use Mimic use Support.PortTracker alias Wayfarer.Target.{ActiveConnections, Selector, TotalConnections} @algorithms ~w[least_connections random round_robin sticky]a describe "choose/3" do test "w...
04f00746ce3975d082e05fb4efc5c4e8afc7c0f9
2,074
[ 85540367 ]
[ "test" ]
defmodule Mixdown.Admin.UserControllerTest do use Mixdown.ConnCase alias Mixdown.User @valid_attrs %{email: "some content", name: "some content", password_hash: "some content"} @invalid_attrs %{} test "lists all entries on index", %{conn: conn} do conn = get conn, admin_user_path(conn, :index) asser...
04f01c88fc7b2ef744b5f953e25e8a06399a8d9f
1,546
[ 995651883 ]
[ "typespec", "documented" ]
defmodule Torngen.Client.Schema.WeaponBonusEnum do @moduledoc false require Logger @behaviour Torngen.Client.Schema @type t :: String.t() @values [ "Any", "Double", "Yellow", "Orange", "Red", "Achilles", "Assassinate", "Backstab", "Berserk", "Bleed", "Blindfire"...
04f0858a0313cb9b6a5a5aa4b6389d3500b18563
3,324
[ 534273916 ]
[ "test", "documented" ]
defmodule Kadena.Types.MetaDataTest do @moduledoc """ `MetaData` struct definition tests. """ alias Kadena.Types.{ChainID, MetaData} use ExUnit.Case describe "new/1" do test "with a valid list params" do %MetaData{ creation_time: 0, ttl: 0, gas_limit: 2500, gas_p...
04f21ea706f8099ade16b461f0de074f0edde524
2,451
[ 112162635 ]
[ "test", "ecto" ]
defmodule Standup.SpreadsheetsTest do use Standup.DataCase alias Standup.Spreadsheets describe "spreadsheets" do alias Standup.Spreadsheets.Spreadsheet @valid_attrs %{spreadsheet_id: "some spreadsheet_id"} @update_attrs %{spreadsheet_id: "some updated spreadsheet_id"} @invalid_attrs %{spreadshe...
04f2513581c300c862c4f4a25ca95db64d9cb071
2,173
[ 140890391 ]
[ "test", "ecto" ]
defmodule Database.PoolsTest do use Database.DataCase alias Database.Pools describe "pools" do alias Database.Pools.Pool @valid_attrs %{event_id: 1, seatgeek_id: "seatgeek", eventbrite_id: "eventbrite"} @update_attrs %{event_id: 1, seatgeek_id: "updated seatgeek", eventbrite_id: "updated eventbrite...
04f25e9d21c89a4a373fa9b7cd8bb0a42d2fc18f
1,620
[ 205302020 ]
[ "typespec" ]
defmodule ListOps do # Please don't use any external modules (especially List or Enum) in your # implementation. The point of this exercise is to create these basic # functions yourself. You may use basic Kernel functions (like `Kernel.+/2` # for adding numbers), but please do not use Kernel functions for Lists...
04f278283b2d95feef3e00106907466843603574
6,514
[ 141747234 ]
[ "typespec", "documented" ]
defmodule ExUnit.ClusteredCase.Node.Agent do @moduledoc false alias ExUnit.ClusteredCase.Node.Manager @doc """ The name of the agent process on each started node """ def name_of(), do: :ex_unit_clustered_case_node_agent # Invoked via `-s #{__MODULE__} start <manager_node>` when # node is started via ...
04f29297d9a45c8bbfa72b201faf6f1770cfbc0a
2,927
[ 820530264 ]
[]
defmodule Pento.Game.Board do alias Pento.Game.{Pentomino, Shape} defstruct active_pento: nil, completed_pentos: [], palette: [], points: [] def puzzles(), do: ~w[default wide widest medium tiny]a def new(palette, points) do %__MODULE__{palette: palette(palette), points: points} end def to_shape(boa...
04f332a1e87d60c32c000fc3fa9af395153ff07c
2,313
[ 497108730 ]
[]
defmodule Ekser.Message.Leave do @behaviour Ekser.Message @impl Ekser.Message def parse_payload(_) do nil end def new(curr, bootstrap) do Ekser.Message.new(__MODULE__, curr, bootstrap, [], nil) end @impl Ekser.Message def send_effect(_) do :ok end end defmodule Ekser.Message.Join do ...
04f33794849e58c80dede7164134c7e3da39f356
2,629
[ 453040048 ]
[ "documented" ]
defmodule AmpsLib.IniManager do @moduledoc """ Documentation for `AmpsLib.IniManager`. """ @doc """ Load contents from INI File ## Examples iex> AmpsLib.load_ini(filename) returns map """ def load_ini(filename) do {:ok, data} = File.read filename parse_ini(data) end @doc """...
04f3f0a05caded27a6004af21d87677132e845d2
4,354
[ 616997606, 763410736, 718580001, 771543513, 488592761, 473559310, 616499111, 796721526 ]
[ "genserver", "liveview" ]
defmodule PmLoginWeb.Project.RecapsLive do use Phoenix.LiveView alias PmLogin.Services alias PmLogin.Monitoring alias PmLogin.MyContex def mount(_params, %{"curr_user_id" => curr_user_id}, socket) do Services.subscribe() Monitoring.subscribe() {:ok, socket |> assign(output_todays:...