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 |
|---|---|---|---|---|
07096902b75a75ad225b115f434436d725eb9758 | 1,566 | [
867153310
] | [
"test",
"ecto"
] | defmodule Poller.PollsTest do
use Poller.DataCase
alias Poller.Polls
describe "polls" do
alias Poller.Polls.Poll
import Poller.PollsFixtures
@invalid_attrs %{}
test "list_polls/0 returns all polls" do
poll = poll_fixture()
assert Polls.list_polls() == [poll]
end
test "get... |
07097992be709eba712238c3142281af2b42d8a6 | 17,022 | [
812748465
] | [] | %{
"axon": {:hex, :axon, "0.7.0", "2e2c6d93b4afcfa812566b8922204fa022b60081e86ebd411df4db7ea30f5457", [:mix], [{:kino, "~> 0.7", [hex: :kino, repo: "hexpm", optional: true]}, {:kino_vega_lite, "~> 0.1.7", [hex: :kino_vega_lite, repo: "hexpm", optional: true]}, {:nx, "~> 0.9", [hex: :nx, repo: "hexpm", optional: false... |
0709b655052946f57bdfafad2cf078b5da09693a | 10,690 | [
89036427
] | [] | %{
"calendar": {:hex, :calendar, "0.17.2", "d6b7bccc29c72203b076d4e488d967780bf2d123a96fafdbf45746fdc2fa342c", [:mix], [{:tzdata, "~> 0.5.8 or ~> 0.1.201603", [hex: :tzdata, optional: false]}]},
"certifi": {:hex, :certifi, "1.1.0", "c9b71a547016c2528a590ccfc28de786c7edb74aafa17446b84f54e04efc00ee", [:rebar3], []},
... |
070a0bab7b9ac3da5bebe2657ec0886945c34951 | 13,701 | [
118413899
] | [
"genserver"
] | defmodule Client do
use GenServer
def start_link(user_name, password, total_users) do
user_process = :"#{user_name}"
GenServer.start_link(__MODULE__, %{z: 0, name: user_name, password: password, tweetids: [], tweets: [], hashtags: [], users: total_users, xuser_follower_count: 0, your_count: ... |
070a2fc4ee65b13dd5edc308a2b896ac8b7e4940 | 3,018 | [
714271237
] | [
"typespec"
] | defmodule Game2048.Impl.Board do
alias Game2048.Type
@type t :: [list(Integer)]
@spec create(Integer.t()) :: t
def create(size) when size < 2 do
raise "Minimum board size is 2"
end
def create(size) when size > 7 do
raise "Maximum board size is 7"
end
def create(size) do
for(_ <- 1..size... |
070a65f0ced6b489824b6475a83b4462542d9018 | 1,865 | [
63387911
] | [
"test"
] | defmodule EloTest do
use ExUnit.Case
doctest Elo
@player 1000.0
@opponent 900.0
@player_i 1000
@opponent_i 900
test "win produces correct result" do
{player, opponent} = Elo.rate(@player, @opponent, :win)
assert player == 1008.6384400047308
assert opponent == 891.3615599952692
end... |
070a8fba22819ddb0bd1e3dec8261074bed9081f | 2,066 | [
150125735
] | [
"genserver"
] | defmodule Drizzle.IO do
use GenServer
@zone_pins Application.get_env(:drizzle, :zone_pins, %{})
# ======
# Client
# ======
def start_link(_args) do
{:ok, _} = GenServer.start_link(__MODULE__, [], name: DrizzleIO)
end
def activate(zone) do
GenServer.cast(DrizzleIO, {:activate, zone})
end
... |
070a98b9257490e8963ee266b929db4925e86cb1 | 3,929 | [
264018873
] | [] | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Fastpass.Repo.insert!(%Fastpass.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they wi... |
070b351e940ccabd25b2c9af87dea43e109875e8 | 4,484 | [
927234821,
492752264,
327711808,
554455380
] | [
"liveview",
"ecto"
] | defmodule LivebookWeb.SessionLive.AddFileEntryFileComponent do
use LivebookWeb, :live_component
import Ecto.Changeset
alias Livebook.FileSystem
@impl true
def mount(socket) do
{:ok,
assign(socket,
file_info: %{exists: true},
changeset: changeset(),
error_message: nil,
f... |
070b557c22882d2785867eabe79488d6e05e1290 | 2,783 | [
756340681
] | [] | defmodule DAUWeb.SearchLive.SearchParams do
@allowed_filter_keys [
"media_type",
"page_num",
"sort",
"verification_status",
"from",
"to",
"taken_up_by",
"filter_unattended"
]
def params_to_keyword_list(params) do
default_filter_params = [
page_num: "1",
sort: "newe... |
070b77f0fe6cd71ac3f0beb0470bcc99a026ed9f | 2,278 | [
807532065
] | [
"liveview"
] | # How to ensure that Shoelace/Tailwind/DeepChat etc are pre-loaded?
defmodule AIChat do
use Phoenix.LiveComponent
def update(assigns, socket) do
{:ok, assign(socket, assigns)}
end
def render(assigns) do
~H"""
<div class="flex flex-col max-w-4xl px-2 py-4">
<div class="text-right my-2">
... |
070b7b4c865f006ef3f4e0eda08fe6e878abaeb8 | 2,752 | [
287958534
] | [
"test",
"ecto"
] | defmodule AwesomeList.Repo.AwesomeList.LanguagesTest do
use AwesomeList.DataCase
alias AwesomeList.Repo.Languages
describe "languages" do
alias AwesomeList.Repo.Languages.Language
@valid_attrs %{list_anchor: "some list_anchor", name: "some name", repo_path: "some repo_path"}
@update_attrs %{list_an... |
070bba434f77f41da86a091d6cba36b7f586ee85 | 6,940 | [
585915775,
500260157
] | [
"typespec",
"documented",
"ecto"
] | defmodule Pleroma.Migrators.HashtagsTableMigrator do
defmodule State do
use Pleroma.Migrators.Support.BaseMigratorState
@impl Pleroma.Migrators.Support.BaseMigratorState
defdelegate data_migration(), to: Pleroma.DataMigration, as: :populate_hashtags_table
end
use Pleroma.Migrators.Support.BaseMigrat... |
070bf528d1eaf9fe3e244bb2450ffb17bdcfefa1 | 17,571 | [
478739792
] | [
"documented"
] | defmodule Parser do
@moduledoc """
Main parsing library
"""
use Bitwise
alias Parser.Types.{MicE, Position}
require Logger
def parse(message) do
try do
[sender, path, data] = String.split(message, [">", ":"], parts: 3)
with [base_callsign, ssid] <- parse_callsign(sender),
data... |
070c5251a2e11969295a8b39c5ea9a0bfb847c1d | 6,608 | [
835333246
] | [
"documented",
"ecto"
] | defmodule Survey.Respons do
@moduledoc """
The Respons context.
"""
import Ecto.Query, warn: false
alias Survey.Repo
alias Survey.Respons.Peserta
@doc """
Returns the list of pesertas.
## Examples
iex> list_pesertas()
[%Peserta{}, ...]
"""
def list_pesertas do
Repo.all(Pesert... |
070d56c88228aa85ea77ed585d673a3ff75bf148 | 7,798 | [
508143159
] | [
"typespec",
"documented"
] | defmodule Uniform.Modifiers do
@moduledoc """
Utilities for building code transformations with
`Uniform.Blueprint.modify/2`.
"""
#
# Eject Fences
#
@doc ~S"""
Apply [Eject Fences](code-transformations.html#eject-fences) to extra
languages with this function.
Uniform already applies Eject Fences... |
070d933782e4555269c4d9a8cd37593af2cd5b5b | 8,028 | [
613459518
] | [
"liveview"
] | defmodule LivebookWeb.SessionLive.ShortcutsComponent do
use LivebookWeb, :live_component
@shortcuts %{
insert_mode: [
%{seq: ["esc"], desc: "Switch back to navigation mode", basic: true},
%{seq: ["tab"], desc: "Autocomplete expression when applicable", basic: true},
%{
seq: ["ctrl", "... |
070da5ef37185abe97f1a3f9af479dcf3504d51b | 2,894 | [
950768856,
950212760
] | [] | %{
"cowboy": {:hex, :cowboy, "2.13.0", "09d770dd5f6a22cc60c071f432cd7cb87776164527f205c5a6b0f24ff6b38990", [:make, :rebar3], [{:cowlib, ">= 2.14.0 and < 3.0.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, ">= 1.8.0 and < 3.0.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "e724d3a70995025d... |
070dabfccd8033a4b86d2ae1bb02d45e02428700 | 5,545 | [
605207035
] | [
"test"
] | defmodule Reedly.Core.Test.FeedEntriesTest do
use ExUnit.Case
use Reedly.Database.Test.RepoCase
alias Reedly.Core.Feeds.FeedEntries
alias Reedly.Database.Test.{FeedEntryTestHelper, FeedEntryTestFactory}
describe "all/1" do
test "returns all feed entries" do
existing_entries = FeedEntryTestFactory.... |
070dc6392b3682dd5d217437e6b70615bf44510c | 1,759 | [
438907458
] | [] | defmodule AbsintheGenerator.SchemaBuilder do
alias AbsintheGenerator.{Type, Mutation, Query, Schema}
@dataloader_regex ~r/^dataloader\(([^,]+)/
def generate(app_name, schema_items) do
{type_items, schema_items} = Enum.split_with(schema_items, &is_struct(&1, Type))
{mutation_items, schema_items} = Enum.s... |
070e19095a6040cc0ee32c6230eb88ae39c893c3 | 4,262 | [
31351789
] | [] | %{
"certifi": {:hex, :certifi, "2.14.0", "ed3bef654e69cde5e6c022df8070a579a79e8ba2368a00acf3d75b82d9aceeed", [:rebar3], [], "hexpm", "ea59d87ef89da429b8e905264fdec3419f84f2215bb3d81e07a18aac919026c3"},
"earmark_parser": {:hex, :earmark_parser, "1.4.43", "34b2f401fe473080e39ff2b90feb8ddfeef7639f8ee0bbf71bb41911831d7... |
070e33fed49a9fd4298b99479d1aa8ac4dc318f0 | 2,933 | [
165115442,
969189171
] | [
"typespec",
"documented"
] | defmodule Logflare.Source.ChannelTopics do
@moduledoc """
Broadcasts all source-related events to source-related topics
"""
require Logger
alias Logflare.LogEvent, as: LE
alias Logflare.Source
alias Logflare.Sources
alias Number.Delimit
use TypedStruct
typedstruct do
field :source_token, Stri... |
070e3f28ffa43e77c2760553c1d4465e3fc8b84d | 6,566 | [
672670746
] | [
"genserver"
] | defmodule Linguex.Agents.Alamedya do
use GenServer
require Logger
def start_link(opts) do
GenServer.start_link(__MODULE__, nil, opts)
end
def single_discord_message(agent, msg) do
GenServer.call(agent, {:single_discord_message, msg}, 30000)
end
def wipe_history(agent, key) do
GenServer.call... |
070e88880023a65bbb9902116f7458110a1bb73b | 1,980 | [
399261642
] | [] | # 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 :blanche,
ecto_repos: [Blanche.Repo]
# Conf... |
070f2f04e332b3b54d64de4cb1e52c554785037f | 3,916 | [
113530302
] | [
"ecto"
] | defmodule Til.Github do
alias Til.Accounts.User
alias Til.Repository.Post
alias Til.Repo
import Ecto.Query
@hello_world_template Path.expand("../../templates/hello_world.md", __DIR__)
|> File.read!()
def setup_til_repo(%User{} = user) do
{:ok, _} = create_repo(user)
{:ok, _}... |
070f600f32d0ae3deac55b252b7193c21d6acd79 | 2,056 | [
121893563
] | [
"typespec"
] | defmodule ListOps do
# Please don't use any external modules (especially List) in your
# implementation. The point of this exercise is to create these basic functions
# yourself.
#
# Note that `++` is a function from an external module (Kernel, which is
# automatically imported) and so shouldn't be used eit... |
070f90e832620471703116cbf1706d7e12c3131d | 3,398 | [
280612863
] | [
"test"
] | defmodule SampleDates6Test do
use ExUnit.Case
import Calixir
alias Calixir.SampleDates
# === Sample Data - dates6.csv - DR4 452
test "Ephemeris Correction - DR4 210 (14.15)" do
for {fixed, ephem_corr} <- SampleDates.fixed_with(:ephem_corr) do
value =
fixed
|> ephemeris_correction... |
071027ed64a8b8cd90fac7495e2e3eb09c758e16 | 18,028 | [
997214727
] | [
"typespec",
"documented"
] | defmodule Aiex.LLM.Templates.TemplateCompiler do
@moduledoc """
Compiles prompt templates into optimized, executable forms.
Features:
- Pre-compilation for performance
- Variable validation and type checking
- Conditional logic compilation
- Template inheritance resolution
- Context injection optimiz... |
0710ab50e8e817de80d477a95f09ef430fbdba69 | 8,180 | [
179795390
] | [
"documented",
"ecto"
] | defmodule Matchalert.Users do
@moduledoc """
The boundary for the Users system.
"""
import Ecto.Query, warn: false
alias Matchalert.Repo
alias Matchalert.Users.Subscription
alias Matchalert.Users.Player
alias Matchalert.Users.PlayerSubscription
@doc """
Returns the list of subscriptions.
## Ex... |
0710e58925138f8ee8b5d557acc54e08d0182e3c | 5,634 | [
779938057
] | [
"documented"
] | defmodule PhxTailwindFreebsd do
@moduledoc """
Workaround to install Tailwind binary on FreeBSD.
Add `phx_tailwind_freebsd` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:phx_tailwind_freebsd, "~> 0.2.1", runtime: Mix.env() == :dev}
]
end
```
Run `mix tailwind.inst... |
0710fc57fc669a6ba61884317ce07963a391ab67 | 3,558 | [
321214690
] | [
"test",
"phoenix"
] | defmodule SponsorlyWeb.SponsorshipControllerTest do
use SponsorlyWeb.ConnCase, async: true
setup :register_and_log_in_user
@invalid_attrs %{copy: nil}
describe "index" do
setup :create_sponsorship
test "lists all sponsorships of user", %{conn: conn, sponsorship: sponsorship} do
other_sponsorsh... |
07113aeb2e18b062792a89aca756d0584142e5e3 | 4,655 | [
554497845
] | [
"typespec",
"documented"
] | defmodule Animals do
@moduledoc """
The `%Animals{}` struct is used to create a binary tree which contains
animals and questions used to distinguish between them.
The `query` function is used to walk the tree and uses callbacks to
get user input along the way to select the path through the tree.
for each ... |
07117d3e93f4a48766a8dde767df7e7449dc2407 | 5,106 | [
122058751
] | [
"test",
"phoenix"
] | defmodule Learn.NovosTestesControllerTest do
use Learn.ConnCase
alias Learn.NovosTestes
describe "Páginas de GET simples" do
test "GET /novostestes", %{conn: conn} do
insert_novos_testes(%{texto: "teste1"})
conn = get(conn, "/novostestes")
assert html_response(conn, 200) =~ "teste1"
en... |
07118a9736ec75b5e6d5a3961e7db40fc456c036 | 2,856 | [
344983036,
344963185
] | [
"test",
"phoenix"
] | defmodule EventsWeb.InviteControllerTest do
use EventsWeb.ConnCase
alias Events.Invites
@create_attrs %{comment: "some comment", response: "some response"}
@update_attrs %{comment: "some updated comment", response: "some updated response"}
@invalid_attrs %{comment: nil, response: nil}
def fixture(:invite... |
0711f236a1ddfc0d19c79740b5b28a8b3d200438 | 3,213 | [
584094958
] | [
"phoenix"
] | defmodule AurigaWeb.Router do
use AurigaWeb, :router
import AurigaWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {AurigaWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
plug... |
0712d28aae769af9267494e75f0d6376204bbc17 | 2,386 | [
501654880
] | [
"liveview"
] | defmodule HajWeb.ApplicationsLive.Index do
use HajWeb, :live_view
alias Haj.Spex
alias Haj.Applications
on_mount {HajWeb.UserAuth, {:authorize, :applications_read}}
def mount(_params, _session, socket) do
current_spex = Spex.current_spex() |> Haj.Repo.preload(show_groups: [group: []])
applications ... |
0712deabdb6903db1a29427ca9ebd7be41fec4b5 | 1,533 | [
647939850
] | [
"liveview",
"phoenix"
] | defmodule ShortlabWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :shortlab
# 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: "_shortla... |
07138045273ce1e92a5659533e6d437cb4bef48c | 2,668 | [
102320207
] | [
"test",
"documented"
] | defmodule XDR.Type.FixedArrayTest.Len0 do
use XDR.Type.FixedArray, len: 0, type: XDR.Type.Int
end
defmodule XDR.Type.FixedArrayTest.Len1 do
use XDR.Type.FixedArray, len: 1, type: XDR.Type.Int
end
defmodule XDR.Type.FixedArrayTest.Len2 do
use XDR.Type.FixedArray, len: 2, type: XDR.Type.Int
end
defmodule XDR.Typ... |
07145813c37536201c953dec11a8ff2df8be22de | 3,843 | [
889097755
] | [
"typespec",
"documented",
"ecto"
] | defmodule Ore.Guilds do
@moduledoc "Module for managing all things related to guilds."
alias Ore.Guilds.Guild
alias Ore.Guilds.Leader
alias Ore.Guilds.Member
alias Ore.Repo
@doc "Creates a new guild."
@spec create_guild(attrs :: map()) :: {:ok, Guild.t()} | {:error, Ecto.Changeset.t()}
def create_guil... |
07147e1e6b5ebbbb7753aa9cf124585f78561c2e | 1,743 | [
794846881
] | [
"typespec",
"documented"
] | defmodule DuckDuckGoose.NodeManager.API do
@moduledoc """
Provides an API for interacting with the NodeManager GenServer, facilitating
operations such as fetching the node's role, managing heartbeats, and handling
voting requests.
"""
@node_manager DuckDuckGoose.NodeManager
require Logger
@doc """
... |
071494b8c800217d5d0b973806a84749644fa89e | 2,680 | [
957365647
] | [] | defmodule EveIndustrex.Reactor do
alias EveIndustrex.Blueprints
alias EveIndustrex.Materials
alias EveIndustrex.Types
def get_alchemy_recipes() do
types = Types.get_formulas()
bps = Blueprints.get_blueprints_from_list_of_ids(Enum.map(types, fn b -> hd(b) end))
type_ids = Enum.map(bps, fn b -> [b.blu... |
07150032802cb2b113e8f0d56e50e9151d757032 | 5,047 | [
117219464
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]... |
071578633f5853e22f18a47df55343f114ef9e9e | 7,923 | [
106873016
] | [
"genserver",
"documented"
] | defmodule NNex.Specie do
@moduledoc """
When the difference of two genotypes is greater than some threshold X, then those genotypes belong to two different species. It would be useful for us to track speciation of NNs, and how these new species are formed, because speciation implies innovation. Thus we should als... |
07158e1f74c998f2aef24b4dff1ed30428f0f040 | 4,670 | [
605026076
] | [
"documented",
"ecto"
] | defmodule Experiment do
@moduledoc """
Module to generate dummy posts with randomized content using string keys.
"""
import Ecto.Query
alias GupIndexManager.Model
alias GupIndexManager.Repo
require Logger
# Template for a dummy post
@base_post %{
"abstract" => "Default abstract content.",
"a... |
0715cc7a61917977e929c1f8c7dfb8176940bbdf | 2,531 | [
112864936
] | [
"documented"
] | defmodule Day6 do
@moduledoc """
Solutions for Day 6 Puzzle
"""
def read_input(source) do
File.read!(source)
|> String.split(~r{\t})
|> Enum.map(&String.to_integer/1)
|> Enum.with_index
end
@doc """
Solution for Part 1
"""
def balance_part1(registers, count, seen) do
if MapSet.me... |
07161594a826ba7bc70eb1d54b8589bbf4b40c5c | 1,838 | [
300638004
] | [
"test"
] | defmodule Hornet.RateCounterTest do
use ExUnit.Case
alias Hornet.RateCounter
test "correctly calculates rates" do
{:ok, pid} = RateCounter.start_link()
inc(pid, 1_000)
assert RateCounter.rate(pid) == 1_000
end
test "re-calculates rate" do
{:ok, pid} = RateCounter.start_link()
inc(pid... |
07169d1de29b7811f7886c4b3f16472a3fdd0d0f | 4,005 | [
279744223
] | [
"test"
] | defmodule HangmanTest do
use ExUnit.Case
alias Game.Hangman
test "new_game returns structure" do
game = Hangman.new_game()
assert game.turns_left == 7
assert game.game_state == :initializing
assert length(game.letters) > 0
end
test "state isn't change for :won or :lost game" do
for sta... |
0716fcae81fbe1b768c231f6f47d1f6c9f7d93cf | 2,233 | [
171054372
] | [
"phoenix"
] | defmodule ChatplayerWeb.UsersController do
use ChatplayerWeb, :controller
alias Chatplayer.{UserManager, UserManager.User, UserManager.Guardian}
action_fallback ChatplayerWeb.FallbackController
def new(conn, _) do
# changeset = UserManager.change_user(%User{})
# maybe_user = Guardian.Plug.current_reso... |
07171fa474e6efe3de8c225bc2666512340bf997 | 3,252 | [
119361791
] | [] | use Mix.Config
# For production, we often load configuration from external
# sources, such as your system environment. For this reason,
# you won't find the :http configuration below, but set inside
# YndPhxBootstrapWeb.Endpoint.init/2 when load_from_system_env is
# true. Any dynamic configuration should be done there... |
071725d44f358fb5f9c0eaa3a4b8d1adac540df7 | 5,404 | [
498675807
] | [
"test"
] | defmodule AppCount.Accounts.Utils.AccountInfoTest do
use AppCount.DataCase
import AppCount.LeasingHelper
alias AppCount.Accounts
alias AppCount.Maintenance.Order
alias AppCount.Tenants.TenancyRepo
alias AppCount.Core.ClientSchema
@moduletag :account_info
def money_as_decimal(number) do
%Decimal{coe... |
07174db550aef53cd6f5d3851b1a1a154bffec45 | 5,009 | [
996163577
] | [
"liveview",
"ecto"
] | defmodule EcommerceFinalWeb.Admin.Dashboard.ProductLive.FormComponent do
alias EcommerceFinal.Catalog.Category
alias EcommerceFinal.Catalog
alias EcommerceFinal.Catalog.Product
use EcommerceFinalWeb, :live_component
@impl true
def render(assigns) do
~H"""
<div class="w-full">
<section class="... |
071750a924f4cd1e47a3ac6636bfa4fd3b42917f | 1,870 | [
497940616
] | [
"phoenix"
] | defmodule W2Web.SVGController do
use W2Web, :controller
alias W2.Durations
@days 7
# TODO cache
# TODO use params
def barchart(conn, params) do
# TODO div
to = :os.system_time(:second)
from = to - @days * 24 * 3600
buckets = Durations.fetch_bucket_data(from, to)
interval = Durations.i... |
07176647519f14194b5c20db80b8e5ee5771092f | 2,472 | [
880455325
] | [] | defmodule AdventOfCode.Solution.Year2024.Day15 do
use AdventOfCode.Solution.SharedParse
import AdventOfCode.Solution.GridMap.HelperFunctions
@obstacle "#"
@box "O"
@robot "@"
@empty "."
@impl true
def parse(input) do
[grid, directions] =
input
|> String.split("\n\n", trim: true)
... |
07183c5e912ba5614f1a25fa4b07583ace955bed | 2,815 | [
119747156
] | [
"documented"
] | defmodule NervesHub.DeviceSSLTransport do
@moduledoc """
SSL transport for device certificate authentication
This transport exists to rate limit incoming SSL connections _before_ any
ssl work has started. This let's us shed incoming devices before we waste
a lot of resources on denying them midway through th... |
07184e94eca0a00027c1c38bb17f29aeaf3fd1bd | 3,092 | [
425336343
] | [
"test",
"phoenix"
] | defmodule BooksCatWeb.BookControllerTest do
use BooksCatWeb.ConnCase
import BooksCat.StorageFixtures
alias BooksCat.Storage.Book
@create_attrs %{
authors: [],
category: [],
cover: "some cover",
description: "some description",
isbn: "some isbn",
title: "some title"
}
@update_attrs... |
071887290192e2dbe6884cbca9bf68e3f77eee47 | 1,681 | [
176574037
] | [
"test"
] | defmodule StixExTest.Object.MarkingDefinition do
use ExUnit.Case
alias StixEx.MarkingDefinition
test "Example data should be valid" do
params = %{
type: "marking-definition",
id: "marking-definition--34098fce-860f-48ae-8e50-ebd3cc5e41da",
created: "2016-08-01T00:00:00.000Z",
definiti... |
07189bea0da74befd267a757bc769a28245c5a6f | 1,772 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DriveLabels.V2.Model.GoogleTypeDate do
@moduledoc """
Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A f... |
0718b92ce70fd8928998628ce8a8b42f49dec887 | 2,543 | [
573119324
] | [] | defmodule AOC.Solver2 do
require AOC.Helper
@win_states [
{:rock, :paper},
{:scissors, :rock},
{:paper, :scissors}
]
@points_per_output %{
lose: 0,
draw: 3,
win: 6,
is_rock: 1,
is_paper: 2,
is_scissors: 3
}
defp assumed_end_conditions, d... |
0718d204ac46b6c2a1f8421885a094a5d5cd4a8b | 5,606 | [
56390467
] | [
"typespec",
"documented"
] | defmodule VmqPlugin do
@moduledoc """
Defines callbacks for writing plugins for the VerneMQ MQTT message
broker. Please refer to the official documentation on plugin
development: https://vernemq.com/docs/plugindevelopment/
The following callbacks can be hooked into when developing plugins
for VerneMQ:
... |
07199d6874b5214725d22faa5024980e0ac5c0cb | 1,633 | [
883804673
] | [
"liveview"
] | defmodule CommunityDemoWeb.Community.Components.Cards.Card002 do
use Phoenix.Component
import CommunityDemoWeb.Components.Card
attr(:id, :string,
default: nil,
doc: "A unique identifier is used to manage state and interaction"
)
attr(:class, :string, default: "border-t-4 !border-t-[#3758f9] shadow-x... |
0719c2c87daaa9d7a89ff17281b9d33025971366 | 2,232 | [
319789425
] | [
"documented"
] | defmodule Krug.PostMarkSender do
@moduledoc """
A module to simplify use of Bamboo SMTP mailing
with the "PostMark" smtp provider.
Documentation at https://postmarkapp.com
"""
@moduledoc since: "0.3.0"
alias Krug.GenericMail
alias Krug.GenericSMTPMailer
@doc """
Send mail over "PostMark"... |
071a2198ff881ec73bbd9b603e3183a443002d70 | 1,775 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1SchemaTrainingjobDefinitionAutoMlTables do
@moduledoc """
A TrainingJob that trains and uploads an AutoML Tables Model.
## Attributes
* `inputs` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1SchemaTrainingjobDefinitionAutoMlTabl... |
071a99e707404753a16fdac7f85625e9d1aad113 | 1,502 | [
929045156
] | [
"liveview",
"phoenix"
] | defmodule FrontlineApplicationWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :frontline_application
# 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: :c... |
071ac02dce0c8c96e3b82441cd645db36bc11d04 | 2,885 | [
225123260
] | [
"test"
] | defmodule Adventofcode.Day12NBodyProblemTest do
use Adventofcode.FancyCase
alias Adventofcode.Day12NBodyProblem.{Parser, Simulation, Printer}
import Adventofcode.Day12NBodyProblem
import ExUnit.CaptureIO
describe "suppose your scan reveals the following positions" do
@input """
<x=-1, y=0, z=2>
... |
071ae4dd97a0ff9459742933cbd87fe2aae3de70 | 4,607 | [
161313544
] | [
"documented"
] | defmodule Star do
defstruct position: nil,
velocity: nil
def new([position, velocity]) do
%__MODULE__{position: position, velocity: velocity}
end
def display_at(starlist, time) do
starlist
|> starfield_at(time)
|> starfield_to_string()
|> IO.puts()
end
def starfield_at(sta... |
071b3e232b6553dc1aa7748aed3bd0750696424c | 7,067 | [
429450429
] | [
"documented",
"ecto"
] | defmodule Distrilixir.Inventory do
@moduledoc """
The context for Inventory related models
"""
import Ecto.Query, warn: false
alias Distrilixir.Repo
alias Distrilixir.Inventory.Category
alias Distrilixir.Inventory.Product
alias Distrilixir.Inventory.Warehouse
@doc """
Returns the list of categori... |
071baa43f18225546e65907277c3371681ef7b7f | 5,579 | [
71045332
] | [
"genserver"
] | defmodule Fw.Led do
use GenServer
@behaviour Contract.Led
## Client API
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
end
def get_hardware_state() do
GenServer.call(__MODULE__, :get_hardware_state)
end
def set_green(switch_to) do
GenServer.cast(__M... |
071c35871a1b7f49637d756feb9d0290a91a0ca5 | 12,598 | [
792241208,
48907849,
603438628,
796226129,
279715065,
939353141,
944124414,
780334795,
493863264
] | [
"typespec",
"documented"
] | defmodule MapSet do
@moduledoc """
Functions that work on sets.
A set is a data structure that can contain unique elements of any kind,
without any particular order. `MapSet` is the "go to" set data structure in Elixir.
A set can be constructed using `MapSet.new/0`:
iex> MapSet.new()
MapSet.new... |
071cd3470cb56d5b915991f7e2085c5fbf457d98 | 11,068 | [
823587427,
965126893
] | [
"documented"
] | defmodule Mix.Tasks.Mishka.Ui.Export do
@example "mix mishka.ui.export --example arg"
@shortdoc "A Mix Task for generating a JSON file from a directory of components"
@moduledoc """
#{@shortdoc}
This Mix Task helps you generate a JSON file from the files in a directory,
enabling you to use it with `mix m... |
071cd35bb8effec913a00b8e81e3a9f74cdeaf5e | 1,709 | [
812745471
] | [
"documented",
"ecto"
] | defmodule StripeSetup.Billing.Plans do
import Ecto.Query, warn: false
alias StripeSetup.Repo
alias StripeSetup.Billing.Plans.Plan
@doc """
Returns the list of plans.
## Examples
iex> list_plans()
[%Plan{}, ...]
"""
def list_plans do
Repo.all(Plan)
end
@doc """
Gets a single pl... |
071cf866c4d48d3d8179f6f2b24612d79bae1526 | 7,400 | [
256866257
] | [
"test"
] | defmodule ApiGateway.UsersControllerTest do
use ApiGateway.ConnCase
import Mox
describe "when listing users" do
test "index/2 should return users with status 200", %{conn: conn} do
ApiGateway.UsersServiceMock
|> expect(:list, fn ->
{:ok, [%{name: "mock1"}, %{name: "mock2"}]}
end)
... |
071d664917bc8a3b7ba3edde4bbdb34e063102f5 | 3,741 | [
224516691
] | [
"typespec"
] | require Logger
defmodule Mailmaid.SMTP.ServerExample do
defmodule State do
defstruct [options: []]
@type t :: %__MODULE__{
options: list
}
end
use Mailmaid.SMTP.Server
def init(hostname, session_count, address, options) do
Logger.info ["Peer: ", inspect(address)]
if session_count ... |
071df3a3e0d7a95f7a0e8cdd12ec6895ea4d6f92 | 5,015 | [
987570597
] | [
"phoenix"
] | defmodule KifaruWeb.Router do
use KifaruWeb, :router
import Oban.Web.Router
use AshAuthentication.Phoenix.Router
import AshAuthentication.Plug.Helpers
pipeline :graphql do
plug :load_from_bearer
plug :set_actor, :user
plug AshGraphql.Plug
end
pipeline :browser do
plug :accepts, ["html"... |
071df57317ad335b9ba31343f007fe688d75abe8 | 7,196 | [
71727570
] | [
"test",
"documented"
] | defmodule ConduitAMQPTest do
@moduledoc false
use ExUnit.Case, async: false
use AMQP
defmodule Broker do
@moduledoc false
def receives(_name, message) do
send(ConduitAMQPTest, {:broker, message})
message
end
end
defmodule OtherBroker do
@moduledoc false
def receives(_name,... |
071e0d8c5c22dbb6489ad5d2dd232ecd29460a19 | 2,758 | [
460412983
] | [
"test",
"phoenix"
] | defmodule PlaygroundWeb.MapControllerTest do
use PlaygroundWeb.ConnCase
import Playground.AssetFixtures
@create_attrs %{description: "some description", image: "some image", is_visible: true, name: "some name", size: 42}
@update_attrs %{description: "some updated description", image: "some updated image", is_... |
071eda831fa0c6f5ac5defcd309cf80633f08a60 | 2,567 | [
63644191
] | [
"phoenix"
] | defmodule OnboardingService.MerchantSocialProfileController do
use OnboardingService.Web, :controller
alias Ecto.Multi
alias OnboardingService.Repo
alias OnboardingService.SocialProfile
alias OnboardingService.MerchantSocialProfile
alias OnboardingService.SocialProfileView
def create(conn, %{"social_pro... |
071ee8c83b677a0aba0c7f1cc0e0218411b39811 | 1,799 | [
134418020
] | [
"ecto"
] | defmodule Cart.Invoice do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias Cart.{Invoice, InvoiceItem, Repo, Item}
@primary_key {:id, :binary_id, autogenerate: true}
schema "invoices" do
field :customer, :string
field :amount, :decimal, precision: 12, scale: 2
field :balance, :dec... |
071ef185af09286a8c3129495197b55b89829197 | 1,733 | [
63711283
] | [
"documented"
] | defmodule DigitalOcean.Key do
@moduledoc """
API methods for interacting with the `SSH Key` module.
See the [SSH Key Reference](https://developers.digitalocean.com/documentation/v2/#ssh-keys).
"""
import DigitalOcean, only: [get: 1, post: 2, put: 2, del: 1, body: 1, full: 1]
@doc """
List all SSH Keys.
"""
... |
071ef51599d112052356b4837e76576bea3550dd | 6,038 | [
345232401
] | [
"documented"
] | defmodule WHATWG.Infra do
@moduledoc """
Functions for [Infra Standard](https://infra.spec.whatwg.org).
"""
@doc """
Returns `true` if `term` is an integer for a surrogate; otherwise returns `false`.
> A **surrogate** is a code point that is in the range U+D800 to U+DFFF, inclusive.
"""
defguard is_su... |
071f3d86c0db34b4727493eacc8b0e6ba438ff92 | 2,973 | [
246766809
] | [
"test",
"ecto"
] | defmodule Edent.TreatmentPlansTest do
use Edent.DataCase
alias Edent.TreatmentPlans
describe "treatment_plans" do
alias Edent.TreatmentPlans.TreatmentPlan
@valid_attrs %{created: ~N[2010-04-17 14:00:00], finish_schedule: ~N[2010-04-17 14:00:00], isfinished: true}
@update_attrs %{created: ~N[2011-05... |
071f48a7b582aaf7b794c54a5a773d1484bbb5b6 | 1,760 | [
723429662
] | [
"liveview"
] | defmodule Paleta.Components.Loading do
use Paleta, :component
attr(:position, :atom, default: :center, values: [:left, :center, :right])
def loading(%{position: position} = assigns) do
assigns =
assigns
|> assign(:class, "text-#{position}")
~H"""
<div class={@class}>
<div role="st... |
071f720ed5a4feb326f7802860d594e1dc9e9daa | 4,085 | [
145619183
] | [
"genserver",
"supervisor"
] | defmodule HyperFeeder do
use Agent
def start_link([[lower, upper], opts]) do
Agent.start_link(fn -> start_feeders(lower..upper) end)
end
def init({:ok, [lower, upper]}) do
start_feeders(lower..upper)
end
def start_feeders(range) do
start_feeders(range, 1_000)
end
def start_feeders(range,... |
071fe0fe37b415400198a35e3f31263cc5990cdd | 16,475 | [
46998301,
47085266
] | [] | defmodule Jumble.ScowlDict.Size10.Length6.Dict do
def get do
%{"agimnn" => ["naming"], "aefhrt" => ["father"], "adeirv" => ["varied"],
"begins" => ["begins"], "gilnos" => ["losing"], "denrtu" => ["turned"],
"adeelv" => ["leaved"], "bcilpu" => ["public"], "acdesu" => ["caused"],
"aeirrv" => ["arr... |
071fee548aab9e9a581149e7c413a940dc3f6ef6 | 6,562 | [
742644590
] | [] | defmodule Backend.Router do
use Commanded.Commands.Router
middleware Backend.EventStoreRewriter.Middleware
middleware Domain.Middleware.TypeValidation
# User routing
identify Domain.User, by: :id
dispatch [
Domain.User.Commands.AcceptInvite,
Domain.User.Commands.Create,
Domain.User.Commands.Cr... |
07204e2b428680201dfeb034607af0f3f288f9bb | 5,649 | [
961658705
] | [
"typespec",
"documented"
] | defmodule Heaters.Clips.Embeddings.Workflow do
@moduledoc """
Embedding workflow state management.
Handles the embedding generation lifecycle including state transitions,
data validation, and result processing for the async embedding pipeline.
"""
import Ecto.Query, warn: false
alias Heaters.Repo
alia... |
0720fea28d9f06b1ff75606a66f6c904e6e10431 | 1,878 | [
50779087
] | [
"phoenix",
"ecto"
] | defmodule Mate.UserController do
use Mate.Web, :controller
import Mate.ControllerCommon
alias Mate.User
alias Mate.Post
def show(conn, %{"id" => id}) do
case Repo.get(User, String.to_integer(id)) do
user when is_map(user) ->
render conn, "show.json", user: user
_ ->
Contro... |
07212a38b3d5ffd9a3e7fc3553bd0653cd006101 | 6,709 | [
1001505778
] | [
"typespec",
"documented"
] | defmodule SnookerGameEx.Core.Physics do
@moduledoc """
Contém todas as computações de física puras, otimizadas com Nx.
Este módulo opera exclusivamente nas structs do Core.GameState.
"""
import Nx.Defn
alias SnookerGameEx.Core.GameState
@typedoc "Batch state: tensors for particle properties"
@type bat... |
0721332eeb2218689e5099cc105b183eacfc8c5d | 2,388 | [
927105019
] | [
"documented"
] | defmodule MakeupSyntect do
@moduledoc """
MakeupSyntect is an adapter for Makeup, providing syntax highlighting using the [syntect](https://docs.rs/syntect/latest/syntect/) Rust library.
More syntax definitions are included using [two-face](https://docs.rs/two-face/latest/two_face/).
For a list of supported l... |
0721c9fe49aa26510ffb22ddb92fcc1b27aad183 | 1,698 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Point do
@moduledoc """
Point is a group of information collected by runtime plane at critical points of the message flow of the processed API request. This is a list of supported point IDs, categorized to three major buckets. For each category, debug points th... |
0721f66c0e2faf61c4fc6c36e5cf05aa06bcec39 | 8,531 | [
942811655,
920024200
] | [
"documented"
] | defmodule InternalApi.Notifications.Notification.Rule.Filter.State do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
field(:STARTED, 0)
field(:FINISHED, 1)
end
defmodule InternalApi.Notifications.Notification.Rule.Filter.Results do
@moduledoc false
use Pr... |
0722014230e6a7fc09f910243a0555e071212c8b | 3,369 | [
191612022
] | [
"typespec",
"documented",
"ecto"
] | defmodule Core.LegalEntities.LegalEntity do
@moduledoc false
use Ecto.Schema
alias Core.Divisions.Division
alias Core.Employees.Employee
alias Core.LegalEntities.EdrData
alias Core.LegalEntities.License
alias Core.LegalEntities.MedicalServiceProvider
alias Core.LegalEntities.RelatedLegalEntity
alias... |
07225c95dcacd0575fb0faca65745ef84d4cdde9 | 1,617 | [
917082120
] | [
"liveview",
"phoenix"
] | defmodule PentominoesWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :pentominoes
# 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: "_p... |
072275758964e800c1f2e8f91913db158d8fb3e8 | 1,504 | [
974674586
] | [
"typespec",
"documented"
] | defmodule Apify.ScheduleResponseData do
@moduledoc """
Provides struct and type for a ScheduleResponseData
"""
use Apify.Encoder
@type t :: %__MODULE__{
__info__: map,
actions: [Apify.ScheduleResponseDataActions.t()],
createdAt: String.t(),
cronExpression: String.t(),
... |
07229568b7a819c1bccb2f0c7bd23b77f29b76ad | 3,845 | [
792331026,
899650370
] | [
"liveview",
"documented"
] | defmodule IngestWeb.LiveComponents.BranchTemplateSearch do
@moduledoc """
RequestModal is the modal for creating/editing Data Requests. Contains all logic
needed for the operation.
"""
use IngestWeb, :live_component
@impl true
def render(assigns) do
~H"""
<div>
<div class="space-y-12">
... |
07229d6aaa033aeba6b1de3f4ec8ae8fb05845e3 | 4,186 | [
259747395
] | [
"documented"
] | defmodule BankApi.Controllers.Account do
@moduledoc """
User Controller context
"""
use Plug.Router
alias BankApi.Repo
alias BankApi.Helpers.TranslateError
alias BankApi.Models.Users
alias BankApi.Models.Transactions
alias BankApi.Router
alias BankApi.Auth.Guardian
plug(:match)
plug(:dispatch... |
0722c6d42a065b87c0049d7a35ecd1c4a08a4c1e | 21,988 | [
77253880,
77785313,
80629259,
80284638,
78030894,
77722619,
82017161,
88435977
] | [
"macro",
"documented"
] | defmodule Postgrex.TypeModule do
@moduledoc false
alias Postgrex.TypeInfo
def define(module, extensions, opts) do
opts =
opts
|> Keyword.put_new(:decode_binary, :copy)
|> Keyword.put_new(:date, :elixir)
config = configure(extensions, opts)
define_inline(module, config, opts)
end
... |
0722ce3c7040fe06b895caf1f2988ef6d72a034a | 2,445 | [
257787813
] | [
"liveview"
] | defmodule Web.Actors.Users.New do
use Web, :live_view
import Web.Actors.Components
alias Domain.Actors
def mount(_params, _session, socket) do
changeset = Actors.new_actor()
socket =
assign(socket,
form: to_form(changeset),
page_title: "New User"
)
{:ok, socket, tempor... |
0722d685ffd4a0058a0baf5c5c51f182ed2e03ff | 1,802 | [
535451193,
441222057,
537264013
] | [
"macro",
"documented",
"phoenix"
] | defmodule FawkesWeb 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 FawkesWeb, :controller
use FawkesWeb, :view
The definitions below will be executed for every view,
controller, etc... |
07231a2d25b13c67d9ce791c5a0535a8191d6b4d | 5,663 | [
44419624,
765390321
] | [
"test"
] | defmodule Absinthe.Schema.Rule.ObjectMustImplementInterfacesTest do
use Absinthe.Case, async: true
defmodule Types do
use Absinthe.Schema.Notation
object :user do
interface :named
interface :favorite_foods
interface :parented
field :name, :string
field :id, :id
field :p... |
07238734aab96081f80c419fb1e9584cb1b22ba9 | 1,866 | [
50703190
] | [
"documented"
] | defmodule Kindred.ChampionMastery do
@moduledoc """
Implements the Champion Mastery endpoint: https://developer.riotgames.com/api/methods#!/1034
"""
@fields ~w(
championId championLevel championPoints championPointsSinceLastLevel championPointsUntilNextLevel chestGranted highestGrade lastPlayTime playerId
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.