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 |
|---|---|---|---|---|
0570514df1d11dade0757ab35c89edf00ffc3220 | 3,373 | [
383447628
] | [
"documented",
"ecto"
] | defmodule ZarynWeb.API.TransactionPayload do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
alias Zaryn.Utils
alias ZarynWeb.API.Types.AddressList
alias ZarynWeb.API.Types.AuthorizedKeys
alias ZarynWeb.API.Types.Hash
alias ZarynWeb.API.Types.Hex
alias ZarynWeb.API.Types.PublicKey
alias Za... |
0570b7871e12659ca802d0eecf83ea9dcfc5da8c | 1,827 | [
630025363
] | [
"macro",
"test",
"documented",
"phoenix"
] | defmodule JehutyWeb.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 the... |
0570c3b0d850b290bcf45bc26f6bd1227a12b25f | 9,326 | [
1010011901
] | [
"documented"
] | defmodule Sui.Rpc.V2beta.TransactionEffects do
@moduledoc """
The effects of executing a transaction.
"""
use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
def descriptor do
# credo:disable-for-next-line
%Google.Protobuf.DescriptorProto{
name: "TransactionEffects",
field... |
0570f0dbc2bdd88544a27f91a023d838dbff2a1f | 3,574 | [
492449411
] | [
"genserver",
"liveview",
"ecto"
] | defmodule RoomWeb.SpaceLive do
use RoomWeb, :live_view
alias Room.Lobby
alias Vax.Types.Counter
@impl true
def mount(%{"shared_space_id" => id}, _session, socket) do
request_tick()
socket = assign(socket, set_changeset: Ecto.Changeset.change({%{item: ""}, %{item: :string}}))
if connected?(sock... |
05713d856459257d54939b6c5c3c99bd69dd68a6 | 6,814 | [
644902367
] | [
"ecto"
] | defmodule AlgoThink.CryptoModuleValidation do
alias AlgoThink.CryptoArtifacts
@available_types [:private_key, :public_key, :signature, :message]
defp get_attribute(crypto_artifact, attribute) do
if (crypto_artifact == nil) do
nil
else
Map.get(crypto_artifact, attribute)
end
end
defp v... |
0571ac85e21606a76326429c062113c05a50054f | 5,619 | [
933291048
] | [
"test"
] | defmodule Arca.Cli.Test do
use ExUnit.Case
import ExUnit.CaptureIO
alias Arca.Cli
alias Arca.Cli.Test.Support
doctest Arca.Cli
@cli_commands [
["about"],
["settings.get", "id"],
["help", "settings.all"],
["cli.history"],
["cli.redo", "0"],
["sys.flush"],
# ["repl"], # doesn't wo... |
05721a20a552984a196b04faa39359d974131322 | 3,632 | [
320458689
] | [] | defmodule CsvMania.LocDataUtil do
import CSV
alias FutureMadeEvents.Repo
alias FutureMadeEvents.Country
alias FutureMadeEvents.City
@path_to_countries_en "data/csv/en/country_locations.csv"
@path_to_cities_en "data/csv/en/city_locations.csv"
# wc -l data/csv/en/<file_name>.csv
@number_of_countries ... |
05722471a85f82337cd63f19a7431ffc769a5f71 | 5,019 | [
726620118
] | [] | defmodule RangeMap do
# an "efficient" map to look up keys based on a range
# for each range we store
# RM[min_source] = {min_dest, length}
# to find the value for a particular index
# we find the largest key in RM that is smaller than the index
# then we check if the index lies within the range of this ke... |
05722cff26f0e60ce64195e74bae289353b407e9 | 5,851 | [
927234821
] | [
"liveview",
"phoenix",
"ecto",
"documented"
] | defmodule LivebookWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :livebook
# 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: "lb_sessi... |
057270bd8f3793e26b9294bc841caf340d15f9f0 | 10,879 | [
717039945,
717831055
] | [
"test"
] | defmodule Web.NotificationControllerTest do
use Web.ConnCase, async: true
alias BillBored.{Notification, Notifications}
import BillBored.Factory
# @post_params %{
# "title" => "Poll",
# "private" => false,
# "media_file_keys" => [],
# "items" => [
# %{"media_file_keys" => [], "title" => "... |
05728de88edc278f59f8cd9cb482b3f6db0b3c9f | 2,941 | [
433484844
] | [
"test"
] | defmodule ExCubicIngestion.ValidatorsTest do
use ExUnit.Case, async: true
alias ExCubicIngestion.Validators
@utc_now MockExAws.Data.dt_adjust_and_format(DateTime.utc_now(), -3600)
describe "valid_iso_date?/2" do
test "string passed in is valid per our requirement" do
assert Validators.valid_iso_dat... |
0572948fc5a35466c6a40d6ab9f920764010aa8b | 2,499 | [
750083958
] | [
"test",
"phoenix"
] | # defmodule RoveApiWeb.AccountControllerTest do
# use RoveApiWeb.ConnCase
# import RoveApi.AccountsFixtures
# alias RoveApi.Accounts.Account
# @create_attrs %{
# email: "some email",
# hash_password: "some hash_password"
# }
# @update_attrs %{
# email: "some updated email",
# hash_passwor... |
0573554426004abe21d8e34ab4451b4c3c19a6cd | 2,869 | [
625965585
] | [] | defmodule AdventOfCode.DayTwo do
@win :win
@draw :draw
@loss :loss
@result_points %{
@loss => 0,
@draw => 3,
@win => 6
}
@shape_points_1 %{
A: 1,
B: 2,
C: 3,
X: 1,
Y: 2,
Z: 3
}
@game_possibilities_1 %{
["A", "X"] => {@draw, @draw},
["A", "Y"] => {@loss, @wi... |
05736d4169bacdef8be40590dbcf1b6fee7417ae | 2,128 | [
331869129
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"credo": {:hex, :credo, "1.5.4", "9914180105b438e378e94a844ec3a5088ae5875626fc945b7c1462b41afc3198", [:mix], [{:bunt, "~> 0.... |
0573c0c826c582e279fcb714e262221873a1bb17 | 8,724 | [
850628335
] | [
"phoenix",
"ecto"
] | defmodule GreekCoinWeb.DepositController do
use GreekCoinWeb, :controller
alias GreekCoin.Funds
alias GreekCoin.Funds.Deposit
alias GreekCoin.Accounts
alias GreekCoin.Repo
alias Ecto.Multi
import Ecto.Query
defp authenticate(conn, _opts) do
if conn.assigns.current_user do
conn
else
... |
0573c54b96d3260f71408f2816cebf8fa920413b | 1,607 | [
205673115
] | [] | defmodule AiusWebsiteWeb.Auth do
import Plug.Conn
def add_author(params, conn) do
Map.put(params, "author", conn.assigns.claims["sub"])
end
def authenticate(conn, _) do
if Mix.env() == :test do
# TODO: valid/invalid tokens?
conn
|> assign(:claims, %{"sub" => "test"})
else
w... |
057454429cf9ebabd2f74c60609af684ec833da0 | 2,625 | [
790270606
] | [
"typespec",
"documented"
] | defmodule Split.RPC.Fallback do
@moduledoc """
This module is used to provide default values for all Splitd RPC calls.
When a call to Splitd fails, the fallback values are returned instead of the error received from the socket.
"""
use Split.RPC.Opcodes
alias Split.RPC.Message
alias Split.Impression
... |
0574634709b787f934e9c96887d3cadd7475d4d8 | 7,621 | [
1002252639
] | [
"test"
] | defmodule Cinder.SortIconAlignmentTest do
use ExUnit.Case, async: true
describe "Sort Icon Alignment" do
test "all themes use consistent sort icon alignment classes" do
themes = [
"default",
"modern",
"dark",
"compact",
"daisy_ui",
"flowbite",
"futu... |
0574c289935e51a5eb8eb4d2a97f107a72b7ba1f | 2,283 | [
286764944
] | [
"macro",
"documented"
] | defmodule RoachFeed.Error do
@moduledoc """
Represents an error.
The `source` field is `:cockroachdb` when the error was returned by the server.
In such cases the `code` field should be the integer code returned (though it
could be `nil` in the unlikely case that the error couldn't be parsed properly).
Otherwis... |
057522acc9c6653ddc33a965a0ed9c09e947aa7c | 2,308 | [
341930555,
330832087
] | [
"typespec",
"documented"
] | defmodule Entities.TransactionStatus do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t :: integer | :UNKNOWN | :PENDING | :FINALIZED | :EXECUTED | :SEALED | :EXPIRED
field :UNKNOWN, 0
field :PENDING, 1
field :FINALIZED, 2
field :EXECUTED, 3
field :SEALED, 4
field :EXPIRED, 5
... |
05754939bffb3265f61ac84f3133029d87312e45 | 1,795 | [
292174592
] | [
"phoenix",
"ecto"
] | defmodule QnotesWeb.NoteController do
use QnotesWeb, :controller
alias Qnotes.Core
alias Qnotes.Core.Note
def index(conn, _params) do
notes = Core.list_notes()
render(conn, "index.html", notes: notes)
end
def new(conn, _params) do
changeset = Core.change_note(%Note{})
render(conn, "new.ht... |
0575589c87922ecc716a863e15d984147545c87a | 1,855 | [
931252103
] | [
"test"
] | defmodule Livekit.TokenVerifierTest do
use ExUnit.Case
alias Livekit.AccessToken
alias Livekit.Grants
alias Livekit.TokenVerifier
@api_key "api_key_123"
@api_secret "secret_456"
describe "verify/2" do
test "successfully verifies a valid token" do
token =
AccessToken.new(@api_key, @api_... |
05756b519a939e49dbc02492f7f0c5870d409f48 | 2,499 | [
152137969
] | [
"typespec",
"documented"
] | defmodule Freddy.Utils.Backoff do
@moduledoc false
@default_config [
type: :jitter,
start: 1000,
max: 10000
]
@opaque t ::
{:mfa, {module, atom, [any]}, attempt}
| {:func, function, attempt}
| {:constant, non_neg_integer}
| {:backoff, :backoff.backof... |
05756df9ea3f0d18149dcb8c7299af9c4753e2a9 | 20,626 | [
806822991
] | [
"typespec",
"macro",
"documented"
] | defmodule Cldr.Interval.Backend do
@moduledoc false
def define_interval_module(config) do
backend = config.backend
config = Macro.escape(config)
quote location: :keep, bind_quoted: [config: config, backend: backend] do
defmodule Interval do
@moduledoc """
Interval formats allow f... |
057584fcf24834cc863006b54888947e8ae96d07 | 3,165 | [
351899007
] | [] | import Config
# Configure Mix tasks and generators
config :hygeia,
ecto_repos: [Hygeia.Repo],
phone_number_parsing_origin_country: "CH",
generators: [context_app: :hygeia, binary_id: true]
# Configures if contact persons are captured
config :hygeia,
quarantine_enabled: false,
isolation_enabled: false
confi... |
0576048dfb9a80910301fdf03cd55adf6c0225f8 | 3,184 | [
977629885,
977389947
] | [
"documented"
] | defmodule SplitwiseWeb.ExpenseJSON do
alias Splitwise.Expenses.{Expense, ExpenseShare, Comment}
@doc """
Renders a list of expenses.
"""
def index(%{expenses: expenses}) do
%{data: for(expense <- expenses, do: data(expense))}
end
@doc """
Renders a single expense.
"""
def show(%{expenses: expe... |
057719b88d454c31a221871703990dcd08654868 | 20,031 | [
227165372
] | [
"documented"
] | defmodule Militerm.Systems.Archetypes do
@moduledoc """
The Archetypes system manages running code defined in an archetype and inspecting aspects
of the archetype.
The public API uses the entity_id rather than an archetype name. The system expects
the archetype for the entity to be available from the Entity ... |
057726b347e0a6433f8ed25d4c7ded0139d3368a | 1,727 | [
896942254
] | [
"typespec"
] | import Combine.Parsers.Base
import Combine.Parsers.Text
defmodule AOC2024.Day02 do
def input(), do: AOC2024.Input.read("lib/day02/input.txt")
def name(), do: "Day 2: Red-Nosed Reports"
@type input_part_1 :: list(list(integer()))
@type input_part_2 :: list(list(integer()))
@type output_part_1 :: integer()
... |
05775b7a877febf0af579bb03d82a4864be5f994 | 2,201 | [
69035628,
68247807
] | [
"test",
"phoenix"
] | defmodule Rumbl.AuthTest do
use Rumbl.ConnCase
alias Rumbl.Auth
setup %{conn: conn} do
conn =
conn
|> bypass_through(Rumbl.Router, :browser)
|> get("/")
{:ok, %{conn: conn}}
end
test "authenticate_user halts when no current_user exists",
%{conn: conn} do
conn = Auth.authe... |
05777d0209849a25c0b1c5255888c7c60683ad2d | 3,919 | [
949664843
] | [
"documented"
] | defmodule Raxol.Terminal.TestHelper do
@moduledoc """
Test helper functions for Raxol.Terminal tests.
This module delegates to Raxol.Test.Support.TestHelper to provide
consistent test utilities across the terminal subsystem.
"""
alias Raxol.Terminal.{ScreenBuffer, Cursor.Manager, ModeManager}
@doc """
... |
05785573bcedb08151a787f18c861d4fcd0025b6 | 3,151 | [
52279279
] | [
"documented"
] | defmodule MqttClient.Topic do
@moduledoc false
@doc """
Validate a given topic filter (todo, describe topic filters)
"""
def valid_filter?("/"), do: {:ok, [""]} #<1>
def valid_filter?(topic_filter) when byte_size(topic_filter) < 65535 do #<2>
topic_filter
|> String.split("/")
|> do_valid_filter... |
05786e845657eb3273a65fdf601aa0b4064c7a06 | 2,795 | [
663793230
] | [
"test",
"phoenix"
] | defmodule ExbidappWeb.ProductControllerTest do
use ExbidappWeb.ConnCase
import Exbidapp.ProductsFixtures
import Exbidapp.UsersFixtures
alias Exbidapp.Products.Product
@update_attrs %{
description: "some updated description",
title: "some updated title",
start_price: "456.7"
}
@invalid_attrs... |
0578aea84104d4b85b255e58269520da0b66f4e0 | 2,301 | [
159892506
] | [
"documented"
] | defmodule Puzzle do
def load_input do
"input"
|> File.read!()
|> String.splitter("\n", trim: true)
end
@doc """
Calculates checksum for list of box IDs, based on the formula: y * x, where y is a number
of box IDs with exactly the same two characters and x is a number of box IDs with exactly
the... |
057909a5fb8b73afc796d3e246498b6c1ed9e53c | 4,057 | [
207003246
] | [
"typespec",
"documented"
] | defmodule AstroEx.Unit.Radian do
@moduledoc """
Radian
"""
alias AstroEx.Unit.{Arcmin, Arcsec, Degrees, DMS, HMS}
alias AstroEx.Utils.Math
@enforce_keys [:value]
defstruct [:value]
@type t :: %__MODULE__{value: integer() | float()}
@doc """
## Examples
iex> AstroEx.Unit.Radian.new(:math... |
0579175ff69d41305087963efb6b962f6905f433 | 3,247 | [
96619000
] | [
"test"
] | defmodule Recase.NameCaseTest do
use ExUnit.Case
import Recase.NameCase
doctest Recase.NameCase
test "should name case usual text" do
assert convert("keith") == "Keith"
assert convert("leigh-williams") == "Leigh-Williams"
assert convert("mccarthy") == "McCarthy"
assert convert("o'callaghan") ... |
057959df60afadff9d3350978056d6cb4aeb5271 | 3,033 | [
836195817
] | [
"documented"
] | defmodule Exercise.Services.CurrencyConverter do
@moduledoc """
Module implementing the currency conversion service
Note: The current implementation will not contact any external service
and will use fixed conversion rates that will most likely not be the correct ones.
"""
@doc """
Converts an amount fr... |
05796ae7ec04d42b27d8281d0b7ab319a05c595b | 2,343 | [
440426437
] | [
"typespec",
"documented",
"ecto"
] | defmodule Snitch.Data.Model.Payment do
@moduledoc """
Payment API and utilities.
Payment is a polymorphic entity due to the many different kinds of "sources"
of a payment. Hence, Payments are not a concrete entity in Snitch, and thus
can be created or updated only by their concrete subtypes.
To fetch the ... |
05797da807ca6a86b492de25903c69746b098df6 | 2,654 | [
131157926
] | [] | defmodule TodoList do
defstruct auto_id: 1, entries: HashDict.new
def new(entries \\ []) do
Enum.reduce(
entries,
%TodoList{},
fn(entry, todo_list_acc) -> add_entry(todo_list_acc, entry) end
)
end
def add_entry(
%TodoList{entries: entries, au... |
0579892a8e5aa4f1aa67fa5819e237d9729a9ed3 | 2,510 | [
278310574
] | [
"test",
"phoenix"
] | defmodule CcbApiWeb.ItemControllerTest do
use CcbApiWeb.ConnCase
alias CcbApi.Items
alias CcbApi.Items.Item
@create_attrs %{
quantity: 42,
sku: "some sku"
}
@update_attrs %{
quantity: 43,
sku: "some updated sku"
}
@invalid_attrs %{quantity: nil, sku: nil}
def fixture(:item) do
{... |
0579e95f269aebabfe90efca6b03553f360fb625 | 5,567 | [
44605268
] | [
"phoenix"
] | defmodule Svradmin.IssueController do
use Svradmin.Web, :controller
import Util
require Logger
alias Svradmin.Issue
import Svradmin.Auth, only: [authenticate_user: 2]
plug :scrub_params, "issue" when action in [:create, :update]
plug :authenticate_user
def index(conn, _params) do
issues = Repo.al... |
0579ef171dbd5cae7262b30f4d3807c6d0b646e2 | 3,112 | [
223820271
] | [
"test"
] | defmodule TwitterTest do
use ExUnit.Case
doctest Twitter
@userId 6
@userPid 6
@otherId 3
@tweet "hello @6 #gogators"
test "registration test" do
:ets.new(:registered_users, [:set, :private, :named_table])
assert :ets.whereis(:registered_users) != :undefined
ServerFunctions.register_user(@use... |
057ab72cdde5e89360ba8b87f6aa44dd26ff8963 | 2,494 | [
433034488
] | [
"documented"
] | defmodule Y2021.Day25 do
use Advent.Day, no: 25
def part1(cucumbers) do
{{max_x, _}, _} = Enum.max_by(cucumbers, fn {{x, _}, _val} -> x end)
{{_, max_y}, _} = Enum.max_by(cucumbers, fn {{_, y}, _val} -> y end)
do_part1(cucumbers, {max_x, max_y}, 1)
end
defp do_part1(cucumbers, max_size, move_count... |
057ad6cadd0779c2a8d1cd5c10fe0855d16a0c75 | 3,307 | [
550796194
] | [
"phoenix"
] | defmodule BorutaIdentityWeb.BackendsController do
# TODO test identity federation
@behaviour BorutaIdentity.Accounts.FederatedSessionApplication
use BorutaIdentityWeb, :controller
import BorutaIdentityWeb.Authenticable,
only: [
store_user_session: 2,
after_sign_in_path: 1,
client_id_from_... |
057b004b55361c96a220bbebcc425057e7fae2da | 2,790 | [
552698433
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule MySlackBotWeb 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 MySlackBotWeb, :controller
use MySlackBotWeb, :view
The definitions below will be executed for every view,
con... |
057b066125fcec7b21b15ead928d5817e9525417 | 2,315 | [
153191357
] | [
"documented",
"ecto"
] | defmodule Myclaims.Insurance do
@moduledoc """
The Insurance context.
"""
import Ecto.Query, warn: false
alias Myclaims.Repo
alias Myclaims.Insurance.Claim
@doc """
Returns the list of claims.
## Examples
iex> list_claims()
[%Claim{}, ...]
"""
def list_claims(args) do
args
... |
057b3af88a61ecf72c674da69ef49a8abb0652e2 | 3,071 | [
275964006
] | [
"documented",
"ecto"
] | defmodule TeslaMate.Settings.GlobalSettings do
use Ecto.Schema
import Ecto.Changeset
alias TeslaMate.Settings.{Units, Range}
schema "settings" do
field :unit_of_length, Units.Length
field :unit_of_temperature, Units.Temperature
field :preferred_range, Range
field :base_url, :string
field... |
057b5a001b73b8e0916300481837e6ad19bd9885 | 10,410 | [
439407702
] | [
"test"
] | defmodule Interop.Client do
import ExUnit.Assertions, only: [refute: 1]
def connect(host, port, opts \\ []) do
{:ok, ch} = GRPC.Stub.connect(host, port, opts)
ch
end
def empty_unary!(ch) do
IO.puts("Run empty_unary!")
empty = Grpc.Testing.Empty.new()
{:ok, ^empty} = Grpc.Testing.TestServic... |
057b80ee71832fd2ea8d34ce857a951d5f6f5669 | 3,140 | [
112810638
] | [
"test"
] |
defmodule Puzzle do
def call(input) do
{name, _, _} = input
|> String.split("\n")
|> Enum.reject(fn line -> line == "" end)
|> Enum.map(&parse/1)
|> Enum.reject(fn {_, _, []} -> true ; _ -> false end)
|> highlander()
name
end
def highlander(rows), do: highlander(rows, rows)
def h... |
057b9c9d9ba6c55ee51d97f7a8d3fc642b1fb9fa | 2,358 | [
191613332
] | [
"documented"
] | defmodule Core.Approvals.Producer do
@moduledoc false
alias Core.Approval
alias Core.Approvals
alias Core.Jobs
alias Core.Jobs.ApprovalCreateJob
alias Core.Jobs.ApprovalResendJob
alias Core.Patients
alias Core.Validators.JsonSchema
alias Core.Validators.OneOf
alias Core.Validators.Patient, as: Pati... |
057c0d106250f7e2e2ebc6011c94867d60ae05ca | 2,064 | [
695249689
] | [
"genserver",
"liveview"
] | defmodule InsigniaNotifyAppWeb.GamesLive do
use InsigniaNotifyAppWeb, :live_view
alias InsigniaNotifyAppWeb.TokenController
alias InsigniaNotifyAppWeb.Shared.GameList.GameListComponent
alias InsigniaNotifyAppWeb.Shared.Filter.FilterComponent
alias InsigniaNotifyAppWeb.Shared.Header.HeaderComponent
alias I... |
057c32c2affaffc75bf43dfe453358beec62e072 | 2,162 | [
406351390
] | [] | defmodule ObanFormatError.MixProject do
use Mix.Project
def project do
[
app: :oban_format_error,
version: "0.1.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: alias... |
057c5341c048dc7e91b1a66e8f17a0342d44ff51 | 3,521 | [
925303255
] | [
"genserver",
"macro",
"documented"
] | defmodule FDBC.Foundation do
@moduledoc """
A convenience behaviour to ease the use of a database instance within an OTP
application while also promoting best practices.
Firstly the configuration for the behaviour must be set and is designed in
such a way that it can be changed for each environment:
```el... |
057c5ccc4f192f63ec5e3fa2c3f3dc6ba4f971f9 | 1,703 | [
55292571
] | [
"test"
] | defmodule CamperTest do
use ExUnit.Case
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
doctest CampMinder.Camper
setup_all do
ExVCR.Config.cassette_library_dir("fixture/vcr_cassettes")
:ok
end
test "single household lead addition" do
household = %CampMinder.Household{Parent1: %CampMinder.Pers... |
057ce08899964143ba0312f524c70c950d012cbb | 1,996 | [
160016700
] | [] | defmodule AdventOfCode.InventoryManagement do
def calculate_checksum(ids) do
do_calculate_checksum(ids, %{twice: 0, thrice: 0})
|> Map.values
|> Enum.reduce(fn x, acc -> acc * x end)
end
def find_prototypes(ids) do
prototypes = ids
|> Enum.filter(fn (id) -> has_partner?(ids, id) end)
sta... |
057d52eb5e1765b20aaf31ccf1af7ee18bcf6c40 | 3,392 | [
931577569
] | [
"documented",
"ecto"
] | defmodule ContextedExamples.Blog do
@moduledoc """
The Blog context.
"""
import Ecto.Query, warn: false
alias ContextedExamples.Repo
alias ContextedExamples.Blog.Post
@doc """
Returns the list of posts.
## Examples
iex> list_posts()
[%Post{}, ...]
"""
def list_posts do
Repo.a... |
057db3f67ff3f17b8fe2a86a4138e9e3d8771184 | 23,963 | [
185269014
] | [] | %{
"artificery": {:hex, :artificery, "0.4.3", "0bc4260f988dcb9dda4b23f9fc3c6c8b99a6220a331534fdf5bf2fd0d4333b02", [:mix], [], "hexpm", "12e95333a30e20884e937abdbefa3e7f5e05609c2ba8cf37b33f000b9ffc0504"},
"astro": {:hex, :astro, "0.4.0", "cf6c9afe6dadf5e4f860cf5d19758f72db93ea69d5e1e0dfe5a81ed6d8f5372e", [:mix], [{:... |
057dbaef463edfc662cfea2ae90dc91c98d79c35 | 2,516 | [
637388715
] | [
"test",
"phoenix"
] | defmodule TodoWeb.ReleaseControllerTest do
use TodoWeb.ConnCase
import Todo.KanbanFixtures
@create_attrs %{date: "some date", title: "some title"}
@update_attrs %{date: "some updated date", title: "some updated title"}
@invalid_attrs %{date: nil, title: nil}
describe "index" do
test "lists all releas... |
057e36601df6c588331d2f0925875b14b44b117c | 1,522 | [
348701943
] | [] | defmodule WordayReports do
alias WordayReports.Parser
def call(file_name) do
"reports/#{file_name}"
|> Parser.parser_csv()
|> Enum.reduce(report_default_map(), fn el, report -> sum_values(el, report) end)
end
defp sum_values([name, hour, _day, month, year], %{
all_hours: all_hours,
... |
057f052433193bb4e966e1724279b821d24f7009 | 2,068 | [
751863886
] | [] | import Config
# Configure your database
config :phoenix_rest, PhoenixRest.Repo,
username: System.get_env("DB_USER"),
password: System.get_env("DB_PASSWORD"),
hostname: System.get_env("DB_HOST"),
database: System.get_env("DB_NAME"),
maintenance_database: System.get_env("DB_NAME"),
stacktrace: true,
show_s... |
057f1393e81d2b39e80ff855a43ff4c05ccf01f4 | 13,345 | [
35018620
] | [
"phoenix",
"ecto",
"genserver",
"macro",
"documented"
] | defmodule Phoenix.Channel do
@moduledoc """
Defines a Phoenix Channel.
Channels provide a means for bidirectional communication from clients that
integrate with the `Phoenix.PubSub` layer for soft-realtime functionality.
## Topics & Callbacks
When clients join a channel, they do so by subscribing to a t... |
057f39e812daba671a28f8e1c709887b3ec178d3 | 4,438 | [
251091905
] | [
"genserver"
] | # 6.1.5 Exercise: refactoring the to-do server
defmodule TodoEntry do
defstruct id: 0, date: nil, title: nil
end
defmodule TodoList do
defstruct auto_id: 1, entries: %{}
def new(entries \\ []) do
Enum.reduce(
entries,
%TodoList{},
&add_entry(&2, &1)
)
... |
057f3af5a8e792081ebb8ac61674514b4ecbe223 | 17,633 | [
180090514
] | [
"test"
] | defmodule Cizen.AutomatonTest do
use Cizen.SagaCase
alias Cizen.EffectHandlerTestHelper.{TestEffect, TestEvent}
alias Cizen.TestHelper
alias Cizen.Automaton
alias Cizen.Dispatcher
alias Cizen.Event
alias Cizen.Filter
alias Cizen.Saga
alias Cizen.SagaID
alias Cizen.Automaton.PerformEffect
alias C... |
05804ea73932006ec2aea88932ea794503fc53d4 | 4,080 | [
689539389,
719407286,
477647394,
15848380
] | [
"documented"
] | defmodule FarmbotOS.UpdateSupport do
@moduledoc false
require FarmbotOS.Logger
alias FarmbotOS.JSON
alias FarmbotOS.Config
@skip %{"image_url" => nil}
@dl_path ~c"/root/upgrade.fw"
@double_flash_error "A software update is already in progress. Please wait."
# Determines if there is an OTA update in pr... |
05806596c2458b3c067d93b1975a41cceebe9c03 | 5,917 | [
105483392
] | [] | %{
"algae": {:hex, :algae, "1.1.0", "6d152fd62efb86385bded7421b635d7194d8a15f4e0ef841438740f9db41f48a", [:mix], [{:quark, "~> 2.3", [hex: :quark, optional: false]}, {:type_class, "~> 1.2", [hex: :type_class, optional: false]}, {:witchcraft, "~> 1.0", [hex: :witchcraft, optional: false]}]},
"bunt": {:hex, :bunt, "0.... |
05809cc1180f537e634888d40782168790a9ad9b | 1,949 | [
93672912
] | [
"test"
] | defmodule HtmlBuilderTest do
use ExUnit.Case
doctest HtmlBuilder
defmodule HtmlTemplate do
import HtmlBuilder
def render_without_attr do
markup do
div do
h1 do
text "Winter"
end
end
div do
p do
text "is coming!"
... |
0580b12f37961027a68f25c66baf057c09502016 | 3,022 | [
203404358
] | [
"documented"
] | defmodule Operate.VM.Extension.Context do
@moduledoc """
Extends the VM state with functions for accessing the transaction context.
"""
use Operate.VM.Extension
alias Operate.VM
def extend(vm) do
vm
|> VM.set!("ctx", [])
|> VM.set_function!("ctx.tx_input", fn vm, args -> apply(__MODULE__, :t... |
058122e97aef41d8d015c153b6be9b7edb8ace0b | 3,469 | [
131076860
] | [] | %{
"certifi": {:hex, :certifi, "2.3.1", "d0f424232390bf47d82da8478022301c561cf6445b5b5fb6a84d49a9e76d2639", [:rebar3], [{:parse_trans, "3.2.0", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"},
"cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:ma... |
058251ce0a2802a7e38114ea8eb70016bb2022a4 | 2,948 | [
761864773
] | [
"liveview"
] | defmodule WordWeb.Presence do
use Phoenix.Presence,
otp_app: :word_processor,
pubsub_server: Word.PubSub
alias Phoenix.LiveView
### API
def list_online_users(),
do: list("online_users") |> Enum.map(fn {_id, presence} -> presence end)
def track_user(persona_id, persona_name, persona_emoji, room... |
05828c32ff54dbfaf3a1f117bee6f7c9398d32b0 | 1,573 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1RunPipelineMetadataProcessWithDocAiPipelineMetadata do
@moduledoc """
The metadata message for Process-with-DocAi pipeline.
## Attributes
* `documents` (*type:* `list(String.t)`, *default:* `nil`) - The input list of all the resource... |
058326d7787d4f91ee9b289c9de271bc21d1b38c | 22,152 | [
11782994
] | [
"test"
] | defmodule ExqTest do
use ExUnit.Case
alias Exq.Redis.JobQueue
alias Exq.Redis.JobStat
alias Exq.Support.Node
import ExqTestUtil
defmodule PerformWorker do
def perform do
send(:exqtest, {:worked})
end
end
defmodule PerformArgWorker do
def perform(arg) do
send(:exqtest, {:worked,... |
0583987f91adc2a1e0d7d6a696d65d11ee199618 | 2,564 | [
105960014
] | [
"test",
"ecto"
] | defmodule MyApp.AccountsTest do
use MyApp.DataCase
alias MyApp.Accounts
describe "users" do
alias MyApp.Accounts.User
@valid_attrs %{
email: "<EMAIL>",
password: "some password",
password_confirmation: "some password",
password_hash: "some password_hash",
type: User.types(... |
05839ac33d317a125b0975ff2ea571cf31e8bcf3 | 2,066 | [
405998814
] | [
"test",
"ecto"
] | defmodule InterBack.StoresTest do
use InterBack.DataCase
alias InterBack.Stores
describe "stores" do
alias InterBack.Stores.Store
@valid_attrs %{store_name: "some store_name", user_id: 42}
@update_attrs %{store_name: "some updated store_name", user_id: 43}
@invalid_attrs %{store_name: nil, user... |
0584df6955121bd62cf6d2a118359b7ea84cc572 | 23,485 | [
282066598
] | [
"test",
"ecto"
] | defmodule Glimesh.ChannelHostsLookupsTest do
use Glimesh.DataCase
use Bamboo.Test
import Glimesh.AccountsFixtures
import Glimesh.StreamsFixtures
alias Glimesh.Streams
alias Glimesh.Streams.ChannelHosts
alias Glimesh.ChannelHostsLookups
defp create_auto_hosting_data(_) do
hosting_channel =
st... |
0584fb4fbbd1960c5a50f2f16b64d15a3fcb7502 | 1,757 | [
542664067
] | [
"documented"
] | defmodule Stripe.HTTPClient.HTTPC do
@moduledoc false
@behaviour Stripe.HTTPClient
@impl true
def init() do
{:ok, _} = Application.ensure_all_started(:inets)
:ok
end
@impl true
def request(:post = method, url, headers, body, opts) do
headers = for {k, v} <- headers, do: {String.to_charlist(k... |
05850be54ddfee49c738bec090caf54d95e118b6 | 1,714 | [
972728612
] | [
"documented"
] | defmodule ExDoppler.Shares do
@moduledoc """
Module for interacting with `ExDoppler.Share`
<!-- tabs-open -->
#{ExDoppler.Doc.resources("share-security", "share-secret")}
<!-- tabs-close -->
"""
alias ExDoppler.Requester
alias ExDoppler.Share
@shares_api_path "/v1/share/secrets"
@doc """
Cre... |
058532d03c9de5ca622f05a0137f1a7ff702bc8b | 19,106 | [
53535974
] | [
"typespec",
"documented"
] | defmodule Regex do
@moduledoc ~S"""
Provides regular expressions for Elixir. Built on top of Erlang's `:re`
module.
As the `:re` module, Regex is based on PCRE
(Perl Compatible Regular Expressions). More information can be
found in the [`:re` module documentation](http://www.erlang.org/doc/man/re.html).
... |
0585936232f114be8718ab1c0115b82564ebf38f | 3,495 | [
112161816
] | [
"test"
] | defmodule Chorizo.WebApp.AuthControllerTest do
@accounts_api Chorizo.Accounts.Mock
use Chorizo.WebApp.ConnCase
import Mox
alias Chorizo.Accounts.VO
setup :verify_on_exit!
describe "POST /auth/token using non-password grant" do
test "responds with invalid grant type error", %{conn: conn} do
%{... |
0585c80fd6931074685c92d9a009b4628b0d76d4 | 3,514 | [
615504525
] | [
"test",
"ecto"
] | defmodule BookSearch.AuthorsTest do
use BookSearch.DataCase
alias BookSearch.Authors
describe "authors" do
alias BookSearch.Authors.Author
import BookSearch.AuthorsFixtures
@invalid_attrs %{name: nil}
test "list_authors/0 with two authors returns all authors" do
author1 = author_fixture... |
058624868ffe49c64ecf90285e3ae93ce204108c | 2,822 | [
659799067
] | [] | # 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
#####################################################... |
0587625b56561ef73e9cd191e542f9b1db2a90e3 | 2,545 | [
235912995
] | [
"documented"
] | defmodule Securion.FakeCards do
@moduledoc """
Fake cards to test API calls (see the official
[https://securionpay.com/docs/testing](docs) for more).
"""
defp card(card_number) do
%{
number: card_number,
expMonth: 12,
expYear: 2040,
cvc: "123"
}
end
def visa_1 do
card... |
0588281b97881f76d6436a352e10b63cf4a63878 | 5,321 | [
118212072
] | [
"genserver"
] | defmodule Mower.Receiver do
use GenServer
require Logger
use Constants
alias ElixirALE.SPI
alias ElixirALE.GPIO
require Mower
#@compile if Mix.env == :test, do: :export_all
# Weights for computing weighted average of timing values from receiver
# @weights [
# 0.628285,
# 0.508911,
# 0.40... |
05883198c918c2ba7ddac076323dc752fcb4ca61 | 2,133 | [
335160944
] | [
"test"
] | defmodule TelluridePipeline.Messaging.BroadwayConfigConsumerTest do
use ExUnit.Case, async: true
@exchange "sensor_events"
@message_queue "broadway_config_queue"
@routing_key "sensor.config"
@dlx_queue "dlx_queue"
@dlx_routing_key "dlx_key"
describe "produce message" do
setu... |
0588354a8261df51b4f5382cc783cd8db198bd57 | 2,290 | [
556161830,
585915775,
589089007,
589866492,
691980346,
807904878,
215544723,
500260157,
691199358,
530308212
] | [
"test",
"phoenix"
] | defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
use Pleroma.Web.ConnCase, async: true
alias Pleroma.User
alias Pleroma.Web.CommonAPI
import Pleroma.Factory
describe "locked accounts" do
setup do
user = insert(:user, is_locked: true)
%{conn: conn} = oauth_access(["follow"], ... |
058862d990de7763d84fed572f81cd19aa8a7dc8 | 3,404 | [
27011211
] | [
"test"
] | defmodule MetadataRequestTest do
use ExUnit.Case
alias Asterix.Protocol.Encodeable
alias Asterix.Protocol.Decodeable
alias Asterix.Protocol.Request
alias Asterix.Protocol.MetadataRequest
alias Asterix.Protocol.MetadataResponse
alias Asterix.Protocol.BrokerMetadata
alias Asterix.Protocol.TopicMetadata
... |
058871452a9d13a9541048c604249bf535e95e2e | 1,593 | [
717565165
] | [
"documented"
] | defmodule AoC2023.Day23.Part1 do
@moduledoc """
@see https://adventofcode.com/2023/day/23
"""
@behaviour AoC2023.Day
@up {0, -1}
@down {0, 1}
@left {-1, 0}
@right {1, 0}
@directions %{
"." => [@up, @down, @left, @right],
"^" => [@up],
"v" => [@down],
"<" => [@left],
">" => [@ri... |
0588d4d4ef518164c7899e0302d343fd5e8f6ca2 | 2,843 | [
99647743
] | [
"documented"
] | defmodule ESpec.Example do
@moduledoc """
Defines macros 'example' and 'it'.
These macros defines function with random name which will be called when example runs.
Example structs %ESpec.Example are accumulated in @examples attribute
"""
@doc """
Example struct.
description - the description of example... |
05893ab9ce5ad44aa32a799e10cc2e0f537f9043 | 2,574 | [
197472304,
244280746
] | [
"documented"
] | defmodule Mix.Tasks.Surface.Init.FilePatchers.MixExs do
@moduledoc false
# Common patches for `mix.exs`
import Mix.Tasks.Surface.Init.ExPatcher
alias Mix.Tasks.Surface.Init.ExPatcher
def add_compiler(code, compiler) do
patcher =
code
|> parse_string!()
|> enter_defmodule()
|> en... |
0589f6c1797c491ce6f1fcbce9abe7d2aca5fdee | 2,751 | [
784264315
] | [
"documented"
] | defmodule Bingo.Grids do
@moduledoc """
module for working with bingo grids
"""
@doc """
Creates a new 5x5, true/false grid mask
"""
def new_grid do
# get random cells, and create a 5x5 grid
cells()
|> Enum.shuffle()
|> Enum.take(25)
|> Enum.chunk_every(5)
|> Enum.map(fn row ->
... |
0589fead9ed2ad1185fdb9fcf1c3e7c1c9f4c800 | 2,565 | [
784692438,
783131240
] | [] | %{
"db_connection": {:hex, :db_connection, "2.6.0", "77d835c472b5b67fc4f29556dee74bf511bbafecdcaf98c27d27fa5918152086", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c2f992d15725e721ec7fbc1189d4ecdb8afef76648c746a8e1cad35e3b8a35f3"},
"decimal": {:hex, :deci... |
058a3ce29e35cdec40c4928daea94c661107771b | 6,192 | [
158739671
] | [
"documented"
] | defmodule Mandarin.Designer.Timestamp do
@moduledoc false
# This module exists as a hack to ensure we have monotonically increasing timestamps
# for ecto migrations. The ecto generators (which Phoenix and Mandarin use)
# generate timestamps with a granularity of a second.
# This is enough if the user is manu... |
058ad6a9679bad88108b22935735ef2148680110 | 2,809 | [
930600936
] | [] | require Logger
Logger.configure(level: :info)
IO.puts("Starting test for InquizitionIndexJob timestamp updates")
alias TriviaAdvisor.Repo
alias TriviaAdvisor.Events.EventSource
alias TriviaAdvisor.Events.Event
alias TriviaAdvisor.Scraping.Oban.InquizitionIndexJob
import Ecto.Query
# Function to check event source tim... |
058b2dd15c7b00e7262dfd6d3dd7e55207651e21 | 6,854 | [
921391148
] | [
"documented",
"ecto"
] | defmodule Wttj.Candidates do
@moduledoc """
The Candidates context.
"""
import Ecto.Query, warn: false
require Logger
alias Ecto.Multi
alias Wttj.Candidates.{Candidate, CandidateStatuses}
alias Wttj.Jobs.Job
alias Wttj.Repo
@doc """
Returns the list of candidates.
## Examples
iex> l... |
058b320ff43df794c93538f9c3c3349bde38fa44 | 4,133 | [
134580831
] | [
"ecto"
] | defmodule Owaygo.Rating.Location.Create do
import Ecto.Query
alias Owaygo.User.Util
alias Owaygo.Repo
alias Ecto.Changeset
alias Owaygo.LocationRating
alias Owaygo.LocationTag
alias Owaygo.Location
alias Owaygo.Tag
alias Owaygo.User
alias Ecto.DateTime
@attributes [:user_id, :location_id, :tag_id... |
058bc2eff8d1bc86807266d558553280daee717a | 2,438 | [
583038009
] | [] | defmodule SampleLevel do
def level do
%{
{0, 0} => :wall,
{0, 1} => :floor,
{0, 2} => :wall,
{0, 3} => :floor,
{0, 4} => :wall,
{0, 5} => :wall,
{0, 6} => :floor,
{0, 7} => :wall,
{0, 8} => :floor,
{0, 9} => :wall,
{1, 0} => :floor,
{1, 1} =>... |
058c0114a7b2b833b6cf7d3d18ca6f42446e94eb | 1,960 | [
592827405
] | [
"phoenix"
] | defmodule SatoriWebsocketsWeb.RoomChannel do
use SatoriWebsocketsWeb, :channel
use Phoenix.Channel
def join("room:lobby", _message, socket) do
{:ok, socket}
end
def join("room:" <> _private_room_id, _params, _socket) do
{:error, %{reason: "unauthorized"}}
end
def handle_in("message:add", %{"mes... |
058c7c524f2494ffd8f05cea5a6266aa5a14c346 | 3,034 | [
896624133
] | [
"test"
] | defmodule Day10Test do
use ExUnit.Case
setup_all do
{:ok, %{day: 10}}
end
test "day 10 parsing works for sample input", context do
input_string = ~s"89010123
78121874
87430965
96549874
45678903
32019012
01329801
10456732"
expected_input = {
{8, 8},
{
{8, 9, 0, 1, 0, 1, 2, 3},
... |
058c7e036b284f22b32bd56e86074d1772a7f930 | 9,742 | [
1008670264
] | [
"typespec",
"documented"
] | defmodule EveDmv.Surveillance.NotificationService do
@moduledoc """
Service for creating and managing surveillance notifications.
Handles creating notifications for surveillance profile matches,
managing user notification preferences, and delivering notifications
via various channels (LiveView, email, webhoo... |
058caa2d1a4bbbe6d22bf47312caafe24df18210 | 3,124 | [
499390408
] | [
"test"
] | defmodule Cache.WorkerTest do
use ExUnit.Case
alias Cache.Store
alias Cache.Worker
describe "start_link/1" do
test "accepts any type of key" do
[
500,
:an_atom,
"a string",
{:a, "tuple"},
%{a: "map"},
[a: "keyword"],
fn -> "a function" end
... |
058cd684ddf88b8074668d89426ef0ca02aadc86 | 4,811 | [
728273855
] | [
"documented"
] | defmodule War do
@moduledoc """
Documentation for `War`.
"""
@doc """
Function stub for deal/1 is given below. Feel free to add
as many additional helper functions as you want.
The tests for the deal function can be found in test/war_test.exs.
You can add your five test cases to this file... |
058cd790da6a4fd0fbd703d8adcd4ca2d73213a3 | 2,268 | [
203846230
] | [
"phoenix",
"documented"
] | defmodule KunWeb.UserSocket do
use Phoenix.Socket
## Channels
channel "authorized:*", KunWeb.AuthorizedChannel
channel "login:*", KunWeb.LoginChannel
# Socket params are passed from the client and can
# be used to verify and authenticate a user. After
# verification, you can put default assigns into
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.