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 |
|---|---|---|---|---|
fff33f9412f523d62fb9b64fb69673e02761a6db | 4,291 | [
722026854
] | [] | defmodule TreasureHunt.RockPaperScissorsManager do
use Agent
def start_link(player_one, player_two) do
IO.puts "Rock Paper Scissors game is starting"
Agent.start_link(fn -> %{:players => [player_one, player_two],
player_one => %{
score: 0,
... |
fff340dd1ff3382142eab03bba62f1194fd517cf | 15,916 | [
969999971,
996364241
] | [
"documented"
] | defmodule DeeperHub.Core.Terminal.IExProcess do
@moduledoc """
Gerencia a interação com um processo IEx individual via Port.
Coleta a saída e a envia para um `client_pid`.
"""
require Logger
alias DeeperHub.Core.Terminal.OutputFormatter
# Timeout para cada `receive` ao coletar output, para permitir envio... |
fff495bcb961ac566ee4df9412b59484e21b333e | 3,515 | [
1015560686
] | [
"test"
] | defmodule Sertantai.Accounts.CredentialAuthTest do
use Sertantai.DataCase, async: false
alias Sertantai.Accounts.User
require Ash.Query
setup do
# Create the test user with exact credentials from seeds
user_attrs = %{
email: "<EMAIL>",
password: "test123!",
password_confirmation:... |
fff4c2a171e7ddcf4fbca64ef094ac51241e9c26 | 4,834 | [
862826111
] | [
"typespec",
"documented"
] | defmodule ResourceKit.JSONPointer.Utils do
@moduledoc false
alias ResourceKit.Types
alias ResourceKit.JSONPointer.Context
@index_out_of_bounds "index is out of bounds"
@index_has_leading_zeros "index has leading zeros"
@index_is_negative "index is negative"
@index_is_invalid "index is not an integer"
... |
fff4cecdaa74a2260d47252e8902872e1bb9e7d1 | 5,401 | [
537933854
] | [
"test"
] | defmodule PhoenixLiveDraw.Game.RoomServerTest do
use PhoenixLiveDraw.GameCase, async: true
alias PhoenixLiveDraw.Game
alias PhoenixLiveDraw.Game.{Player, PubSub, Room, RoomServer, State}
describe "join/3" do
setup do
Game.create_room("room_id")
:ok
end
test "returns {:ok, room}" do
... |
fff4d482cedceb9f729ffbbb6d5d4b42bf48ed82 | 2,997 | [
75496303
] | [
"documented"
] | defmodule AOC2021.Day14 do
@moduledoc """
Advent of Code 2021, day 14: Extended Polymerization
"""
require AOC
@doc """
Parse input
"""
def parse(puzzle_input) do
[template, _ | rules] = puzzle_input |> String.split("\n")
{
template |> String.first() |> String.to_charlist(),
templa... |
fff507ce95596411c06fabcaf6e1f9847eaefd18 | 1,535 | [
98185781
] | [
"test"
] | defmodule Runner.CheckerGeneratorTest do
use Codebattle.DataCase, async: true
alias Runner.CheckerGenerator
alias Runner.Languages
test "work for all langs" do
task = %Runner.Task{
asserts: [
%{
arguments: [1, "a", 1.3, true, %{a: "b", c: "d"}, ["d", "e"], [["Jack", "Alice"]]],
... |
fff5282aa8106065fea55218286196399ef50338 | 2,056 | [
377421056
] | [
"test",
"ecto"
] | defmodule WatchFaces.KeywordsTest do
use WatchFaces.DataCase
alias WatchFaces.Keywords
describe "keywords" do
alias WatchFaces.Keywords.Keyword
@valid_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
def keyword_fixture(attrs \\ %{}) do
... |
fff5d877fd46d709a897eba8e0e6b18858cfc26d | 2,277 | [
115969822
] | [
"genserver"
] | defmodule Servy.PledgeServer do
@name :pledge_server
use GenServer
defmodule State do
defstruct cache_size: 3, pledges: []
end
# def child_spec(arg) do
# %{id: Servy.PledgeServer, restart: :temporary, shutdown: 5000,
# start: {Servy.PledgeServer, :start_link, [[]]}, type: :worker}
# end
... |
fff5e843c06f796da409b9653aa6206730c7975c | 6,498 | [
959374436
] | [
"liveview"
] | defmodule ImsWeb.RoleLive.FormComponent do
use ImsWeb, :live_component
alias Ims.Accounts.Role
@impl true
def render(assigns) do
~H"""
<div class="max-w-4xl mx-auto bg-gray-50 p-6 rounded-lg shadow-md">
<.header>
<%= @title %>
<:subtitle>Use this form to manage role records and a... |
fff607c74053a714fc5324a62e11d6115a24a941 | 5,340 | [
899500022
] | [
"documented"
] | defmodule Myapp.SocialMediaConfig do
@moduledoc """
Centralized configuration management for social media integrations.
This module provides a standardized interface for retrieving and validating
social media platform configurations and credentials.
"""
@doc """
Returns the configuration for a specifi... |
fff6497ce96bc84f324743dbc9241053ce4b1706 | 1,501 | [
162128283
] | [
"documented"
] | defmodule OpenLocationCode.CodeArea do
@moduledoc """
A code area is a region on a map indicated by a lower-left corner---the southernmost latitude and
the westernmost longitude. The size of the region is given by the resolution, which is the height
and length of the region in degrees.
"""
@d... |
fff66357afec736a3056205d46ceb0b023adc913 | 3,204 | [
924349331
] | [] | %{
"aten": {:hex, :aten, "0.6.0", "7a57b275a6daf515ac3683fb9853e280b4d0dcdd74292fd66ac4a01c8694f8c7", [:rebar3], [], "hexpm", "5f39a164206ae3f211ef5880b1f7819415686436e3229d30b6a058564fbaa168"},
"earmark_parser": {:hex, :earmark_parser, "1.4.43", "34b2f401fe473080e39ff2b90feb8ddfeef7639f8ee0bbf71bb41911831d77c5", [... |
fff668e108f35142b8903fb834b1ab8de16b4422 | 1,820 | [
361827494
] | [
"documented"
] | defmodule Esperanto.Parsers.FencedCode do
@moduledoc """
Parse code indented with ```
"""
alias Esperanto.CodeUtility
alias Esperanto.Walker
@behaviour Esperanto.Parser
@impl Esperanto.Parser
def parse(walker, tree, parent_id, _opts) do
walker_and_tag = get_code_tag(walker)
astify(walker_and_t... |
fff669570a53d1e2f21505ff79f58832f29f0731 | 5,114 | [
536931549
] | [
"liveview",
"documented"
] | defmodule PhoenixUiComponents.SideNav do
@moduledoc """
Deprecated use PhoenixUiComponents.Sidebar instead
"""
use PhoenixUiComponents, :component
import PhoenixUiComponents.Icon
import PhoenixUiComponents.CustomLink
import PhoenixUiComponents.Logo
attr :sections, :list,
required: true,
exampl... |
fff6d18caf5eadb345359e48bc22bacdec6702ae | 1,737 | [
238075442
] | [
"test",
"documented"
] | defmodule Liquex.RepresentableTest do
@moduledoc false
use ExUnit.Case, async: true
alias Liquex.Representable
defmodule TestStruct do
defstruct [:name]
end
describe "represent/2" do
test "Converts map to string key map",
do: assert(%{"test" => "hello"} == Representable.represent(%{test: "... |
fff6ec79bee387bca03e5a88d5578166f3e27332 | 3,743 | [
41898280
] | [
"test"
] | defmodule PixieBackendExamples do
use ESpec, shared: true
let :backend, do: shared.backend
before do
config = Application.get_env(:pixie, :backend)
new_config = [
name: Module.split(shared.backend) |> List.last
]
Application.put_env(:pixie, :backend, new_config)
{:ok, pid} = apply(shar... |
fff7170894a4b3f4e01c6da098c84b779baa9078 | 1,655 | [
708950292
] | [
"typespec",
"documented"
] | defmodule TarragonWeb.Svg.Attributes.RoundedCornerAttributes do
@moduledoc """
Rounded Corner Attributes
The amount of rounding in x and y directions
## Fields
+ **rx** - The amount of rounding in the Horizontal axis
+ **ry** - The amount of rounding in the Vertical axis
"""
@behaviour Tarr... |
fff7186f9b21c239d8b3d12d1b8fc60a2895cfac | 9,758 | [
885191011
] | [
"genserver",
"typespec",
"documented"
] | defmodule Brainworms.Model do
use GenServer
alias Brainworms.Utils
alias Brainworms.Knob
alias Brainworms.Display
@moduledoc """
Helper module for defining, training and running inference with fully-connected
networks for the "map a seven-segment digit to the number displayed" problem.
This module is ... |
fff74f1ea915d9fd8c8d7a80571534962cc359b1 | 3,514 | [
58400007
] | [
"test"
] | defmodule Sips.MeasureControllerTest do
use Sips.ConnCase
alias Sips.Measure
@valid_attrs %{name: "some content", value: "some content"}
@invalid_attrs %{}
setup %{conn: conn} do
user = Repo.insert! %Sips.User{}
goal = Repo.insert! %Sips.Goal{owner_id: user.id}
{:ok, jwt, _} = Guardian.encode_an... |
fff7b4758d380bc6b5ce2082bfa8a8101299d937 | 3,523 | [
217812173
] | [
"documented"
] | defmodule Warehouse do
@moduledoc """
Documentation for Warehouse.
"""
@read_message "Enter a coordinate: "
@doc """
Reads integers from STDIN until a 0 is entered.
"""
def read do
@read_message
|> IO.gets()
|> String.trim()
|> case do
"0" -> []
number -> [String.to_integer... |
fff7d4e96eb2804fa25d4f3f04a9e1a14072f4a4 | 5,923 | [
650700339
] | [] | defmodule Jetzy.User.Interest.Repo.TypeHandler do
require Noizu.DomainObject
Noizu.DomainObject.noizu_type_handler()
Noizu.DomainObject.noizu_sphinx_handler()
#----------------------------------
#
#----------------------------------
#----------------------
# from_partial
#----------------------
... |
fff86469627a0e10fa26f8ed5944eb1173ca5fc6 | 4,786 | [
911264133
] | [
"test"
] | defmodule Lux.Lenses.Etherscan.TokenHolderCountLensTest do
use UnitAPICase, async: false
alias Lux.Lenses.Etherscan.TokenHolderCount
setup do
# Set up test API key in the configuration
Application.put_env(:lux, :api_keys, [
etherscan: "TEST_API_KEY",
etherscan_pro: true
])
:ok
e... |
fff8b1e49e571fc40d4358480a804a6132f4cdf7 | 1,588 | [
155990163
] | [
"phoenix"
] | defmodule TaskTrackerSpaWeb.AssignedTaskController do
use TaskTrackerSpaWeb, :controller
alias TaskTrackerSpa.AssignedTasks
alias TaskTrackerSpa.AssignedTasks.AssignedTask
action_fallback TaskTrackerSpaWeb.FallbackController
def index(conn, _params) do
assigned_tasks = AssignedTasks.list_assigned_tasks... |
fff8e629f2c96b12f6dd09bb9880ea0dfe908567 | 2,569 | [
70429050
] | [] | defmodule Tboechatbot.Listening do
use Timex
def more_product_options(they_said) do
they_said == "for2"
end
def faq(they_said) do
# TODO add regex stuff for faqs and standard responses
# https://github.com/VerbalExpressions/ElixirVerbalExpressions
cond do
String.contai... |
fff8f4a462202e3c433402609cb9bb902f7868f6 | 2,989 | [
839023495
] | [
"liveview",
"phoenix"
] | defmodule RenewCollabWeb.LiveIcons do
use RenewCollabWeb, :live_view
use RenewCollabWeb, :verified_routes
@topic "icons"
def mount(_params, _session, socket) do
RenewCollabWeb.Endpoint.subscribe(@topic)
{:ok, load_data(socket)}
end
defp load_data(socket) do
socket |> assign(:icons, RenewColl... |
fff9a9c587917d90a3be2323d71551ed2848cd3b | 4,526 | [
49815284
] | [
"macro"
] |
defmodule Translations do
# convert a list of
# "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";"<U0054><U0075><U0065>";
# "<U0057><U0065><U0064>";"<U0054><U0068><U0075>";"<U0046><U0072><U0069>";"<U0053><U0061><U0074>"
# into a list of utf-8 names
# ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]... |
fff9bbac0c76b4aac6cbe8741d638dc5e79185d9 | 2,147 | [
896762473
] | [] | defmodule Advent.Year2024.Day07 do
def part1(args), do: solve(args, false)
def part2(args), do: solve(args, true)
defp solve(args, allow_concat?) do
for {target, equation} <- parse_input(args) do
with {:ok, operators} <- put_operators(target, tl(equation), hd(equation), allow_concat?) do
{targe... |
fff9caba870de5ec080d1566ba898881cafb35f1 | 1,914 | [
237667213
] | [
"test"
] | defmodule DifferEctoTest do
use ExUnit.Case
doctest DifferEcto
test "call optimize by default" do
diff1 = DifferEcto.diff("qwerty xyz", "qwerxy1234")
diff2 = Differ.diff("qwerty xyz", "qwerxy1234") |> Differ.optimize()
assert diff1 == diff2
end
test "pass params to optimize" do
diff1 = Diff... |
fff9f36c7c0a5c4c170269069de7c3c36f940499 | 7,147 | [
984995263
] | [
"test",
"phoenix"
] | defmodule FlagQuiz.SvgTest do
use ExUnit.Case
@svg_file "./test/fixtures/pa.svg"
@svg_content File.read!(@svg_file)
describe "parse_string" do
test "parses an svg" do
assert {:ok, doc} = FlagQuiz.Svg.parse_string(@svg_content)
assert {:xmlElement, :svg, :svg, [], {:xmlNamespace, :"http://www.... |
fffa6123a341cf445cbe5af46c2623ab08389af2 | 1,832 | [
33010983
] | [
"typespec",
"documented"
] | defmodule ExTwilio.JWT.AccessToken.VoiceGrant do
@moduledoc """
A JWT grant to access a given Twilio voice service.
## Examples
ExTwilio.JWT.AccessToken.VoiceGrant.new(
outgoing_application_sid: "application_sid",
outgoing_application: %{"key" => "value"},
incoming_allow: true,
... |
fffa8d53de15c078ad8cd05663041d0c019a545b | 4,288 | [
517918702
] | [
"test",
"ecto"
] | defmodule Rumbl.MultimediaTest do
use Rumbl.DataCase
alias Rumbl.Multimedia
describe "videos" do
alias Rumbl.Multimedia.Video
import Rumbl.MultimediaFixtures
@invalid_attrs %{" url": nil, desscription: nil, title: nil}
test "list_videos/0 returns all videos" do
video = video_fixture()
... |
fffb25030a281d44420409f365d45ab73154c873 | 2,732 | [
375033835
] | [
"phoenix"
] | defmodule ExpWeb.Router do
use ExpWeb, :router
import ExpWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {ExpWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :fetch_curr... |
fffb392f1be78d46ec7e7c4b2042fe7e5afbefda | 7,511 | [
782006973
] | [
"genserver",
"typespec",
"documented"
] | defmodule Leaky do
@moduledoc """
Implements a token-based rate limiter using the leaky bucket algorithm, ideal for controlling access rates to resources in Elixir applications.
This implementation leverages ETS for optimized performance, making it suitable for high-load environments.
## Overview
The leaky ... |
fffb4f319b118922aba64c4bece109287738c2ee | 5,132 | [
238561364
] | [] | require Logger
defmodule HealthTraxx.ProcedurePolling.PollRequestData do
defstruct payor: nil, old_amount: nil
end
defmodule HealthTraxx.ProcedurePolling.PollTracker do
use GenStateMachine, callback_mode: :state_functions
alias HealthTraxx.Reimbursements
alias HealthTraxx.ProcedurePolling.{PayorProcedureRefr... |
fffb76ecc7388d66580682dd48abbf1e84c6ebc3 | 2,010 | [
259713357
] | [
"test"
] | defmodule CrossTest do
use ExUnit.Case, async: true #Выполняет наборы тестов параллельно
test "Добавить запись в хранилищи" do
Storage.delete("key")
assert Storage.read("key") == "Такой запись не существует"
assert Storage.create("key", "value", 40000) == "Запись value добавлена"
assert Storage.rea... |
fffbbfa6714ffd6ec2d340ea2b5fa66b97166f94 | 2,618 | [
758375392
] | [
"liveview"
] | defmodule VachanWeb.ListLive.FormComponent do
use VachanWeb, :live_component
alias Vachan.Crm
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage list records in your database.</:subtitle>
</.header>
<.simple_form
... |
fffc98430841924f844d092af832580892c6e6c6 | 2,175 | [
712257756
] | [
"phoenix"
] | # 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 :elmir,
ecto_repos: [Elmir.Repo],
generato... |
fffcab675db297405eb25507b318cb9fd31bd51e | 1,651 | [
418010354
] | [] | defmodule Solution do
def part1() do
rounds = MapSet.new([20, 60, 100, 140, 180, 220])
input()
|> Enum.reduce({1, 1, 0}, fn c, {v, rnd, acc} ->
case c do
:noop ->
rnd = rnd + 1
if rnd in rounds do
{v, rnd, acc + rnd * v}
else
{v, rnd, a... |
fffcb06fd33a7318cdeb733b82176887495d45fe | 5,417 | [
811670520
] | [
"test"
] | defmodule PaymentServerWeb.Schemas.UserMutationTest do
use PaymentServer.DataCase
alias PaymentServerWeb.Schema
alias PaymentServer.SchemasPg.Accounts
alias PaymentServer.Support.UserFactory
setup [:setup_account]
@valid_user_params %{
"first_name" => "John",
"last_name" => "Doe",
"email" => ... |
fffcc7fc55191d563ab5a31a00e12dc8937f1259 | 1,585 | [
112753287
] | [] | defmodule DayFour do
def validate(passphrase) do
String.split(passphrase)
|> is_unique?
end
def count_valids(input) do
String.split(input, "\n")
|> Enum.map(&(validate(&1)))
|> Enum.reduce(0, &(increment_if_true(&1, &2)))
end
def validate_anagrams(passphrase) do
String.split(passphr... |
fffde964f7f607c4c2fc6898b50c50ec0f27d8ad | 3,431 | [
902327418,
126746886
] | [
"typespec",
"documented"
] | defmodule ElixirLS.LanguageServer.Providers.Completion.Reducers.CompleteEngine do
@moduledoc false
alias ElixirSense.Core.Metadata
alias ElixirSense.Core.Source
alias ElixirSense.Core.State
alias ElixirLS.Utils.CompletionEngine
alias ElixirLS.LanguageServer.Providers.Completion.Reducer
@type t() :: Comp... |
fffe0ebff965e5c5cbe0eaed6344454169502551 | 4,563 | [
967831208
] | [
"test"
] | defmodule WebsockexNova.Defaults.DefaultMessageHandlerTest do
use ExUnit.Case, async: true
alias WebsockexNova.ClientConn
alias WebsockexNova.Defaults.DefaultMessageHandler
describe "DefaultMessageHandler.handle_message/2" do
test "passes through messages without modification" do
message = %{"type" ... |
fffee05920a26621815fb2a38e5c2b436d1fbe61 | 1,763 | [
429229122
] | [
"documented"
] | import Mox
defmock Bacen.STA.ClientMock, for: Bacen.STA.Client
defmodule FakeBacenSTA do
@moduledoc false
@behaviour Bacen.STA.Client
@impl true
def send_protocol(
"<?xml version=\"1.0\"?><Parametros><IdentificadorDocumento>ACCS001</IdentificadorDocumento><Hash>053c29ae8b823df65f5bff084f410ca70530c30... |
ffff510ae86af3deb03370fcaddabf52c9aa9e1d | 8,010 | [
461248297
] | [
"documented"
] | defmodule Scholar.Metrics.Similarity do
@moduledoc """
Similarity metrics between multi-dimensional tensors.
"""
import Nx.Defn
import Scholar.Shared
general_schema = [
axis: [
type: {:custom, Scholar.Options, :axis, []},
doc: """
Axis over which the distance will be calculated. By d... |
ffff5d8789b1a2635b91deff0c09c91b6755ff9a | 5,824 | [
367278931
] | [
"documented"
] | defmodule Google.Ads.Searchads360.V0.Common.YoutubeVideoAsset do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :youtube_video_id, 2, proto3_optional: true, type: :string, json_name: "youtubeVideoId"
field :youtube_video_title, 3, type: :string, json_name: "youtubeVi... |
fffff2ea47835dc12cd50f6ece7e27116d7cc1a4 | 5,836 | [
112857727
] | [
"genserver"
] | defmodule Vm do
use GenServer
def start_link(name, program, inputs, outputs, neighbor, main_thread) do
opts =
if name == nil do
[]
else
[name: name]
end
GenServer.start_link(
__MODULE__,
{program, inputs, outputs, neighbor, name, main_thread},
opts
)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.