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 |
|---|---|---|---|---|
0c00c6fc39be04bb3acaa30cec8574466cc47aa4 | 3,215 | [
366388694
] | [
"test"
] | defmodule HandlerRegistryTest do
use ExUnit.Case
import Mock
alias HandlerRegistry
alias HandlersConfig, as: Conf
describe "serve_query/3" do
test "calls Conf.new and Conf.add_listener with correct params" do
with_mocks([
{Conf, [:passthrough],
[
new: fn :app -> %Conf{b... |
0c00d5d3ac80af942087d3de757413da1cd45d86 | 1,824 | [
814368387
] | [
"documented",
"ecto"
] | defmodule ApiDisplay.Page do
@moduledoc """
The Page context.
"""
import Ecto.Query, warn: false
alias ApiDisplay.Repo
alias ApiDisplay.Page.Booking
@doc """
Returns the list of bookings.
## Examples
iex> list_bookings()
[%Booking{}, ...]
"""
def list_bookings do
Repo.all(Boo... |
0c01167ed59b12880d8a0626e3324bf14e19d0ee | 2,259 | [
722726075,
669677957
] | [] | defmodule Example.MixProject do
use Mix.Project
def project do
[
app: :example,
version: "0.1.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end
# Configuration for the OT... |
0c014809a37a799060f2e7778fbf98123d9e1185 | 1,924 | [
1007462461
] | [
"documented"
] | defmodule Mix.Tasks.Project.Setup do
@moduledoc """
Sets up a new Phoenix project with all the standard configurations.
## Usage
mix project.setup
This task will:
- Install dependencies
- Set up git hooks
- Run initial setup commands
- Create database
"""
use Mix.Task
@shortdoc "Sets up... |
0c014a4fb374863933948ab3f45bf2ab011f2b4f | 11,943 | [
1010414021
] | [
"test"
] | defmodule Pipeline.Error.NestedPipelineTest do
use ExUnit.Case, async: true
alias Pipeline.Error.NestedPipeline
describe "format_nested_error/3" do
test "formats basic nested pipeline error with context" do
context = %{
pipeline_id: "test_pipeline",
nesting_depth: 2,
parent_con... |
0c0221451410739996839438e3965d1e65f1a8c6 | 6,888 | [
713659583
] | [
"liveview"
] | defmodule GrottoWeb.BoardLive.Show do
use GrottoWeb, :live_view
alias Grotto.Boards
alias Grotto.Lists
alias Grotto.Cards
@impl true
def mount(_params, _session, socket) do
{:ok, assign(socket, :tz_offset, Map.get(socket.private.connect_params, "tz_offset"))}
end
@impl true
def handle_params(%{... |
0c023f780b614987ac3107f02992cd8525202d7d | 4,948 | [
961356839
] | [
"phoenix",
"ecto"
] | # credo:disable-for-this-file Credo.Check.Refactor.Nesting
# credo:disable-for-this-file Credo.Check.Refactor.CyclomaticComplexity
defmodule AgoraWeb.CommentController do
use AgoraWeb, :controller
alias Agora.Forum
# alias Agora.Forum.Comment
def create(conn, %{"thread_id" => _thread_id, "comment" => comment... |
0c025691ee5f8aae09b3028d029f68d25c0d988f | 2,856 | [
218418244
] | [
"documented"
] | defmodule ContentSecurityPolicy.Plug.AddNonce do
@moduledoc """
Plug which adds a random nonce to the content security policy. Sets this
nonce in `Plug.assigns` under the `csp_nonce` key.
This plug must be run after the `ContentSecurityPolicy.Setup` plug, or it
will raise an exception.
## Example Usage
... |
0c02b4f7af4f101a1939c4cbf91c84dda27c1257 | 3,187 | [
783248241
] | [] | %{
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"},
"earmark_parser": {:hex, :earmark_parser, "1.4.42... |
0c0320ae8e5d797c4b52eae1204df7b0899e02c4 | 7,050 | [
202846144
] | [
"typespec"
] | defmodule Chain.State do
require Logger
alias Chain.Account
@enforce_keys [:accounts]
defstruct accounts: %{}, hash: nil, store: nil
@type t :: %Chain.State{accounts: any(), hash: any(), store: any()}
def new() do
%Chain.State{accounts: MutableMap.new()}
end
def compact(%Chain.State{accounts: acc... |
0c03c0ce6b1f7bb880874fa105cac386f033877e | 1,617 | [
1018703995
] | [
"documented"
] | defmodule FinancialAdvisorAi.Chat.Agents.ChatAgent do
alias FinancialAdvisorAi.Chat.{Message, Assistant}
alias FinancialAdvisorAi.Repo
require Logger
@doc """
Processes a user message in a conversation using the ongoing instructions flow.
This function:
1. Creates a user message record marked as comple... |
0c03ccda78778a8879b6161b0331ac78c940440f | 3,567 | [
360982842
] | [
"test",
"phoenix"
] | defmodule EventsSpaWeb.ResponseControllerTest do
use EventsSpaWeb.ConnCase
alias EventsSpa.Responses
alias EventsSpa.Responses.Response
@create_attrs %{
analytical: 120.5,
anger: 120.5,
body: "some body",
confident: 120.5,
fear: 120.5,
joy: 120.5,
rating: 42,
sadness: 120.5,
... |
0c03e29a1ef39f9fa7d6434f042096c2e028ce47 | 3,024 | [
143164828,
91143120
] | [
"phoenix"
] | defmodule OneChatWeb.UserSocket do
use Phoenix.Socket
import Rebel.Query
alias InfinityOne.Accounts.User
alias InfinityOne.Repo
alias OneChatWeb.RoomChannel.Message, as: WebMessage
require OneChat.ChatConstants, as: CC
require Logger
## Channels
channel CC.chan_room <> "*", OneChatWeb.RoomChannel ... |
0c040fb3fe8137824e9fc10d3534edbaeada661b | 3,960 | [
213612935
] | [
"typespec",
"documented"
] | defmodule Plug.Telemetry.ServerTiming do
@behaviour Plug
@external_resource "README.md"
@moduledoc File.read!("README.md")
|> String.split(~r/<!--\s*(BEGIN|END)\s*-->/, parts: 3)
|> Enum.at(1)
import Plug.Conn
@impl true
@doc false
def init(opts), do: opts
@impl true
@doc... |
0c042620864bb2b3abde757533560f4ae0fb5a73 | 3,685 | [
972048641
] | [
"documented",
"ecto"
] | defmodule Repo.User do
use Repo.Schema
schema "users" do
field :rev, :integer, default: 1
field :username, Repo.Types.StringyTrimmedLower
field :name, Repo.Types.StringyTrimmed
field :email, Repo.Types.StringyTrimmedLower
field :phone, Repo.Type... |
0c0435752e3a5d420f6d386b8993ff21afb2be3a | 3,929 | [
44564329
] | [
"typespec",
"documented"
] | defmodule Dnsimple.Contacts do
@moduledoc """
Provides functions to interact with the
[contact endpoints](https://developer.dnsimple.com/v2/contacts/).
"""
@moduledoc section: :api
alias Dnsimple.Client
alias Dnsimple.Listing
alias Dnsimple.Response
alias Dnsimple.Contact
@doc """
Lists the cont... |
0c048d52beb48b5f2cf9c02f7f53c8d3fd9e33b5 | 2,359 | [
769926347
] | [
"genserver"
] | defmodule Message do
defstruct id: 0, sender: "", text: ""
# Implement Jason.Encoder for the Message struct
defimpl Jason.Encoder, for: __MODULE__ do
def encode(message, _opts) do
Map.from_struct(message) |> Jason.encode!()
end
end
end
defmodule ElixchatWeb.ChatRoomChannel do
use ElixchatWeb, ... |
0c04b6dc148bcdfef098c6505919fadc4b18f214 | 2,063 | [
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Spanner.V1.Model.BatchWriteRequest do
@moduledoc """
The request for BatchWrite.
## Attributes
* `excludeTxnFromChangeStreams` (*type:* `boolean()`, *default:* `nil`) - Optional. When `exclude_txn_from_change_streams` is set to `true`: * Modifications from all transactions in this batch ... |
0c05f062c4008154fa9be689cbe12b6eda3f46a2 | 2,805 | [
827165615
] | [
"test",
"ecto"
] | defmodule Chatter.ChatTest do
use Chatter.DataCase, async: true
alias Chatter.Chat
describe "all_rooms/0" do
test "returns all rooms available" do
[room1, room2] = insert_pair(:chat_room)
rooms = Chat.all_rooms()
assert room1 in rooms
assert room2 in rooms
end
end
describe ... |
0c05f98fe41780a1b88c8844f5f65bb03afeb9d0 | 1,790 | [
430135349
] | [
"macro",
"documented",
"phoenix"
] | defmodule GymixWeb 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 GymixWeb, :controller
use GymixWeb, :view
The definitions below will be executed for every view,
controller, etc, s... |
0c061ff2055df00306f735a26e79374527f3ee43 | 12,104 | [
343209812,
341577165,
343815695,
341934035,
341590671,
352394402,
332127886,
346793150,
341506243,
343844359,
349082708,
334897869,
344909461,
360977359,
348463225,
422598348,
334940315,
347044434,
356743326,
349098320,
376928281,
377273858
] | [
"genserver",
"documented"
] | defmodule DBConnection.ConnectionError do
defexception [:message, severity: :error, reason: :error]
@moduledoc """
The raised exception might include the reason which would be useful
to programatically determine what was causing the error.
"""
@doc false
def exception(message, reason) do
message
... |
0c065e0d06d91f1c9b89011de92b3fe4e1a29d67 | 9,181 | [
105636145
] | [
"documented",
"ecto"
] | defmodule MehrSchulferien.Locations do
@moduledoc """
The Locations context.
"""
import Ecto.Query, warn: false
alias MehrSchulferien.Repo
alias MehrSchulferien.Locations.Country
@doc """
Returns the list of countries.
## Examples
iex> list_countries()
[%Country{}, ...]
"""
def l... |
0c06a65d3bf32bedddd42091e54289513ae5fd27 | 2,196 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1IngestConversationsRequestGcsSource do
@moduledoc """
Configuration for Cloud Storage bucket sources.
## Attributes
* `bucketObjectType` (*type:* `String.t`, *default:* `nil`) - Optional. Specifies the type of the objects i... |
0c06b18708e5d648f40c392122439ef13ddc93ec | 2,488 | [
158309725
] | [
"test"
] | defmodule Lucidboard.AccountTest do
use ExUnit.Case
import Lucidboard.Account
alias Lucidboard.{Board, BoardRole, BoardSettings, User}
test "has_role?: open boards are cool for non-owners" do
assert has_role?(
%User{},
%Board{settings: %BoardSettings{access: "open"}},
... |
0c06b49e35548806e39722077dad04bf05722ba8 | 1,907 | [
435255947
] | [
"documented"
] | defmodule Day13 do
@doc """
iex>Day13.part1(\"""
...>6,10
...>0,14
...>9,10
...>0,3
...>10,4
...>4,11
...>6,0
...>6,12
...>4,1
...>0,13
...>10,12
...>3,4
...>3,0
...>8,4
...>1,10
...>2,14
...>8,10
...>9,0... |
0c07e1dae24af43d0e9964c61f0814793825873f | 2,407 | [
87887290
] | [] | defmodule WordFinder do
@search_word "include"
def find(scheduler) do
send scheduler, { :ready, self() }
receive do
{ :find, file, client } ->
send client, { :answer, file, _find(file), self() }
find(scheduler)
{ :shutdown } ->
exit(:normal)
end
end
defp _find(f... |
0c07f54dafd47d8210e62e239e508cb7e8da62fd | 2,762 | [
588559315
] | [] | defmodule JpData.MixProject do
use Mix.Project
def project do
[
app: :jp_data,
version: "0.1.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
test_coverage: [tool: ExCoveralls],... |
0c083eb89b85c985da1bc83bd6305f18439f7283 | 1,790 | [
190496658
] | [] | %{
"benchee": {:hex, :benchee, "1.0.1", "66b211f9bfd84bd97e6d1beaddf8fc2312aaabe192f776e8931cb0c16f53a521", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}], "hexpm", "3ad58ae787e9c7c94dd7ceda3b587ec2c64604563e049b2a0e8baafae832addb"},
"deep_merge": {:hex, :deep_merge, "1.0.0", ... |
0c087b7e2bc229a68dfb65e04c45d8de9e8e65ec | 4,244 | [
897098497
] | [] | defmodule AdventOfCode.Day05 do
def part1(input) do
{page_sets, update_reqs} = pages_and_orderings(input)
# IO.inspect(page_sets, label: "Page sets", charlists: :as_lists)
# IO.inspect(update_reqs, label: "Update lists", charlists: :as_lists)
# correct_orders =
update_reqs
|> Enum.filter(&re... |
0c08af7d1da33ab9fda0e699d42d33b1d6f9d6fb | 1,638 | [
143882854,
143128336,
141502790,
142360775
] | [
"macro",
"documented",
"phoenix"
] | defmodule HolidayAppWeb 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 HolidayAppWeb, :controller
use HolidayAppWeb, :view
The definitions below will be executed for every view,
con... |
0c08b24a179cd945440cf8a12acfaf86008cc905 | 18,484 | [
997661524
] | [
"genserver",
"liveview",
"documented"
] | defmodule NathanForUsWeb.VideoTimelineSearchLive do
@moduledoc """
Primary entrypoint for GIF creation.
Provides a search interface with random quote suggestions and displays
results grouped by episode with frame previews.
"""
use NathanForUsWeb, :live_view
import Ecto.Query
alias NathanForUs.{Video,... |
0c08f05b518f802154cf4c15586d40d0f2b18f7a | 2,465 | [
376162777
] | [
"test",
"ecto"
] | defmodule BooksApi.StoreTest do
use BooksApi.DataCase
alias BooksApi.Store
describe "books" do
alias BooksApi.Store.Book
@valid_attrs %{
authors: [],
description: "some description",
isbn: "some isbn",
price: 120.5,
title: "some title"
}
@update_attrs %{
auth... |
0c097242efd2573d8bf224e0f2f17651f7a62db1 | 2,598 | [
936423461
] | [
"test",
"phoenix"
] | defmodule StrongbondWeb.CharacterControllerTest do
use StrongbondWeb.ConnCase
import Strongbond.GameFixtures
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
describe "index" do
test "lists all characters", %{conn: conn} do
conn = get(con... |
0c09cac2ef57d81399b197f302ae28b0039b5898 | 2,559 | [
190499547
] | [
"phoenix",
"ecto"
] | defmodule PluginistaWeb.CategoryController do
use PluginistaWeb, :controller
alias Pluginista.Admin
alias Pluginista.Admin.Category
def related_fields() do
[
groups: Admin.list_groups() |> PluginistaWeb.GroupView.map_for_form,
]
end
def index(conn, _params) do
categories = Admin.list_ca... |
0c09dbfb7b2e1d8860c47062a56be9ff2bfff64c | 1,999 | [
805616069,
1008214681,
1010774883
] | [
"liveview",
"documented"
] | defmodule ControlServerWeb.PostgresClusterTable do
@moduledoc false
use ControlServerWeb, :html
alias CommonCore.Postgres.Cluster
alias CommonCore.Util.Memory
attr :id, :string, default: "postgres-cluster-table"
attr :rows, :list, required: true
attr :meta, :map, default: nil
attr :abridged, :boolean,... |
0c09f38ca599903b1114e24b0733d14e8099816e | 1,528 | [
158978815,
202534716
] | [
"macro",
"documented",
"phoenix"
] | defmodule SlingWeb 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 SlingWeb, :controller
use SlingWeb, :view
The definitions below will be executed for every view,
controller, etc, s... |
0c09f51f865eb0fb1ac364c3b36148529ee7eb6a | 1,531 | [
922694954
] | [] | ecto = Mix.Project.deps_paths()[:ecto]
Code.require_file "#{ecto}/integration_test/cases/assoc.exs", __DIR__
Code.require_file "#{ecto}/integration_test/cases/joins.exs", __DIR__
Code.require_file "#{ecto}/integration_test/cases/preload.exs", __DIR__
Code.require_file "#{ecto}/integration_test/cases/repo.exs", __DIR__... |
0c0a2e05089a11b67e42681d5f9692b2c71d62db | 4,666 | [
776018171
] | [
"test"
] | defmodule TransitData.GlidesReport.TripUpdateTest do
use ExUnit.Case, async: true
use ExUnitProperties
alias TransitData.GlidesReport.Generators.TripUpdate, as: Gen
alias TransitData.GlidesReport.TripUpdate
# Clean up a trip update, using a defined constant as the header timestamp.
defp clean_up(tr_upd) ... |
0c0a4ad96239b1d8dc8eb56ee5e9ef1783220dd9 | 3,059 | [
105192416
] | [
"test",
"ecto"
] | defmodule Lukimat.UserTest do
use Lukimat.DataCase
import Comeonin.Bcrypt, only: [checkpw: 2]
alias Lukimat.Accounts
describe "users" do
alias Lukimat.Accounts.User
@valid_attrs %{class: "some class", email: "<EMAIL>", password: "password", password_confirmation: "password", first_name: "some first_n... |
0c0a888ef5e79761f3824ddcdc3fa1556069cd7f | 4,194 | [
896995952
] | [] | {registers, program} =
File.read!("data/17.txt")
|> String.split(["\n\n", "\r\n\r\n"])
|> then(fn [registers_str, program_str] ->
[a, b, c] =
registers_str
|> String.split(["\n", "\r\n"])
|> Enum.map(fn str ->
str
|> String.split(": ")
|> Enum.at(1)
|> String.... |
0c0a90a3d105f66130745a934567e030867b84a2 | 1,829 | [
796977713
] | [
"test",
"ecto"
] | defmodule MiddleGround.QuestionChatTest do
use MiddleGround.DataCase
alias MiddleGround.QuestionChat
describe "chats" do
alias MiddleGround.QuestionChat.Chat
import MiddleGround.QuestionChatFixtures
@invalid_attrs %{name: nil}
test "list_chats/0 returns all chats" do
chat = chat_fixture... |
0c0ab0f6b6730649e55e8aa4991b7ce63468a075 | 2,589 | [
124585191
] | [
"test"
] | defmodule Juvet.Connection.SlackRTM.SlackRTMTest do
use ExUnit.Case
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
alias Juvet.Connection.SlackRTM
setup_all do
Juvet.FakeSlack.start_link()
on_exit(fn ->
Juvet.FakeSlack.stop()
end)
{:ok, token: "SLACK_BOT_TOKEN"}
end
describe "Slac... |
0c0b4e5e382540dbd848c22017ffa69427bd3cc7 | 2,496 | [
897099735
] | [
"typespec"
] | defmodule Day10 do
def read_input(name) do
input =
File.read!("./input/#{name}")
get_map(input)
end
def get_map(input) do
lines = input |> String.split("\r\n", trim: true)
col_len = Enum.count(lines)
row_len = List.first(lines) |> String.length()
rows = lines |> Enum.map(&String.s... |
0c0bd4498ef27016fa9139c0cc7e3adcb737c34f | 1,704 | [
467645913
] | [
"test"
] | defmodule Pipe.RouterTest do
use ExUnit.Case, async: true
defmodule MyBlogRouter do
use Pipe.Router
pipe :match
pipe :dispatch
def do_match("GET", "/") do
fn conn ->
conn
|> put_status(200)
|> put_resp_body("<h1>Welcome!</h1>")
end
end
def do_match("PO... |
0c0c3b87e4f5c9171a626dc6308dd878ef7f27d6 | 1,618 | [
215461015
] | [
"macro",
"documented",
"phoenix"
] | defmodule SpadesWeb 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 SpadesWeb, :controller
use SpadesWeb, :view
The definitions below will be executed for every view,
controller, etc... |
0c0c58a2d65d3913861eabaf8737f5c86d77468b | 2,277 | [
887377354
] | [
"typespec",
"ecto"
] | defmodule Pleroma.User.Import do
use Ecto.Schema
alias Pleroma.User
alias Pleroma.Web.CommonAPI
alias Pleroma.Workers.BackgroundWorker
require Logger
@spec perform(atom(), User.t(), list()) :: :ok | list() | {:error, any()}
def perform(:mutes_import, %User{} = user, [_ | _] = identifiers) do
Enum.m... |
0c0c856626c87cee1aef1f8d9c5e9bda0c93ee36 | 2,385 | [
574113033
] | [
"liveview"
] | defmodule SlayPlayWeb.AdminLive.SongRowComponent do
use SlayPlayWeb, :live_component
alias Phoenix.LiveView.JS
def send_status(song_id, status) when status in [:playing, :paused, :stopped] do
send_update(__MODULE__, id: "song-#{song_id}", action: :send, status: status)
end
def render(assigns) do
~H... |
0c0c95562473aaa916a9b1ef3e6fb1d00fe63fa0 | 2,196 | [
158844919
] | [] | defmodule Sea.MixProject do
use Mix.Project
@version "0.5.0"
def project do
[
app: :sea,
version: @version,
elixir: "~> 1.6",
deps: deps(),
test_coverage: [tool: ExCoveralls],
preferred_cli_env: preferred_cli_env(),
# Hex
description: "Side-effect abstraction... |
0c0c959043cd14e855be33870008d9e6d5ae5e48 | 2,176 | [
78124006
] | [] | defmodule Blog.PostChannel do
use Blog.Web, :channel
alias Blog.CommentView
def join("posts:" <> post_id, params, socket) do
last_seen_id = params["last_seen_id"] || 0
post_id = String.to_integer(post_id)
post = Repo.get!(Blog.Post, post_id)
comments = Repo.all(
from c in assoc(post, :comm... |
0c0cac3485a66032d71b804179a38cf122c8aa42 | 2,427 | [
448047706
] | [] | defmodule AOC12 do
defp downcase?(input), do: input == String.downcase(input)
defp sort_end_start(["end", other]), do: [other, "end"]
defp sort_end_start([other, "start"]), do: ["start", other]
defp sort_end_start(any), do: any
def parse(input) do
input
|> String.split("\n")
|> Enum.reduce(%{}, ... |
0c0cc78cc8abfe0bd344c88866bb2707dfb64d00 | 1,791 | [
92660269
] | [
"test"
] | defmodule FinanceTest do
use ExUnit.Case
doctest Finance
alias HTTPotion
setup do
gen_server_start = GenServer.start(Finance.DataCacher, %{})
{:ok, pid} = gen_server_start
{:ok, %{gen_pid: pid}}
end
test "DataCacher add", context do
pid = context[:gen_pid]
GenServer.cast(pid, {:usd_eu... |
0c0d2aec63eb7107b536ae5a334232880fdffd05 | 19,975 | [
257787813
] | [
"typespec",
"liveview",
"phoenix",
"ecto",
"documented"
] | defmodule Web.FormComponents do
@moduledoc """
Provides Form UI components.
"""
use Phoenix.Component
use Web, :verified_routes
import Web.CoreComponents, only: [icon: 1, error: 1, label: 1, translate_error: 1]
### Inputs ###
@doc """
Renders an input with label and error messages.
A `%Phoenix.HT... |
0c0d80c872675a7e71af7d56f098788b2addf199 | 1,744 | [
114297105
] | [
"test"
] | defmodule Phxblog.CommentChannelTest do
use Phxblog.ChannelCase
alias Phxblog.CommentChannel
import Phxblog.Factory
setup do
user = insert(:user)
post = insert(:post, user: user)
comment = insert(:comment, post: post, approved: false)
{:ok, _, socket} =
socket("user_id", %{user... |
0c0df407283783aaddfa479f31cd0f9e5e2f5f89 | 3,307 | [
105948750
] | [
"documented",
"ecto"
] | defmodule CommunityTools.Presentations do
@moduledoc """
The boundary for the Presentations system.
"""
import Ecto.Query, warn: false
alias CommunityTools.Repo
alias CommunityTools.Helpers
alias CommunityTools.Presentations.Presentation
@doc """
Returns the list of presentations.
## Examples
... |
0c0e5be7eb457edfa9582cd09bf76833de3bcbc9 | 1,594 | [
177781926
] | [
"typespec",
"documented"
] | defmodule Drop do
import :math, only: [sqrt: 1]
@moduledoc """
Documentation for Drop.
"""
@doc """
Hello world.
## Examples
iex> Drop.hello()
:world
"""
@spec fall_velocity(number()) :: float()
def hello do
:world
end
def drop do
receive do
{from, planemo, dist... |
0c0ea93355369f274a098d9f1c4e94f413b9cbe4 | 1,764 | [
94461387
] | [
"documented"
] | defmodule YoutubeDownloader do
@default_download_path Path.expand("~/Downloads")
@task_stream_options [
max_concurrency: 3,
timeout: :infinity
]
@moduledoc """
Documentation for YoutubeDownloader.
"""
def start do
filepath = IO.gets "Please input the path to the playlist json\n"
# "~/Do... |
0c0f177defa0cfcd45ad377234e6bd57920d7355 | 13,482 | [
93765520,
99250164
] | [
"typespec",
"documented"
] | defmodule Mix.Tasks.Xref do
use Mix.Task
alias Mix.Tasks.Compile.Elixir, as: E
import Mix.Compilers.Elixir, only: [read_manifest: 2, source: 1, source: 2, module: 1]
@shortdoc "Performs cross reference checks"
@recursive true
@moduledoc """
Performs cross reference checks between modules.
## Xref mo... |
0c0f2ec363b7c4036de390136e4cfbfc28abec69 | 4,834 | [
82186020
] | [
"documented"
] | defmodule Protox.Conformance.Escript do
@moduledoc false
# An escript that will be called by the protobuf conformance test runner
# It reads a conformance test request on its standard input and outputs
# the test results on the standard output.
use Protox,
files: [
"./deps/protobuf/conformance/con... |
0c0fca5d5f174416db6efdb432931136b8a1e0a2 | 1,864 | [
214723589
] | [
"test"
] | defmodule Ecobiex.Endpoint.InfoTest do
use ExUnit.Case
import Mock
setup do
body = """
{
"data": {
"stations": [
{
"address": "Ramos Mejia, Jose Maria, Dr. Av. & Del Libertador Av.",
"altitude": 0.0,
"capacity": 20,
... |
0c0fde6929baee4929f81357ef4d8d3a32089584 | 2,512 | [
89032365
] | [] | # BASICS
# Elixir is a dynamic, functional, scalable, fault-tolerant programming language
# Most of the language basic syntax and
# features are very intuitive except for a few caveats and special design choices
# A brief overview of the less obvious syntax and features
IO.puts "hello world" # print statement, use... |
0c0ff9eba868f770022cfc353840939e2c1bbd2b | 2,410 | [
237772351
] | [
"phoenix"
] | defmodule SpiderWeb.ProduceOrderContainerController do
use SpiderWeb, :controller
alias Spider.ProduceOrderContainers
alias Spider.ProduceOrderContainers.ProduceOrderContainer
alias Spider.Repo
action_fallback SpiderWeb.FallbackController
def index(conn, _params) do
produce_order_containers = Produce... |
0c101347e894fb4dbff8f034fe4bf5a0f29794ba | 2,296 | [
171553752
] | [
"phoenix"
] | defmodule Budget.TransactionController do
use Budget.Web, :controller
alias Budget.Transaction
def index(conn, _params) do
transactions = Repo.all(Transaction)
render conn, "index.html", transactions: transactions
end
def index_roman(conn, _params) do
transactions = Repo.all(Transaction)
re... |
0c10d0c6ede525d440ea91569108c9e8886a52b0 | 4,832 | [
527982938
] | [] | defmodule Rmsdemo.Functions.OrderBook do
alias Rmsdemo.Models.OrderBook
alias Rmsdemo.Functions.Rules
alias Rmsdemo.Functions.RuleValues
def create_order(placed_by,exchange_order_id,parent_order_id,status,
status_message,status_message_raw,order_timestamp,exchange_update_timestamp,
exchange_timestamp,varie... |
0c10f345bf3e2f53370c5f84d86f5a7fab163ad4 | 6,424 | [
1000534630
] | [
"documented"
] | defmodule ElixirLeanLab.VM do
@moduledoc """
VM management for testing and analyzing minimal Elixir VMs.
"""
@doc """
Launch a VM image using QEMU.
"""
def launch(image_path, opts \\ []) do
memory = opts[:memory] || 256
cpus = opts[:cpus] || 1
cond do
String.ends_with?(image_path, ... |
0c123111a904d95b1d517cce4519402c9a8de889 | 2,704 | [
91397792
] | [
"typespec",
"macro",
"documented"
] | defmodule Talon.Components.Datatable do
@moduledoc """
An Talon component for server side datatables.
"""
defmacro __using__(opts) do
quote do
import unquote(__MODULE__)
@doc """
Render the search results
"""
def render("search.html", opts) do
render("table_body.html",... |
0c124b8985e93afb05e91bb3f5d5e1dddfc9fa32 | 5,082 | [
158013615
] | [
"typespec",
"documented"
] | defmodule Asteroid.OIDC.AuthenticationEvent do
@moduledoc """
Convenience functions to work with authentication events
The `%Asteroid.OIDC.AuthenticationEvent{}` object has the following meaningful members in
its `:data` field:
- `"name"`: the event name (`t:Asteroid.AuthenticationEvent.name/0`)
- `"amr"`:... |
0c12e2e022ce1f45744b30e676ea7cac1d5f6014 | 5,000 | [
262584157
] | [
"liveview"
] | defmodule SeanceWeb.PostLive.MarkdownComponent.Content do
defstruct [
:body,
:target_pid,
:inserting_code_block,
:unsplash_slash_command,
:imgur_slash_command,
:chart_slash_command,
:buffer_update
]
@code_block_pattern ~r/^```\z/m
@unsplash_slash_command_pattern ~r{^/unsplash\z}m
... |
0c130d97697a295bcbb8372587a2c5b297ba5d6e | 1,841 | [
103215739
] | [
"phoenix",
"ecto"
] | defmodule MicroblogWeb.KeywordController do
use MicroblogWeb, :controller
alias Microblog.Keywords
alias Microblog.Keywords.Keyword
def index(conn, _params) do
keywords = Keywords.list_keywords()
render(conn, "index.html", keywords: keywords)
end
def new(conn, _params) do
changeset = Keywords... |
0c1312969ea7479bc0587e41eb4854a374e5b31d | 1,887 | [
887682089
] | [
"liveview"
] | defmodule TeslaMateWeb.CarLive.Index do
use TeslaMateWeb, :live_view
require Logger
alias TeslaMate.{Settings, Vehicles}
alias TeslaMate.Settings.GlobalSettings
on_mount {TeslaMateWeb.InitAssigns, :locale}
@impl true
def mount(_params, %{"settings" => settings}, socket) do
socket =
socket
... |
0c133942d0b8af54e9828dee655e9be5081f8729 | 6,637 | [
942811655,
920024200
] | [] | defmodule Guard.FeatureHubProvider do
use FeatureProvider.Provider
require Logger
alias InternalApi.Feature.FeatureService.Stub
alias InternalApi.Feature.{
OrganizationFeature,
OrganizationMachine,
Availability,
Machine,
Feature
}
@impl FeatureProvider.Provider
def provide_machines(... |
0c13cfb3adaf5c3a1883e8cdfcb0328f0854283b | 2,607 | [
681379886
] | [
"liveview",
"ecto"
] | defmodule TeacherWeb.AlbumLive.FormComponent do
use TeacherWeb, :live_component
alias Teacher.Recordings
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage album records in your database.</:subtitle>
</.header>
<.... |
0c140b32e881b4bf790595a074d2fc6115aa2755 | 9,092 | [
654588295
] | [
"documented"
] | defmodule Revard.Card.Badges do
@moduledoc """
Hardcoded minified SVGs as base64 for Revard cards
"""
def svg("developer") do
"PHN2ZyBmaWxsPSJub25lIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDM0MyAzNDMiPjxwYXRoIGQ9Im0zMDUuNiA4Ny4yLTU4IDU4LjEtNTMtNTIuOCA1OC4yLTU4LjJB... |
0c148ee4d635b0aa8b19d39aa5bced5159359491 | 4,941 | [
958231508
] | [
"ecto"
] | defmodule Elixir.Conduit.QAD.Table.Itm_det do
use Ecto.Schema
import Ecto.Changeset
schema "qad_itm_det" do
field :itm_nbr, :string
field :itm_prefix, :string
field :itm_part, :string
field :itm_rev, :string
field :itm_cmtindx, :integer
field :itm_serial, :string
field :itm_ref,... |
0c14fca41c50697deb81bbfcaf36543c7bd55885 | 5,576 | [
693676989
] | [
"liveview",
"documented"
] | defmodule RentReadyWeb.CustomComponents do
use Phoenix.Component
import RentReadyWeb.Gettext
@doc ~S"""
Renders the transactions table with selectable rows and stackable columns.
## Examples
<.transaction_table id="users" rows={@users}>
<:col :let={user} label="id"><%= user.id %></:col>
... |
0c1531832f02e16bc19838477567e0389f63ec26 | 2,663 | [
178415599
] | [
"test"
] | defmodule Commodity.Api.Iam.User.PersonalInformationTest do
use Commodity.DataCase
@lipsum "Lorem ipsum dolor sit amet, consectetur adipiscing elit volutpat."
alias Commodity.Api.Iam.User.PersonalInformation
test "changeset with valid params" do
changeset = PersonalInformation.changeset(%PersonalInformation{},... |
0c1576db02ce63cba65d06c27c20b398febde8a5 | 11,489 | [
244870223
] | [
"typespec",
"documented"
] | defmodule AeMdw.Db.Sync.Transaction do
@moduledoc "
Syncs whole history based on Node events (and assumes block index is in place.
"
alias AeMdw.Blocks
alias AeMdw.Contract
alias AeMdw.Db.Model
alias AeMdw.Db.Channels
alias AeMdw.Db.ContractCallMutation
alias AeMdw.Db.ContractCreateMutation
alias A... |
0c1584aaf805fad5f6f06559e609523436e7d948 | 5,448 | [
41227823,
41243642
] | [
"typespec",
"macro",
"documented",
"ecto"
] | defmodule Ecto.Model do
@moduledoc """
Provides convenience functions for defining and working
with models.
## Using
When used, `Ecto.Model` works as an "umbrella" module that adds
common functionality to your module:
* `use Ecto.Schema` - provides the API necessary to define schemas
* `import Ec... |
0c15a00eb867950e930017788267607fe8ff2bef | 20,377 | [
488592761
] | [
"genserver",
"liveview",
"ecto"
] | defmodule PmLoginWeb.Project.ContributorTasksLive do
use Phoenix.LiveView
import Phoenix.HTML.Link
# import Phoenix.HTML.Form
# Importer les composants nécessaires
alias PmLoginWeb.LiveComponent.{
PlusModalLive,
ModifModalMenu,
CommentsModalMenu
}
alias PmLogin.Monitoring
alias PmLogin.Ka... |
0c15a56192613c6be0c33ae26d477e9788b0adaf | 1,837 | [
179250188
] | [] | # n = 12; decomp(12) -> "2^10 * 3^5 * 5^2 * 7 * 11"
# since 12! is divisible by 2 ten times, by 3 five times, by 5 two times and by 7 and 11 only once.
# 2 3 2 2 5 3 2 7 2 2 2 3 3 2 5 11 3 2 2
# 2^10 * 3^5 * 5^2 * 7 * 11
defmodule FactorialDecomposition do
def prime_factors(dict, num, next \\ 2)
def prime_factors... |
0c16181ca9265fd9143e28cb5e6fd41269687d7e | 1,959 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.ContainerAnalysis.V1alpha1.Model.ContaineranalysisGoogleDevtoolsCloudbuildV1GitSource do
@moduledoc """
Location of the source in any accessible Git repository.
## Attributes
* `dir` (*type:* `String.t`, *default:* `nil`) - Optional. Directory, relative to the source root, in which to ru... |
0c16865e4827e49c029b6339219a219d6321d471 | 2,581 | [
940671280
] | [
"liveview",
"ecto"
] | defmodule AuthAppWeb.UserLive.Registration do
use AuthAppWeb, :live_view
alias AuthApp.Accounts
alias AuthApp.Accounts.User
def render(assigns) do
~H"""
<div class="mx-auto max-w-sm">
<.header class="text-center">
Register for an account
<:subtitle>
Already registered?
... |
0c16b3739d5e69cd3cbe19ca0562d4709b246437 | 1,960 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Compute.V1.Model.SerialPortOutput do
@moduledoc """
An instance serial console output.
## Attributes
* `contents` (*type:* `String.t`, *default:* `nil`) - [Output Only] The contents of the console output.
* `kind` (*type:* `String.t`, *default:* `compute#serialPortOutput`) - [Output ... |
0c16b8af3d113365d46311c9a87bfe8b9e630a0c | 5,715 | [
236372440
] | [
"ecto"
] | defmodule Bloomchain.Content.Post do
import Ecto.Changeset
import Ecto.Query
use BloomchainWeb, :model
use Waffle.Ecto.Schema
alias Bloomchain.Content.{Tag, Media, Author}
alias BloomchainWeb.Uploaders.File
alias Bloomchain.Repo
@derive {Phoenix.Param, key: :slug}
def fetch(term, key) do
term
... |
0c16fad5f0e0c8360627d99a521579011be425a5 | 6,924 | [
1014446314
] | [
"documented"
] | defmodule Introspex.Postgres.TypeMapper do
@moduledoc """
Maps PostgreSQL data types to Ecto schema types.
"""
@doc """
Maps a PostgreSQL data type string to an Ecto type atom or tuple.
"""
def map_type(postgres_type, enum_values \\ nil, _opts \\ []) do
# Clean up the type string (remove size constra... |
0c1769106e4a1fd2653aef070e90ed8a597bb283 | 1,938 | [
93777129
] | [
"documented"
] | defmodule Sue.Commands.Dumb do
@moduledoc """
I suppose I'll just put dumb lil things in here.
"""
alias Sue.Models.Response
@doc """
Checks if it is yet Rubbing Day.
Caveat: By invoking this command, you believe Elixir is the best programming language.
Usage: !rub
"""
def c_rub(_msg) do
now =... |
0c1835e66f8ee84bae4b4e404ff399788d35ee16 | 1,605 | [
931472377
] | [] | defmodule PhoneyApi.Accounts.User do
use Ash.Resource,
data_layer: AshPostgres.DataLayer,
domain: PhoneyApi.Accounts
identities do
identity :email, :email
end
attributes do
uuid_primary_key :id
attribute :email, :string, public?: true, allow_nil?: false
attribute :username, :string, ... |
0c189fef8ee915623b2e1b74abbe115fa9085ddc | 5,120 | [
29387790
] | [
"documented"
] | defmodule Brando.Factory do
@moduledoc false
use ExMachina.Ecto, repo: Brando.Repo.repo()
alias Brando.Content
alias Brando.Content.Module
alias Brando.Content.Palette
alias Brando.Image
alias Brando.Images.Image
alias Brando.Pages.Fragment
alias Brando.Pages.Page
alias Brando.Sites.GlobalSet
ali... |
0c197931d0b28bf58ceb40d22a3cedaa1146378b | 2,836 | [
147006199
] | [
"test"
] | defmodule GeekWeb.UserControllerTest do
use GeekWeb.ConnCase
alias Geek.Accounts
alias Geek.Accounts.User
@create_attrs %{avatar: "some avatar", gender: 42, nick: "some nick", openid: "some openid", phone: "some phone"}
@update_attrs %{avatar: "some updated avatar", gender: 43, nick: "some updated nick", op... |
0c199b4bee8be57129f71e5f29dfdff46c71b760 | 2,790 | [
103006016
] | [] | defmodule Hourai.CommandParser do
alias Nostrum.Struct.Guild
alias Nostrum.Struct.Guild.Member
alias Nostrum.Struct.User
alias Nostrum.Cache.UserCache
@id ~r/^(?<id>\d+)$/iu
@regex_user_mention ~r/^\<@(?<id>\d+)\>$/iu
@regex_nickname_mention ~r/^\<@!(?<id>\d+)\>$/iu
@regex_channel_mention ~r/^\<#(?<id... |
0c19bf124285a3c52bcf46d02c4cdc83d915e55e | 1,540 | [
716304964
] | [
"documented"
] | defmodule LearningElixir do
require Nx.Defn
import Nx.Defn
@moduledoc """
Documentation for `LearningElixir`.
"""
@doc """
Hello world.
## Examples
iex> LearningElixir.hello()
:world
"""
def hello do
:world
end
def tensor_operations do
# Erstellt zwei Tensoren
tens... |
0c1a7c170942305eae997a2fd226efd8a5799782 | 2,997 | [
127551324
] | [
"test",
"ecto"
] | defmodule Haytni.Confirmable.OnEmailChangeTest do
use Haytni.DataCase, [
email: true,
plugin: Haytni.ConfirmablePlugin,
]
@new_email "123@456.789"
@old_email "<EMAIL>"
describe "Haytni.ConfirmablePlugin.on_email_change/4" do
setup do
[
config: @plugin.build_config(),
]
end... |
0c1b3358dd12f4e1a9b68df0cc149d29e04bc774 | 4,212 | [
858950761
] | [] | 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
# AuthenticationFlowServerWeb.Endpoint.init/2 when load_from_system_env is
# true. Any dynamic configuration should be d... |
0c1b39cc0abf4452ecb5b983da7e542d2564984b | 17,465 | [
145774355
] | [
"test",
"ecto"
] | defmodule Ui.AdminTest do
use Ui.DataCase
alias Ui.Admin
describe "users" do
alias Ui.Admin.User
@valid_attrs %{age: 42, name: "some name"}
@update_attrs %{age: 43, name: "some updated name"}
@invalid_attrs %{age: nil, name: nil}
def user_fixture(attrs \\ %{}) do
{:ok, user} =
... |
0c1b448bd3b1fab4ce73810bd0b8a7188c3c2fea | 2,840 | [
962385898
] | [
"test"
] | # test/trackrunner/channel/agent_channel_manager_test.exs
defmodule Trackrunner.Channel.AgentChannelManagerTest do
use ExUnit.Case, async: true
alias Trackrunner.Channel.{WarmPool, AgentChannelManager}
alias Trackrunner.Channel.WebsocketContract
setup do
Application.put_env(:trackrunner, :pusher, Trackru... |
0c1b4a88f97d63531d35ca60ae22a209ca372d59 | 2,274 | [
994696924
] | [] | defmodule TSP do
# Fungsi utama
def solve_tsp(matrix) do
n = length(matrix)
dp =
for i <- 1..(n - 1), into: %{} do
key = {Enum.sort([0, i]), i}
{key, Enum.at(Enum.at(matrix, 0), i)}
end
dp =
for size <- 3..n, reduce: dp do
acc_dp ->
subsets = combina... |
0c1ba1a31fc1e0c6750fdb5ab313376e26ad9c70 | 4,178 | [
966681343,
1019681284,
1009764698,
210347143
] | [
"documented",
"ecto"
] | defmodule Realtime.Tenants.Migrations.AddInOpToFilters do
@moduledoc false
use Ecto.Migration
def change do
execute("alter type realtime.equality_op add value 'in';")
execute("
create or replace function realtime.check_equality_op(
op realtime.equality_op,
type_ regtype,
... |
0c1bb3e96a694e5992e767e5a50322ccd5f1562b | 1,993 | [
888525063
] | [] | # 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 :tinypath,
ecto_repos: [Tinypath.Repo],
ge... |
0c1c44c8b55e378a7df603d645c514d8b52947a5 | 3,527 | [
237278698
] | [
"typespec",
"documented"
] | defmodule Bowling do
@doc """
Creates a new game of bowling that can be used to store the results of
the game
"""
@strike 10
@max_frames 10
@spec start() :: any
def start, do: []
@doc """
Records the number of pins knocked down on a single roll. Returns `any`
unless there is something w... |
0c1c767bd1513be2b1380516d32764573a12d42e | 3,074 | [
151515508
] | [
"test"
] | defmodule ApiWeb.ConnectToChannelTest do
use ApiWeb.ChannelCase
use ApiWeb, :db
setup do
[u1 | _] =
users =
["John", "Alex", "Mary"]
|> Enum.map(&%User{name: &1})
|> Enum.map(&Repo.insert!/1)
jim = Repo.insert!(%User{name: "Jim"})
category =
%Category{name: "Квартиры"}... |
0c1c7bc5a1940f6b08b8a3998fe085ed2381d9a9 | 12,567 | [
103105109,
109620344,
115751654,
131530086,
133927323,
135370449,
138562706,
154180160,
99375517,
120836354,
122787696,
134501845,
136631125,
153681753,
228937556,
103459096,
117414829,
123029159,
123950289,
124564174,
140890391,
147200116,
147655359,
113956009,
12226... | [
"macro",
"documented",
"ecto"
] | defmodule Ecto.Query.API do
@moduledoc """
This module lists all functions allowed in the query API.
* Comparison operators: `==`, `!=`, `<=`, `>=`, `<`, `>`
* Boolean operators: `and`, `or`, `not`
* Inclusion operator: `in/2`
* Search functions: `like/2` and `ilike/2`
* Null check functions: `... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.