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 |
|---|---|---|---|---|
0c5acbeb06b3925a9e6e2b51cd70a15f005be706 | 2,915 | [
808102579
] | [
"liveview",
"ecto"
] | defmodule DashboardWeb.Live.Modal.DbAttributesModal do
use DashboardWeb, :component
def db_attrs_modal(assigns) do
db_attrs_added =
assigns.changeset |> Ecto.Changeset.get_field(:db_attrs, []) |> length() != 0
assigns = assign(assigns, :db_attrs_added, db_attrs_added)
~H"""
<DashboardWeb.Li... |
0c5b0603b8a864eea343efc935365fbc53bfaca0 | 23,171 | [
588790131
] | [
"typespec",
"documented"
] | defmodule Explorer.SmartContract.Reader do
@moduledoc """
Reads Smart Contract functions from the blockchain.
For information on smart contract's Application Binary Interface (ABI), visit the
[wiki](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI).
"""
alias EthereumJSONRPC.{Contract, Encoder}... |
0c5b256a95e24bfb078b471f47c871e0337b954d | 2,928 | [
422814245
] | [
"typespec",
"documented",
"ecto"
] | defmodule Server.Context.Context do
@moduledoc """
Ecto schema for SEED memory contexts using TimescaleDB hypertables.
This schema represents 2-minute aggregated contexts containing transcriptions,
chat interactions, emotes, and AI-generated insights for training data.
"""
use Ecto.Schema
import Ecto.Ch... |
0c5b655fdebf61c8237f844da9d380315e4e6008 | 3,595 | [
482555587
] | [
"typespec",
"documented"
] | defmodule ExOAPI.Stripe.SDK.Files do
@doc """
**description**: <p>Retrieves the details of an existing file object. Supply the unique file ID from a file, and Stripe will return the corresponding file object. To access file contents, see the <a href="/docs/file-upload#download-file-contents">File Upload Guide</a>.<... |
0c5c0f9e49663adf857c8ffec68009971bc71795 | 3,245 | [
992062277
] | [
"test",
"documented",
"ecto"
] | defmodule QuickCrudIntrospectionTest do
@moduledoc """
- https://elixircasts.io/introspecting-ecto-schemas
- https://hexdocs.pm/ecto/Ecto.Schema.html#module-reflection
"""
use ExUnit.Case, async: true
alias QuickCrud.User
describe "ecto" do
test "basic info" do
fields = User.__schema__(:fields... |
0c5cfcef65c4ca45eeeae6926dc6de4f6bb350d5 | 1,616 | [
962104804
] | [
"test"
] | defmodule JSONStringifierTest do
use ExUnit.Case
doctest JSONStringifier
test "value to string" do
assert JSONStringifier.stringify(nil) === "null", "JSONStringifier.stringify(:nil) === \"null\" failed"
assert JSONStringifier.stringify(nil) === "null"
assert JSONStringifier.stringify(false) === "fals... |
0c5d474a83c9691e6cef202390162e035fbf2fa4 | 1,599 | [
55873522
] | [
"supervisor"
] | defmodule KV.Supervisor do
use Supervisor
def start_link do
# spec is:
# on_start ::
# {:ok, pid} |
# :ignore |
# {:error, {:already_started, pid} | {:shutdown, term} | term}
# start_link(module, term) :: on_start
Supervisor.start_link(__MODULE__, :ok)
end
def init(:ok) do
chil... |
0c5d56e92cdda6d2f0a3245facafec26d388ed2b | 1,729 | [
70068343
] | [
"test"
] | defmodule Mollie.RefundTest do
use ExUnit.Case
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
setup_all do
ExVCR.Config.cassette_library_dir("test/fixtures/vcr_cassettes/mollie/refund")
ExVCR.Config.filter_sensitive_data("Bearer .+", "TOKEN")
ExVCR.Config.filter_sensitive_data("(?:\\d{1,3}\\.){3}\\d{... |
0c5de7eda42da2384a423ef49e2d854d4e315f54 | 2,349 | [
458715412
] | [
"phoenix"
] | defmodule BackendWeb.SessionController do
use BackendWeb, :controller
use PhoenixSwagger
alias Backend.Users
alias Backend.Guardian
action_fallback(BackendWeb.FallbackController)
swagger_path :login do
post("/api/login")
summary("login")
description(
"login with slack token. in order t... |
0c5e5442084c1daaa71f5fd9db042e8fd4bee4f7 | 2,468 | [
613819399
] | [
"documented"
] | defmodule IdenticonSvg.Color do
@moduledoc """
Module of `IdenticonSvg` that contains functions related to handling colors.
"""
@moduledoc since: "0.9.0"
@doc """
Convert an integer in the range 0..255 to a zero-padded hexacedimal string
"""
def integer_to_hex(value) when is_integer(value) and value in... |
0c5e64a671faf903b86960ef16d8dc625e7a4b2d | 7,058 | [
119206724
] | [
"typespec",
"documented"
] | defmodule PlayfabEx.Admin.Default.TitleWideDataManagement do
@doc """
Adds a new news item to the title's news feed
@link https://api.playfab.com/documentation/admin/method/AddNews
"""
@spec add_news(map()) :: {:ok, map} | {:error, String.t}
def add_news(params) do
fetch("Admin/AddNews", params)
end... |
0c5ec58ef4fe46e2a2c4898e9d0ee8e7bc4ccf3d | 2,885 | [
995944955
] | [
"liveview"
] | defmodule ShopUxPhoenixWeb.WebSocketTestLive do
use ShopUxPhoenixWeb, :live_view
@impl true
def mount(_params, _session, socket) do
{:ok, assign(socket, count: 0, ws_status: "checking...", connected: connected?(socket))}
end
@impl true
def render(assigns) do
~H"""
<div class="max-w-4xl mx-auto... |
0c5ee82502b8e14f60a1e9791322248a5249ab4d | 5,346 | [
367278931
] | [
"documented"
] | defmodule Google.Devtools.Testing.V1.DeviceSession.SessionState do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :SESSION_STATE_UNSPECIFIED, 0
field :REQUESTED, 1
field :PENDING, 2
field :ACTIVE, 3
field :EXPIRED, 4
field :FINISHED, 5
field :UN... |
0c5f0eccedb29dc1a5614d951b44e6325de2efe8 | 1,749 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.SQLAdmin.V1beta4.Model.InstancesListServerCertificatesResponse do
@moduledoc """
Instances ListServerCertificatess response.
## Attributes
* `activeVersion` (*type:* `String.t`, *default:* `nil`) - The `sha1_fingerprint` of the active certificate from `server_certs`.
* `caCerts` (*ty... |
0c5f747cede68f9641328ff1594c517ce221b67e | 3,366 | [
222781292
] | [
"phoenix"
] | defmodule DemoWeb.Router do
use DemoWeb, :router
import Utilities, only: [nilify_error: 1]
alias Guardian.Plug.LoadResource, as: Guardian_LoadResource
alias Guardian.Plug.Pipeline, as: Guardian_Pipeline
alias Guardian.Plug.VerifyHeader, as: Guardian_VerifyHeader
alias Guardian.Plug.VerifySession, as: Guar... |
0c5fa1baf9d6c30f61ad9572bf4c61301f3e7a21 | 5,103 | [
472430075
] | [] | # modulo del main,,, el cual llevara el
# "hilo de ej" del programa.
defmodule DungeonCrawl.CLI.Main do
# alias para la shell,, para tener acceso a la consola mas rapido
alias Mix.Shell.IO, as: Shell
import DungeonCrawl.CLI.BaseCommands
## funcion de empezar el juego
def start_game do
mensaje_bienvenida(... |
0c5fd462217eef1b871982728949d1ffa3109fc0 | 13,096 | [
80109208
] | [
"typespec",
"macro",
"documented"
] | defmodule Membrane.Core.Child.PadsSpecs do
@moduledoc false
# Functions parsing element and bin pads specifications, generating functions and docs
# based on them.
use Bunch
alias Membrane.Core.OptionsSpecs
alias Membrane.Pad
require Membrane.Logger
require Membrane.Pad
@doc """
Returns documenta... |
0c604a33823af66f61985980cd404658fd0d7680 | 2,130 | [
564863485
] | [
"supervisor",
"documented"
] | defmodule ServoKit.ServoSupervisor do
@moduledoc """
Supervises `ServoKit.ServoController` processes.
"""
# https://hexdocs.pm/elixir/DynamicSupervisor.html
use DynamicSupervisor
require Logger
alias ServoKit.ServoController
def start_link(_args) do
Logger.debug("#{__MODULE__} starting")
Dyn... |
0c60c3008351d140e684dbfd19566dc379ba0f29 | 10,493 | [
132529526
] | [
"test",
"ecto"
] | defmodule GateGoat.FeesTest do
use GateGoat.DataCase
alias GateGoat.Fees
describe "registrations" do
alias GateGoat.Fees.Fee
@valid_attrs %{group_name: "some group_name", membership_number: "some membership_number", legal_name: "some legal_name", sca_name: "some sca_name", waiver: true}
@update_att... |
0c61e14f58940ae2c36b3a3e8f377c1931440e13 | 2,241 | [
219090264,
219093299,
219079344,
219087712
] | [
"phoenix",
"ecto"
] | defmodule TimesheetWeb.TaskController do
use TimesheetWeb, :controller
alias Timesheet.Tasks
alias Timesheet.Tasks.Task
alias Timesheet.Workers
alias Timesheet.Workers.Worker
def index(conn, _params) do
tasks = Tasks.list_tasks()
workers = Workers.list_manager_id(conn.assigns[:current_user].id)
... |
0c61e458928aac297f413599fed0e676240ebd46 | 1,642 | [
907672293
] | [
"liveview",
"phoenix"
] | defmodule PhoenixRecipesWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :phoenix_recipes
# 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,
k... |
0c621d3aa7edfe329cdf4f1b8e05db677e3a96ae | 15,015 | [
624054242
] | [
"typespec",
"documented"
] | # Code generated by protox. Don't edit.
# credo:disable-for-this-file
defmodule PgQuery.JoinExpr do
@moduledoc false
if function_exported?(Protox, :check_generator_version, 1) do
Protox.check_generator_version(1)
else
raise "This code was generated with protox 2 but the runtime is using an older version o... |
0c62b45bae06060c10e713103fe13885b3d7d4bb | 1,964 | [
439118885
] | [] | defmodule Paths do
defmodule Path do
defstruct nodes: MapSet.new(), path: [], last: nil
end
def run(file) do
file
|> data()
|> paths()
|> print_paths()
end
def data(file) do
File.stream!(file, mode: :line)
|> Stream.map(&String.trim/1)
|> Stream.map(&String.split(&1, "-"))
... |
0c62c29d80b3171c4f526ef9c666f22b478e439d | 2,096 | [
970817672
] | [
"supervisor",
"documented"
] | # lib/frestyl/studio/recording_engine_supervisor.ex
defmodule Frestyl.Studio.RecordingEngineSupervisor do
@moduledoc """
DynamicSupervisor for RecordingEngine processes.
"""
use DynamicSupervisor
require Logger
def start_link(init_arg) do
DynamicSupervisor.start_link(__MODULE__, init_arg, name: __MODU... |
0c62d7badfa586844c0ed7168aaf867551ecedaf | 5,723 | [
872054048
] | [
"genserver"
] | defmodule SimulIngestion.Dashboard do
alias SimulIngestion.Dashboard
use GenServer
@speed_measure_sample 1_000
def start_link(_args) do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
end
def add_book(book, nb_chunks) do
GenServer.cast(__MODULE__, {:add_book, book, nb_chunks, DateTime.utc_... |
0c62fcf17c186a8f108e5fd29924787c4d646b52 | 1,887 | [
917609177
] | [] | defmodule Dialectic.Graph.Siblings do
alias Dialectic.Graph.Vertex
def up(node) do
new_node_or_self(node, fn node -> node.parents |> List.first() end)
end
def down(node) do
new_node_or_self(node, fn node -> node.children |> List.first() end)
end
def left(node, graph) do
sorted = sort_siblings... |
0c630d4806817d68a8a59bdf3c707bf917426c93 | 11,580 | [
967831208
] | [
"test",
"documented"
] | defmodule WebsockexNova.Helpers.StateHelpersTest do
use ExUnit.Case, async: true
alias WebsockexNova.Helpers.StateHelpers
describe "state handler updates" do
setup do
state = %{
handlers: %{
existing_handler: :some_value
},
some_field: "test"
}
empty_stat... |
0c635c6b3f27a30f55a0f915468ea2f0824b1b99 | 1,835 | [
156716077
] | [
"typespec",
"documented"
] | defmodule Chain.EVM.Notification do
@moduledoc """
Default EVM chain notification structure.
For example on chain start it should fire event `:started` and so on.
Example:
```elixir
%Chain.EVM.Notification{
id: "15054686724791906538",
event: :started,
data: %{
accounts: ["0x51ef0fe1fe60... |
0c63a2040d233717d49e48f65ead5b021cb67025 | 2,533 | [
149347147
] | [] | %{
"bcrypt_elixir": {:hex, :bcrypt_elixir, "1.1.1", "6b5560e47a02196ce5f0ab3f1d8265db79a23868c137e973b27afef928ed8006", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a61... |
0c648d0c4a0548a4022b6a16ac29ce10e95d65c9 | 7,847 | [
36470617
] | [
"documented"
] | Code.ensure_compiled(ExAdmin.Utils)
defmodule ExAdmin.Theme.AdminLte2.Filter do
@moduledoc false
require Logger
require Ecto.Query
import ExAdmin.Utils
import ExAdmin.Gettext
import ExAdmin.Filter
use Xain
def theme_filter_view(conn, defn, q, order, scope) do
markup safe: true do
div ".box.b... |
0c6514a33fd520bb28dbd0523153d60ba0e72b66 | 1,718 | [
127414971
] | [
"phoenix"
] | defmodule StorexWeb.BookController do
use StorexWeb, :controller
alias Storex.Store
plug StorexWeb.Plugs.AdminOnly when action not in [:index, :show]
def index(conn, _params) do
render conn, "index.html", books: Store.list_books()
end
def show(conn, %{"id" => book_id}) do
ren... |
0c657f6e868adf19531c4f4f995a5fa2b645a483 | 4,463 | [
99812433
] | [
"test",
"supervisor"
] | defmodule OPQTest do
use OPQ.TestCase, async: true
doctest OPQ
@moduletag capture_log: true
test "enqueue items - child_spec/1" do
Supervisor.start_link([{OPQ, name: :opq}], strategy: :one_for_one)
OPQ.enqueue(:opq, :a)
OPQ.enqueue(:opq, :b)
wait(fn ->
assert_empty_queue(:opq)
end... |
0c65a8d52447c2f23b0eadd42e97f68674ad4cb0 | 2,766 | [
153937532
] | [
"documented"
] | defmodule Day9 do
@moduledoc """
Documentation for Day9.
"""
@doc """
iex> Day9.highest_score(9, 25)
32
iex> Day9.highest_score(10, 1618)
8317
#
# iex> Day9.highest_score(13, 7999)
# 146373
#
# iex> Day9.highest_score(17, 1104)
# 2764
#
#... |
0c65f142319194ba9d71f05b1700a47951d7a67c | 10,347 | [
771776061
] | [] | %{
"castore": {:hex, :castore, "1.0.6", "ffc42f110ebfdafab0ea159cd43d31365fa0af0ce4a02ecebf1707ae619ee727", [:mix], [], "hexpm", "374c6e7ca752296be3d6780a6d5b922854ffcc74123da90f2f328996b962d33a"},
"cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar... |
0c66922037a7641eb744c3c940fa88436d903ec8 | 8,080 | [
165517500
] | [
"typespec",
"documented"
] | defmodule Ratatouille.Runtime do
@moduledoc """
A runtime for apps implementing the `Ratatouille.App` behaviour. See
`Ratatouille.App` for details on how to build apps.
## Runtime Context
The runtime provides a map with additional context to the app's
`c:Ratatouille.App.init/1` callback. This can be used,... |
0c66af07e3beb62f042f245d617d3fde13284e8d | 1,781 | [
163277988
] | [
"typespec"
] | defmodule Dialyxir.Warnings.CallbackSpecArgumentTypeMismatch do
@behaviour Dialyxir.Warning
@impl Dialyxir.Warning
@spec warning() :: :callback_spec_arg_type_mismatch
def warning(), do: :callback_spec_arg_type_mismatch
@impl Dialyxir.Warning
@spec format_short([String.t()]) :: String.t()
def format_shor... |
0c66d6ec4e25aad3ccd37c122ad48e97cdd725aa | 1,504 | [
50941308
] | [
"typespec",
"documented"
] | defmodule Braintree.AddOn do
@moduledoc """
Add-ons and discounts are created in the Control Panel. You cannot create or
update them through the API.
Add-ons and discounts can be applied manually on a case-by-case basis, or you
can associate them with certain plans to apply them automatically to new
subscr... |
0c673baeb433a70e926cb7c0fa559583113f136d | 2,675 | [
179712640
] | [
"test",
"phoenix"
] | defmodule ShoppingListWeb.ListControllerTest do
use ShoppingListWeb.ConnCase
alias ShoppingList.ShoppingLists
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
def fixture(:list) do
{:ok, list} = ShoppingLists.create_list(@create_attrs)
list... |
0c6798c24f6dc5cab9dc00b3401fba6e40cf9840 | 1,722 | [
205137761
] | [] | defmodule RetryApiWeb.IdempotencyPlug do
import Plug.Conn
require Logger
def init(options \\ []) do
defaults = [header_name: "x-idempotency-token"]
Keyword.merge(defaults, options) |> Enum.into(%{})
end
defp check_header(conn, header_name) do
case get_req_header(conn, header_name) do
[] ->... |
0c67df1d774601b9a23feb572e7f57b4c6ff7e39 | 3,795 | [
433959528
] | [
"test"
] | defmodule Day09Test do
use ExUnit.Case
doctest Day09
test "next marble" do
assert Day09.next_marble_idx(0, 1) == 1
assert Day09.next_marble_idx(1, 2) == 1
assert Day09.next_marble_idx(1, 3) == 3
assert Day09.next_marble_idx(3, 4) == 1
assert Day09.next_marble_idx(1, 5) == 3
assert Day09.n... |
0c67fc769645a99238c7c81784f0235d3bcf2db3 | 12,291 | [
500260157
] | [] | defmodule Pleroma.Mixfile do
use Mix.Project
def project do
[
app: :pleroma,
version: version("2.4.52"),
elixir: "~> 1.9",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
elixirc_options: [warnings_as_errors: warnings_as_errors()]... |
0c6818e3c276581010c0cb29e62382dca3ce6562 | 1,866 | [
73618468
] | [
"documented",
"ecto"
] | defmodule TinyFair.Order do
use TinyFair.Web, :model
@avaialable_statuses ~w(new accepted declined fulfilled)
schema "orders" do
field :amount, :integer, default: 1
field :status, :string, default: "new"
field :expiry, :utc_datetime
belongs_to :issuer, User, foreign_key: :user_id
belongs_to ... |
0c68316a0102c16082f6ac7ecdabe509e00b326c | 3,840 | [
448948658,
459182862,
823294387,
642675403,
473697525,
529748378,
529761913,
584672709,
521332927,
514687923
] | [
"typespec",
"macro",
"documented"
] | defmodule Credo.CLI.Command do
@moduledoc """
`Command` is used to describe commands which can be executed from the command line.
The default command is `Credo.CLI.Command.Suggest.SuggestCommand`.
A basic command that writes "Hello World" can be implemented like this:
defmodule HelloWorldCommand do
... |
0c68ab8ec3199ac9bec4a83507333680c0e0a2ef | 3,843 | [
892687315
] | [
"typespec"
] | defmodule Tutorials.Structs.SevenWonders do
# This is a struct representing a Seven Wonders of the World
defstruct name: "", country: ""
alias Tutorials.Structs.SevenWonders
# This is a type representing a Seven Wonders of the World
@type t :: %SevenWonders{
name: String.t(),
country: Str... |
0c6933e35047abe63731656a6406ac9905110ffe | 1,507 | [
410111872
] | [
"test"
] | defmodule RockeliveryWeb.UsersViewTest do
use RockeliveryWeb.ConnCase, async: true
import Phoenix.View
import Rockelivery.Factory
alias Rockelivery.User
alias RockeliveryWeb.UsersView
test "renders create.json" do
user = build(:user)
token = "valid_token"
response = render(UsersView, "create... |
0c696c5afdf1d10bf937cd91e5e0fbf8326cc30b | 4,156 | [
196475547
] | [
"genserver",
"test"
] | defmodule Xgit.Repository.Plumbing.PutSymbolicRefTest do
use ExUnit.Case, async: true
alias Xgit.Ref
alias Xgit.Repository.InvalidRepositoryError
alias Xgit.Repository.Plumbing
alias Xgit.Repository.Storage
alias Xgit.Test.OnDiskRepoTestCase
import FolderDiff
describe "put_symbolic_ref/4" do
test... |
0c6988fba7161cab8b5ae9f4df475de3805e9a1e | 4,322 | [
30042248
] | [
"typespec",
"documented"
] | defmodule GoogleSheets.Loader.Docs do
@moduledoc """
Implements GoogleSheets.Loader behavior by fetching a Spreadsheet through Google spreadsheet API.
The only configuration value required is :url, which should point to the Atom feed of the spreadsheet.
See [README](extra-readme.html) how to publish a spreadsh... |
0c6a1951fc65b47fd36636d523f675b95cfc444f | 9,391 | [
675065258,
623651558
] | [
"liveview",
"phoenix",
"test"
] | defmodule Phoenix.LiveView.NavigationTest do
use ExUnit.Case, async: false
import Phoenix.ConnTest
import Phoenix.LiveViewTest
alias Phoenix.LiveViewTest.{Endpoint, DOM}
@endpoint Endpoint
setup do
{:ok, conn: Plug.Test.init_test_session(build_conn(), %{})}
end
# Nested used of navigation helpe... |
0c6a2a64f3651a35a246b8fde2688a42f6a93044 | 3,929 | [
726417643,
295290852
] | [] | defimpl Console.PubSub.Auditable, for: [
Console.PubSub.ServiceCreated,
Console.PubSub.ServiceUpdated,
Console.PubSub.ServiceDeleted,
Console.PubSub.ClusterCreated,
Console.PubSub.ClusterUpdated,
Console.PubSub.ClusterDeleted,
Console.PubSub.ProviderCreated,
Console.PubSub.ProviderUpdated,
Console.Pub... |
0c6a378215c6a9fbb30d758b9f18f070cbbac3a1 | 10,193 | [
459699346
] | [
"documented"
] | defmodule Plug.Parsers.MULTIPART do
@moduledoc """
Parses multipart request body.
## Options
All options supported by `Plug.Conn.read_body/2` are also supported here.
They are repeated here for convenience:
* `:length` - sets the maximum number of bytes to read from the request,
defaults to 8_000... |
0c6ad0e1c018c823c3df75d6eafc677cc68fcad2 | 1,842 | [
555825268
] | [
"test"
] | defmodule Octopus.TransformTest do
use ExUnit.Case, async: true
alias Octopus.Transform
describe "transform/2" do
test "when args are valid" do
args = %{"foo" => "bar", "baz" => 1, "h" => "haha"}
config = %{
"x" => "/path/#{args["foo"]}",
"y" => [1, "args[\"baz\"]", "args[\"h\"]... |
0c6b5446530dfe0bc22df2430466d2f6ceaf139a | 1,774 | [
219097402
] | [
"documented",
"ecto"
] | defmodule Timesheets.Sheets do
@moduledoc """
The Sheets context.
"""
import Ecto.Query, warn: false
alias Timesheets.Repo
alias Timesheets.Sheets.Sheet
@doc """
Returns the list of sheets.
## Examples
iex> list_sheets()
[%Sheet{}, ...]
"""
def list_sheets do
Repo.all(Sheet)
... |
0c6b5b34a27d58b8b42fe8d219762461dca96211 | 1,568 | [
210209595
] | [
"liveview",
"phoenix"
] | defmodule LotdWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :lotd
# 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: "_lotd_key",
... |
0c6b74884cd940b477bdb09673f9627c2b20ad8c | 1,562 | [
882924950
] | [] | defmodule AppWeb.Auth.UserConfirmationController do
use AppWeb, :api_controller
alias App.Accounts
alias AppWeb.Shared.Schemas.{GenericErrorResponse, SchemaErrorResponse, SuccessResponse}
alias AppWeb.Auth.Schemas.ResendConfirmationEmailRequest, as: Request
tags(["auth"])
operation(:create,
summary: ... |
0c6b9ec4c743c448c088b868ff101cb510234aa3 | 1,840 | [
356402195
] | [
"genserver"
] | defmodule BiddingPocWeb.BiddingChannel do
use BiddingPocWeb, :channel
require Logger
import BiddingPocWeb.SocketHelpers
alias BiddingPoc.Database.{AuctionItem, AuctionBid}
alias BiddingPoc.AuctionManager
alias BiddingPoc.AuctionPublisher
@impl true
def join("bidding:" <> auction_id, _payload, socket... |
0c6ba48f2bda2a848a212f1d7546a11ac75173fd | 2,355 | [
789706378,
804638504
] | [
"genserver",
"liveview"
] | defmodule SwaiWeb.EdgesLive.Index do
use SwaiWeb, :live_view
require Logger
require Seconds
require Jason.Encoder
alias Edge.Facts, as: EdgeFacts
alias Edges.Service, as: EdgesCache
alias Phoenix.PubSub
import ErlUtils
@edges_cache_facts EdgeFacts.edges_cache_facts()
# def refresh(_caller_state... |
0c6bfb120e51ca71a32005ed2fd9b3f46459be30 | 5,688 | [
137383377
] | [] | defmodule ExcommerceWeb.Admin.VariantController do
use ExcommerceWeb, :admin_controller
import ExcommerceWeb.Authorize
alias Excommerce.Catalog
alias Excommerce.Catalog.{Product, Variant, VariantOptionValue}
plug :user_check
plug :scrub_params, "variant" when action in [:create, :update]
plug :find_prod... |
0c6c89d550db1fb4ea80e8178746c63424b878bc | 22,790 | [
896950909,
318863677
] | [
"test"
] | defmodule AdventOfCode.Solution.Year2020.Day19Test do
use ExUnit.Case, async: true
import AdventOfCode.Solution.Year2020.Day19
setup_all do
[
input: """
0: 4 1 5
1: 2 3 | 3 2
2: 4 4 | 5 5
3: 4 5 | 5 4
4: "a"
5: "b"
ababbb
bababa
abbbab
aaabb... |
0c6d6593cc4283cdfb35abcffabc477178b1e0eb | 2,622 | [
144409835,
149154480,
145566106,
164171143
] | [
"typespec",
"macro",
"documented"
] | defmodule NimbleParsec.Printer do
@moduledoc """
Functions for printing parser combinator code.
"""
@doc """
Prints parser combinator code.
Receives the same options as `NimbleParsec.defparsec/3`.
"""
@spec defparsec(atom(), NimbleParsec.t(), keyword()) :: iodata
def defparsec(name, combinator, opts... |
0c6d738d23b9a2777726ec5126ca9c43347019a7 | 3,634 | [
82918073
] | [
"genserver",
"macro",
"documented"
] | defmodule Extatus.Process do
@moduledoc """
This module defines a behaviour to instrument a `GenServer`s.
For an uninstrumented `GenServer` process, i.e:
```elixir
defmodule Uninstrumented do
use GenServer
def start_link, do: GenServer.start_link(__MODULE__, nil)
def stop(pid), do: GenServer.... |
0c6e114ce647cd184d7c8a17a7b2926fabec17c0 | 8,584 | [
518625976,
640656590,
564964111,
415974446,
576295356,
637945987,
600362606,
158984833,
580858551,
669079833,
575449429,
790205522,
406570359,
575507361,
976013920,
534653779,
594893960,
597952057,
266804057,
522509322,
587331839,
511179576
] | [
"macro",
"test"
] | defmodule DancingDots.AnimationTest do
use ExUnit.Case
import ExUnit.CaptureIO
describe "Animation module" do
@tag task_id: 1
test "defines two required callbacks, init/1 and handle_frame/3" do
assert DancingDots.Animation.behaviour_info(:callbacks) == [{:init, 1}, {:handle_frame, 3}]
end
... |
0c6e1be442c758e6d365aee9cb3d8a3e49971a62 | 1,806 | [
346429667
] | [] |
defmodule ReportsGenerator do
@available_foods [
"sushi",
"açaí",
"hambúrguer",
"churrasco",
"pizza",
"prato_feito",
"pastel",
"esfirra"
]
@options ["foods", "users"]
alias ReportsGenerator.Parser
def build(filename) do
filename
|>Parser.parse_file()
|>Enum.red... |
0c6e60fd648e549be4529edf2f950d76c630d0f4 | 3,346 | [
343420615
] | [
"documented"
] | defmodule Graph.Reducers.Bfs do
@moduledoc """
This reducer traverses the graph using Breadth-First Search.
"""
use Graph.Reducer
@doc """
Performs a breadth-first traversal of the graph, applying the provided mapping function to
each new vertex encountered.
NOTE: The algorithm will follow lower-weigh... |
0c6e740c31a823e7c56e46166b05f90bb861644f | 1,593 | [
151453938
] | [
"macro",
"documented",
"phoenix"
] | defmodule RecipesWeb 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 RecipesWeb, :controller
use RecipesWeb, :view
The definitions below will be executed for every view,
controller, ... |
0c6eab9bf2637f9aa25c471e81ad7d7bac45e877 | 1,759 | [
369203665
] | [
"macro",
"ecto"
] | defmodule AppRecorder.Events.EventSchema do
defmacro configurable_fields() do
quote do
import Ecto.Schema
field(
elem(AppRecorder.owner_id_field(:schema), 0),
elem(AppRecorder.owner_id_field(:schema), 1),
elem(AppRecorder.owner_id_field(:schema), 2)
)
if AppRecord... |
0c6f2946e54279fe7eb9a2c92e936bb626dc35d7 | 1,515 | [
624613366
] | [
"genserver",
"supervisor"
] | defmodule Mmo.MatricesManager do
use GenServer
alias Mmo.{Matrix, MatrixDynamicSupervisor}
@me __MODULE__
defstruct matrices: %{}, map: {}
### API ###
def start_link(args) do
{:ok, pid} = GenServer.start_link(@me, args, name: @me)
Enum.each(1..4, fn x -> create(x) end)
{:ok, pid}
end
d... |
0c6f3d2abc1c62604b47c89b02cb40e0c3bed45f | 1,561 | [
589535814,
598050696,
616127556,
612868361
] | [] | ["setup.exs"] |> Enum.map(&Code.require_file/1)
alias Ockam.Transport.TCPAddress
alias Ockam.Workers.RemoteForwarder
# Parse argument. Usage: elixir 03-outlet.exs target_host:target_port
[target] = System.argv()
[host, port_s] = String.split(target, ":")
{port, ""} = Integer.parse(port_s)
# Start the TCP Transpor... |
0c6f6e9c964d2204a93026c4f2f265226303ccf4 | 2,094 | [
713330106
] | [
"phoenix"
] | defmodule UsersApiWeb.WorkteamsController do
use UsersApiWeb, :controller
alias UsersApi.TeamManagement
alias UsersApi.TeamManagement.WorkTeams
action_fallback UsersApiWeb.FallbackController
def index(conn, _params) do
workteams = TeamManagement.list_workteams()
render(conn, "index.json", workteams... |
0c6f9600fa0f6d925e1f211428684cff2a0051b4 | 2,300 | [
75487919
] | [
"documented"
] | defmodule Advent2020.Day3 do
@moduledoc "https://adventofcode.com/2020/day/3"
@behaviour Advent
def setup do
with {:ok, str} <- File.read("#{__DIR__}/input.txt") do
setup_string(str)
end
end
def setup_string(str) do
map =
str
|> String.split("\n", trim: true)
|> Enum.with... |
0c6ff416879ebbc99b3609ea753364b0fae1dc76 | 2,350 | [
426246497
] | [
"test",
"phoenix"
] | defmodule TodolistWeb.TeamuserControllerTest do
use TodolistWeb.ConnCase
import Todolist.SchemaFixtures
alias Todolist.Schema.Teamuser
@create_attrs %{
}
@update_attrs %{
}
@invalid_attrs %{}
setup %{conn: conn} do
{:ok, conn: put_req_header(conn, "accept", "application/json")}
end
desc... |
0c70293aa20cd0c6e5baf1d3f08b6c24f6e17c46 | 3,869 | [
1005339406
] | [
"liveview",
"test"
] | defmodule DeeperHubWeb.AchievementLiveTest do
use DeeperHubWeb.ConnCase
import Phoenix.LiveViewTest
import DeeperHub.HubFixtures
@create_attrs %{name: "some name", description: "some description", points: 42, icon: "some icon"}
@update_attrs %{name: "some updated name", description: "some updated descriptio... |
0c70473f37df5ac0b72a7fac506ae6070e378a77 | 4,642 | [
952251447
] | [
"phoenix"
] | defmodule TalentWeb.Router do
use TalentWeb, :router
import TalentWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {TalentWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
p... |
0c70c6746633778739a69752fdab9bcaa30db9ef | 1,972 | [
45871879
] | [] | defmodule Toolbox.PackageSync.FetchUpdates do
def fetch(client) do
newest_in_db = Toolbox.Package.newest_hex_updated_at_with_names
# Let's not parallelize this. It's fast enough at the time of writing, and there is also rate limiting.
fetch_page(client, 1, newest_in_db)
end
defp fetch_page(client, p... |
0c7111e38ff417bb8fd59bb2eafd46c1a99caab7 | 3,634 | [
183124357
] | [
"documented",
"ecto"
] | defmodule Garena.Component do
@moduledoc """
The Component context.
"""
import Ecto.Query, warn: false
alias Garena.Repo
alias Garena.Component.Arena
@doc """
Returns the list of arenas.
## Examples
iex> list_arenas()
[%Arena{}, ...]
"""
def list_arenas do
Repo.all(Arena) |> ... |
0c71b33c8e36b67cfb2bd5e2537cec8b55460ae2 | 12,540 | [
700271874
] | [
"typespec",
"documented"
] | defmodule Diesel.Tag.Validator do
@moduledoc """
Helper module that validates a tag against a schema.
Validation of tags is only available for structured tags, and is applied right after tag parsing
and before code generation.
"""
@doc """
Validates the given node, against the given schema
"""
@spec... |
0c71ce3153203dc578cf071ec515149f332ffcb2 | 2,609 | [
853420917
] | [] | # This file is responsible for configuring your umbrella
# and **all applications** and their dependencies with the
# help of the Config module.
#
# Note that all applications in your umbrella share the
# same configuration and dependencies, which is why they
# all use the same configuration file. If you want different... |
0c729b842e9d809daeed8fe059946275ef783610 | 2,053 | [
869143224
] | [
"test",
"ecto"
] | defmodule Timemanager.UsersTest do
use Timemanager.DataCase
alias Timemanager.Users
describe "users" do
alias Timemanager.Users.User
import Timemanager.UsersFixtures
@invalid_attrs %{username: nil, role: nil, email: nil}
test "list_users/0 returns all users" do
user = user_fixture()
... |
0c72bb30cb1bb9ec450f65fb2b0a1147e39ffe5f | 1,503 | [
805463397
] | [
"liveview",
"phoenix"
] | defmodule MomentumHqWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :momentum_hq
# 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: "_mo... |
0c72debc6880adb0640f84dd63c0fc930e9f4933 | 1,549 | [
40358923
] | [] | defmodule Retriever do
defp process_float(parsed) do
case parsed do
{ amount, _ } when amount < 0 -> { :error, "No negatives allowed!. Try again." }
{ amount, "" } -> { :ok, amount }
{ _, _ } -> { :error, "You must enter a float. Try again." }
:error -> { :error, "You didn't enter a vali... |
0c73fad7b29fe4753cdaf751c26cb7d303fe6c87 | 14,002 | [
434213689
] | [
"test"
] | #import ExUnit.Assertions
#filename = "input/day14-super-simple.txt"
#filename = "input/day14-simple.txt"
filename = "input/day14-real.txt"
defmodule Day14 do
def split_str_to_tuple(s, pattern), do: String.split(s, pattern, trim: true) |> List.to_tuple()
def split_str_to_int(s, pattern), do: String.split(s, pattern... |
0c7417512c59273759b667ef71e7abc2b40f20a6 | 9,067 | [
578860487
] | [
"typespec",
"documented"
] | defmodule GitHub.PullRequest do
@moduledoc """
Provides struct and types for a PullRequest
"""
use GitHub.Encoder
@type minimal :: %__MODULE__{
__info__: map,
base: GitHub.PullRequest.Base.minimal(),
head: GitHub.PullRequest.Head.minimal(),
id: integer,
numbe... |
0c74453a3e6ea7eef26f2ba3b3bbb38aae4b1f5b | 1,727 | [
285683543
] | [
"documented",
"ecto"
] | defmodule Restapi.Vehicles do
@moduledoc """
The Vehicles context.
"""
import Ecto.Query, warn: false
alias Restapi.Repo
alias Restapi.Vehicles.Brand
@doc """
Returns the list of brands.
## Examples
iex> list_brands()
[%Brand{}, ...]
"""
def list_brands do
Repo.all(Brand)
e... |
0c7456802d83f995813741d70724fd54b1ac035a | 4,525 | [
132715449
] | [] | defmodule Microsoft.Azure.Storage.ContainerLease do
import Microsoft.Azure.Storage.RequestBuilder
alias Microsoft.Azure.Storage.{Container}
# "x-ms-lease-action" acquire/renew/change/release/break
# "x-ms-lease-id" Required for renew/change/release
# "x-ms-lease-break-period" optional 0..60
# "x-ms-le... |
0c75810a8945b5563b770231ab586dcb3b1abf3d | 2,483 | [
148445789
] | [
"documented",
"ecto"
] | defmodule Hasbihal.Users.User do
@moduledoc false
use Ecto.Schema
use Arc.Ecto.Schema
import Ecto.Changeset
alias Comeonin.Bcrypt
schema "users" do
field(:email, :string)
field(:confirmed_at, :naive_datetime)
field(:name, :string)
field(:summary, :string)
field(:location, :string)
... |
0c7581920c8976be230b0079307a44dfff61e717 | 3,009 | [
318392779
] | [] | defmodule Aoc.Day16 do
@input Path.join([__DIR__, "..", "..", "..", "inputs", "day16.txt"])
def run_part_1 do
input = read_input()
input.nearby_tickets
|> List.flatten()
|> Enum.reject(fn value ->
Enum.any?(input.rules, fn {_field, ranges} ->
Enum.any?(ranges, &(value in &1))
e... |
0c75a9a16c35dd7f944f00415c8e970014796a15 | 7,045 | [
970817672
] | [
"phoenix",
"ecto"
] | # Database Migration for Calendar System (Only existing table references)
# priv/repo/migrations/20250718_create_calendar_system.exs
defmodule Frestyl.Repo.Migrations.CreateCalendarSystem do
use Ecto.Migration
def change do
# Calendar Events - Core event storage
create table(:calendar_events, primary_key:... |
0c7615cd50bfe02a058c71b5cc874f27e9034756 | 9,175 | [
156634783
] | [
"typespec",
"supervisor",
"documented"
] | defmodule Cables do
@moduledoc """
Asynchronous multiplexed HTTP/2 connection manager.
Create a new Cable using `Cable.new/2`. Cables will immediately open `min_connections` specified in the profile.
## Examples
{:ok, cable} = Cables.new("https://nghttp2.org/")
{:ok, %Cables.Response{status: 200}}... |
0c76792c099a14473178b745137ea12c780786b9 | 2,540 | [
16328245
] | [] | defmodule Hexpm.Store.GCS do
import SweetXml, only: [sigil_x: 2]
require Logger
@behaviour Hexpm.Store.Behaviour
@gs_xml_url "https://storage.googleapis.com"
def list(bucket, prefix) do
list_stream(bucket, prefix)
end
def get(bucket, key, _opts) do
url = url(bucket, key)
case Hexpm.HTTP.r... |
0c76a169b583cc55a17c5bc345b464a65ab02da6 | 1,765 | [
714717237
] | [
"documented",
"ecto"
] | defmodule Primeiro.Prom do
@moduledoc """
The Prom context.
"""
import Ecto.Query, warn: false
alias Primeiro.Repo
alias Primeiro.Prom.Tarefa
@doc """
Returns the list of tarefa.
## Examples
iex> list_tarefa()
[%Tarefa{}, ...]
"""
def list_tarefa do
Repo.all(Tarefa)
end
... |
0c76b226edbc7d91bdcfa0855d6973a00cf80690 | 4,072 | [
524633868
] | [
"phoenix",
"ecto"
] | defmodule HetProjectWeb.ProgramController do
use HetProjectWeb, :controller
alias HetProject.ProgramContext
alias HetProject.ProgramContext.Program
alias HetProject.ExerciseContext
#alias HetProject.ExerciseContext.Exercise
#alias HetProject.Repo
def index(conn, _params) do
programs = ProgramConte... |
0c76bba77ee142a10bdc31704ec3617baeebec02 | 6,743 | [
50263476,
164176994,
55212359
] | [
"typespec",
"documented"
] | defmodule Timex.Format.DateTime.Formatters.Default do
@moduledoc """
Date formatting language used by default by the `DateFormat` module.
This is a novel formatting language introduced with `DateFormat`. Its main
advantage is simplicity and usage of mnemonics that are easy to memorize.
## Directive format
... |
0c771437f518371078744348eb55016b769d0762 | 3,451 | [
903999320
] | [
"documented"
] | defmodule Jido.Agent.Server.Sensors do
@moduledoc false
use ExDbug, enabled: false
@doc """
Builds sensor configuration by injecting the agent pid into sensor targets and preparing child specs.
## Parameters
- state: Current server state
- opts: Configuration options containing sensor specs
- agent_pi... |
0c77ffcff2da928743eed3326ede71480dc5279e | 1,549 | [
57306544
] | [
"test"
] | defmodule TrueStoryTest do
use ExUnit.Case
use TrueStory
defp add_to_map(c, key, value),
do: Map.put(c, key, value)
story "flat story" do
assert :erlang.phash("", 1) == 1
end
story "adding to a map", c
|> add_to_map(:key, :value),
verify do
assert c.key == :value
refute c.key == :no... |
0c780c22e48bdd5468c8ea0e8d0ae21aefb78fc4 | 3,146 | [
352169809
] | [
"liveview",
"ecto"
] | defmodule PentoWeb.ProductLive.FormComponent do
use PentoWeb, :live_component
alias Pento.Catalog
@impl true
def update(%{product: product} = assigns, socket) do
changeset = Catalog.change_product(product)
{:ok,
socket
|> assign(assigns)
|> assign(:changeset, changeset)
|> allow_... |
0c788bd90920231944e15924d84f261e84f6a976 | 1,681 | [
141675073
] | [] | defmodule Ikasumi do
alias Ikasumi.{Client, Request, Cognito}
alias Ikasumi.Request.Signer
def request(%Request{} = request, %Client{} = client, options \\ []) do
request = request
|> Request.encode!(:payload)
|> Signer.sign_v4(client, options)
url = Request.url(client, request)
url = if len... |
0c78db49a281e79536d7c27d860bda654dad16b6 | 3,438 | [
836634467
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule GlammWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, components, channels, and so on.
This can be used in your application as:
use GlammWeb, :controller
use GlammWeb, :html
The definitions below will be executed for every controller,
compon... |
0c78f3200970326edd82811ccd01a5492f45da50 | 15,164 | [
736995914
] | [
"documented"
] | defmodule SillySeahorse.Adjective do
@moduledoc false
@adjectives {
"able",
"absolute",
"abundant",
"academic",
"accurate",
"aching",
"acidic",
"active",
"actual",
"adept",
"admired",
"adorable",
"adored",
"advanced",
"afraid",
"aged",
"agile",
... |
0c78feb5c9ae6dd3795bc7e8f338bb2f9ab006a4 | 2,788 | [
646103364
] | [
"typespec",
"documented"
] | defmodule Redis.Stream do
@moduledoc """
Module definition for redis streams
"""
alias Redis.Client
alias Redis.Stream
require Logger
@type since :: binary() | non_neg_integer()
@type until :: binary() | non_neg_integer()
@type response :: {:ok, [Stream.Entry.t()]} | {:error, :stream_parse_error}
... |
0c7937911d6e8ece0996abad6198598b23c1a5a3 | 1,981 | [
167046908
] | [
"typespec"
] | defmodule Ten do
# Vi skall implementera en funktion fizzbuzz/1 som givet ett tal n ≥ 0 returnerar en lista av de n första elementen i zzbuzz-serien. Fizz-Buzz går till
# så att man räknar från 1 till n men byter ut all tal som är delbara med 3
# mot :fizz, alla tal som är delbara med 5 med :buzz och all tal so... |
0c79553b0b46ad2e4bae6fd285c36602605657ea | 1,822 | [
134136100
] | [
"phoenix",
"ecto"
] | defmodule YamatoWeb.StoryController do
use YamatoWeb, :controller
alias Yamato.Stories
alias Yamato.Stories.Story
plug(YamatoWeb.Plugs.CheckAuth when action in [:new, :create, :edit, :update, :delete])
def index(conn, _params) do
stories = Stories.list_stories()
render(conn, "index.html", stories: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.