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 |
|---|---|---|---|---|
01b8cb0426b52c96964004e7d6433609f0cc3035 | 2,386 | [
103957646
] | [
"phoenix"
] | defmodule Pxblog.CommentController do
alias Pxblog.Comment
alias Pxblog.Post
use Pxblog.Web, :controller
plug :scrub_params, "comment" when action in [:create, :update]
plug :set_post_and_authorize_user when action in [:update, :delete]
def create(conn, %{"comment" => comment_params, "post_id" => post_id}... |
01b9221c6ca5daea4e3a12a8f019b791c569099d | 2,888 | [
151600373
] | [
"test"
] | # Suppress output of testing mix task
# Mix.shell(Mix.Shell.Process)
defmodule GitOps.Mix.Tasks.Test.InstallTest do
use ExUnit.Case, async: true
import Igniter.Test
describe "install" do
test "patches configs" do
config = """
import Config
"""
files = %{"config/config.exs" => confi... |
01b94419d1b805249e53c1bb79843cf81f9f1964 | 5,333 | [
220059030
] | [
"typespec",
"documented"
] | defmodule SmartBank.Factory do
@moduledoc """
Module responsible to provide helper funcions for entity creations on tests
"""
import SmartBank.Utils, only: [recursive_struct_to_map: 1]
alias SmartBank.Authentication
alias SmartBank.Bank
alias SmartBank.Repo
def jwt_account_token do
user = insert... |
01b94eae6c605af74deeff8981315659264b4217 | 5,783 | [
327690448
] | [] | defmodule CLIO.Table do
alias CLIO.Table.Column
@table_borders %{
top: "═",
top_separator: "╤",
top_left: "╔",
top_right: "╗",
bottom: "═",
bottom_separator: "╧",
bottom_left: "╚",
bottom_right: "╝",
left: "║",
left_separator: "╟",
right: "║",
right_separator: "╢",
... |
01b99f6425d677423f84609ce1dedc983443baa0 | 3,534 | [
572562099
] | [] | defmodule Day8 do
def parse(example \\ false) do
Input.parse(8, example)
|> String.split("\r\n")
|> Enum.map(&String.graphemes(&1))
|> init()
end
def init(input) do
for y <- 0..(length(input) - 1) do
row = Enum.at(input, y)
for x <- 0..(length(row) - 1) do
%{x: x, y: y, v... |
01b9e283d4496226bb9f76058d1341090511e036 | 8,203 | [
559553778
] | [
"typespec",
"documented"
] | defmodule Myrex.Parser do
@moduledoc """
Parse the tokenized regular expression to get an AST.
The parser has two passes:
The first pass reorders the linear infix token list into postfix format,
where the operator node comes before its arguments.
The implementation is a variation of Dijkstra's _Shunting Y... |
01ba00caa41b2193acf54c401217e8cea84d2d72 | 1,614 | [
109536372
] | [
"macro",
"documented",
"phoenix"
] | defmodule AuthKataWeb 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 AuthKataWeb, :controller
use AuthKataWeb, :view
The definitions below will be executed for every view,
controlle... |
01ba2c2ed53772c3858d1d5c73e30e61d5215ba1 | 4,098 | [
209074830
] | [
"test"
] | defmodule MarkevichMoney.Steps.Telegram.SendMessageTest do
use MarkevichMoney.MockNadia, async: true
alias MarkevichMoney.Steps.Telegram.SendMessage
import ExUnit.CaptureLog
describe "with success nadia response" do
defmock Nadia do
def send_message(_chat_id, _message, _opts) do
{:ok, nil}
... |
01ba4701c27be5566dbf51d3457a52ca7bd93254 | 12,360 | [
709510542
] | [
"typespec",
"documented"
] | defmodule CustomerIo.App.Broadcasts do
@moduledoc """
Provides API endpoints related to broadcasts
"""
@default_client CustomerIo.App.Client
@doc """
Get broadcast action link metrics
Returns link click metrics for an individual broadcast action. Unless you specify otherwise, the response contains data... |
01badf41a18ba0b2e8e1cc642e8e0357df29c469 | 2,730 | [
275417311
] | [
"test",
"ecto"
] | defmodule App.PlansTest do
use App.DataCase
alias App.Plans
describe "investment_plans" do
alias App.Plans.InvestmentPlan
@valid_attrs %{description: "some description", name: "some name"}
@update_attrs %{description: "some updated description", name: "some updated name"}
@invalid_attrs %{descr... |
01bb4de10008219c975a8175332f2f561e7ebe16 | 2,054 | [
445766854
] | [
"liveview",
"documented"
] | defmodule AppWeb.LiveHelpers do
@moduledoc false
import Phoenix.LiveView
import Phoenix.LiveView.Helpers
alias Phoenix.LiveView.JS
@doc """
Renders a live component inside a modal.
The rendered modal receives a `:return_to` option to properly update
the URL when the modal is closed.
## Examples
... |
01bb7f36ac9dc008067420820d65fb8f1bd292f4 | 2,170 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1RestoreDatabaseRequest do
@moduledoc """
The request message for FirestoreAdmin.RestoreDatabase.
## Attributes
* `backup` (*type:* `String.t`, *default:* `nil`) - Required. Backup to restore from. Must be from the same project as the parent. The r... |
01bb8b3da32def7d671ee08b73b150fbda346323 | 1,551 | [
250355980
] | [
"typespec",
"documented"
] | defmodule MatchingBrackets do
@doc """
Checks that all the brackets and braces in the string are matched correctly, and nested correctly
"""
@spec check_brackets(String.t()) :: boolean
def check_brackets(""), do: true
def check_brackets(str) do
has_matching_brackets(str, "", false)
end
defp has_ma... |
01bceb21ee95cd8c59152f19d0561890cb97312a | 4,649 | [
207884147
] | [
"typespec",
"phoenix"
] | defmodule ToDoAPIWeb.UserController do
use ToDoAPIWeb, :controller
require Logger
require String.Chars
require Map
alias ToDoAPI.Res
alias ToDoAPI.Res.User
action_fallback ToDoAPIWeb.FallbackController
# Une fonction prends tjs conn en premier paramètre.
# Paramètre de l'URL -> email qui sera retra... |
01bd0b7a9852c0e182b04440b4fbdc64d6e046c2 | 2,710 | [
518991648
] | [
"documented"
] | defmodule RacingTelemetry.F122.Packets.F122PacketSessionHistoryLap do
@moduledoc """
F122PacketSessionHistoryLap
Size: 88 bits / 11 bytes
"""
use Bitwise, skip_operators: true
require Logger
alias RacingTelemetry.F122.Packets.{
F122PacketHeader,
}
defstruct [
# original
m_lapTimeInMS: n... |
01bd0e44d73b6dea7fea9ae4344c120400719583 | 1,765 | [
74182366
] | [] | defmodule Koalog.CommentHelper do
alias Koalog.Comment
alias Koalog.Post
alias Koalog.User
alias Koalog.Repo
import Ecto, only: [build_assoc: 2]
def create(%{"postId" => post_id, "body" => body, "author" => author}, _socket) do
post = get_post(post_id)
changeset = post
|> build_assoc(:c... |
01bd39c03f91d8fb3ca1d5a073560bf84f30bfae | 2,331 | [
853729096
] | [
"test",
"ecto"
] | defmodule Tooter.CatalogTest do
use Tooter.DataCase
alias Tooter.Catalog
describe "products" do
alias Tooter.Catalog.Product
import Tooter.CatalogFixtures
@invalid_attrs %{name: nil, description: nil, unit_price: nil, sku: nil}
test "list_products/0 returns all products" do
product = pr... |
01bd785528c67eafd9ef72f7fd872e0fb0acf014 | 11,683 | [
998553982
] | [
"typespec",
"documented"
] | defmodule TuiChat.CharacterCard do
@moduledoc """
SillyTavern v2 character card parser and editor.
Handles loading PNG files with embedded JSON metadata,
parsing the character data, and saving modifications.
"""
# Safety limits
@max_png_file_size 50 * 1024 * 1024 # 50MB limit
defstruct [
# V1 ... |
01bde2a4deeaa92506ec87abb4a2a0be318132ab | 2,164 | [
279151698
] | [
"documented"
] | defmodule ExerciseWorkingWithMultipleProcesses5 do
@moduledoc """
Q: (Based on the previous exercise)
Repeat the two, changing spawn_link to spawn_monitor.
A: Running run_exit:
❯ elixir -r exercise-working-with-multiple-processes-5.exs -e "ExerciseWorkingWithMultipleProcesses5.run_exit"
-> recei... |
01be0ad8af11f28bdb73bbfe2ebcaf7af304a099 | 3,182 | [
193056720
] | [
"test"
] | defmodule TransporterWeb.CompanyControllerTest do
use TransporterWeb.ConnCase
alias Transporter.Settings
@create_attrs %{address: "some address", contact: "some contact", fax: "some fax", gst: "some gst", mobile: "some mobile", name: "some name", person: "some person", phone: "some phone"}
@update_attrs %{add... |
01bf16bd7379b3058643a7c466bbc58264f21d7a | 2,528 | [
762409258
] | [
"test",
"ecto"
] | defmodule Sticker.PredictionsTest do
use Sticker.DataCase
alias Sticker.Predictions
describe "predictions" do
alias Sticker.Predictions.Prediction
import Sticker.PredictionsFixtures
@invalid_attrs %{output: nil, prompt: nil, uuid: nil}
test "list_predictions/0 returns all predictions" do
... |
01bf1c595bbfad9c5d9baa944dce5eb33f2a85e8 | 1,914 | [
478940992
] | [] | defmodule Twiddle.Task.State do
alias Twiddle.Task.State
defstruct [:id, :data, :options, :next_tasks, :stats, :errors, :progress]
def new(id, path, options \\ [])
def new(id, path, options) when is_integer(id),
do: Integer.to_string(id) |> new(path, options)
def new(id, path, options) do
%State{
... |
01bfa33cc2ba2d2bad3e4b794800e08fb9cbffef | 1,865 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DisplayVideo.V1.Model.CampaignFlight do
@moduledoc """
Settings that track the planned spend and duration of a campaign.
## Attributes
* `plannedDates` (*type:* `GoogleApi.DisplayVideo.V1.Model.DateRange.t`, *default:* `nil`) - Required. The dates that the campaign is expected to run. Th... |
01c02cac5751b1e224c12c6c3d694b3b62a2d6c9 | 1,643 | [
585572389
] | [
"typespec",
"documented"
] | defmodule Alternis.Engines.MatchEngine.WordleImpl do
@moduledoc """
Implements Wordle logic for matching a guess to the secret word
"""
alias Alternis.Match
@spec match(String.t(), String.t()) :: Match.t() | {:error, map}
def match(word, secret) do
case validate(word, secret) do
:ok ->
... |
01c0bf50a4ae505d31d7e98d2a502a95ec42f29e | 1,897 | [
317546749
] | [
"test"
] | defmodule AdventOfCode.Solutions.Y20.Day25Test do
alias AdventOfCode.Solutions.Y20.Day25, as: Solution
alias AoC.Input
use ExUnit.Case, async: true
# To run the test, run the following command:
#
# mix test test/2020/day_25_test.exs
#
# To run the solution
#
# mix aoe.run --year 2020 --day ... |
01c134085713a54917d3c98a057f0a9306f48687 | 4,309 | [
744281225,
116826798,
313251367
] | [
"typespec",
"documented"
] | defmodule EWallet.Bouncer.TransactionScope do
@moduledoc """
Permission scoping module for transactions.
"""
@behaviour EWallet.Bouncer.ScopeBehaviour
import Ecto.Query
alias EWallet.Bouncer.{Helper, Permission}
alias EWalletDB.{Transaction, User, AccountUser}
@spec scoped_query(EWallet.Bouncer.Permiss... |
01c15262b6484ec3822ffdc9200323b130e2d694 | 2,151 | [
979682372
] | [
"documented"
] | defmodule WaymarkFhir.QueryFixtures do
@moduledoc """
This module defines test helpers for creating
entities via the `WaymarkFhir.Query` context.
"""
alias WaymarkFhir.Query
@doc """
Generate a organization.
"""
def organization_fixture(attrs \\ %{}) do
unique_id = System.unique_integer([:positi... |
01c1eb3a551cb59a5370dc5ee8b685099c554f87 | 1,975 | [
352241751
] | [
"typespec"
] | defmodule SlidingWindowNif do
use Rustler, otp_app: :sliding_window_nif, crate: "sliding_window_nif"
@opaque table :: reference()
@spec new(List.t(), integer(), integer()) :: {atom(), table() | binary()}
def new(_, _, _), do: error()
@spec push(table(), List.t()) :: {:ok, table()} | {:error, binary()}
def... |
01c22e69172a21a6b37c7ba2fa6ca6255fbcb3cf | 2,575 | [
153111359
] | [
"typespec",
"documented"
] | defmodule ParamUtils do
@moduledoc """
ParamUtils provides functions for converting user input into accepted internal data.
"""
@doc since: "0.1.0"
@doc """
Params library removes nil and empty strings via changeset.
For update actions the user may actually want to save a nil value.
original param is u... |
01c25665964ed362c7a53728fa3b6cf5d0f4cf54 | 3,661 | [
293426509
] | [] | defmodule LogicCalc do
def take_input(gate, input_a, input_b) do
{a, _} = Integer.parse(input_a)
{b, _} = Integer.parse(input_b)
cond do
gate == "AND" ->
and_gate(a, b)
gate == "FALSE" ->
false_gate(a, b)
gate == "NOR" ->
nor_gate(a, b)
gate == "A_NOT_B" -... |
01c261fe3729af5932e4e068a988c2589bd57fad | 4,949 | [
248113444
] | [] | %{
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"},
"conform": {:hex, :conform, "2.5.2", "7035787a9c09d28607745444e7a1700426dc47c452634a5694033fa2fbb3414c", [:... |
01c27094a0c5823d7a5812bbc2d1e12c8ef35177 | 2,847 | [
559953996
] | [
"genserver",
"documented"
] | defmodule BigBrother.FS.Watcher do
@moduledoc false
use GenServer
@recompile_events [
[:renamed],
[:removed],
[:modified],
[:modified, :closed]
]
@default_debounce 1000
@default_patterns [
~r"lib/.*(ex)$"
]
defp app_config(), do: Application.get_env(:big_brother_ex, :reload_confi... |
01c2870fc7008ee9f8b831e820797bd04c222ce1 | 2,536 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Datastore.V1.Model.GoogleDatastoreAdminV1beta1ImportEntitiesMetadata do
@moduledoc """
Metadata for ImportEntities operations.
## Attributes
* `common` (*type:* `GoogleApi.Datastore.V1.Model.GoogleDatastoreAdminV1beta1CommonMetadata.t`, *default:* `nil`) - Metadata common to all Datastor... |
01c2b406bce7db4258649362343e2381f5151e1c | 3,361 | [
87101450
] | [
"documented"
] | defmodule Man.Templates.Renderer do
@moduledoc false
alias Man.Templates.Template
alias Man.Templates.Template.Locale
alias Man.Cache
alias NExJsonSchema.Validator
@doc """
Renders a template.
## Examples
iex> render_template(template, attrs)
{:ok, html}
iex> render_template(templa... |
01c2dffd6f41c6b2cc5f5724393056b2c73bb309 | 5,656 | [
961132765
] | [
"typespec",
"documented",
"ecto"
] | defmodule ExOnvif.Devices.NetworkInterface do
@moduledoc """
Device's network interface
"""
use Ecto.Schema
import Ecto.Changeset
import SweetXml
alias ExOnvif.Devices.NetworkInterface.{ConnectionSetting, PrefixedIPAddress}
@required [:token, :enabled]
@type t :: %__MODULE__{}
@primary_key fal... |
01c3345e4a8fbdb945130cefa6a718eb228c9662 | 1,960 | [
275762620
] | [
"test"
] | defmodule Test.Acceptance.Ast.Footnotes.FnInListsTest do
use Support.AcceptanceTestCase
import Support.FootnoteHelpers
describe "two footnotes" do
test "in list header" do
markdown = """
- A line with[^1] two references[^2]
[^1]: Footnote **one**
[^2]: - Footnote 2.1
- Footnot... |
01c35737fb2ee0d5d992f85daa8c8bea3d500cf2 | 2,363 | [
454521382
] | [
"genserver"
] | defmodule WordBattle.PlayerQueue do
use GenServer
require Logger
alias WordBattle.GameState
# === Client ===
def start_link(opts) when is_list(opts) do
GenServer.start_link(__MODULE__, nil, opts)
end
def join(node) when is_atom(node) do
GenServer.call({__MODULE__, node}, :join)
end
def lea... |
01c37ca41bd16743c786d2fc0bef98875548f228 | 7,593 | [
969645730
] | [
"test",
"documented"
] | defmodule Antenna.GuardTest do
use ExUnit.Case, async: true
@moduledoc """
Test suite for the Antenna.Guard functionality, focusing on channel and handler
management, cleanup, and error handling.
"""
require Antenna
@antenna __MODULE__.ID
setup_all ctx do
Map.put(ctx, :antenna_pid, start_supervi... |
01c3d61f380d2919ab4effc0bc9e7a39bc4e32ea | 3,742 | [
640063824
] | [
"documented"
] | defmodule DeepHousing do
@moduledoc """
Train a sequential neural network with California
Housing dataset (excluding categorical features).
"""
alias Explorer.DataFrame, as: DF
import Utils
@val_size 6512
def housing_data() do
{train, test} =
Housing.load_data()
|> DF.discard("ocean_p... |
01c40d92beec07b9d3aadd33341e7f70dd723aab | 10,620 | [
236852798,
75767893,
196200304,
366872029,
211097139,
19643959,
180274417
] | [
"typespec",
"macro"
] | defprotocol IEx.Info do
@fallback_to_any true
@spec info(term()) :: [{info_name :: String.Chars.t(), info :: String.t()}]
def info(term)
end
defimpl IEx.Info, for: Tuple do
def info(_tuple) do
[
{"Data type", "Tuple"},
{"Reference modules", "Tuple"}
]
end
end
defimpl IEx.Info, for: Atom... |
01c55f9a9bdd134cb36380f243b974e49b2cdf74 | 3,562 | [
987480345
] | [
"test"
] | defmodule DeribitEx.RPCRequestFormatTest do
use ExUnit.Case
alias DeribitEx.RPC
describe "generate_request/2" do
test "builds a JSON-RPC request for public/get_time" do
{:ok, payload, id} = RPC.generate_request("public/get_time", %{})
assert payload["jsonrpc"] == "2.0"
assert payload["id"... |
01c5618a194ae29037f78bb86c5d5548ad9a917e | 3,909 | [
162384511
] | [
"test"
] | defmodule ProviderLinkWeb.Api.V1.Migration.UserControllerTest do
use ProviderLinkWeb.ConnCase
# use ProviderLinkWeb.SchemaCase
import ProviderLinkWeb.TestHelper
setup do
conn = build_conn()
user =
:user
|> insert(%{username: "masteradmin", password: "P@ssw0rd"})
conn =
conn
... |
01c5b84abf0bd4e4ec9327424361009584718d64 | 9,404 | [
290934484,
48860943
] | [
"test"
] | defmodule Absinthe.Relay.PaginationTest do
use Absinthe.Relay.Case, async: true
defmodule Schema do
use Absinthe.Schema
use Absinthe.Relay.Schema, :classic
@foos 0..9 |> Enum.map(&%{id: &1, index: &1})
node object(:foo) do
field :index, non_null(:integer)
end
query do
connect... |
01c5c5455e8daf23028da0512c636c0af37f9f05 | 14,673 | [
333239824
] | [
"test"
] | defmodule DbTypesDateRangeDateTest do
use ExUnit.Case, async: true
alias MscmpSystDb.DbTypes
alias MscmpSystDb.Types.BoundsCompareResult
test "Can compute Date/Date result operators" do
assert DbTypes.compare(~D[2022-01-01], ~D[2022-01-01]) == :eq
assert DbTypes.compare(~D[2022-01-01], ~D[2022-01-02])... |
01c5d2b943fcf4f5156b5f1d1629418f00322573 | 6,301 | [
1007126584
] | [
"test"
] | defmodule CorroCLI.ParserTest do
use ExUnit.Case
doctest CorroCLI.Parser
alias CorroCLI.Parser
describe "parse_json_output/2" do
test "parses empty string" do
assert {:ok, []} = Parser.parse_json_output("")
end
test "parses nil input" do
assert {:ok, []} = Parser.parse_json_output(nil... |
01c5d646132cb68f4e512a430d0ee0d39d67c607 | 2,610 | [
78012656
] | [
"test"
] | defmodule GithubHookBotTest.Example.ExampleTest.Client.Neko do
def neko() do
1 + 1
end
end
defmodule GithubHookBotTest.Example.ExampleTest.Client do
use GithubHookBot.Client.Plug
alias GithubHookBot.Client.Action
alias GithubHookBotTest.Example.Client.Sample1
@repository_name "example/sample1"
plu... |
01c5d77768678213fcd33835bc6ee36a127356fd | 2,014 | [
708209739
] | [
"supervisor",
"documented"
] | defmodule Nostrum.Application do
@moduledoc false
use Application
alias Nostrum.Token
require Logger
# Used for starting nostrum when running as an included application.
def child_spec(_opts) do
%{
id: __MODULE__,
start: {__MODULE__, :start, [:normal, []]},
type: :supervisor,
... |
01c5e786d1cbe878d0c79f3763a891d6be68968e | 1,659 | [
65624847
] | [] | defmodule Mix.Tasks.Compile.Cmake do
@shortdoc "Compiles helper in src"
def run(_) do
{result, _error_code} = System.cmd("cmake", ["."], stderr_to_stdout: true)
Mix.shell.info result
{result, _error_code} = System.cmd("make", ["all"], stderr_to_stdout: true)
Mix.shell.info result
:ok
end
end
... |
01c624648c9ca73c3e893921b3af8a25752dcb72 | 1,899 | [
919065026
] | [
"ecto"
] | defmodule Durandal.Repo.Migrations.CreatePlayerTeamsTable do
use Ecto.Migration
def change do
create_if_not_exists table(:player_teams, primary_key: false) do
add(:id, :uuid, primary_key: true, null: false)
add(:name, :string)
add(:universe_id, references(:game_universes, on_delete: :nothin... |
01c63508b0c785edb70cb1542f985a31af5511ce | 3,869 | [
80109208
] | [
"test"
] | defmodule Membrane.DiamondDetectionTest do
use ExUnit.Case, async: true
import Membrane.ChildrenSpec
import Mock
alias Membrane.Core.Element.DiamondDetectionController.DiamondLogger
alias Membrane.Core.Element.DiamondDetectionController.PathInGraph.Vertex
alias Membrane.Testing
require Membrane.Pad, as... |
01c659223f5dda35bfa840672b3b88a99798f2ce | 1,799 | [
223431630
] | [] | # use Mix.Config
# Elixir 1.9.0 =>
import Config
config :logger, :file_log,
path: System.get_env("SSCS_LOG_FILE") || "log/sscs_ex.log",
level: :debug,
color: :enabled
config :logger, :console,
level: :info,
color: :enabled
config :sscs_ex, :ssh_conf,
# Port for the sftp server
port: String.to_integer(S... |
01c6af8e9ce0276fd91feb18031483e696b221bb | 2,037 | [
49529180
] | [
"phoenix"
] | defmodule Back.Monster43Controller do
use Back.Web, :controller
alias Back.Monster43
plug :scrub_params, "monster43" when action in [:create, :update]
def index(conn, _params) do
monsters43 = Repo.all(Monster43)
render(conn, "index.html", monsters43: monsters43)
end
def new(conn, _params) do
... |
01c6d79af26e8ef903253778e28a707af46b980d | 2,468 | [
323162396
] | [] | %{
"cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "... |
01c7c63cb58993305e5bae5d1e1c8873c10b8397 | 4,132 | [
774645608
] | [
"genserver",
"typespec",
"documented"
] | defmodule Clock.FakeClock do
@moduledoc false
use GenServer
alias Clock.FakeClock
defstruct [:pid]
@type t :: %__MODULE__{pid: pid()}
def new(initial_datetime \\ DateTime.utc_now()) do
{:ok, pid} = GenServer.start_link(__MODULE__, initial_datetime)
%FakeClock{pid: pid}
end
def shutdown(%Fak... |
01c7dc0a4a927ea57da72805aac717c98217c347 | 4,967 | [
239783495
] | [
"typespec",
"documented"
] | defmodule Tbot.Runner do
@moduledoc """
Main functions to run Trading Bot
"""
alias Tbot.{Account, Equity, Fetcher, Position, Strategies, Technical}
require Logger
@data_fercher Application.get_env(:tbot, :data_fetcher_module, Tbot.Fetcher)
# @order Tbot.Benchmark
@fast_ema_window 16
@slow_ema_windo... |
01c87613167b2ddec18cbd4339684eb05eaf44af | 6,068 | [
71293410
] | [
"documented"
] | defmodule Wabbit.Record do
@moduledoc false
require Record
Record.defrecord :p_basic, :'P_basic', Record.extract(:'P_basic', from_lib: "rabbit_common/include/rabbit_framing.hrl")
Record.defrecord :queue_declare_ok, :'queue.declare_ok', Record.extract(:'queue.declare_o... |
01c90a95d790876eb756d8b3a9617d58b7a28833 | 2,072 | [
78014292
] | [
"genserver",
"typespec",
"documented"
] | defmodule Sample.DailyCycler do
@moduledoc """
Cron server for ensuring that the business date has been cycled. It should ensure that the
`SystemCycled` event gets created exactly once per day.
"""
use GenServer
require Logger
alias Sample.Contexts.Events
alias Sample.EventRepo.Event
alias Sample.H... |
01ca5c312760c9c1d853172d7c9af5dff7936fa3 | 2,115 | [
316978630
] | [
"ecto"
] | defmodule Dk6santa.Mail do
import Ecto.Query, warn: false
alias Dk6santa.Repo
alias Dk6santa.Mail.Contact
def list_contacts do
Repo.all(Contact)
end
def get_contact!(id), do: Repo.get!(Contact, id)
def get_contact_by_santa(santa_id) when santa_id |> is_integer,
do: Repo.get_by(Contact, santa_... |
01ca6b0ffdbb6ea73ca9844aa9a30071e09f4414 | 7,208 | [
755227435
] | [] | %{
"bandit": {:hex, :bandit, "1.3.0", "6a4e8d7c9ea721edd02c389e2cc867890cd96f83116e71ddf1ccbdd80661550c", [:mix], [{:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", opti... |
01cb4356fd15f905903c80daf5fe78070703c464 | 7,533 | [
73909448
] | [
"typespec",
"documented"
] | defmodule Arango.Simple do
@moduledoc "ArangoDB Simple methods"
alias Arango.Request
alias Arango.Utils
alias Arango.Collection
@doc """
Return all documents
PUT /_api/simple/all
"""
@spec all(Collection.t, keyword) :: Arango.ok_error(map)
def all(collection, opts \\ []) do
vars = Utils.opts_... |
01cb893c3bb388be3aece96ea020a4db135ceac3 | 3,625 | [
553319532
] | [
"typespec",
"documented"
] | defmodule PostgrexWal.Messages.Relation do
defmodule Column do
@moduledoc """
columns message.
Int8
Flags for the column. Currently can be either 0 for no flags or 1 which marks the column as part of the key.
String
Name of the column.
Int32 (Oid)
OID of the column's data type.
... |
01cbe6b9b01d764b9458d7a0205cbb91c0b87ce7 | 3,785 | [
194560880
] | [
"test",
"documented"
] | defmodule Qencode.TaskTest do
@moduledoc false
alias Qencode.Client
alias Qencode.Task
use ExUnit.Case
doctest Qencode.Task
@test_video_url "https://github.com/char0n/qencode/raw/master/test/data/test.mp4"
describe "create!/1: given valid request payload" do
setup [:create_client]
test "should ... |
01ccc38649bcb0674968acdbc8bde54a4526cf1c | 4,015 | [
270387063
] | [
"liveview",
"test"
] | defmodule BlanksWeb.ClozeTestLiveTest do
use BlanksWeb.ConnCase
import Phoenix.LiveViewTest
alias Blanks.ClozeTests
@create_attrs %{content: "some content", name: "some name"}
@update_attrs %{content: "some updated content", name: "some updated name"}
@invalid_attrs %{content: nil, name: nil}
defp fix... |
01ccd8226100cb602befd5b55475616565c6ee82 | 1,953 | [
311913497
] | [
"macro",
"documented",
"phoenix"
] | defmodule OauthExampleWeb 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 OauthExampleWeb, :controller
use OauthExampleWeb, :view
The definitions below will be executed for every view,... |
01cd59996280a87cb3c9fd3bce174182deb31d99 | 1,625 | [
97998873
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Testproj.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Testproj.Web, :controller
use Testproj.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them ... |
01cd71c00f21a3da01169a7aef3733d60e6baf7b | 1,844 | [
51272059
] | [] | defmodule CEC.Remote do
@behaviour UniversalRemote.Remotes.Behaviour
alias CEC.Mapping.{Destination, ControlCodes}
alias CEC.RemoteControlPassthrough
defp valid_device(device) do
Destination.devices
|> keys()
|> Enum.any?(fn(d) -> d == device end)
end
defp valid_key(key) do
ControlCodes.c... |
01ce042481f4ee4b4cdf73d819fc2c97f05534c8 | 1,909 | [
245846838
] | [
"documented",
"ecto"
] | defmodule GelleiaApi.UserTeams do
@moduledoc """
The UserTeams context.
"""
import Ecto.Query, warn: false
alias GelleiaApi.Repo
alias GelleiaApi.UserTeams.UserTeam
@doc """
Returns the list of user_teams.
## Examples
iex> list_user_teams()
[%UserTeam{}, ...]
"""
def list_user_te... |
01cea5392a1e431863a92c77757ab69ee974401b | 1,572 | [
709047795
] | [
"liveview",
"phoenix"
] | defmodule CommandedTestWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :commanded_test
# 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... |
01d0021e551fe979a0ba4c6384dd7ec153943ac3 | 2,473 | [
155273698,
174154276,
187703849
] | [
"test",
"ecto"
] | defmodule Rumbl.AccountsTest do
use Rumbl.DataCase
alias Rumbl.Accounts
describe "credentials" do
alias Rumbl.Accounts.Credential
@valid_attrs %{email: "some email", password_hash: "some password_hash"}
@update_attrs %{email: "some updated email", password_hash: "some updated password_hash"}
@i... |
01d00ab161290b7d845889479d6b1f92eff2889e | 2,139 | [
85076071
] | [
"documented"
] | defmodule MSBase.AccessLog do
@moduledoc """
Access Log
"""
alias Plug.Conn
@behaviour Plug
def init(opts) do
opts
end
def call(conn, _) do
start = System.monotonic_time()
Conn.register_before_send(conn, fn conn ->
stop = System.monotonic_time()
diff = System.convert_time_... |
01d024f9743ac635de3a8615326fddfa4dc6f67d | 6,060 | [
381987064
] | [
"genserver",
"documented"
] | defmodule WebRTCToHLS.Stream do
@moduledoc false
use GenServer
require Membrane.Logger
alias Membrane.ICE.TURNManager
alias Membrane.RTC.Engine
alias Membrane.RTC.Engine.Endpoint.{HLS, WebRTC}
alias Membrane.RTC.Engine.Endpoint.HLS.{HLSConfig, MixerConfig}
alias Membrane.RTC.Engine.Message.{Endpoint... |
01d18346dcb05f5cfad2613192d6b5afe7bd83c6 | 1,911 | [
434599676
] | [
"test"
] | defmodule TwentythreeTest do
use ExUnit.Case
test "extract numbers from string" do
assert Dayone.Dayone.resultFromString("agljasdgl13lajsdg") == 13
assert Dayone.Dayone.resultFromString("5dsgadg6") == 56
assert Dayone.Dayone.resultFromString("dsgadg34") == 34
assert Dayone.Dayone.resultFromString("... |
01d1efe8583749dd5e3b428e942123b05a10086b | 1,675 | [
601814260
] | [
"documented",
"ecto"
] | defmodule Partygo.Parties.Party do
use Ecto.Schema
import Ecto.Changeset
schema "parties" do
field :age_from, :integer
field :age_to, :integer
field :date, :utc_datetime
field :description, :string
field :latitude, :float
field :longitude, :float
field :geohash, :string
field :tit... |
01d21804d60b35832392fe1b87f22f693a161365 | 1,937 | [
607697321
] | [
"test",
"ecto"
] | defmodule StacApi.UsersTest do
use StacApi.DataCase
alias StacApi.Users
describe "users" do
alias StacApi.Users.User
import StacApi.UsersFixtures
@invalid_attrs %{biography: nil, full_name: nil}
test "list_users/0 returns all users" do
user = user_fixture()
assert Users.list_users... |
01d219d0a9b817d3b971550162cf5af33b7bde37 | 2,153 | [
81898145
] | [] | defmodule ClicheRumbl.VideoChannel do
use ClicheRumbl.Web, :channel
alias ClicheRumbl.AnnotationView
def join("videos:" <> video_id, params, socket) do
last_seen_id = params["last_seen_id"] || 0
video_id = String.to_integer(video_id)
video = Repo.get!(ClicheRumbl.Video, video_id)
annotations = R... |
01d280b5881fe71c773abf2b137d59a261d2dcfe | 1,527 | [
38776906
] | [] | tax_rates = [NC: 0.075, TX: 0.08]
orders = [
[id: 123, ship_to: :NC, net_amount: 100.00],
[id: 124, ship_to: :OK, net_amount: 35.50],
[id: 125, ship_to: :TX, net_amount: 24.00],
[id: 126, ship_to: :TX, net_amount: 44.80],
[id: 127, ship_to: :NC, net_amount: 25.00],
[id: 128, ship_to: :MA, net_amount: 1... |
01d28a6ce6992490d825850900e417276ee42564 | 3,630 | [
106867917
] | [] | %{"bson": {:hex, :bson, "0.4.4", "175ad645cc492349a4cefa0bdff612178a0db611adf38dabe2bbfad2aa25627a", [], [], "hexpm"},
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [], [], "hexpm"},
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf... |
01d2cf341d0bb749b4ae3668f4c25525acad0c89 | 3,248 | [
330797580
] | [
"test"
] | defmodule ExMon.GameTest do
use ExUnit.Case
alias ExMon.{Player, Game}
describe "start/2" do
test "starts the game state" do
player = Player.build("Leonardo", :chute, :soco, :cura)
computer = Player.build("Robo", :chute, :soco, :cura)
assert {:ok, _pid} = Game.start(computer, player)
... |
01d3962d2e78ab40fb4ef8a1c8f446eaec957a21 | 6,585 | [
115664102
] | [
"genserver"
] | defmodule TwitterClone.Client do
use GenServer
require Logger
def start_link(userId,noOfTweets,noToSubscribe,existingUser) do
GenServer.start_link(__MODULE__, [userId,noOfTweets,noToSubscribe,existingUser])
end
def make_distributed([head | tail],l) do
unless Node.alive?() ... |
01d42b87224a6cb9584f03378a709f27a7b5a61f | 1,812 | [
572977751
] | [] | defmodule Day02 do
def part_one(guide) do
guide
|> split_rounds()
|> Enum.map(&interpret_round_part_1/1)
|> Enum.map(&Enum.sum/1)
|> Enum.sum()
end
def part_two(guide) do
guide
|> split_rounds()
|> Enum.map(&interpret_round_part_2/1)
|> tap(&IO.inspect/1)
|> Enum.map(&Enum... |
01d4aa23660e7245818143dc107c3bdc76461d5b | 8,559 | [
711917256
] | [
"liveview"
] | defmodule LiveViewResetReproductionWeb.ReproductionLive.Index do
use LiveViewResetReproductionWeb, :live_view
alias FuzzyMaya.GLN
alias FuzzyMaya.GoldenRecords
def render(assigns) do
~H"""
<h1>Runs</h1>
<form phx-change="update-runs">
<ul>
<li :for={run <- @matcher_runs}>
<... |
01d4bcdbd241e33bec36c2bd1bdbe065e32c9e30 | 1,543 | [
222522576
] | [] | defmodule VendingMachine.PaymentDisplay do
alias VendingMachine.{Display}
alias IEx.Helpers
def display_amount(amount_required, amount_added, price) do
Helpers.clear()
Display.print_border_line()
Display.print_insert_money()
Display.print_center_line()
Display.print_item_price("#{price}")
... |
01d4f6b20179d2350da76754a601e720f6cfb0a6 | 2,787 | [
207307095
] | [
"test"
] | defmodule IdkPayWeb.AddressControllerTest do
use IdkPayWeb.ConnCase
alias IdkPay.Ethereum
@create_attrs %{addr: "some addr", remark: "some remark"}
@update_attrs %{addr: "some updated addr", remark: "some updated remark"}
@invalid_attrs %{addr: nil, remark: nil}
def fixture(:address) do
{:ok, address... |
01d58e41b7d32c94ace6bf39639f9c9ed8274202 | 1,745 | [
130748338,
276023881
] | [] | defmodule Pleroma.Config do
defmodule Error do
defexception [:message]
end
def get(key), do: get(key, nil)
def get([key], default), do: get(key, default)
def get([parent_key | keys], default) do
case :pleroma
|> Application.get_env(parent_key)
|> get_in(keys) do
nil -> defau... |
01d5f1e1f1088f1875bba4b2b2e19c9388b9667f | 6,515 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Monitoring.V3.Model.HttpCheck do
@moduledoc """
Information involved in an HTTP/HTTPS Uptime check request.
## Attributes
* `acceptedResponseStatusCodes` (*type:* `list(GoogleApi.Monitoring.V3.Model.ResponseStatusCode.t)`, *default:* `nil`) - If present, the check will only pass if the H... |
01d67e325870042bb3135370ca5cc02037b0f6ab | 1,729 | [
552991938
] | [
"test"
] | defmodule HighSchoolSweetheartTest do
use ExUnit.Case
doctest HighSchoolSweetheart
describe "first_letter/1" do
@tag task_id: 1
test "it gets the first letter" do
assert HighSchoolSweetheart.first_letter("Mary") == "M"
end
@tag task_id: 1
test "it doesn't change the letter's case" do
... |
01d6cd077e43cf99e74a24bf077af8a14a622077 | 1,824 | [
425222664,
239182752,
238344742,
248292846,
244384132,
256354544,
264116374,
257246799,
333225527
] | [] | defmodule DBConnection.Mixfile do
use Mix.Project
@pools [:connection_pool, :ownership]
@version "2.2.1"
def project do
[app: :db_connection,
version: @version,
elixir: "~> 1.6",
deps: deps(),
docs: docs(),
description: description(),
package: package(),
build_per_enviro... |
01d6da58e566934efaf2fec2084410373c43e3d0 | 4,018 | [
371381231
] | [
"test"
] | defmodule Rfx.Ops.Proto.CommentDelTest do
use ExUnit.Case
alias Rfx.Ops.Proto.CommentDel
alias Rfx.Util.Source
alias Rfx.Util.Tst
@base_source """
# TestComment
x = 1
"""
@base_expected """
x = 1
"""
@base_diff """
1d0
< # TestComment
"""
doctest CommentDel
describe "#cl_code w... |
01d6ddf37a0f3938c2bb42f1b9c3321c5012e4b4 | 16,924 | [
197554210
] | [
"typespec",
"documented"
] | defmodule Maxwell.Multipart do
@moduledoc """
Process mutipart for adapter
"""
@type param_t :: {String.t, String.t}
@type params_t :: [param_t]
@type header_t :: {String.t, String.t} | {String.t, String.t, params_t}
@type headers_t :: Keyword.t
@type disposition_t :: {String.t, params_t}
@type bound... |
01d7318014cd2713d996ce6779ecb2a0376700ae | 2,660 | [
582469757
] | [] | defmodule ER.Test.Setups do
import ER.Factory
use ER.DataCase
alias ER.Events
import ER.Test.Helpers
def setup_topic(_context) do
topic = insert(:topic)
ER.Destinations.Delivery.create_table!(topic)
ER.Events.Event.create_table!(topic)
on_exit(fn ->
ER.Destinations.Delivery.drop_table... |
01d77392a4d958b110bd282ea27559203296f4b5 | 4,728 | [
757463973,
768011158,
279895213,
610994830,
421861084,
792554244,
493445187,
644559297,
895439861,
756299391,
531030808,
449967422
] | [
"test",
"phoenix"
] | defmodule ChatApiWeb.TagControllerTest do
use ChatApiWeb.ConnCase
import ChatApi.Factory
alias ChatApi.Tags.Tag
@create_attrs params_for(:tag, name: "some name")
@update_attrs %{
name: "some updated name"
}
@invalid_attrs %{name: nil}
setup %{conn: conn} do
account = insert(:account)
user... |
01d7fea5445934eb0f94c5126176b5e7ecd1b4e5 | 8,061 | [
877316475
] | [
"genserver",
"liveview",
"documented",
"ecto"
] | defmodule ReflectOS.Core.Sections.DateTime do
use ReflectOS.Kernel.Section, has_children: false
alias Scenic.Graph
import Scenic.Primitives, only: [{:text, 3}]
import Phoenix.Component, only: [sigil_H: 2]
import ReflectOS.Kernel.Typography
alias ReflectOS.Kernel.Settings.System
alias ReflectOS.Kernel.S... |
01d8150f8c05d90d66a942cdb21d6bfc765e7a6f | 2,185 | [
942811655,
920024200
] | [
"genserver",
"documented"
] | defmodule Scheduler.Workers.Initializer do
@moduledoc """
It is invoked on Application start and it loads all periodics from DB in batches
and starts quantum job for each of them.
"""
use GenServer, restart: :transient
alias Scheduler.Workers.QuantumScheduler
alias Scheduler.Periodics.Model.PeriodicsQuer... |
01d836e66deff80baee08e43934ce6418a5fe56b | 4,990 | [
960533781
] | [
"phoenix",
"documented"
] | defmodule PIIDetectorWeb.API.WebhookController do
use PIIDetectorWeb, :controller
require Logger
# def slack(conn, _params) do
# # Will implement in next task
# conn
# |> put_status(200)
# |> json(%{status: "ok"})
# end
@doc """
Handle incoming webhook from Notion.
"""
def notion(conn... |
01d84ae1acebb0a00a01e6fc96701a3ede2399c1 | 15,162 | [
142186256
] | [
"documented"
] | defmodule Unifex.CodeGenerators.NIF do
@moduledoc """
Generates NIF boilerplate based on `Unifex.Specs`.
"""
@behaviour Unifex.CodeGenerator
import Unifex.CodeGenerator.Utils, only: [sigil_g: 2]
alias Unifex.{CodeGenerator, InterfaceIO, Specs}
alias Unifex.CodeGenerator.{BaseType, Utils}
alias Unifex.... |
01d8bd7a2792f5601231c4878f3f0c6f1f4b5f27 | 4,563 | [
317755854
] | [] | defmodule DayEleven do
def part_one(seat_layout) do
stable_state = simulate_rounds_until_stable(
seat_layout,
&directly_adjacent_visibility_func(&1, &2)
)
count_occupied_seats(stable_state)
end
def part_two(seat_layout) do
stable_state = simulate_rounds_until_stable(
seat_layout,... |
01d8e7d487253c8194d228527965a52609df45d6 | 2,494 | [
312873734
] | [
"test"
] | defmodule Rumbl.AccountsTest do
use Rumbl.DataCase
alias Rumbl.Accounts
alias Rumbl.Accounts.User
describe "register_user/1" do
@valid_attrs %{
name: "User",
username: "eva",
credential: %{email: "eva@test", password: "secret"}
}
@invalid_attrs %{}
test "with valid data inse... |
01da740e03004cb41cad50028a1dbf98ae9be10d | 1,973 | [
942468823
] | [
"macro",
"test",
"documented",
"ecto"
] | defmodule GameBot.DataCase do
@moduledoc """
This module defines the setup for tests requiring
access to the application's data layer.
You may define functions here to be used as helpers in
your tests.
Finally, if the test case interacts with the database,
we enable the SQL sandbox, so changes done to t... |
01da9dab86f95b6c8dc04ddb1279b62a044cb5d3 | 10,618 | [
665725558
] | [
"documented",
"ecto"
] | defmodule Shinstagram.Timeline do
@moduledoc """
Everything to do with timelines.any()
"""
import Ecto.Query, warn: false
import AI
import Shinstagram.AI
alias Shinstagram.Repo
alias Shinstagram.Profiles.Profile
alias Shinstagram.Timeline.{Post, Like}
require Logger
@model "gpt-4"
@dumb_model... |
01db4f213ce928c856e304efce2dae552d7b9e93 | 2,765 | [
101512326
] | [] | defmodule Architect.MixProject do
use Mix.Project
def project do
[
app: :architect,
version: "0.1.0",
elixir: "~> 1.5",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext, :phoenix_swagger] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.