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 |
|---|---|---|---|---|
0555371eafe56e4dc7cae11c9888a1a8ae348e25 | 7,585 | [
911264133
] | [
"test",
"documented"
] | defmodule Lux.Integration.AgentChatTest do
use IntegrationCase, async: true
alias Lux.Memory.SimpleMemory
# Fixed seed for deterministic responses in tests
@seed 42
defmodule TestPrism do
@moduledoc """
A test prism that can be used to test the agent.
"""
use Lux.Prism,
name: "#{TestP... |
055559fe8f7f58ad000832ce2579d2c9755bd657 | 3,304 | [
63436537
] | [
"test"
] | defmodule PlugProxyTest do
use ExUnit.Case, async: true
defp proxy_url(mod) do
conf = Application.get_env(:plug_proxy, mod, [])
port = Keyword.get(conf, :port)
"http://localhost:#{port}"
end
defp request(), do: request([])
defp request(options) when is_list(options) do
request(PlugProxyTes... |
05556f04f63a15674e1512c1da6c46999aed3e19 | 1,708 | [
227909153
] | [
"test"
] | defmodule KV.RegistryTest do
use ExUnit.Case, async: true
setup context do
_ = start_supervised!({KV.Registry, name: context.test})
%{registry: context.test}
end
test "spawns buckets", %{registry: registry} do
assert KV.Registry.lookup(registry, "shopping") == :error
KV.Registry.create(regist... |
055570149f9612f0ae9b40e94e099f0fee59a734 | 6,183 | [
392657747
] | [
"test",
"ecto"
] | defmodule Hotelverse.ContentTest do
use Hotelverse.DataCase
alias Hotelverse.Content
describe "images" do
alias Hotelverse.Content.Image
@valid_attrs %{property_id: 42, url: "some url"}
@update_attrs %{property_id: 43, url: "some updated url"}
@invalid_attrs %{property_id: nil, url: nil}
d... |
0555948b443c8bca5aa1918b6a7c957d698209be | 2,467 | [
921493255
] | [
"typespec",
"documented"
] | defmodule EngineSystem.Engine.Effects.MessageEffects do
@moduledoc """
I handle effects related to message sending and communication.
I manage:
- Message sending between engines
- Message validation
"""
alias EngineSystem.Engine.{Instance, State}
alias EngineSystem.System.Message
alias EngineSystem.... |
0555a33c5129afbb5ad009bc5dd9fcbc0e931cb3 | 2,544 | [
363419449
] | [
"test",
"documented"
] | defmodule OMG.Watcher.Integration.BlockGetter3Test do
@moduledoc """
This test is intended to be the major smoke/integration test of the Watcher
It tests whether valid/invalid blocks, deposits and exits are tracked correctly within the Watcher
"""
use ExUnitFixtures
use ExUnit.Case, async: false
use OMG... |
0555aa4c370e124e88b98dc896bb07445466d68e | 2,642 | [
654033295
] | [
"liveview",
"ecto"
] | defmodule WorkspaceWeb.ClientLive.FormComponent do
use WorkspaceWeb, :live_component
alias Workspace.Clients
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage client records in your database.</:subtitle>
</.header>
... |
0555e9294292f14655f58e87668d3b9ef61aa1c4 | 1,676 | [
12025329
] | [
"macro"
] | defmodule ExMake.Lib.Erlang do
use ExMake.Lib
require ExMake.Helpers
description "Support for the Erlang programming language."
license "MIT License"
version ExMake.Helpers.get_exmake_version_tuple()
url "https://github.com/lycus/exmake"
author "Alex Rønne Petersen", "<EMAIL>"
preciou... |
05562868cb6a1a7aef7f1e9d2beedcf59de821a9 | 3,105 | [
191472072
] | [
"test"
] | defmodule StackoverflowCloneF.Controller.Answer.CreateTest do
use StackoverflowCloneF.CommonCase
alias StackoverflowCloneF.TestData.QuestionData
alias StackoverflowCloneF.TestData.AnswerData
@api_prefix "/v1/answer"
@header %{
"authorization" => "user_credential"
}
test "create/1 " <> "success" do
... |
0556765851a45d6686ec4e7db3afca0003205e48 | 2,823 | [
42716040
] | [
"documented",
"ecto"
] | defmodule SummerSinger.Track do
use SummerSinger.Web, :model
schema "tracks" do
field :title, :string
field :path, :string
field :metadata, :map
field :duration, :float, null: false
field :rating, :integer
field :inbox, :boolean
field :imported, :boolean
belongs_to :artist,... |
05569e6d9c473dfb4e6829723d79b6574b0e294c | 1,954 | [
213868613
] | [
"documented",
"ecto"
] | defmodule Rest.Rest_web do
@moduledoc """
The Rest_web context.
"""
import Ecto.Query, warn: false
alias Rest.Repo
alias Rest.Rest_web.Assignment
@doc """
Returns the list of assignments.
## Examples
iex> list_assignments()
[%Assignment{}, ...]
"""
def list_assignments do
Rep... |
0556a156d71cf238053b96fa1540fa59d35e1717 | 1,725 | [
53162586
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Friendship.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Friendship.Web, :controller
use Friendship.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep... |
0556d93fc2cc46fcca6cd9e05e2b9d8e9f320e49 | 3,551 | [
934815751
] | [
"test",
"phoenix"
] | defmodule CdfWeb.UserSessionControllerTest do
use CdfWeb.ConnCase, async: true
import Cdf.AccountsFixtures
setup do
%{user: user_fixture()}
end
describe "POST /user/log_in" do
test "logs the user in", %{conn: conn, user: user} do
conn =
post(conn, ~p"/user/log_in", %{
"user"... |
0556fec0d923c0b755728b35d389b38c493839f0 | 1,679 | [
159197359
] | [
"macro",
"documented",
"phoenix"
] | defmodule ElixirStudyWeb 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 ElixirStudyWeb, :controller
use ElixirStudyWeb, :view
The definitions below will be executed for every view,
... |
0556ff8d6d547ba9c27c0dbf657d19f7ec5d2a3c | 3,275 | [
227177690
] | [] | defmodule AdventOfCode.Day05 do
def part1(opcodes, input) do
parse_opcodes(opcodes, input, 0, nil)
end
def part2(opcodes, input) do
parse_opcodes(opcodes, input, 0, nil)
end
def parse_opcodes(opcodes, input, at, nil) do
instructions = Enum.drop(opcodes, at)
parse_opcodes(opcodes, input, at, ... |
0557e1fe44a4b410352a9c70861e193d5934940a | 15,133 | [
660377590
] | [
"liveview",
"documented",
"ecto"
] | defmodule Beacon.LiveAdmin.PageEditorLive.FormComponent do
@moduledoc false
use Beacon.LiveAdmin.Web, :live_component
alias Beacon.LiveAdmin.Client.Config
alias Beacon.LiveAdmin.Client.Content
alias Beacon.LiveAdmin.RuntimeCSS
alias Ecto.Changeset
@impl true
def update(%{site: site, page: page} = ass... |
055801f2559663466bb49e4eebb2d6e48babec4e | 9,387 | [
756365326
] | [
"typespec",
"documented"
] | defmodule ContentfulElixir do
@moduledoc """
Provides functions to interact with the Contentful Content Delivery API,
allowing for fetching entries, assets, and lists of entries based on content type and locale.
This module is designed to facilitate easy integration with Contentful for Elixir applications,
a... |
055802073e1f573b3e303d31d0beefce9dd1e1c7 | 1,860 | [
473764636
] | [
"test",
"ecto"
] | defmodule PlexRequest.SourcesTest do
use PlexRequest.DataCase
alias PlexRequest.Sources
describe "source" do
alias PlexRequest.Sources.Source
import PlexRequest.SourcesFixtures
@invalid_attrs %{name: nil}
test "list_source/0 returns all source" do
source = source_fixture()
assert ... |
05580639206e8232f5d19bec0aa55753c07d22d5 | 1,793 | [
63364456
] | [] | defmodule ElixirLangMoscow.ExAdmin.Event do
use ExAdmin.Register
alias ElixirLangMoscow.Repo
alias ElixirLangMoscow.{Event, Registration}
register_resource Event do
menu priority: 1
scope :all, default: true
scope :upcoming, fn(q) ->
now = Ecto.DateTime.utc
where(q, [p], p.time_at > ^... |
0558d4c702d5c52635b16b0c34a7a084c73a1a98 | 17,536 | [
43778196
] | [
"typespec",
"documented"
] | import TypeClass
defclass Witchcraft.Apply do
@moduledoc """
An extension of `Witchcraft.Functor`, `Apply` provides a way to _apply_ arguments
to functions when both are wrapped in the same kind of container. This can be
seen as running function application "in a context".
For a nice, illustrated introducti... |
0559c7f2c1f3208af3ca560708d5f0a73c753e4a | 7,594 | [
761929336
] | [
"documented"
] | defmodule RssAutoGenerator.FeedHtmlParsers.EntryParser do
@moduledoc """
Responsible for parsing the HTML content of a page and extracting the RSS feed items from it.
"""
alias RssAutoGenerator.FeedAnalyzer.HtmlSelectors
alias RssAutoGenerator.Utils.Date
alias RssAutoGenerator.Entries.Entry
alias RssAuto... |
055a5c53b4d07845d6a57e2ba87d59fcddd7562c | 3,016 | [
72137464
] | [
"test",
"ecto"
] | defmodule Comiditas.UsersTest do
use Comiditas.DataCase
alias Comiditas.Users
alias Comiditas.Accounts.User
import Comiditas.UsersFixtures, only: [user_fixture: 0]
@valid_attrs %{
email: "<EMAIL>",
name: "some name",
password: "some password",
power_user: false,
root_user: false
}
... |
055aabc20ec40f704718da27adaf13d837d6a260 | 2,985 | [
13896750
] | [
"genserver",
"documented"
] | defmodule Funnel.Transistor do
@moduledoc """
`Funnel.Transistor` can be see as a User. It can have several transports, and
will notify a matching document on each of thoses transports.
"""
use GenServer
alias Funnel.Transistor.Cache
alias Funnel.Caches
import Funnel.Transport, only: [write: 2]
defmo... |
055b14a1cd476491e262d29029ce7334950be11e | 2,604 | [
320413007
] | [] | # Lots of iterations
# move_tail is the basic rules
# iterate over the movements, saving a set of the positions where the tail has been
# remember the last position for both, tail and head (on part 2, extend to have a head and 8 nodes behaving like tails)
defmodule AdventOfCode.Day09 do
def part1(args) do
{_, _... |
055b1a129255f33eb49d29c8d6742592ad0c4c40 | 10,417 | [
419435907
] | [
"test"
] | defmodule Oli.Delivery.Attempts.ManualGradingTest do
use Oli.DataCase
alias Oli.Repo.{Paging, Sorting}
alias Oli.Delivery.Attempts.ManualGrading
alias Oli.Delivery.Attempts.ManualGrading.BrowseOptions
alias Oli.Activities.Model.{Part}
alias Oli.Delivery.Attempts.Core
def add_submitted_activity(map, reso... |
055b436133c94ba30e4312fca9fb8d7bb599d7c7 | 3,973 | [
106824851
] | [
"test"
] | defmodule SwarmEngine.RepoTest do
use ExUnit.Case, async: true
alias SwarmEngine.Repo
setup do
# Explicitly get a connection before each test
:ok = Ecto.Adapters.SQL.Sandbox.checkout(SwarmEngine.Repo)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(SwarmEngine.DataVault)
end
@newDataset %SwarmEngine.D... |
055b5cb8be2be23c812862a135a3ace9e7596bf6 | 1,866 | [
315449524
] | [] | defmodule Multichess.Game.Pawn do
alias Multichess.Game.Board
def moves(board, {c, r}, previous_moves \\ []) do
colour = (board |> Board.piece({c, r})).colour
regular_moves(board, colour, {c, r}) ++
attacks(board, colour, {c, r}, previous_moves |> List.last())
end
defp regular_moves(board, :whi... |
055b6142d542d18c9e23cceca32352386c66f0c3 | 1,967 | [
1017265446
] | [
"typespec",
"liveview",
"documented"
] | defmodule AntoniaApp.Logger.EctoLogger do
@moduledoc """
Default Telemetry for Ecto SQL based queries.
"""
require Logger
@measurements_of_interest [
:decode_time,
:idle_time,
:query_time,
:queue_time,
:total_time
]
@metadata_interests [:result, :source]
@doc """
Start the telem... |
055bd7968215106238b446bdfb5ab634587dd979 | 1,851 | [
316230537
] | [
"macro",
"documented",
"phoenix"
] | defmodule TwitterApiWeb 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 TwitterApiWeb, :controller
use TwitterApiWeb, :view
The definitions below will be executed for every view,
con... |
055c285545933befb7953e8dbc9a14e4d4d238b6 | 6,541 | [
29387790
] | [
"test"
] | defmodule Brando.AuthorizationTest do
use ExUnit.Case, async: true
defmodule TestAuth do
use Brando.Authorization
alias Brando.Users.User
alias Brando.Pages.Page
types([
{"User", Brando.Users.User},
{"Page", Brando.Pages.Page}
])
rules :superuser do
can :manage, :all
... |
055c8de8212be16cde6a08eabf21f31eda8eeb0a | 6,127 | [
269577894
] | [
"typespec",
"documented"
] | defmodule WeChat.SDK.Material do
@moduledoc "素材管理"
import Jason.Helpers
alias WeChat.{SDK, UploadMedia, UploadMediaContent}
@doc_link "#{SDK.doc_link_prefix()}/offiaccount/Asset_Management"
@typedoc """
素材的类型
* `image` - 图片
* `video` - 视频
* `voice` - 语音
* `news` - 图文
support type
*... |
055d02612b410db97c6cff137cbbdff3e87b76db | 2,826 | [
67418487
] | [
"test"
] | defmodule Unix do
def ps_ax do
"""
PID TT STAT TIME COMMAND
1 ?? Ss 1:23.43 /sbin/launchd
38 ?? Ss 0:10.87 /usr/libexec/UserEventAgent (System)
5920 ?? Ss 0:00.07 /System/Library/Frameworks/VideoToolbox.framework/Versions/A/XPCServices/VTDecoderXPCService.xpc/Contents/MacO... |
055d823a72539b281b82a9555dda1d7ebcc546ff | 1,614 | [
187982501
] | [] |
defprotocol Animal do
@fallback_to_any true
def greet(arg)
def talk(arg)
def warn(arg)
defdelegate kind(arg), to: Animal.Any
defdelegate describe(arg), to: Animal.Any
defdelegate attributes(arg), to: Animal.Any
end
defimpl Animal, for: Any do
def greet(_), do: ""
def talk(_), do: ""
def warn(_), ... |
055dd9d05f4d11d829bf9ec9f28b18955d9a4e1a | 1,621 | [
412584844
] | [
"test"
] | defmodule ExAws.InstanceMetaTest do
use ExUnit.Case, async: false
import Mox
test "instance_role" do
role_name = "dummy-role"
ExAws.Request.HttpMock
|> expect(:request, fn _method, _url, _body, _headers, _opts ->
{:ok, %{status_code: 200, body: role_name}}
end)
config =
ExAws.C... |
055e5d52d90659dc7bdf5b212cbf2d3d60715cd7 | 4,742 | [
270476461
] | [
"test",
"phoenix"
] | defmodule WalkingMandarinWeb.UsersSettingsControllerTest do
use WalkingMandarinWeb.ConnCase, async: true
alias WalkingMandarin.Accounts
import WalkingMandarin.AccountsFixtures
setup :register_and_login_users
describe "GET /user/settings" do
test "renders settings page", %{conn: conn} do
conn = ge... |
055ec03b8d798969c7e3fdfa879b2a10130472cd | 2,941 | [
210432674
] | [
"typespec",
"documented"
] | defmodule ExOura.Client.DailyActivityModel do
@moduledoc """
Provides struct and type for a DailyActivityModel
"""
alias ExOura.Client.ActivityContributors
alias ExOura.Client.DailyActivityModelTimestamp
alias ExOura.Client.SampleModel
@type t :: %__MODULE__{
active_calories: integer,
... |
055ed25c9db408c6d538e80c41fa17e436b9df2e | 1,617 | [
619400419
] | [
"genserver",
"documented"
] | defmodule Scoreboard.Users.PointsUpdater do
@moduledoc """
I want to run the update on a separate process and there are a few reasons for that:
1. We want the operation to be async to not block the caller.
2. The database can fail, so we need a retry mechanism to ensure data integrity.
3. The process of upda... |
055ed2d9086c7dbd587466e65c8fdc8e25798c32 | 3,580 | [
900445592
] | [
"typespec",
"documented"
] | defmodule Floppabot.Commands.Sysinfo do
@moduledoc "System Info command"
import Nostrum.Struct.Embed
alias Floppabot.Utilities
@behaviour Nosedrum.ApplicationCommand
@spec name() :: String.t()
def name(), do: "sysinfo"
@impl true
@spec description() :: String.t()
def description(), do: "General syst... |
055fa1a7c1559c297b574e6754ffaacb68143314 | 4,596 | [
63429750
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], []},
"certifi": {:hex, :certifi, "2.3.1", "d0f424232390bf47d82da8478022301c561cf6445b5b5fb6a84d49a9e76d2639", [:rebar3], [{:parse_trans, "3.2.0", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexp... |
056018f06712fa3e6bca09c4bd9a16b1374fc94a | 2,793 | [
787790836,
660714128,
798904285,
765772505
] | [] | %{
"cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911... |
056041c518bc32f47b799b43115ff70c87fb8d5f | 4,804 | [
558206604
] | [
"macro",
"documented"
] | defmodule RustlerGithub do
require Logger
alias RustlerGithub.{Config, Http, Metadata}
@native_dir "priv/native"
defmacro __using__(opts) do
force =
if Code.ensure_loaded?(Rustler) do
quote do
use Rustler, only_rustler_opts
end
else
quote do
raise "R... |
056081d88eb0661bb43ccd2ec6992d8e18af7894 | 2,679 | [
551524682
] | [
"documented",
"ecto"
] | defmodule GoliathCredits.API.ClientsQuota do
use Ecto.Schema
import Ecto.Changeset
@derive {Jason.Encoder, only: [:id,
:loan_code,
:calc_number_days,
:concept_state,
:condoned_amount,
:office_code,
:concept_code,
:debt_balance,
... |
0560df84fe04953a4e9676f16b0d779d3f168099 | 8,835 | [
48253708
] | [] | defmodule Tracker.Plug do
@behaviour Plug
import Plug.Conn
import Tracker.Utils, only: [to_scrape_path: 1]
alias Tracker.File.Peer.Announce
alias Tracker.File.Statistics
def init(opts) do
# The scrape path will be found relative to the announce path.
# This will fail if the annonuce path is inval... |
056120429cd46217a556a4c3e7c7f4f143bc4cbe | 8,023 | [
237364100
] | [
"test"
] | defmodule Api.ValidationTest do
use ExUnit.Case, async: true
setup do
module = Module.safe_concat(__MODULE__, Validator)
:code.delete(module)
:code.purge(module)
:ok
end
test "empty validator" do
defmodule Validator do
import Api.Validation, only: [validate: 1]
validate do
... |
05614e106ed7c8a908f840b298a309011b4cdcbc | 3,716 | [
164238413
] | [
"documented"
] | defmodule Servy.Handler do
@moduledoc "Handles HTTP requests"
@pages_path Path.expand("pages", File.cwd!)
import Servy.Plugins, only: [rewrite_path: 1, track: 1]
import Servy.Parser, only: [parse: 1]
import Servy.FileHandler, only: [handle_file: 2, handle_markdown: 2]
import Servy.View, only: [render: 3]... |
05615a7bc2270627cce2c7875ff7f614a43deeca | 6,500 | [
476843035
] | [
"liveview",
"documented",
"phoenix"
] | defmodule ArslaneToNarniaWeb.PageBuilderLive do
@moduledoc """
A dev-only live view that builds new pages by copying templates and modifying the router.
"""
use ArslaneToNarniaWeb, :live_view
alias ArslaneToNarnia.PageBuilder
alias ArslaneToNarnia.PageChangeset
@impl true
def mount(params, _session, so... |
05617330bba280682a3c01f00afe1d02c7fb2599 | 12,982 | [
57299881
] | [
"test"
] | defmodule CheckerTest do
use ExUnit.Case
doctest Funchaku.Checker
import Funchaku.Checker
import Mock
test "validates a URL" do
with_mock HTTPoison, [get: fn(_url, _headers, _options) -> mocked_validation end] do
{ status, results } = check "http://validationhell.com"
assert status == :ok
... |
0561ae787875f86f0641bbb26b75df2cf28d73dc | 3,612 | [
287121987
] | [] | defmodule GetthatjobWeb.Resolvers.Accounts do
alias Getthatjob.{Recruitment, Accounts}
alias GetthatjobWeb.Schema.ChangesetErrors
def me(
_,
_,
%{
context: %{
current_user: user
}
}
) do
{:ok, user}
end
def me(_, _, _) do
{:ok, n... |
05620d123f38d86eb62db427065a39edddb5eade | 1,584 | [
51166750
] | [] |
defmodule Todo.List do
defstruct auto_id: 1, entries: HashDict.new
def new(entries \\ []) do
Enum.reduce(entries, %Todo.List{}, fn(entry, todo_list) ->
add_entry(todo_list, entry)
end)
end
def add_entry(%Todo.List{} = todo_list, date, title) do
add_entry(todo_list, Todo.Entry.new(date, tit... |
0562c7a8eedfe7928b42d76850cde77fa0804755 | 1,631 | [
222558635
] | [
"test",
"phoenix"
] | defmodule CarPoolingWeb.JourneyControllerTest do
use CarPoolingWeb.ConnCase
setup %{conn: conn} do
{:ok, conn: put_req_header(conn, "accept", "application/json")}
end
describe "[Create Journey]" do
@tag :web
test "Create journey when data is valid", %{conn: conn} do
cars = build_list(1, :car... |
0562cab4b38e4b26aa6950a6efa7954bae658633 | 4,531 | [
728692619
] | [
"typespec",
"documented"
] | defmodule FwdClient.Vulnerability do
@moduledoc """
Provides struct and type for a Vulnerability
"""
use FwdClient.Encoder
@type t :: %__MODULE__{
__info__: map,
description: String.t() | nil,
detectionMethod: String.t(),
devices: [String.t()],
id: String.t()... |
05630bd95d1a2375f3b9c74b70eea3dae63720b1 | 3,304 | [
75527050
] | [
"test"
] | defmodule Classlab.Classroom.ChatMessageControllerTest do
alias Classlab.ChatMessage
use Classlab.ConnCase
@valid_attrs Factory.params_for(:chat_message) |> Map.take(~w[body]a)
@invalid_attrs %{body: ""}
@form_field "chat_message_body"
setup %{conn: conn} do
user = Factory.insert(:user)
event = Fa... |
05634c8ef077b3f436bf60dc8332f3c3fa5ead47 | 2,064 | [
463909124
] | [
"test"
] | defmodule ExMatchTest.UsePlain do
use ExMatchTest.TestCase
use ExMatch
import ExMatchTest.TestCase, only: [match_fails: 2]
test "exmatch _, _" do
exmatch 1, 1
match_fails(
exmatch(1, 2),
"""
left: 1
right: 2
"""
)
end
test "exmatch _ == _" do
exmatch 1 == 1... |
0563628a90b4a149cfecf443e70575ab54fa557e | 3,903 | [
344280000
] | [
"genserver",
"typespec",
"liveview"
] | defmodule LiveView.StudioWeb.StoresLive do
use LiveView.StudioWeb, [:live_view, :aliases]
import StoresComponents
@spec mount(LV.unsigned_params(), map, Socket.t()) ::
{:ok, Socket.t(), keyword}
def mount(_params, _session, socket) do
socket =
socket
|> assign_fields(false, "", "", [... |
0563758146395d0b5e8cf5b8377a40cb37e55166 | 2,688 | [
83251357
] | [
"typespec",
"documented"
] | defmodule Absinthe.Phase.Parse do
@moduledoc false
use Absinthe.Phase
alias Absinthe.{Language, Phase}
@spec run(Language.Source.t, Keyword.t) :: Phase.result_t
def run(input, options \\ []) do
result(parse(input), Map.new(options))
end
defp result({:error, %{message: msg, locations: [%{line: lin... |
0563943609c72640458cbc8ab44ad4f0dd807cfa | 2,151 | [
580944383
] | [
"documented"
] | defmodule FishjamWeb.ApiSpec.Component.File do
@moduledoc false
require OpenApiSpex
alias OpenApiSpex.Schema
defmodule Properties do
@moduledoc false
require OpenApiSpex
OpenApiSpex.schema(%{
title: "ComponentPropertiesFile",
description: "Properties specific to the File component",
... |
0563f7bb92fb130363c0134576be9d6b61bc6817 | 2,309 | [
259207239
] | [
"test"
] | defmodule Observer.Common.CommonTest do
use BeholdWeb.ConnCase
alias Observer.Common.Common
test "convert_float_to_integer/1 returns ok when int provided", _ do
response = Common.convert_float_to_integer(1)
assert response == {:ok, 1}
end
test "convert_float_to_integer/1 returns ok when float provi... |
0563fcfc3a4b476e339b0cadad8596220508dafc | 2,503 | [
959927846
] | [
"documented"
] | defmodule XIAM.Auth.WebAuthn do
@moduledoc """
Acts as a facade for WebAuthn (passkey) operations.
Delegates registration and authentication tasks to specific submodules.
"""
alias XIAM.Users.User
alias XIAM.Auth.WebAuthn.{Registration, Authentication}
require Logger
# Configuration - fetched from appl... |
0563fd6d21c012f296a786bf2e18aed356fb9089 | 1,680 | [
833675655
] | [] | defmodule ArchiveBot.CommandHandler do
alias ArchiveBot.MarkdownToHtml
require Logger
def sleep(token, chat_id, message_id, seconds) do
Telegram.Api.request(token, "sendMessage",
chat_id: chat_id,
reply_to_message_id: message_id,
text: "Sleeping '#{seconds}'s"
)
Process.sleep(secon... |
0564065bf38c0754a9823d7493e6cef27fc2171f | 2,215 | [
752348714
] | [
"genserver"
] | defmodule FeatureFlagsService.Flags do
use GenServer
use FeatureFlagsService.PubSub
def start_link(_) do
GenServer.start_link(__MODULE__, [], name: {:global, :flags})
end
def init(state) do
subscribe(@add_feature_flag_topic, :remote)
subscribe(@request_remove_feature_flag_topic, :remote)
sub... |
0564574bcc86f1c01ad854c9f78c684033328753 | 2,155 | [
592684624
] | [
"documented"
] | defmodule Identicon do
@moduledoc """
Documentation for `Identicon`.
"""
@doc """
This is the main function, where all the process is run.
"""
def main(input) do
input
|> hash_input
|> pick_colour
|> build_grid
|> filter_odd_squares
|> build_pixel_map
|> draw_image
|> sa... |
05645e01981915b8247a056a073bbca70b00a066 | 2,009 | [
544534077
] | [] | user_input = IO.gets "Write your ability score:\n" #prompts user to enter a number
{ability_score, _} = Integer.parse(user_input) #wildcard _ matches everything and is used to ignore some parts of the matching expression
ability_modifier = (ability_score - 10) / 2
IO.puts "Your ability modifier is #{ability_modifier}"
... |
05647107b2664ee8e80e49f73c14be555fb4f3fb | 3,660 | [
655674182
] | [
"documented"
] | defmodule LineReminder.Sns.Line do
@moduledoc """
Module for sending Line messages using Line Notify API.
"""
import OK, only: [~>: 2]
@behaviour LineReminder.SnsBehaviour
@api_header [{"Content-Type", "application/x-www-form-urlencoded"}]
@congrats_sticker_package 11_537
@congrats_sticker_id 52_002_7... |
056485ce74c27a6cd49c9055cccf43d3e5f30840 | 2,490 | [
482653915
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule GATWeb 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 GATWeb, :controller
use GATWeb, :view
The definitions below will be executed for every view,
controller, etc, so keep... |
05649acc365a2fcebb9cae2e0db2f31ddb841811 | 1,546 | [
210052965
] | [] | defmodule Phx.Metrics do
use Prometheus.Metric
def setup do
## Counter for page turns
Counter.new(
name: :elixir_app_page_turned,
help: "Counter for page turns"
)
Gauge.declare(
name: :elixir_app_user_count,
help: "User count."
)
# Our counter for the number of se... |
0564a6bf018f32cd6ea2a82b9076f923406a78d7 | 5,412 | [
367278931
] | [
"documented"
] | defmodule Google.Cloud.Notebooks.V1.ExecutionTemplate.ScaleTier do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :SCALE_TIER_UNSPECIFIED, 0
field :BASIC, 1
field :STANDARD_1, 2
field :PREMIUM_1, 3
field :BASIC_GPU, 4
field :BASIC_TPU, 5
field :... |
0564c1b9d408bedbf5ee14ca5e3b56571b45e9db | 1,590 | [
406541610
] | [
"ecto"
] | defmodule Console.Repo.Migrations.MoveConfigs do
use Ecto.Migration
def cast_organization(record) do
{:ok, organization_id} = Ecto.UUID.load(Enum.at(record, 0))
%{
id: organization_id,
address: Enum.at(record, 1),
join_credentials: Enum.at(record, 2),
port: Enum.at(record, 3),
... |
05656a0cabfa665e5456b0e8d78944ac65921b5b | 1,933 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Run.V1.Model.Job do
@moduledoc """
Job represents the configuration of a single job, which references a container image which is run to completion.
## Attributes
* `apiVersion` (*type:* `String.t`, *default:* `nil`) - Optional. APIVersion defines the versioned schema of this representati... |
0565abc4d066d1d252f08fca3ff1f59b45a93554 | 1,980 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.FirebaseAppCheck.V1beta.Model.GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse do
@moduledoc """
Response message for the ExchangeAppAttestAttestation method.
## Attributes
* `appCheckToken` (*type:* `GoogleApi.FirebaseAppCheck.V1beta.Model.GoogleFirebaseAppcheckV1betaApp... |
0565c864261f59977c7ceaf820c7c6eeb5c4a0b9 | 7,012 | [
191423461
] | [
"test"
] | defmodule Meadow.Ingest.ProgressTest do
use Meadow.DataCase
use Meadow.IngestCase
alias Meadow.Ingest.{Progress, Rows}
alias Meadow.Ingest.Schemas.Progress, as: ProgressSchema
alias Meadow.Pipeline.Actions
alias Meadow.Pipeline.Dispatcher
alias Meadow.Repo
@bad_sheet_id "deadface-c0de-feed-cafe-addedb... |
0565fbc5d81b213473034ecd18d1302ede2a921f | 12,049 | [
133966408
] | [
"test"
] | defmodule ExMessengerTest.ManagerTest do
use ExUnit.Case, async: false
import ExMessenger.ApiTestHelper
alias ExMessenger.TeslaMockJson
alias ExMessenger.Manager
@poll 50
@check 100
@clean 100
@send_timeout 10_000
setup_all do
TeslaMockJson.prepare_global()
:ok
end
setup [:save_restor... |
05663fa99714e96071191b22ab29e0e1725dfb09 | 12,060 | [
581007504
] | [
"documented",
"ecto"
] | defmodule WingManager.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias WingManager.{Repo, DefaultPassword}
alias WingManager.Accounts.{User, UserToken, UserNotifier}
@doc """
Returns the list of users.
## Examples
iex> list_users()
[%User{}, ..... |
0566fc968323d154348702b00e0d18a8e4708f51 | 5,190 | [
80331344
] | [
"ecto"
] | defmodule Butler.Item do
alias Butler.Item
alias Butler.User
@derive {Poison.Encoder, only: [:id, :user_id, :item, :expiration_date, :expiration_string]}
use Butler.Web, :model
alias Butler.DateInterpreter
schema "items" do
field :alexa_id, :string, virtual: true
field :item, :string
field :ex... |
05675a82ea74f2de980371daaea6d70fae9ed89b | 1,818 | [
164176994
] | [
"documented"
] | defmodule Servy.Parser do
alias Servy.Conv, as: Conv
def parse(request) do
[top, params_string] = String.split(request, "\r\n\r\n")
[request_line | header_lines] = String.split(top, "\r\n")
[method, path, _] = String.split(request_line, " ")
headers = parse_h... |
0567fdbcc23bfa1ae078162b5d6ad3507425915a | 1,999 | [
200067502,
78886331
] | [
"test"
] | defmodule Statistics.Query.PriciestTest do
use Statistics.ModelCase
alias Statistics.Query
alias Statistics.Property
@valid_attributes %{description: "dummy", squareMetres: 76.2, rent: 608}
test "the priciest property is returned" do
Property.changeset(%Property{}, %{@valid_attributes | rent: 100})
... |
056825f61b7542bcdb5ac0b1910b116549be0734 | 1,583 | [
555225235
] | [
"liveview"
] | defmodule ApartmanWeb.CheckinLive.FormComponent do
use ApartmanWeb, :live_component
alias Apartman.Booking
@impl true
def update(%{checkin: checkin} = assigns, socket) do
changeset = Booking.change_checkin(checkin)
{:ok,
socket
|> assign(assigns)
|> assign(:changeset, changeset)}
end... |
0568535d000dee8374a80a1fef2b9b7b9532d488 | 3,468 | [
130371520
] | [
"typespec",
"documented"
] | defmodule Plymio.Funcio.Enum.Map.Gather do
@moduledoc ~S"""
Map and Gather Patterns for Enumerables.
These functions map the elements of an *enum* and gather the
results according to one of the defined *patterns*.
Gathering means collecting all the `:ok` and `:error` results into a
*opts* with keys `:ok` ... |
056855a6981a731baa465192d17ad41f2eeb14c9 | 2,192 | [
50012619,
135215951,
80654092
] | [
"test"
] | if !System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("strain.exs", __DIR__)
end
ExUnit.start
ExUnit.configure trace: true, exclude: :pending
defmodule StrainTest do
use ExUnit.Case
defp is_odd?(n), do: rem(n, 2) == 1
defp is_even?(n), do: rem(n, 2) == 0
defp noop(_), do: true
#@tag :pending
... |
05685857fa243226cef12200b3a074611ccdecaf | 3,025 | [
646574586,
907120034
] | [
"documented",
"ecto"
] | defmodule LivePet.Pets do
@moduledoc """
The Pets context.
"""
import Ecto.Query, warn: false
alias LivePet.PetSupervisor
alias LivePet.Repo
alias LivePet.Pets.Pet
@doc """
Returns a list of all pet types
## Examples
iex> list_pet_types()
["cat", "crab", ...]
"""
def list_pet_t... |
056864f4c6d8fac29b06ed423402948f3dc224ce | 1,587 | [
801083281
] | [] | defmodule MeasurementStream do
use Creek
use Creek.MetaBehaviour
def is_xml?({:xml, _}), do: true
def is_xml?(_), do: false
def is_json?({:json, _}), do: true
def is_json?(_), do: false
def xml_to_float({:xml, value}), do: value
def json_to_float({:json, value}), do: value
dag not_next as filter(&... |
056916271555475b4b5d4b2ceb00505ababed4bd | 3,257 | [
46792347,
54606771,
46581093,
47783914,
48197916,
51232718,
44308112,
51866787,
48748961,
56479386,
41227823,
43259887,
44181278,
39921724,
75696014,
81621440,
41243642
] | [
"documented"
] | defmodule Phoenix.LiveReloader do
@moduledoc """
Router for live-reload detection in development.
## Usage
Add the `Phoenix.LiveReloader` plug within a `code_reloading?` block
in your Endpoint, ie:
if code_reloading? do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
... |
05699fe8acf9e3583bb5748649ebc0060e051133 | 5,071 | [
493636191
] | [
"liveview",
"documented"
] | defmodule SelphiDaisy.Form.DateTimeLocalInput.Example03 do
@moduledoc """
DateTimeLocalInput 控件。
DateTimeLocalInput 组件 min,max 为日期字符串,eg max="2000-01-03 09:00:00" min="2000-01-03 09:00:00",
组件将不允许用户选择范围外的日期。
上报格式
%{
"datetimelocal" => "",
"datetimelocal1" => "2022-03-01T08:00:01",
"datetimelocal2" =>... |
0569c4e590ee5c94d9d84abb26c1ba836617d67a | 2,011 | [
32465139
] | [
"genserver"
] | defmodule Chat.Registry do
use GenServer
@reg_name __MODULE__
#
# Client API
#
def start do
GenServer.start(__MODULE__, :ok, [name: @reg_name])
end
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, :ok, opts ++ [name: @reg_name])
end
def whereis_name(name) do
GenServer.... |
056a04548d1194dc8bbc55f22cc62ea174aa1118 | 2,910 | [
141308542
] | [
"test"
] | defmodule LocaleBuilderTest do
use ExUnit.Case
doctest LocaleBuilder
test "all_locale_codes: should return a list of all locales" do
all_locale_codes = LocaleBuilder.all_locale_codes()
assert Enum.member?(all_locale_codes, "fr")
assert Enum.member?(all_locale_codes, "fr-FR")
end
test "english_lo... |
056a6aa7993b5f14879d03afe9117875dde2e17f | 1,501 | [
47763923
] | [
"typespec",
"documented"
] | defmodule PerfectNumbers do
@doc """
Determine the aliquot sum of the given `number`, by summing all the factors
of `number`, aside from `number` itself.
Based on this sum, classify the number as:
:perfect if the aliquot sum is equal to `number`
:abundant if the aliquot sum is greater than `number`
:def... |
056af4dc6f6f675350f9cd2c3d0fba16994b0817 | 4,292 | [
141718317
] | [
"documented"
] | defmodule Andy.Profiles.Rover.GMDefs.ObservingOther do
@moduledoc "The GM definition for :observing_other"
alias Andy.GM.{GenerativeModelDef, Intention, Conjecture, ConjectureActivation}
import Andy.GM.Utils
import Andy.Utils, only: [now: 0]
def gm_def() do
%GenerativeModelDef{
name: :observing_ot... |
056b0c0ad1cecc115b61e22f536d206a05ca10c7 | 2,928 | [
737186361
] | [
"test"
] | defmodule Mix.Tasks.CloneTest do
use ExUnit.Case
import ExUnit.CaptureLog
alias Mix.Tasks.Umwelt.Clone
setup do
bypass = Bypass.open()
Application.put_env(:umwelt, :api_port, bypass.port)
:ok = Application.ensure_started(:umwelt)
on_exit(fn ->
:timer.sleep(99)
File.rm_rf!("temp")... |
056b4f0b04fb1c183aafe153e3576806cac59adc | 4,872 | [
329346595
] | [
"documented"
] | defmodule RakNet.Packet do
@moduledoc "Encoding & decoding utils for RakLib data, taken from ExRakLib"
require Logger
alias RakNet.ReliabilityLayer
alias RakNet.ReliabilityLayer.Reliability
def decode_with_timestamp(<<timestamp::size(32), data::binary>>) do
Map.put(decode_no_timestamp(data), :timestamp, ... |
056be02b1da6059e1514661a964a982b813bf90e | 17,686 | [
317958501
] | [] | defmodule Day9.Input do
def numbers do
[
37,
7,
16,
34,
48,
24,
5,
40,
30,
35,
2,
45,
19,
33,
36,
49,
32,
1,
44,
21,
25,
3,
11,
38,
15,
4,
6,
7,
... |
056cf5a6225b3cf8014ee78738ab5b08b0913b48 | 6,382 | [
329355024
] | [] | defmodule Pleroma.Web.ApiSpec.FilterOperation do
alias OpenApiSpex.Operation
alias OpenApiSpex.Schema
alias Pleroma.Web.ApiSpec.Helpers
alias Pleroma.Web.ApiSpec.Schemas.BooleanLike
def open_api_operation(action) do
operation = String.to_existing_atom("#{action}_operation")
apply(__MODULE__, operatio... |
056d1cc1d9df5a28afcc79e6cf2d83fccc8bf6aa | 3,448 | [
136087312
] | [
"test",
"ecto"
] | defmodule Podbql.EventsTest do
use Podbql.DataCase
alias Podbql.Events
describe "events" do
alias Podbql.Events.Event
@valid_attrs %{category: "some category", description: "some description", endTime: ~N[2010-04-17 14:00:00.000000], eventClicked: 42, eventId: "7488a646-e31f-11e4-aace-600308960662", po... |
056d1dd9564212cf0d88e7e7ea82a51e4f1b37f4 | 1,627 | [
147534687
] | [
"documented",
"ecto"
] | defmodule AskAGator.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
import Bcrypt, only: [hash_pwd_salt: 1]
schema "users" do
field :email, :string
field :first_name, :string
field :last_name, :string
field :middle_name, :string
field :password, :string, virtual: true
field :pas... |
056d912c0ad11a9cb3cd3410f6e6c7cba4419be4 | 5,045 | [
976020898
] | [
"test",
"phoenix"
] | defmodule CMSWeb.UserOTPControllerTest do
use CMSWeb.ConnCase, async: true
import CMS.AccountsFixtures
alias CMS.Repo
alias CMS.Accounts.UserToken
@otp_validity_in_minutes 5
setup %{conn: conn} do
org = organization_fixture(%{hostname: "www.example.com"})
%{conn: conn, organization: org}
end
... |
056e34808191fe8b7eaa9398a47952f6abf8857c | 2,432 | [
389550723
] | [
"test",
"phoenix"
] | defmodule VelocityWeb.StoryControllerTest do
# use VelocityWeb.ConnCase
# alias Velocity.Scrum
# alias Velocity.Scrum.Story
# @create_attrs %{}
# @update_attrs %{}
# @invalid_attrs %{}
# def fixture(:story) do
# {:ok, story} = Scrum.create_story(@create_attrs)
# story
# end
# setup %{conn:... |
056f2db4bc94ac76f0d234442477e35de8a05a36 | 4,712 | [
455169881
] | [
"test"
] | defmodule Existence.PlugTest do
defmodule HealthRouter do
use Plug.Router
@custom_response [
ok_status: 222,
ok_body: "OK_custom",
error_status: 555,
error_body: "Error_custom"
]
plug :match
plug :dispatch
get "/healthcheck_get_default", to: Existence.Plug
get "/... |
056f4fee69a55038dfbc083ae86571747d008e48 | 1,918 | [
228098731
] | [
"documented"
] | defmodule CodeFlow.Recursion do
@moduledoc """
Fix or complete the code to make the tests pass.
"""
alias CodeFlow.Fake.Customers
#alias CodeFlow.Schemas.OrderItem
alias CodeFlow.Schemas.Customer
@doc """
Sum a list of OrderItems to compute the order total.
"""
def order_total(items) do
order_t... |
056f86d9896f7a60b644a31fe69ebe759f168266 | 2,045 | [
23044349
] | [
"typespec",
"test",
"documented"
] | # In this étude, create a module named Random, and write a function
# generate_pockets/2. This function has a character list consisting of T and F
# for its first argument. A T in the list indicates that the tooth is present,
# and a F indicates a missing tooth. This will be a single quoted character list,
# so you can... |
056fbed2c7cf9eecb3eb6919b9b4df5ef9e1b381 | 5,806 | [
251064648
] | [
"genserver",
"liveview"
] | defmodule ScrabbleExWeb.DashboardLive do
# FIXME: show 'leave' on pending games; destroy game if last player leaves
# FIXME: show 'forfeit' on in-progress games;
# FIXME: optionally show pending games to public
# FIXME: invite user in game view
# FIXME: look into LiveComponent and preload to split the games i... |
057019a8df79fe87f20d5d9a81e32273ec4ed055 | 7,381 | [
9309583
] | [] | defmodule Doble9Engine.UI.Assets do
@axis [:x, :y]
def other :x do :y end
def other :y do :x end
def size dominoes, :x do {length(dominoes) * width(:y), height(:y)} end
def size dominoes, :y do {width(:x), length(dominoes) * height(:x)} end
def width(axis) when axis in @axis do width frame axis end
d... |
057025c2bb07f9b4669e02b0821490ab156b0305 | 2,659 | [
703143319
] | [
"test"
] | defmodule User.UseCases.AuthenticationTest do
use ExUnit.Case
alias User.FakeAdapters.Inserting, as: InsertingUser
alias ConfirmationCode.FakeAdapters.Inserting, as: InsertingConfirmationCode
alias ConfirmationCode.FakeAdapters.Getting, as: GettingConfirmationCode
alias User.FakeAdapters.GettingByEmail, as:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.