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 |
|---|---|---|---|---|
074173da6e28ec135a85e9efec86f6cbf0fd0852 | 8,164 | [
776253833
] | [
"test"
] | defmodule InvarcWeb.InvestmentsControllerTest do
use InvarcWeb.ConnCase, async: true
alias Invarc.Investments.Changesets.TransactionChangesets
alias Invarc.Investments.Loaders.{TransactionLoaders, WalletLoaders}
alias InvarcWeb.Security.Guardian
setup ctx do
acc =
insert(:account,
email: "... |
0741b605cda22fdd053ffc41a337378d4749d1c3 | 2,245 | [
550548598
] | [
"typespec",
"liveview",
"documented"
] | defmodule LivebookWeb.SessionHelpers do
import Phoenix.LiveView
alias Phoenix.LiveView.Socket
alias Livebook.Session
alias LivebookWeb.Router.Helpers, as: Routes
@doc """
Creates a new session, redirects on success,
puts an error flash message on failure.
Accepts the same options as `Livebook.Session... |
0741f5fc5ee126da917d9d2060a6c6992823a7da | 1,662 | [
112877497
] | [
"phoenix"
] | defmodule RealWorldWeb.ProfileController do
use RealWorldWeb, :controller
use Guardian.Phoenix.Controller
alias RealWorld.Accounts.{Users, User}
action_fallback RealWorldWeb.FallbackController
plug Guardian.Plug.EnsureAuthenticated, %{handler: RealWorldWeb.SessionController} when action in [:follow, :unfol... |
074214c907f42d8a60ac017ed0934261079d1aa9 | 4,878 | [
84937151
] | [
"typespec",
"documented"
] | defmodule LoggerJSON.Formatter.RedactorEncoder do
@doc """
Takes a term and makes sure that it can be encoded by the encoder without errors
and without leaking sensitive information.
## Encoding rules
Type | Encoding | Redaction
-------------------... |
0742b20332fad33a1b438e11d323a301800683cd | 2,844 | [
298526464
] | [
"documented"
] | defmodule AppExample.Http do
@moduledoc """
ref: https://blog.appsignal.com/2019/01/22/serving-plug-building-an-elixir-http-server.html
decoding requests and encoding responses
accept HTTP requests and run a Plug application.
mix run --no-halt 运行 application
a server : like cowboy
"""
require Log... |
07431401469c0cd8c626457939600cac46a178a9 | 5,025 | [
663120382
] | [
"documented",
"ecto"
] | defmodule DidServer.Identities.Key do
use Ecto.Schema
import Ecto.Changeset
require Logger
alias __MODULE__
@primary_key false
schema "keys" do
field :did, :string, primary_key: true
field :method, :string
field :current_user_id, :integer, virtual: true
# Password authentication
field... |
07432e19e29454276c89f0284d6bc7741aa684b5 | 5,363 | [
479883934
] | [
"liveview"
] | defmodule CollaborlistWeb.Live.InviteModal do
use CollaborlistWeb, :live_component
alias Collaborlist.Invites
alias Collaborlist.Account
alias Collaborlist.Catalog
alias Phoenix.LiveView.JS
@defaults %{
left_button: "Cancel",
left_button_action: nil,
left_button_param: nil,
right_button: ... |
074341e1722a116edacbc5a02e5b4f704912632a | 1,816 | [
174680350
] | [
"test"
] | defmodule Pipelines.ValidateTest do
use ExUnit.Case, async: false
@valid %{
title: "title",
author: "data"
}
@invalid_missing %{
title: "title"
}
@invalid_nil %{
title: "title",
author: nil
}
test "Returns item unchanged when has required fields" do
Application.put_env(:crawly,... |
074346e0c88afd8b70fe24cc94faa4711a2ce8ec | 1,805 | [
145523365
] | [
"documented"
] | defmodule GigsHunt.Resolver.Wallet do
alias GigsHunt.Repo
alias GigsHunt.Wallets
# private functions
@doc """
create Wallet for user
"""
defp create_wallet(wallet_params, user_id) do
wallet_changeset= Wallets.changeset(%Wallets{user_id: user_id}, wallet_params)
case Repo.insert(wallet_changese... |
07436a12246846c649cda3394ca0cad594c4d786 | 2,081 | [
643793653
] | [
"test"
] | defmodule PieceTable.ChangeTest do
use ExUnit.Case
doctest PieceTable.Change
alias PieceTable.Change
describe "new/3" do
test "works" do
assert {:ok, %Change{change: :ins, text: "ciao", position: 4, blame: "bob"}} =
Change.new(:ins, "ciao", 4, "bob")
end
test "fails with wron... |
07437a48a94314524b0340443a8861d2a2a6f22a | 4,644 | [
180459464
] | [
"documented",
"ecto"
] | defmodule Spur do
@moduledoc """
Simple activity tracking for Ecto-backed Elixir apps.
"""
alias Spur.{Activity, Trackable}
alias Ecto.{Multi}
@doc """
Inserts the given Struct and an `Spur.Activity` record.
## Examples
iex> result = Spur.insert(%SpurTest.TrackableStruct{user: %SpurTest.AppUs... |
07438998342d01d31983aea0712deb0945e9c905 | 2,762 | [
239822890,
419435907,
459291087
] | [
"liveview"
] | defmodule OliWeb.Components.LiveModal do
use Phoenix.LiveComponent
def mount(socket) do
{:ok, assign(socket, :show, false)}
end
def update(assigns, socket) do
{:ok,
assign(
socket,
Map.merge(assigns, %{
title: assigns[:title] || nil,
class: assigns[:class] || "",
... |
074471fa0acde3e2a2b205e251b66e4dffb04cb3 | 2,259 | [
44888889
] | [
"test"
] | defmodule MessageApi.V1.MessageControllerTest do
use MessageApi.ConnCase
alias MessageApi.V1.Message
@valid_attrs %{message: "some content", user_id: 42}
@invalid_attrs %{}
setup do
conn = conn() |> put_req_header("accept", "application/json")
{:ok, conn: conn}
end
test "lists all entries on in... |
074563544d19ecb34fcd4ced67ffe1522010cbe8 | 2,240 | [
854313489
] | [
"genserver"
] | defmodule MagusLive.SemanticSearch do
use GenServer
alias MagusLive.SemanticSearch.Document
# Default dimensions for OpenAI embeddings
# TODO: Make these all configurable later
@dimensions 1536
@max_elements 100
@search_default_results 5
# Client
def start_link() do
GenServer.start_link(__MODU... |
074594b747dc6671ec5789ee0de23908956cdce1 | 2,416 | [
103117158
] | [
"phoenix"
] | defmodule Perseids.PaymentController do
use Perseids.Web, :controller
alias Perseids.Order
def payu_notify(conn, %{"order" => %{"extOrderId" => order_id, "status" => status, "currencyCode" => currency}} = _params) do
%{"signature" => signature} = Regex.named_captures(~r/signature=(?<signature>.{32})/, conn |... |
07459543b8d2b7a6f055e10ab40aaaf65c7627cb | 2,726 | [
573324865
] | [] | #!/usr/bin/env elixir
defmodule Matrix do
def traverse(matrix, start) do
visit(matrix, start, 0, MapSet.new(), [])
end
def visit(matrix, {i, j} = point, depth, visited, lengths) do
if matrix |> at(point) == ?E do
IO.puts("Found new way of length #{depth}")
{visited, [depth | lengths]}
el... |
0745dc376cb596a074231c63d2fbc103aef0fe67 | 16,095 | [
800182948
] | [
"liveview",
"documented"
] | defmodule BudgetTrackerWeb.Components.Drawer do
@moduledoc """
The `BudgetTrackerWeb.Components.Drawer` module provides a flexible and customizable drawer component
for use in Phoenix LiveView applications.
## Features:
- **Positioning:** Drawers can be positioned on the left, right, top, or bottom of the sc... |
0746140ae5df1ee3f67906b0adf0027d49f766ba | 2,217 | [
614869745
] | [
"liveview"
] | defmodule VejperWeb.Admin.CategoryAssociateFieldsComponent do
use VejperWeb, :live_component
alias Vejper.Store
@impl true
def render(assigns) do
~H"""
<div class="grid grid-cols-5 rounded gap-2 ">
<ul
id="dropzone-left"
phx-hook="Dropzone"
phx-target={@myself}
cl... |
07466782959bc2adb129bb1280eaa1e3620ed1c7 | 3,132 | [
1015787279
] | [] | import Config
# Configure your database
config :home_ware, HomeWare.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "home_ware_dev",
port: 5433,
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
# For development, we disable any cache and... |
0746c6f1008d5b48d16fe91cc6d01c6acaa70198 | 7,550 | [
912415046
] | [
"test"
] | defmodule Handan.Purchasing.PurchaseOrderTest do
use Handan.DataCase
import Handan.Infrastructure.DecimalHelper, only: [decimal_add: 2]
alias Handan.Turbo
alias Handan.Dispatcher
alias Handan.Purchasing.Projections.PurchaseOrder
alias Handan.Stock.Projections.StockItem
describe "create purchase order" ... |
0746ec79ed2dc669e4bd3c3473ac1d8524e01392 | 10,607 | [
997730042
] | [
"test"
] | # test/critical_issues_test_suite.exs
# This file runs all the critical issue tests to verify the Layer 3 implementation
# Run with: mix test test/critical_issues_test_suite.exs
defmodule JsonRemedy.CriticalIssuesTestSuite do
use ExUnit.Case
@moduletag :critical_issues
describe "Critical Issues Test Suite Ove... |
0746fd7ff12a202bcb3d87105b67a952a6888882 | 1,510 | [
749382617
] | [
"genserver",
"liveview"
] | defmodule MmoaigWeb.TrainingMatchLive.Show do
alias Mmoaig.Matches.Runner
use MmoaigWeb, :live_view
alias Mmoaig.Matches
alias Mmoaig.Matches.Match
alias Mmoaig.Matches.Gateway
def mount(_params, _session, socket) do
{:ok, socket}
end
def handle_params(%{"id" => id} = params, _uri, socket) do
... |
07473f9cb5cc85ecead72c502b7e10e1e18e6b77 | 1,835 | [
147641673,
194872187,
197923173,
167625143,
142050122
] | [
"test"
] | if !System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("secret_handshake.exs", __DIR__)
end
ExUnit.start()
# ExUnit.configure(trace: true, exclude: :pending)
defmodule SecretHandshakeTest do
use ExUnit.Case
describe "Create a handshake for a number" do
# @tag :pending
test "wink for 1" do
... |
07474c80ef480b77e5eb3668127f675008c7b5ed | 1,508 | [
288007602
] | [] | defmodule Day14 do
def calc(input) do
input
|> String.split("\n", trim: true)
|> Enum.chunk_by(fn x -> String.starts_with?(x, "mask") end)
|> do_calc(%{})
end
defp do_calc([], results) do
results
|> Map.values
|> Enum.sum
end
defp do_calc(in... |
0748b55d74fb548870a317ce0896a5043fddfe7d | 2,026 | [
305563598
] | [
"macro",
"documented",
"phoenix"
] | defmodule DeliveryCenterTestWeb 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 DeliveryCenterTestWeb, :controller
use DeliveryCenterTestWeb, :view
The definitions below will be execut... |
0749384e41c6eb3c843f5652a1eee6482c832c8f | 3,901 | [
524779715
] | [
"documented"
] | defmodule AtomicWeb.Schema do
@moduledoc """
Definition of the absinthe graphql schema.
This is the starting point for the graphql api definition
"""
use Absinthe.Schema
alias Atomic.ProjectManagement
import_types AtomicWeb.Schema.Types
import_types Absinthe.Type.Custom
def context(ctx) do
loa... |
07497861a79423a157ce5f3ead5b72545a792950 | 9,468 | [
372499099
] | [
"typespec",
"documented"
] | defmodule Kino.Bridge do
@moduledoc false
import Kernel, except: [send: 2]
# This module encapsulates the communication with Livebook
# achieved via the group leader. For the implementation of
# that group leader see Livebook.Evaluator.IOProxy
@type request_error :: {:request_error, :unsupported | :termi... |
0749ad903f1954bf1731d020019673c558410580 | 3,086 | [
94802536
] | [
"typespec",
"documented"
] | defmodule ExWire.Packet do
@moduledoc """
Packets handle serializing and deserializing framed packet data from
the DevP2P and Eth Wire Protocols. They also handle how to respond
to incoming packets.
"""
alias ExWire.Packet
@type packet ::
Packet.Hello.t()
| Packet.Disconnect.t()
... |
0749dde511866bf49e2e48393acc1ab363371694 | 2,218 | [
492823415
] | [] | import Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :oceanconnect, OceanconnectWeb.Endpoint,
http: ... |
0749e1ecc7f4194313c537a40c2e82f9db5dafaa | 2,091 | [
753317823
] | [
"typespec",
"documented"
] | defmodule B3.DTO.OperationDTO do
@moduledoc false
@derive Jason.Encoder
defstruct [:ticker, :date, :time, :price, :amount]
@time_regex ~r"(?<hour>\d{2})(?<minute>\d{2})(?<second>\d{2})"
@type t :: %{
ticker: String.t(),
date: String.t(),
time: String.t(),
price: Stri... |
074a06099dc3e97d0a7d288ccb453b02beaf0cfb | 2,851 | [
758006228
] | [
"documented"
] | defmodule Measure do
@moduledoc"""
Módulo Measure, Módulo para estudiar tiempos sobre operaciones sobre listas
"""
@doc"""
run, Dado una lista de funciones, un entero "n" genera una lista de tamaño "n"
la cual es aplicada toda la lista de funciones y devuleve un resumen de los tiempos de dicha... |
074a2c5b9d76b453c929e78551114036358af333 | 5,977 | [
136744142
] | [
"documented",
"ecto"
] | defmodule FilixPersistence do
@moduledoc """
Responsible for all Database (e.g. Ecto/Postgres) interaction for Filix.
This module contains functions for CRUD actions against the database.
It shouldn't be used directly unless for dataloading legacy files or seeding.
A separate application should be used for... |
074a69b00c3c67f2fc0ec789e6e90a44d8231349 | 1,734 | [
815053845
] | [
"documented"
] | defmodule ExLogto.Client do
@moduledoc false
alias ExLogto.{ClientConfig, Core}
@doc """
Signs in the user and returns the sign-in URI.
The `redirect_uri` here is the redirect uri in our app
"""
def sign_in(redirect_uri, code_challenge, code_verifier, state) do
signin_options = ClientConfig.signin_o... |
074a8e195577cbada3c2fc3f5d31544200e7810a | 1,505 | [
456348534
] | [
"test"
] | defmodule Pickle.PPAParserTest do
use ExUnit.Case
describe "Scrapes the tournaments correctly - PPA" do
test "works" do
tournaments =
[File.cwd!(), "scrappable_html", "ppa_schedule.html"]
|> Path.join()
|> File.read!()
|> Pickle.PPAParser.call()
assert Enum.count(to... |
074aa6c8b49a3f74ec699cf7e2c3c59d1c636c35 | 4,708 | [
895963632
] | [
"documented"
] | defmodule Aoc.Day23 do
@moduledoc """
Day 23 solutions
https://adventofcode.com/2024/day/23
"""
def execute_part_1(data \\ fetch_data()) do
data
|> parse_input()
|> find_connection_sets()
|> Enum.map(&get_nodes/1)
|> deduplicate()
|> Enum.flat_map(&into_sets(&1, 3))
|> deduplicate(... |
074ab15a9bbe8485c246f25312e0d5876d140f8c | 2,080 | [
986617386
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
# General application configuration
import Config
config :ai_social_backend,
ecto_repos: [AiSocialBac... |
074b2f341890d83c359a7bb095f181e39d76957f | 3,989 | [
776098680
] | [
"typespec",
"documented"
] | defmodule Kubereq.Kubeconfig do
@moduledoc """
This is the `Pluggable.Token` for the pipeline loading the Kubernetes config.
The Kubeconfig represents the configuration to establish a connection to
the Kubernetes cluster. It contains informations like endpoint, certificates,
user authentication details etc.
... |
074bda777aba15d5639f1eb8f96aebe7591d01b4 | 2,274 | [
37360779
] | [
"documented"
] | defmodule Alkyl.PadData.Pool do
defstruct numToAttrib: %{}, nextNum: 0
alias __MODULE__
@doc """
Unifying the attribute identifiers of a changeset's pool (chs_pool) to
those of the pool of the pad (exs_pool) resp. adding not yet present
attributes to the existing pool (with new ids for both pools).
... |
074c9f8dbb2dac69aea41311d41c8c0416830c5c | 1,746 | [
225510851
] | [
"documented"
] | defmodule Day13 do
@doc """
iex> Day13.part1()
372
"""
def part1(), do: run() |> elem(0) |> Enum.count(fn {_, val} -> val == 2 end)
@doc """
iex> Day13.part2()
19297
"""
def part2(), do: run(2) |> elem(1)
def run(quarters \\ 1) do
[_ | program] = Parser.int_list("input13.txt", ",")
spawn... |
074d33cdaa0a3c73e9ba40c468aacd0d125da12a | 1,778 | [
425787113
] | [
"phoenix"
] | defmodule TimemanagerWeb.ClocksController do
use TimemanagerWeb, :controller
alias Timemanager.ClocksManagement
alias Timemanager.ClocksManagement.Clocks
action_fallback TimemanagerWeb.FallbackController
# def index(conn, _params) do
# clocks = ClocksManagement.list_clocks()
# render(conn, "index.j... |
074dde95397fce8ae8caff65e1e0a8a22825f6ce | 1,985 | [
485556914
] | [] | defmodule DevChallenge.MixProject do
use Mix.Project
def project do
[
app: :dev_challenge,
version: "0.1.0",
elixir: "~> 1.7",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: ali... |
074e11f6314ba4a767cc2dfa83ed53c8906b3de3 | 1,799 | [
117984890
] | [
"phoenix",
"ecto"
] | defmodule FtcMembersWeb.MemberController do
use FtcMembersWeb, :controller
alias FtcMembers.Accounts
alias FtcMembers.Accounts.Member
def index(conn, _params) do
members = Accounts.list_members()
render(conn, "index.html", members: members)
end
def new(conn, _params) do
changeset = Accounts.c... |
074f1b3fad0b88eca9efe48f001059b0b315a5e3 | 10,276 | [
711862705
] | [
"liveview",
"phoenix",
"test"
] | defmodule CharacterSheetWeb.PlayerAuthTest do
use CharacterSheetWeb.ConnCase, async: true
alias Phoenix.LiveView
alias CharacterSheet.Accounts
alias CharacterSheetWeb.PlayerAuth
import CharacterSheet.AccountsFixtures
@remember_me_cookie "_character_sheet_web_player_remember_me"
setup %{conn: conn} do
... |
074f4e6a498011f88ae3c3c98a1528f813775e11 | 13,436 | [
584731460
] | [
"genserver",
"test",
"phoenix"
] | defmodule FedecksServer.SocketTest do
use ExUnit.Case
alias FedecksServer.{Socket, FedecksHandler}
defmodule FullHandler do
@behaviour FedecksHandler
@impl FedecksHandler
def handle_in(device_id, %{"talk to" => "me"}) do
{:reply, "#{device_id} term wat?"}
end
def handle_in(device_id,... |
074fb9e20c297111c80c4ef6969c463a92832d3f | 1,741 | [
76139068
] | [
"documented"
] | defmodule Api.Schema.Types do
@moduledoc false
use Absinthe.Schema.Notation
object :user do
field :id, :id
field :name, :string
field :workouts, list_of(:workout) do
arg :limit, :integer
arg :offset, :integer
resolve &Api.Resolvers.WorkoutResolver.list/2
end
field :workout_c... |
075040488352a5abd29ff45d650e885a95c7b70d | 1,607 | [
307733199
] | [
"macro",
"liveview"
] | defmodule GameServerWeb.LiveHelpers do
import Phoenix.LiveView
alias GameServer.Users.UserRegistry
require Logger
def assign_defaults(socket, %{"username" => username} = session) do
with {:ok, user} <- UserRegistry.get_user(username) do
Logger.debug("Setting assign current_user from username (#{us... |
075053239df5c4b76ffd6a6c8698a4b74f4509b1 | 1,783 | [
995630008
] | [
"test",
"phoenix"
] | defmodule GewitnesWeb.AuthSocketTest do
use GewitnesWeb.ChannelCase
import ExUnit.CaptureLog
alias GewitnesWeb.AuthSocket
defp generate_token(id, opts \\ []) do
salt = Keyword.get(opts, :salt, "salt identifier")
Phoenix.Token.sign(GewitnesWeb.Endpoint, salt, id)
end
describe "connect/3 success" do... |
075060099235a88532cb01efdf4f62f10a017e6a | 2,039 | [
962529983,
1017248001,
1002277727,
1017741371,
1019465249,
1010134902,
1008010336,
1018026088,
936927438,
1008064659,
1013128869,
929037144,
1008054178,
981784524,
1011444481,
981152162,
993081259,
959201671,
1000365083,
1014978820,
1018310553,
955910071,
1007788828,
97... | [] | defmodule Postgrex.Mixfile do
use Mix.Project
@source_url "https://github.com/elixir-ecto/postgrex"
@version "0.20.0"
def project do
[
app: :postgrex,
version: @version,
elixir: "~> 1.11",
deps: deps(),
name: "Postgrex",
description: "PostgreSQL driver for Elixir",
... |
075135aa7b335ffeabf7616b0748814bf03b6bbe | 1,781 | [
205302020
] | [
"typespec",
"documented"
] | defmodule OcrNumbers do
@doc """
Given a 3 x 4 grid of pipes, underscores, and spaces, determine which number is represented, or
whether it is garbled.
"""
@spec convert([String.t()]) :: {:ok, String.t()} | {:error, String.t()}
def convert(input) do
numbers =
input
|> Enum.chunk_every(4, 4,... |
07513cdc2e0b1cc0b403e6feecad74dd3ba9a7c7 | 1,629 | [
470508032
] | [
"documented",
"ecto"
] | defmodule Offsync.AccessLog do
@moduledoc """
The AccessLog context.
"""
import Ecto.Query, warn: false
alias Offsync.AccessLog.Entry
alias Offsync.Repo
@doc """
Returns the list of entries.
## Examples
iex> list_entries()
[%Entry{}, ...]
"""
def list_entries do
Repo.all(Entr... |
0751a6870b310b5651c3986ba57ed0bf28d246e2 | 15,120 | [
746354157
] | [
"genserver",
"typespec",
"liveview",
"documented"
] | defmodule TwitchEventSub.WebSocket.Client do
@moduledoc false
use WebSockex
alias TwitchEventSub.Subscriptions
require Logger
@opaque state :: %{
optional(:user_id) => %{},
optional(:conditions) => %{},
auth_store: TwitchAPI.AuthStore.name() | pid(),
channel_... |
0751b469810fa8c34e67552634a181bc6a039bfd | 6,006 | [
106712767
] | [
"test"
] | defmodule Sanbase.Alert.TriggerPayloadTest do
use Sanbase.DataCase, async: false
import Sanbase.Factory
alias Sanbase.Alert.{UserTrigger, Scheduler}
alias Sanbase.Alert.Trigger.MetricTriggerSettings
setup do
Sanbase.Cache.clear_all(:alerts_evaluator_cache)
user =
insert(:user,
email:... |
0751f6d5e40bd6768b9d6bbe9e6423a72308b4c7 | 1,586 | [
260121073
] | [
"test"
] | defmodule HackAssembler.SymbolTableTest do
use ExUnit.Case
alias HackAssembler.SymbolTable
describe "creating a new symbol table" do
test "returns a SymbolTable with predefined symbols" do
expected_symbols = %{
"R0" => 0,
"R1" => 1,
"R2" => 2,
"R3" => 3,
"R4" =>... |
075243f7af8e7f287d2d55e6f0ad492520e49ef3 | 1,641 | [
343379821
] | [
"liveview",
"ecto"
] | defmodule TechExperiments1Web.LVTEBallLive.FormComponent do
use TechExperiments1Web, :live_component
alias TechExperiments1.LVTE
@impl true
def update(%{lvte_ball: lvte_ball} = assigns, socket) do
changeset = LVTE.change_lvte_ball(lvte_ball)
{:ok,
socket
|> assign(assigns)
|> assign(:c... |
0752d0e0d8e4e077b14b7c07d577913ef7324c5f | 11,578 | [
402304399
] | [
"documented",
"ecto"
] | defmodule IndiePaper.Authors do
@moduledoc """
The Authors context.
"""
import Ecto.Query, warn: false
alias IndiePaper.Repo
alias IndiePaper.Authors.{Author, AuthorToken, AuthorNotifier}
alias IndiePaper.AuthorProfile
alias IndiePaper.ExternalAssetHandler
## Database getters
@doc """
Gets a a... |
0752f2b333dbd50199c99bdcac4d7e6ce6a369e5 | 1,658 | [
98528847
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Openlibrary.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Openlibrary.Web, :controller
use Openlibrary.Web, :view
The definitions below will be executed for every view,
controller, etc, so k... |
075350d7d29bc8890cce2d50c67ba48f0fbf6fdb | 8,565 | [
160612665
] | [
"documented"
] | defmodule Eosex.JsonRpc do
alias Eosex.Client
defmodule Wallet do
@moduledoc """
调用wallet的API,需要在本机或者服务器启动keosd服务。默认端口为8888,可以在启动时指定端口号。
"""
@doc """
创建钱包
Args:
* `wallet_name` - 钱包名称
"""
def create(endpoint, wallet_name) do
Client.request(endpoint <> "/v1/wallet/creat... |
07535f234270b72b58eb0ed7fd66c614183fc5a0 | 6,348 | [
155087628
] | [] | %{
"amqp": {:hex, :amqp, "1.0.3", "06a6d909abc71d82b7c3133ca491899ca18fce857d0697dd060c29de1ef498d8", [:mix], [{:amqp_client, "~> 3.7.3", [hex: :amqp_client, repo: "hexpm", optional: false]}, {:goldrush, "~> 0.1.0", [hex: :goldrush, repo: "hexpm", optional: false]}, {:jsx, "~> 2.8", [hex: :jsx, repo: "hexpm", optiona... |
07539222aec0b2cb80d3788fa502b4c4f5c1c36d | 4,983 | [
163277988
] | [
"macro",
"documented"
] | defmodule Prometheus.Model do
@moduledoc """
Helpers for working with Prometheus data model. For advanced users.
`Prometheus.Collector` example demonstrates how to use this module.
"""
use Prometheus.Erlang, :prometheus_model_helpers
@doc """
Creates Metric Family of `type`, `name` and `help`.
`colle... |
07539773bb2d1cf82ec23829ef89cb2bd735a178 | 3,559 | [
556763065
] | [] | defmodule Dispatcher do
use Matcher
define_accept_types [
html: [ "text/html", "application/xhtml+html" ],
json: [ "application/json", "application/vnd.api+json" ],
any: [ "*/*" ]
]
@html %{ accept: %{ html: true } }
@json %{ accept: %{ json: true } }
@any %{ accept: %{ any: true } }
# In or... |
0753f824304c1bb73ceac8bfafd5d38ac9fc0498 | 2,002 | [
45010992
] | [
"genserver",
"phoenix"
] | defmodule Usic.Model.Dispatcher do
use GenServer
require Logger
import Phoenix.Channel
alias Usic.Resource.State
def start_link() do
GenServer.start_link(__MODULE__, [], [name: __MODULE__])
end
def init(_args) do
{:ok, %{}}
end
def model_key(model) do
model.__struct__
|> Atom.to_str... |
07554ad8c0c107d6087ac91d0b5279421041591e | 4,430 | [
40109433
] | [
"test"
] | defmodule Ace.HTTP2.ClientTest do
use ExUnit.Case
alias Raxx.{Response}
alias Ace.HTTP2.{Client}
setup do
{:ok, client} = Client.start_link("http2.golang.org")
{:ok, %{client: client}}
end
test "sends correct request headers", %{client: client} do
request = Raxx.request(:GET, "/reqinfo")
... |
07554ed116fbddd3299ad1f5745215f138db798a | 3,821 | [
950747020
] | [] | defmodule Aoc2023.Day5 do
def parse_seeds(seed_line) do
seed_line
|> String.split(": ")
|> List.last()
|> String.split(" ")
|> Enum.map(&String.to_integer/1)
end
def parse_map(data) do
[types | tail] = String.split(data, "\n", trim: true)
types =
types
|> String.split(" "... |
07555811cd61067984606e15f7e9294b2003ef41 | 7,138 | [
879965838
] | [] | %{
"broadway": {:hex, :broadway, "1.2.1", "83a1567423c26885e15f6cd8670ca790370af2fcff2ede7fa88c5ea793087a67", [:mix], [{:gen_stage, "~> 1.0", [hex: :gen_stage, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.3.7 or ~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> ... |
07556ac89661ed8be78bbd1681fff4e3c8f96bb5 | 2,056 | [
705296334
] | [
"typespec",
"documented"
] | defmodule O11y.BaggageProcessor do
@moduledoc """
Adds any attributes stored in baggage in the current context to each span that is processed.
## Configuration
In your project's config.exs (or runtime.exs or w/e):
```elixir
config(:opentelemetry, :processors, [{O11y.BaggageProcessor, %{}}])
```
If th... |
0755aee92c6052805c5f758389b7e65210f129ee | 2,207 | [
47763923
] | [
"typespec",
"documented"
] | defmodule Alphametics do
defstruct [:addends, :sum, :nonzeros]
@type puzzle :: binary
@type solution :: %{required(?A..?Z) => 0..9}
@doc """
Takes an alphametics puzzle and returns a solution where every letter
replaced by its number will make a valid equation. Returns `nil` when
there is no valid soluti... |
075602604d5b1db596a0a5ee63f373c86c395554 | 2,433 | [
169627021
] | [
"test",
"phoenix"
] | defmodule ElixirTrelloWeb.ListControllerTest do
use ElixirTrelloWeb.ConnCase
alias ElixirTrello.Boards
alias ElixirTrello.Boards.List
@create_attrs %{
name: "some name"
}
@update_attrs %{
name: "some updated name"
}
@invalid_attrs %{name: nil}
def fixture(:list) do
{:ok, list} = Boards.... |
0756131b32d12cc7904fa3c4951b46fb235fbbd9 | 3,676 | [
680481530
] | [
"liveview",
"test"
] | defmodule AllThingsSocialWeb.TaskLiveTest do
use AllThingsSocialWeb.ConnCase
import Phoenix.LiveViewTest
import AllThingsSocial.TasksFixtures
@create_attrs %{
name: "some name",
status: "some status",
description: "some description",
price: "some price"
}
@update_attrs %{
name: "some u... |
07563baa4b272c2b2ed8991aa0a6a347d7366ece | 2,783 | [
224907590
] | [
"supervisor"
] | defmodule Fungifarm.Database.MongoImpl do
alias Fungifarm.Database.Impl
@behaviour Impl
@db :mongo
@config Application.get_env(:fungifarm, :mongo_conf)
@collection_prefix @config[:collection_prefix]
@readonly @config[:readonly]
def child_spec(_opts) do
%{
id: __MODULE__,
start: {__MODUL... |
07578e2db722e7bb19d937bccb43ed80fc4d654e | 1,570 | [
169135602
] | [
"typespec",
"macro",
"documented"
] | defmodule CivilCode.ValueObject.Date do
@moduledoc """
A value object based on a date.
"""
defmacro __using__(_) do
quote do
use CivilCode.ValueObject.Base
alias CivilCode.Result
typedstruct enforce: true do
field(:value, Date.t())
end
def new(value) when is_binary(... |
075887ad9048fb7fdb476c23d9df4bfde6602336 | 3,113 | [
450097775
] | [
"documented"
] | defmodule Estructura.Nested.Type.URI do
@moduledoc """
`Estructura` type implementation for handling `URI` values.
This type provides functionality for:
- Generating URI values for testing
- Coercing string and map inputs into URI structs
- Validating URI values
## Examples
Estructura.Nested.Type.URI... |
0758902be633093e7df685425a7bef80acc9ad74 | 11,405 | [
178082430
] | [
"phoenix",
"documented"
] | defmodule NodeMonitorWeb.NodesController do
use NodeMonitorWeb, :controller
require Logger
import Ecto.Query
alias NodeMonitor.{Repo, Nodes, BootEvents, DataLogs, StatusLogs}
alias NodeMonitor.Nodes.Node
alias NodeMonitor.BootEvents.{BootEvent, LatestBootEvent}
alias NodeMonitor.DataLogs.{DataLog, LatestD... |
07591ad287eb39ec641cfcac0f2b4862ee2d0d8c | 2,200 | [
203400176
] | [
"documented"
] | defmodule Cards do
@moduledoc """
Provides methods for creating and handling a deck of cards
"""
@doc """
Returns a list of strigs representing a deck of playing cards
"""
def create_deck do
values = ["Ace", "Two", "Three", "Four", "Five"]
suits = ["Spades", "Clubs", "Hearts", "Diamonds"]
... |
075952c9147792a4189e4b0c7af669f7577be657 | 5,557 | [
993009676,
989352999
] | [
"genserver",
"typespec",
"documented"
] | defmodule ElixirScope.ASTRepository.MemoryManager.Monitor do
@moduledoc """
Memory monitoring subsystem for tracking repository memory usage.
Provides real-time memory statistics and historical tracking
for the AST Repository system.
"""
use GenServer
require Logger
# ETS table for memory statistics
... |
07595c05e033437cf75201494d46f5e8b97dec19 | 2,168 | [
210976781
] | [
"test",
"ecto"
] | defmodule Database.DocumentTest do
use ExUnit.Case
use Database.Case
alias Database.{ Document, Fact, Id, Topic }
defp persistent_topic(label) do
topic = Topic.new(label)
Topic.persist(topic)
topic
end
describe "Given a transient topic" do
test "fetch/1 returns a :not_found error" do
... |
075ae6253e7b0359eb9c8184f9ff3b25d02ab68b | 7,584 | [
800182948
] | [
"typespec",
"liveview",
"documented"
] | defmodule BudgetTrackerWeb.Components.Gallery do
@moduledoc """
The `BudgetTrackerWeb.Components.Gallery` module provides a customizable gallery component for displaying
media content in a structured and visually appealing layout.
It supports various styles, including default, masonry, and featured galleries,
... |
075b2b24c10e0a32cc21c6bf4e6f6449da9a2844 | 2,149 | [
589535814
] | [] | defmodule Ockam.Services.MixProject do
use Mix.Project
@version "0.10.1"
@elixir_requirement "~> 1.10"
@ockam_github_repo "https://github.com/build-trust/ockam"
@ockam_github_repo_path "implementations/elixir/ockam/ockam_services"
def project do
[
app: :ockam_services,
version: @version,... |
075b7e7d8ecb9df6adfad6e1c44c22e1b4d0118e | 5,393 | [
421827398,
444592268,
880032973,
899995576,
575063579,
732735761,
260063278
] | [
"test",
"documented"
] | defmodule PatternMatching.GuardClausesTest do
@moduledoc """
Fix or complete the code to make the tests pass.
"""
use ExUnit.Case
alias PatternMatching.User
alias PatternMatching.GuardClauses
describe "return_numbers/1" do
test "returns value or error" do
assert 1.5 == GuardClauses.return_numbe... |
075bbe0799c212481ca84961dee72c35cdb208b9 | 1,516 | [
338724299
] | [
"phoenix"
] | defmodule MvpApiWeb.ControlPointController do
use MvpApiWeb, :controller
alias MvpApi.Infrastructure
alias MvpApi.Infrastructure.Metrology.ControlPoint
action_fallback MvpApiWeb.FallbackController
def index(conn, _params) do
control_points = Infrastructure.list_control_points()
render(conn, "index.... |
075bbf53f7a9c90e6f4f2dd7c57e95491fe46581 | 1,847 | [
145180018
] | [
"test"
] | defmodule Speakeasy.AuthzTest do
use ExUnit.Case
alias Speakeasy.Authz
def mock_resolution(user \\ "chauncy") do
%Absinthe.Resolution{
state: :unresolved,
context: %{
speakeasy: %Speakeasy.Context{user: user, resource: "kittens"}
}
}
end
test "given an alternate user key, a... |
075c380e431523c3c6710157e6f7c848115a6281 | 1,536 | [
318089067
] | [] | defmodule CeresMonitor do
def solve(map_as_string) do
asteroid_map = AsteroidMap.parse_string_map(map_as_string)
{:ok, {coord, m}} =
asteroid_map.asteroids
|> Task.async_stream(&AsteroidMap.generate_asteroid_visibility(&1, asteroid_map))
|> Enum.max_by(fn {:ok, {_a, m}} -> map_size(m) end)
... |
075c7ae14b418479fcafe4bc1f2ab009d6f4bf32 | 1,504 | [
744281225,
116826798,
313251367
] | [
"documented"
] | defmodule LocalLedger.Wallet do
@moduledoc """
This module is an interface to the LocalLedgerDB schema (Balance, CachedBalance
and Entry) and contains the logic needed to lock a list of addresses.
"""
alias LocalLedger.CachedBalance
alias LocalLedgerDB.{Repo, Wallet}
@doc """
Calculate and returns the ... |
075c8d0fffd9ea7313ca4dc0ebbe11a0f5eb85ab | 11,795 | [
820192032
] | [
"test"
] | defmodule Sequin.EtsMultisetTest do
use ExUnit.Case, async: true
alias Sequin.EtsMultiset
setup do
%{table: EtsMultiset.new()}
end
describe "initialization" do
test "new/0 creates an empty ETS table" do
table = EtsMultiset.new()
assert is_reference(table)
assert EtsMultiset.keys(t... |
075c8ea60e9c7519102989e75821afdabea1e941 | 1,989 | [
470564016
] | [
"test",
"documented"
] | defmodule Compatibility.LAN_WMBUS_G2_LDS_LDSTest do
use ExUnit.Case, async: true
@moduledoc """
Tests for the LAN-WMBUS-G2-LDS/LDP leakage detector device.
At time of writing, document stored at https://www.lansensystems.com/media/1215/g2_lds_data_format_v8_0.pdf
product page: https://www.lansensystems.com/a... |
075c8ea6276bffbbbe3f3201ad9672b3b8e84713 | 1,965 | [
492823415
] | [
"test"
] | defmodule Oceanconnect.Admin.Company.IndexTest do
use Oceanconnect.FeatureCase
alias Oceanconnect.Admin.Company.IndexPage
hound_session()
setup do
admin_user = insert(:user, %{is_admin: true})
user = insert(:user)
active_company = insert(:company, is_active: true)
inactive_company = insert(:co... |
075cd5c0e675f83accf9e565d8e14ccab91de0a5 | 6,688 | [
633861562
] | [
"typespec",
"documented"
] | defmodule Soroban.Contract.InvokeContractFunction do
@moduledoc """
`InvokeContractFunction` implementation to invoke authorized and not authorized contract functions.
"""
alias Soroban.Contract.RPCCalls
alias Soroban.RPC
alias Soroban.RPC.{SendTransactionResponse, Server, SimulateTransactionResponse}
a... |
075cddf29580a4b0280410bfae894f415a040c98 | 2,879 | [
412047406
] | [
"genserver"
] | defmodule ManagerApproach.ManagerOperationsConsumer do
use GenServer
use AMQP
require IEx
# Most of this code is from https://hexdocs.pm/amqp/readme.html#setup-a-consumer-genserver
@channel :garbage_can_channel
@exchange "garbage-can-exchange"
@queue "manager-operations"
@me __MODULE__
@enforce_ke... |
075d8194631f39633026d807bcf148ddd0f5a229 | 6,292 | [
167727602
] | [
"test"
] | defmodule Deli.HostFilter.DefaultTest do
use DeliCase, async: false
alias Deli.HostFilter.Default, as: HostFilter
test "behaviour" do
assert behaves?(HostFilter, Deli.HostFilter)
end
def a_z, do: nonempty_string(?a..?z)
def a_k, do: nonempty_string(?a..?k)
def l_z, do: nonempty_string(?l..?z)
def ... |
075dd7b2ce3a3b22f21c334651a6370397ab0f68 | 1,571 | [
889563201
] | [] | defmodule DijkstrasAlgorithm do
def dijkstra_algorithm(graph, times, parents, processed) do
node = lowest_time_node(times, processed)
if node != nil do
time = times[node]
neighbors = graph[node]
{new_times, new_parents} = Enum.reduce(neighbors, {times, parents}, fn {k,v}, {times, parents} ... |
075f00fb6376a2b0cc306b70b531ca14caec0c30 | 8,684 | [
1015560686
] | [
"liveview",
"test"
] | defmodule SertantaiWeb.Organization.ProfileLiveTest do
use SertantaiWeb.ConnCase
import Phoenix.LiveViewTest
import Sertantai.AccountsFixtures
import Sertantai.OrganizationsFixtures
alias Sertantai.Organizations.Organization
describe "mount/3" do
test "redirects to registration when user has no organ... |
075f35fd29f3af68b6ec051fc0d1964e03b2d746 | 2,077 | [
994989852
] | [
"genserver"
] | defmodule FridgeBuddy do
use GenServer
alias Llm.OpenAiClient
alias Llm.Chat
# Client
def start_link() do
GenServer.start_link(__MODULE__, %{ingredients: [], preferences: []}, name: __MODULE__)
end
def add_ingredient(name, quantity) do
GenServer.cast(__MODULE__, {:add_ingredient, %{name: name, q... |
075fbc41695fbdd177abefcc75e370101502deec | 1,517 | [
72841254,
80811189
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
# Configures the endpoint
config :playdays, Playdays.Endpoint,
url: [host: "localho... |
07601d92f77ba033949bdb34fa85878ff3112f8b | 2,803 | [
898399771
] | [
"liveview",
"documented",
"phoenix"
] | defmodule LiveDebuggerWeb.Layout do
@moduledoc """
Inspiration was taken from Phoenix LiveDashboard
https://github.com/phoenixframework/phoenix_live_dashboard/blob/main/lib/phoenix/live_dashboard/layout_view.ex
https://github.com/phoenixframework/phoenix_live_dashboard/blob/main/lib/phoenix/live_dashboard/layou... |
076029d7863389d67c8db586ec274ebb3d10aa72 | 19,742 | [
650889764
] | [
"documented",
"ecto"
] | defmodule BnApis.Rewards.RewardsLead do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias BnApis.Repo
alias BnApis.Rewards.RewardsLeadStatus
alias BnApis.Rewards.Status
alias BnApis.Rewards.RewardsLead
alias BnApis.Stories.Story
alias BnApis.Accounts.DeveloperPocCredential
alias BnApis.A... |
0760a768a45caf5b973f5ee6121183a4d16d4816 | 13,198 | [
679057013
] | [
"genserver",
"typespec",
"supervisor"
] | defmodule Onion.TickerSession do
use GenServer, restart: :temporary
defmodule Order do
@type t :: %{
id: String.t(),
side: String.t(),
operation: String.t(),
time: String.t(),
volume: number(),
seq_num: number(),
price: number... |
0760f8779d43def2b942e19bed5d48a318350a17 | 8,339 | [
109671583
] | [
"documented",
"phoenix"
] | defmodule Gateway.Transports.ServerSentEvents do
@moduledoc """
Phoenix-Transport implementation for server-sent events (SSE).
A heartbeat is used to make sure the connection is still up. This way,
broken connections are detected and the corresponding process can halt
normally.
Example:
transport :ss... |
07615bb984078b5251ed48011c1eea52d482ef29 | 8,808 | [
168753881,
333694281
] | [
"typespec",
"documented",
"ecto"
] | defmodule Cforum.Cites do
@moduledoc """
The Cites context.
"""
import Ecto.Query, warn: false
alias Cforum.Repo
alias Cforum.Cites.Cite
alias Cforum.Cites.Vote
alias Cforum.System
@doc """
Returns the list of cites.
## Examples
iex> list_cites()
[%Cite{}, ...]
"""
def list_c... |
0761b23ddcd41b042682917f8666750b8861f91d | 4,129 | [
192955692
] | [
"macro",
"documented"
] | defmodule JaSpex.SchemaParser do
@moduledoc """
An implementation of the `JaSerializer.ParamParser` protocol for generated schemas.
When used the `JaSpex.SchemaParser` module will generate a ParamParser
implementation that matches the current schema.
You can optionally whitelist or blacklist certain fields ... |
0761bae56a359402ec0ba9368dcb42dd42aa7450 | 1,576 | [
1009799947
] | [
"documented"
] | #Вся логика работы с пользователями
defmodule LocallinkApi.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias LocallinkApi.Repo
alias LocallinkApi.User
@doc """
Создает нового пользователя.
"""
def create_user(attrs \\ %{}) do
%User{}
|> User.registr... |
0761cfe806eedadb4ddd8e31ae8fbb23dcfd0380 | 2,964 | [
932071549
] | [
"documented"
] | defmodule CursorDemo.Notifications do
@moduledoc """
The Notifications context handles user notifications.
"""
import Ecto.Query, warn: false
alias CursorDemo.Repo
alias CursorDemo.Notifications.Notification
alias CursorDemo.Accounts.User
@doc """
Returns a list of notifications for a user.
"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.