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 |
|---|---|---|---|---|
01db6be3e57d8ae34f06399e5705d680c7d795c4 | 2,728 | [
650698680
] | [
"documented"
] | defmodule TudoChatWeb.GraphQL.Resolvers.SettingResolver do
@moduledoc false
alias TudoChat.Settings
alias TudoChatWeb.Controllers.SettingController
alias TudoChatWeb.Utils.CommonFunctions
def list_settings(_, _, _) do
{:ok, Settings.list_settings()}
end
def list_group_settings(_, _, _) do
{:ok, ... |
01dc67ad6c739f68c0fd864ec61bbe11e0320eb0 | 12,647 | [
270220179
] | [
"macro",
"documented",
"test"
] | defmodule Assertion do
@doc """
On using the module it imports all the macros on this module and registers a
module attributed called tests on which all the tests are accumulated. As last
step it triggers the before_compile function that will define a run test for
executing all the tests.
"""
defmacro __... |
01dc8952730f5b38b36b27a746dc4f545d536bac | 4,698 | [
218984102
] | [
"typespec",
"documented",
"ecto"
] | defmodule AuthShield.Resources.Roles do
@moduledoc """
Roles are used to define an group of permissions that the user has. It usually works
as an definition of the person function in the company.
We use this to implement and Role-based access control (RBAC).
RBAC is a policy-neutral access-control mechanism... |
01dc9a8bf58bf68117a1dd6229e2a353327a99ca | 3,724 | [
10641158
] | [] | defmodule Data.Dictionary.Standard do
defrecordp :wrap, __MODULE__, dict: nil
def new do
wrap(dict: :dict.new)
end
def new(enum_or_dict) do
wrap(dict: Data.to_list(enum_or_dict) |> :dict.from_list)
end
def has_key?(wrap(dict: self), key) do
:dict.is_key(key, self)
end
def get(wrap(dict: ... |
01dcadcea2cbcb360af8c6ffd4de0396d85b1c0d | 2,869 | [
78435867
] | [
"genserver",
"supervisor"
] | defmodule Todo.Server do
# Add restart configuration details.
# the child process is never restarted, regardless of the supervision strategy: any termination (even abnormal) is considered successful.
#
# If some of the todo servers crashes
# it will be started anyway by DynamicSupervisor
# so if we crashes ... |
01dd113890bc4e223cd5bf1a9173c5562e23754c | 2,138 | [
104223581
] | [] | defmodule IcdCode.ICDCode.Codes_Q21 do
alias IcdCode.ICDCode
def _Q210 do
%ICDCode{full_code: "Q210",
category_code: "Q21",
short_code: "0",
full_name: "Ventricular septal defect",
short_name: "Ventricular septal defect",
category_name: "Ventricular septal defect... |
01ddba84626fb5a3f5debcc2a9b16df392627682 | 3,840 | [
669575169
] | [
"liveview",
"test"
] | defmodule VectoraWeb.GainCreatorLiveTest do
use VectoraWeb.ConnCase
import Phoenix.LiveViewTest
import Vectora.ToolsFixtures
@create_attrs %{name: "some name", description: "some description"}
@update_attrs %{name: "some updated name", description: "some updated description"}
@invalid_attrs %{name: nil, d... |
01dddcb1b5badee58f831d7c9b0eaf3502685205 | 2,813 | [
982384796
] | [
"phoenix"
] | defmodule ExJiraWeb.Router do
use ExJiraWeb, :router
import ExJiraWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {ExJiraWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
p... |
01de2e85c8b45a7418a39947b7e74f1ef5eaddf9 | 5,829 | [
367278931
] | [
"documented"
] | defmodule Google.Ads.Googleads.V18.Common.AudienceDimension do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
oneof :dimension, 0
field :age, 1, type: Google.Ads.Googleads.V18.Common.AgeDimension, oneof: 0
field :gender, 2, type: Google.Ads.Googleads.V18.Common.GenderDi... |
01de545058974a0f119fc0c1428ca5ce9677990c | 9,712 | [
950279778
] | [
"liveview"
] | defmodule BeamFlowWeb.Author.PostLive.Index do
use BeamFlowWeb, :live_view
import BeamFlowWeb.DashboardComponents
alias BeamFlow.Content
alias BeamFlow.Content.Post
@impl true
def mount(_params, _session, socket) do
socket =
socket
|> assign(:page_title, "My Posts")
|> assign(:filter... |
01de94356b8e1dfa4058b35bafcc17eda84b2b50 | 3,513 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Recommender.V1beta1.Api.InsightTypes do
@moduledoc """
API calls for all endpoints tagged `InsightTypes`.
"""
alias GoogleApi.Recommender.V1beta1.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@doc """
Lists av... |
01dec96a298c4dc2cabc5d3faef486e9f7c8c620 | 1,500 | [
847486453
] | [] | defmodule Again.MixProject do
use Mix.Project
@version "0.1.1"
@source_url "https://github.com/alexkuang/again"
def project do
[
app: :again,
version: @version,
elixir: "~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps()... |
01df368eaa8a7a7c919f0cd0654fcf2ed545c16d | 3,021 | [
101502186
] | [
"documented"
] | defmodule SmileysData.Query.Post do
require Ecto.Query
alias SmileysData.{Post, Room, PostMeta, Repo}
alias SmileysData.Query.Post.Helper
alias SmileysData.Query.Vote, as: QueryVote
@doc """
Retrieve post specific data via hash key
"""
def by_hash(hash) do
Post |> Repo.get_by(hash: hash)
end
... |
01df631a0a21c4cc0bbcb420957267c34ae4140f | 1,996 | [
724775188
] | [
"test",
"ecto"
] | defmodule BattleTetris.RoomsTest do
use BattleTetris.DataCase
alias BattleTetris.Rooms
describe "rooms" do
alias BattleTetris.Rooms.Room
import BattleTetris.RoomsFixtures
@invalid_attrs %{description: nil, name: nil}
test "list_rooms/0 returns all rooms" do
room = room_fixt... |
01dfb3267bc873a975c433e211d9c7db4c33faeb | 3,625 | [
248023275
] | [
"documented"
] | defmodule Cloudevents.Format.V_0_1.Decoder.JSON do
@moduledoc false
@behaviour Cloudevents.Format.Decoder.JSON
alias Cloudevents.Format.Decoder.DecodeError
alias Cloudevents.Format.ParseError
alias Cloudevents.Format.V_0_1.Event
@doc """
Turns a JSON string into a Cloudevent 0.1 struct.
## Examples
... |
01dfb63a7ff9a5f11a706e4b0fb1ff143dbe711c | 4,206 | [
348895159
] | [
"documented"
] | defmodule Mastery.Core.Quiz do
alias Mastery.Core.Template
alias Mastery.Core.Question
alias Mastery.Core.Response
defstruct title: nil,
mastery: 3,
templates: %{},
used: [],
current_question: nil,
last_response: nil,
record: %{},
... |
01e01fada15843069135a3ebe4297ad0d4f047ae | 1,770 | [
45667366
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Requestbox.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Requestbox.Web, :controller
use Requestbox.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep... |
01e087e33b6c337aa3ec5a27137790cd4712350c | 3,209 | [
366716983
] | [
"genserver",
"liveview"
] | defmodule DashyWeb.RepoLive do
use Surface.LiveView
alias DashyWeb.Components.Layout
alias DashyWeb.Components.Card
alias DashyWeb.Components.CardContent
alias DashyWeb.Components.CardTitle
alias DashyWeb.Components.Charts.LastRuns
alias DashyWeb.Components.Charts.Parts
alias Dashy.Charts.Helpers
@... |
01e0cdc25e11e3f848af6dae2994aa11ee41c413 | 22,997 | [
165217643,
837319868
] | [
"typespec",
"documented"
] | defmodule K8s.Selector do
@moduledoc """
Builds [label selectors](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) and [field selectors](https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/) for `K8s.Operation`s
## Examples
Parse from a YAML map
... |
01e0dd9235c3dbcd07493cac1c8c78a34c27c70a | 1,594 | [
225810520
] | [
"macro",
"documented",
"phoenix"
] | defmodule BabyWeb 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 BabyWeb, :controller
use BabyWeb, :view
The definitions below will be executed for every view,
controller, etc, so k... |
01e106088d6990a3cb630158176fd2fa8c0ffd0d | 1,773 | [
37922757
] | [
"typespec",
"documented"
] | defmodule AuthorizeNet.Card do
@moduledoc """
Credit card information for payment profiles and other transactions.
Copyright 2015 Marcelo Gornstein <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a co... |
01e162873f643aa56e3e7990fe6c1881cc2743ce | 5,595 | [
120321295
] | [
"phoenix",
"ecto"
] | # Sample email: http://bin.mailgun.net/b1748eea#7jmd
defmodule IgwetWeb.RsvpController do
use IgwetWeb, :controller
require Logger
alias Igwet.Network
alias Igwet.Network.Node
alias Igwet.Network.SMS
alias Igwet.Scheduler
alias Igwet.Scheduler.Helper
@max_rsvp 6
@server "https://www.igwet.com"
def... |
01e17d61831c6551827fcc1fa2aee09b921598ee | 1,554 | [
163319904
] | [
"genserver",
"documented"
] | defmodule Exchange.Rabbit.Broadcaster do
use GenServer
@exchange "exchange.exchange"
@routing "exchange.routing"
@moduledoc """
Keeps a RabbitMQ connection open to a fanout exchange
where each worker is connected to. When messages are
broadcasted, they're sent to all workers, and also to
all the Pho... |
01e1b9c1cd21629211ea3e581a12cd2f0e84edf7 | 4,576 | [
185558207,
556161830,
213229236,
1000104078,
585915775,
589089007,
982054619,
589866492,
691980346,
882572863,
217320195,
174991383,
807904878,
215544723,
540729553,
500260157,
691199358,
771023416,
887377354,
530308212
] | [
"test",
"phoenix"
] | defmodule Pleroma.ConfigTest do
use Pleroma.DataCase
test "get/1 with an atom" do
assert Pleroma.Config.get(:instance) == Application.get_env(:pleroma, :instance)
assert Pleroma.Config.get(:azertyuiop) == nil
assert Pleroma.Config.get(:azertyuiop, true) == true
end
test "get/1 with a list of keys"... |
01e1d8666714e33e5251d290240e57c9ab80b647 | 6,768 | [
837813073
] | [
"typespec",
"documented"
] | defmodule Exa.Graf.Build do
@moduledoc """
Utilities for building directed graphs.
"""
import Bitwise
import Exa.Types
alias Exa.Types, as: E
alias Exa.Random
alias Exa.Graf.Types, as: G
alias Exa.Graf.Graf
alias Exa.Graf.Gdb
# ------------
# constructors
# ------------
@doc "Disconnec... |
01e25b07767974c1a454044ea561d2682d068287 | 6,018 | [
423818339
] | [
"documented",
"ecto"
] | defmodule Inventory.Warehousing do
@moduledoc """
The Warehousing context.
"""
import Ecto.Query, warn: false
alias Inventory.Repo
alias Inventory.Warehousing.Company
@doc """
Returns the list of companies.
## Examples
iex> list_companies()
[%Company{}, ...]
"""
def list_companie... |
01e29f3e3e45da96763b06858508f47cd3772453 | 18,832 | [
821769193,
875742128,
774405652,
857708817
] | [
"macro",
"documented"
] | defmodule Makeup.Lexers.ElixirLexer do
@moduledoc """
A `Makeup` lexer for the Elixir language.
"""
import NimbleParsec
import Makeup.Lexer.Combinators
import Makeup.Lexer.Groups
import Makeup.Lexers.ElixirLexer.Helper
@behaviour Makeup.Lexer
########################################################... |
01e29f48a995b16a5efa1d7a6079757b768b17b1 | 7,817 | [
152995924,
180368458,
137185910,
163850345
] | [
"test"
] | if !System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("twelve_days.exs", __DIR__)
end
ExUnit.start()
ExUnit.configure(trace: true, exclude: :pending)
defmodule TwelveDaysTest do
use ExUnit.Case
describe "verse" do
# @tag :pending
test "first verse" do
assert TwelveDays.verse(1) ==
... |
01e2e8e1dee710f27ca4e124e82e906427581763 | 15,378 | [
253864504
] | [] | %{
"absinthe": {:hex, :absinthe, "1.4.16", "0933e4d9f12652b12115d5709c0293a1bf78a22578032e9ad0dad4efee6b9eb1", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "076b8bd9552f4966ba1242f412f6c439b731169... |
01e378d04f8d2e9969edfa37d7f7d7731957b09b | 3,766 | [
848260374
] | [
"test",
"phoenix"
] | defmodule ExstreamerWeb.UserResetPasswordControllerTest do
use ExstreamerWeb.ConnCase, async: true
alias Exstreamer.Accounts
alias Exstreamer.Repo
import Exstreamer.AccountsFixtures
setup do
%{user: user_fixture()}
end
describe "GET /users/reset_password" do
test "renders the reset password pag... |
01e3dff518446a71cc3c0c6d24f1e53bd8814c8d | 2,236 | [
635843151
] | [
"test"
] | defmodule SigilsTest do
use ExUnit.Case
import LineSigil
use ColorSigil
import CsvSigil
test "lines" do
assert ~l"""
line 1
line 2
and another line in #{__MODULE__}
""" == [
"line 1",
"line 2",
"and another line in #{__MOD... |
01e4252919931859578ac09cca54b351c8bdac36 | 5,338 | [
211390448
] | [
"genserver",
"typespec",
"documented"
] | defmodule ReIntegrations.Notifications.Emails.Server do
@moduledoc """
Module responsible for sending email
"""
use GenServer
use Retry
require Logger
alias Re.{
PubSub,
Repo
}
alias ReIntegrations.Notifications.Emails
@env Application.get_env(:re_integrations, :env)
@spec start_link ... |
01e44c1e2cdb44eae920e33acfa8373aa1b82b46 | 1,907 | [
173033332
] | [
"documented",
"ecto"
] | defmodule TaskTracker.Tasks do
@moduledoc """
The Tasks context.
"""
import Ecto.Query, warn: false
alias TaskTracker.Repo
alias TaskTracker.Tasks.Task
@doc """
Returns the list of tasks.
## Examples
iex> list_tasks()
[%Task{}, ...]
"""
def list_tasks do
Repo.all(Task)
end
... |
01e4ab9ea0b6b6b7838dbdbfeb92d853d91ad643 | 15,490 | [
990942450
] | [
"documented"
] | defmodule CooCoo.Projections.TransverseMercator do
@moduledoc """
Provides Transverse Mercator projection conversions.
This module implements the core mathematical formulas for the projection.
UTM is a specific application of Transverse Mercator.
Based on NGA.SIG.0012_2.0.0_UTMUPS "The Universal Grids and th... |
01e4ba866dd754ffb0fdef4110557220ce689bbe | 1,562 | [
528432749
] | [
"typespec"
] | defmodule Domain.OperationAgent do
alias Domain.Entities.Operation
@required_fields [:agents, :operation]
@enforce_keys @required_fields
defstruct @required_fields
@type agents :: %{
average_purchage: pid(),
damage: pid(),
list_shares_purchased: pid()
}
@type t :: %__MODULE__{
agents: a... |
01e4f2fe3c8d628fd14aece854362cb9627d1923 | 3,548 | [
222558635
] | [
"typespec",
"documented"
] | defmodule CarPooling.Runs do
@moduledoc """
The boundary for the Runs system.
"""
alias CarPooling.Runs.Commands.CreateCar
alias CarPooling.Runs.Commands.CreateJourney
alias CarPooling.Runs.Commands.DeleteJourney
alias CarPooling.Runs.Projections.Car
alias CarPooling.Runs.Projections.Journey
alias Ca... |
01e50876dc22bc30160df191754919f214f58cad | 1,603 | [
84134990
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Dwblog.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Dwblog.Web, :controller
use Dwblog.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them short ... |
01e575b1e33d65f111ee0a65f49d15b140d1af05 | 2,602 | [
612180422
] | [
"documented"
] | defmodule TrackerOptions do
@moduledoc """
process the optional fields in the payload if they exist
they are identified by a keystring as the last field in the payload beginning with "012345"
return a list of sondehub keys and parsed values
if the keys do not exist return an empty list
"""
@option_map %{
"... |
01e57d5a7b4850a507ba5cf399631a55bc03c654 | 4,291 | [
907542993
] | [
"documented",
"ecto"
] | defmodule PoopyLoops.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias PoopyLoops.Repo
alias PoopyLoops.Accounts.{User, UserToken}
## Database getters
@doc """
Gets a user by email.
## Examples
iex> get_user_by_email("<EMAIL>")
%User{}
... |
01e589b3347b48e5bd734b07e5457dd9040e0541 | 15,567 | [
744281225,
116826798,
313251367
] | [
"test"
] | defmodule LocalLedger.CachedBalanceTest do
use ExUnit.Case, async: true
import LocalLedgerDB.Factory
alias Ecto.Adapters.SQL.Sandbox
alias LocalLedger.{CachedBalance}
alias LocalLedgerDB.{Repo}
alias EWalletConfig.{Config, ConfigTestHelper}
alias ActivityLogger.System
setup do
:ok = Sandbox.checkou... |
01e5ca544d86330e0601cf0b45fc5d068b101580 | 1,669 | [
208641457
] | [
"documented",
"ecto"
] | defmodule Letitcrash.Landing do
@moduledoc """
The Landing context.
"""
import Ecto.Query, warn: false
alias Letitcrash.Repo
alias Letitcrash.Landing.Mail
@doc """
Returns the list of mails.
## Examples
iex> list_mails()
[%Mail{}, ...]
"""
def list_mails do
Repo.all(Mail)
e... |
01e5d26318c08b5170d827a1930d09931f778ed3 | 2,999 | [
27317463
] | [
"genserver"
] |
defmodule TailFServer do
use GenServer
@timeout_now 0
defmodule State do
defstruct path: "", io: nil, read_period: 0, lines: nil, partial: ""
end
############################################################
# GenServer callbacks
def init({path, num_lines, read_period}) do
{:ok, io} = File.open... |
01e643e2f16f7d53a9d6368b68bac2cef5d78c96 | 3,593 | [
433780312
] | [] | defmodule AOC.Year2021.Day8 do
use AOC, day: 8
def part1(list \\ input()) do
checks = [2, 4, 3, 7]
list
|> parse_input()
|> Enum.reduce(0, fn {_patterns, output}, acc ->
count = output |> Enum.count(&(String.length(&1) in checks))
acc + count
end)
end
def part2(list \\ input()... |
01e692cea3aba52ce8878e51e24a3315e5f05731 | 3,073 | [
918266040
] | [] | %{
"cc_precompiler": {:hex, :cc_precompiler, "0.1.10", "47c9c08d8869cf09b41da36538f62bc1abd3e19e41701c2cea2675b53c704258", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "f6e046254e53cd6b41c6bacd70ae728011aa82b2742a80d6e2214855c6e06b22"},
"db_connection": {:hex, :d... |
01e6ca66e4090a0e66e8a173e815cded8cc9c09b | 2,615 | [
691134020
] | [
"test"
] | defmodule ExtismTest do
use ExUnit.Case
doctest Extism
defp new_plugin() do
path = Path.join([__DIR__, "../wasm/count-vowels.wasm"])
manifest = %{wasm: [%{path: path}]}
{:ok, plugin} = Extism.Plugin.new(manifest, false)
plugin
end
test "counts vowels" do
plugin = new_plugin()
{:ok, o... |
01e6d16e2b751092bd24acae107925d3afeb22e6 | 12,370 | [
949664843
] | [
"typespec",
"documented"
] | defmodule Raxol.UI.Theming.Theme do
@moduledoc """
Theme management for Raxol UI components.
This module provides functionality for:
- Theme definition and management
- Color palette integration
- Component styling
- Theme variants and accessibility
"""
alias Raxol.Style.Colors.{Color, Utilities}
... |
01e75d00b0f74cc7b4893512e1aa1241a7b10534 | 14,919 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.GamesManagement.V1management.Api.Achievements do
@moduledoc """
API calls for all endpoints tagged `Achievements`.
"""
alias GoogleApi.GamesManagement.V1management.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@... |
01e788d8f949f26eb5e295e9433fd3a606977142 | 1,787 | [
389561072
] | [] | defmodule Handroll do
require Logger
import Nx.Defn
@epochs 30
@input_columns [
"Cylinders",
"Displacement",
"Horsepower"
]
def run_example() do
# split the data into test and train sets, each with inputs and targets
{test_inputs, test_targets, train_inputs, train_targets} =
Au... |
01e7deef62ba4b8a6d8534c9b5c7cac70ccb299b | 3,232 | [
673681410
] | [
"phoenix"
] | defmodule BlogAppWeb.Router do
use BlogAppWeb, :router
import BlogAppWeb.AccountAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {BlogAppWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_header... |
01e8c5293958b64c4c3a7037eaf41cf5bb8264b5 | 2,361 | [
148039425
] | [
"test"
] | defmodule FluidTest do
use ExUnit.Case, async: true
doctest Fluid
defmodule Foo do
use Fluid,
fields: [
inserted_at: %Fluid.Field.NaiveDateTime{size: 4},
node_id: %Fluid.Field.Integer{size: 4}
],
formats: [
hex: %Fluid.Format.Hexadecimal{
separator: ?-,
... |
01e92a5233b597ac22420b34fc329ce00874b929 | 1,804 | [
507621812
] | [] | defmodule ReportsGenerator do
alias ReportsGenerator.Parser
@available_foods [
"açaí",
"churrasco",
"esfirra",
"hambúrguer",
"pastel",
"pizza",
"prato_feito",
"sushi"
]
@options [ "foods", "users"]
def build(filename) do # define a função para abrir o arquivo com um argumento
... |
01e9416924835475953bd1d3793c04eb96d7caff | 2,352 | [
757463973,
768011158,
279895213,
610994830,
792554244,
493445187,
644559297,
895439861,
756299391,
531030808,
449967422
] | [
"typespec",
"phoenix"
] | defmodule ChatApiWeb.ReportingController do
use ChatApiWeb, :controller
require Logger
alias ChatApi.Reporting
action_fallback(ChatApiWeb.FallbackController)
@spec index(Plug.Conn.t(), map()) :: Plug.Conn.t()
def index(%{assigns: %{current_user: %{account_id: account_id}}} = conn, %{
"from_date"... |
01e9c5ffe573ae5d77275020894cb0d917f8e8af | 1,978 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.CloudErrorReporting.V1beta1.Model.HttpRequestContext do
@moduledoc """
HTTP request data that is related to a reported error. This data should be provided by the application when reporting an error, unless the error report has been generated automatically from Google App Engine logs.
## Attri... |
01e9cb1a2e3fc5034349a199d08504e22acea143 | 1,739 | [
59431130
] | [
"phoenix"
] | defmodule HelloPhoenix.ProductController do
use HelloPhoenix.Web, :controller
alias HelloPhoenix.Product
plug :scrub_params, "product" when action in [:create, :update]
def index(conn, _params) do
products = Product |> Repo.all |> Repo.preload([:images])
render(conn, "index.json", products: products)... |
01e9ed55b2b5e45680e3294e86c30949418c13f5 | 1,637 | [
117668988
] | [
"phoenix",
"ecto"
] | defmodule BiddingWeb.BidController do
use BiddingWeb, :controller
alias Bidding.Primary
alias Bidding.Primary.Bid
def index(conn, _params) do
bids = Primary.list_bids()
render(conn, "index.html", bids: bids)
end
def new(conn, _params) do
changeset = Primary.change_bid(%Bid{})
render(conn,... |
01ea29d22389fbbc2d46fa5ffdf48baf3efca6dc | 4,250 | [
256005654
] | [
"macro",
"documented",
"test"
] | defmodule Sally.HostAid do
@moduledoc """
Supporting functionality for creating Sally.Host for testing
"""
defmacrop put_host(val) do
quote bind_quoted: [val: val] do
Map.put(var!(ctrl_map), :host, val)
end
end
# NOTE: ExUnit.Case setup function
def add(%{host_add: opts}), do: %{host: add(... |
01ea648e6513c4e002cd9871e6ed6dbd4bcadcb6 | 1,699 | [
386634430
] | [
"phoenix"
] | defmodule BankAppWeb.Router do
use BankAppWeb, :router
pipeline :browser do
plug(:accepts, ["html"])
plug(:fetch_session)
plug(:fetch_flash)
plug(:protect_from_forgery)
plug(:put_secure_browser_headers)
end
pipeline :api do
plug(:accepts, ["json"])
end
scope "/", BankAppWeb do
... |
01eb3f10cb5384eb25f864262114cf7ce71fb568 | 3,759 | [
329355024
] | [
"test"
] | defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
use Pleroma.DataCase
alias Pleroma.Config
alias Pleroma.User
alias Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy
alias Pleroma.Web.ActivityPub.Visibility
setup do:
clear_config(:mrf_object_age,
threshold: 172_800,
... |
01eb5de6d9a6242415cb9b112e9a70709a782117 | 3,294 | [
70603353
] | [
"ecto"
] | defmodule Pings.Ping do
use Pings.Web, :model
alias Pings.Repo
alias Pings.Ping
# define the table schema
schema "pings" do
field :device_id, :string
field :time, Ecto.DateTime
end
# use a changeset to validate insert statements
def changeset(ping, params \\ %{}) do
ping
|> cast(params... |
01ebd0bb5d83242af6e54bf1e3ab64fc0ca9f057 | 2,521 | [
426551327
] | [
"documented"
] | defmodule Sensei.Storage.Users do
@moduledoc """
Two main cases of appear of user:
1. User launch /start
2. Admin add some sensei, who doesnt launch /start (active? == false)
In case 2. we use fake id and replace with real id (refine user), when sensei launch bot
"""
require OK
require Logger
al... |
01ec0fd1b5dc0411ee433ba8008663ca812ece06 | 4,115 | [
279934790
] | [
"phoenix"
] | defmodule BijakhqWeb.Api.QuizSessionView do
use BijakhqWeb, :view
alias BijakhqWeb.Api.QuizSessionView
# alias Bijakhq.Game.Server
alias Bijakhq.Game.GameManager
alias BijakhqWeb.Api.UserView
def render("index.json", %{quiz_sessions: quiz_sessions}) do
%{data: render_many(quiz_sessions, QuizSessionView... |
01ec1fc07594df99cc18a272c13495c422b12504 | 3,316 | [
488312080
] | [
"typespec",
"documented"
] | defmodule Notifiex.Service.Slack do
@moduledoc """
Slack service for Notifiex.
"""
@behaviour Notifiex.ServiceBehaviour
@type payload :: %{required(:text) => binary, required(:channel) => binary}
@type options :: %{
required(:token) => binary,
optional(:channel_ids) => any,
op... |
01ec4350564bc68ed6aef0918e943e53d631fe91 | 1,653 | [
919096124
] | [
"documented",
"ecto"
] | defmodule Tela.Web do
@moduledoc """
The Web context.
"""
import Ecto.Query, warn: false
alias Tela.Repo
alias Tela.Web.Page
@doc """
Returns the list of pages.
## Examples
iex> list_pages()
[%Page{}, ...]
"""
def list_pages do
Repo.all(Page)
end
@doc """
Gets a single... |
01ec58f22c8d892e47a029c5528ec4d845016ff5 | 1,570 | [
764901590
] | [
"supervisor",
"documented"
] | # credo:disable-for-this-file Credo.Check.Refactor.ModuleDependencies
defmodule Signbank.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
{NodeJS.Supervis... |
01edc2fc9e871690182c7410282fc0876bb95cdd | 3,305 | [
377299901,
379540653,
379539389,
379103003,
379497482,
376697125,
379145358,
379539640,
379539363
] | [
"test",
"phoenix"
] | defmodule IdeaSnippetsWeb.UserConfirmationControllerTest do
use IdeaSnippetsWeb.ConnCase, async: true
alias IdeaSnippets.Accounts
alias IdeaSnippets.Repo
import IdeaSnippets.AccountsFixtures
setup do
%{user: user_fixture()}
end
describe "GET /users/confirm" do
test "renders the confirmation pag... |
01ede9c0f180c27c99619b78838d83f5dd10e5e8 | 2,648 | [
29387790
] | [
"test"
] | defmodule Brando.Utils.SchemaTest do
use ExUnit.Case
use Brando.ConnCase
use BrandoIntegration.TestCase
alias Brando.Factory
alias Brando.Utils
test "update_field/2" do
user = Factory.insert(:random_user)
assert {:ok, schema} = Utils.Schema.update_field(user, name: "James Bond")
assert schema.... |
01eee514a881d596c6c083bbf0ce3989ef30e32d | 20,237 | [
218301249
] | [] | %{
"accept": {:hex, :accept, "0.3.5", "b33b127abca7cc948bbe6caa4c263369abf1347cfa9d8e699c6d214660f10cd1", [:rebar3], [], "hexpm", "11b18c220bcc2eab63b5470c038ef10eb6783bcb1fcdb11aa4137defa5ac1bb8"},
"amqp": {:hex, :amqp, "3.3.0", "056d9f4bac96c3ab5a904b321e70e78b91ba594766a1fc2f32afd9c016d9f43b", [:mix], [{:amqp_cl... |
01ef1f2216cfac6f9cd35eeaf4663b63a3889feb | 2,105 | [
898580701,
317574855
] | [] | defmodule Day7 do
@input File.read!(Path.absname("priv/day7.txt", Application.app_dir(:aoc2020)))
def solve(input \\ @input) do
graph = build_graph(input)
part1 = Enum.count(graph, fn {key, _inner} ->
# Don't count ourselves
if key == "shiny gold" do
false
else
reachable?... |
01ef47a265ff3b5c777ecd7015eee85e661ef930 | 5,551 | [
650138283
] | [
"phoenix"
] | defmodule SellSetGoApiWeb.Router do
use SellSetGoApiWeb, :router
pipeline :api do
plug(Plug.Session, Application.get_env(:phoenix, __MODULE__)[:session])
plug(:fetch_session)
plug(:put_secure_browser_headers)
end
pipeline :XML do
plug(SellSetGoApi.Plug.FetchXml)
end
pipeline :JSON do
... |
01ef510d141010f2349e46e6b9e543b0a4eb6162 | 3,983 | [
51291289
] | [
"genserver"
] | defmodule Upup.Worker do
use Silverb, [
{"@ttl", :timer.seconds(30)},
{"@proxy_whitelist_ttl", :timer.minutes(5)}
]
use GenServer
require Exutils
def start_link(args), do: GenServer.start_link(__MODULE__, args)
def init(uid) do
Upup.notice("start worker #{Integer.to_string(uid)}")
<<a::32,b::32,c::32>> ... |
01ef7ea4e7827c9bb15cd75ed55c2cd01411ddfb | 2,358 | [
944239642
] | [] | defmodule Ledger.MixProject do
use Mix.Project
def project do
[
app: :ledger,
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 OTP ... |
01efbdc9c8af64bd215f6221befd49b43b78446d | 4,863 | [
77002407
] | [
"typespec",
"documented"
] | defmodule Vivid.Circle do
alias Vivid.{Circle, Point, Polygon}
defstruct center: nil, radius: nil, fill: false
import Vivid.Math
@moduledoc ~S"""
Represents a circle based on it's center point and radius.
## Example
iex> use Vivid
...> Circle.init(Point.init(10,10), 10)
...> |> to_string()
... |
01efd3799b53d05ad68c62073ebb131e5aa5769a | 3,178 | [
504330050
] | [
"phoenix"
] | defmodule WhatWhereWhenWeb.Router do
use WhatWhereWhenWeb, :router
import WhatWhereWhenWeb.PersonAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {WhatWhereWhenWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_s... |
01efe11b9cf09d312a01e1053e5005d7aa9f1b31 | 2,988 | [
308720922
] | [] | %{
"certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"},
"hackney": {:hex, :hackney, "1.16.0", "... |
01efe60f57014624a4e53951de9a481e927dc567 | 2,278 | [
129260560
] | [
"genserver"
] | defmodule RumblWeb.VideoChannel do
use RumblWeb, :channel
import Destructure
alias Rumbl.{Streaming, Accounts}
alias RumblWeb.{AnnotationView}
def join("videos:" <> video_id, params, socket) do
last_seen_id = params["last_seen_id"] || 0
video_id = String.to_integer(video_id)
annotations =
v... |
01f04a798362463021fd269cbe4a7733e290b047 | 2,662 | [
96444607
] | [] | defmodule KioskSystemRpi3.MixProject do
use Mix.Project
@github_organization "nerves-web-kiosk"
@app :kiosk_system_rpi3
@version Path.join(__DIR__, "VERSION")
|> File.read!()
|> String.trim()
def project do
[
app: @app,
version: @version,
elixir: "~> 1.8",
a... |
01f07c4421f2b8c82ec749e63f7d11abccad0971 | 3,401 | [
369048033
] | [
"test",
"phoenix"
] | defmodule HelixGymWeb.EmployeeSessionControllerTest do
use HelixGymWeb.ConnCase, async: true
import HelixGym.AccountsFixtures
setup do
%{employee: employee_fixture()}
end
describe "GET /employees/log_in" do
test "renders log in page", %{conn: conn} do
conn = get(conn, Routes.employee_session_... |
01f07e0b439344fdc2f9cc36371c3a8430ae8bbd | 5,008 | [
26083748
] | [
"genserver",
"phoenix",
"documented"
] | defmodule Entice.Web.EntityChannel do
use Entice.Web.Web, :channel
use Entice.Logic.Attributes
alias Entice.Utils.StructOps
alias Entice.Entity
alias Entice.Entity.Coordination
alias Entice.Logic.{Maps, Npc}
alias Entice.Web.{Endpoint, Token}
alias Phoenix.Socket
@all_reported_attributes [
Positi... |
01f08adafa6132f9c542523a1bf8e12a9ed462e5 | 2,151 | [
309701254
] | [
"documented",
"ecto"
] | defmodule Bookstore.Media do
@moduledoc """
The Media context.
"""
import Ecto.Query, warn: false
alias Bookstore.Repo
alias Bookstore.Media.Publisher
@doc """
Returns the list of publishers.
## Examples
iex> list_publishers()
[%Publisher{}, ...]
"""
def list_publishers do
Re... |
01f09453540d3270aa2117c792ccaac49826454f | 11,242 | [
292214006
] | [
"phoenix"
] | defmodule InvetHubWeb.DashboardController do
use InvetHubWeb, :controller
alias InvetHub.Inventory.Inventory, as: Inventory
plug(
InvetHubWeb.Plugs.RequireAuth
when action in [
:all,
:index,
:kabwata,
:ibex_hill,
:soweto,
:lumumba
]
)
def index(conn, _params) do
render(conn,... |
01f0aa5919c11aecb3e999b5d06636618e276c6e | 2,195 | [
470712252
] | [
"liveview"
] | defmodule StoryWeb.AddNewReadingLive do
use StoryWeb, :live_component
import StoryWeb.LayoutView, only: [markdown_as_html: 1]
alias Story.Pages
alias Phoenix.LiveView.JS
def update(assigns, socket) do
reading = %Pages.Reading{id: "new"}
{:ok,
socket
|> assign(:page_id, assigns.page_id)
... |
01f1a9bf04742d89933a2d9cfe1d703e81b31080 | 3,186 | [
815308672
] | [] | defmodule ChowChaser.MixProject do
use Mix.Project
def project do
[
app: :chow_chaser,
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... |
01f1ac80fd08dbb579768989b332f774355b36dc | 2,016 | [
497660798
] | [] | defmodule Healthz.MixProject do
use Mix.Project
@source_url "https://github.com/mpran/healthz"
@version_file Path.join(__DIR__, ".version")
@external_resource @version_file
@version (case Regex.run(~r/^v([\d\.]+)/, File.read!(@version_file),
capture: :all_but_first
) do
... |
01f24d9014dc708b0acd0c00d48448cc7f24f134 | 20,096 | [
904841321
] | [
"typespec",
"documented"
] | defmodule Jido.AI.Prompt.Template do
@moduledoc """
Enables defining a prompt template and delaying the final
building of it until a later time when input values are substituted in.
This also supports the ability to create a Message from a Template.
PromptTemplates are powerful because they support Elixir's... |
01f29c76117b5fbabb0ff5be04e8c159db8bfd0d | 20,643 | [
1014340631
] | [
"documented"
] | defmodule Thunderwave.BroadwayPipeline do
@moduledoc """
🌊📡 Broadway Pipeline Integration for Thunderline Monad-ECS Architecture
High-throughput event streaming with concurrency, batching, and backpressure handling
across all 12-aspect monad systems. Integrates with OpenTelemetry for full observability
and... |
01f2eaf402c58b68b23ddba7630ee8022efe1c16 | 5,120 | [
751889882
] | [
"typespec",
"documented"
] | defmodule NFTScanClient.Client do
@moduledoc """
Client module for interacting with the NFTScan API.
## Example
# Fetch NFTs for an account
{:ok, nfts} = NFTScanClient.Client.nfts_by_account("0x123...")
# Fetch a collection
{:ok, collection} = NFTScanClient.Client.get_collection("0xabc.... |
01f2f065c82f2dfd5bfb333275c3b55a77d4c208 | 1,706 | [
237364100
] | [
"typespec",
"phoenix"
] | defmodule ApiWeb.V1.UserController do
use ApiWeb, :controller
alias Api.{Repo, User}
@spec index(Plug.Conn.t(), %{}) :: Plug.Conn.t()
def index(conn, _params) do
users = Repo.all(User)
json(conn, users)
end
@spec show(Plug.Conn.t(), %{required(String.t()) => String.t()}) :: Plug.Conn.t()
def s... |
01f33d1a648770ad456d0cecb42bb4c2101916d3 | 1,592 | [
145998905
] | [
"phoenix"
] | defmodule Smarthood.Plugs.Authorizer do
use SmarthoodWeb, :controller
require IEx
def unauthorized_user(conn) do
[url] = get_req_header(conn, "referer")
key = "x-pjax-url"
# conn = delete_req_header(conn, "x-pjax")
# conn = delete_req_header(conn, "x-pjax-container")
conn = conn
|> put_re... |
01f343b3b42c429320cc064223cbdf1277286b70 | 2,624 | [
374076365
] | [
"test"
] | defmodule EDS.Remote.Spy.Interpreter.ErrorsTests do
use EDS.DataCase, async: false
alias EDS.Remote.Spy.Server
alias EDS.Fixtures.Errors
setup_all do
start_supervised(Server)
Server.load(Errors)
Server.load(Errors.Interpreted)
:ok
end
test "raise in non-interpreted function" do
assert... |
01f35fac94f08b9f9ac4db387ab0a22c617ef1c3 | 2,086 | [
104659436
] | [
"typespec",
"documented"
] | defmodule NodoRemoto do
@moduledoc """
modulo de gestión de ciclo de vida de nodos remotos
"""
@doc """
Poner en marcha un nodo VM remoto con ssh
- Se tiene en consideracion los puertos disponibles,
debido al cortafuegos, en el laboratorio 1.02
"""
@spec start(... |
01f3aa471bda1af74e57b5286c6307c9e8777dfc | 2,439 | [
166011865
] | [
"genserver"
] | defmodule Events do
use GenStage
def start_link() do
GenStage.start_link(__MODULE__, :no_state)
end
def init(state) do
{:consumer, state, subscribe_to: [Events.Arrive]}
end
def handle_events(events, _from, state) do
# handle events!
# pattern matching
... |
01f52be137f69e78f97bf49e7626f09475aac8f7 | 3,736 | [
537182196
] | [
"typespec",
"documented"
] | defmodule Blast.Util.Parser do
@moduledoc """
This module provides a streamlined way of parsing
maps with an expected format, e.g. a set of known fields
that has certain types, values etc.
"""
@error_key :_parser_error
@type field_type :: :string | :int | :map
@type field :: {any(), keyword()}
@... |
01f56c61b4f8d5344fb3e04d7a654268ee49db4b | 1,970 | [
54250098
] | [] | %{"benchfella": {:hex, :benchfella, "0.3.2", "b9648e77fa8d8b8b9fe8f54293bee63f7de03909b3af6ab22a0e546716a396fb", [:mix], []},
"certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0df0979153cbafcd853ababaf", [:rebar3], []},
"earmark": {:hex, :earmark, "1.0.3", "89bdbaf2aca8bbb5c97d8b3b55c5dd0... |
01f5d67df40c13877f6fc4a790c7ade99a99b167 | 1,726 | [
170695325
] | [
"macro",
"documented",
"phoenix"
] | defmodule TwitterIntegrationWeb 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 TwitterIntegrationWeb, :controller
use TwitterIntegrationWeb, :view
The definitions below will be execut... |
01f615288425aede1607129a44819f3803a407e3 | 1,604 | [
785112910
] | [] | defmodule PointPulseWeb.User.GetUserJSON do
alias PointPulse.Users.User
def show(%{user: user, permissions: permissions}) do
%{status: :OK, data: data_permissions(user, permissions)}
end
def show(%{user: user}) do
%{status: :OK, data: data(user)}
end
def show_message(%{message: message}) do
%... |
01f61d57d1d5d69fb29c5cd36a609ed6b50fb2fb | 3,496 | [
757318513
] | [
"genserver"
] | defmodule Connect4Telnet.Conn do
use GenServer, restart: :temporary
alias Connect4.Games.Board
alias Connect4.Games.Game
alias Connect4.Games.Player
alias Connect4Telnet.Handler
require Logger
defstruct params: [],
path: [],
pid: nil,
response: "",
request:... |
01f675157d2f6d8fa43035b8e5c8ba70cc602fd3 | 2,162 | [
919884823
] | [
"test",
"ecto"
] | defmodule Ecommerce.OrderTest do
use Ecommerce.DataCase
alias Ecommerce.Order
describe "order_items" do
alias Ecommerce.Order.OrderItem
import Ecommerce.OrderFixtures
@invalid_attrs %{quantity: nil, price: nil}
test "list_order_items/0 returns all order_items" do
order_item = order_item... |
01f68eb61d80039918ef3ee0a4dc4fdbe67e1739 | 2,821 | [
610564222
] | [
"genserver"
] | defmodule PaynetServerAndCpayServerSim.CpayServer.Handler do
use GenServer
@behaviour :ranch_protocol
@timeout 120000
@send_interval 30*1000
@impl true
def start_link(ref, transport, opts) do
{:ok, :proc_lib.spawn_link(__MODULE__, :init, [{ref, transport, opts}])}
end
@impl true
def init({ref, ... |
01f6cbc5609fb58fe31dc4c0603b4cf91006e0c6 | 3,989 | [
426749115
] | [
"liveview",
"test"
] | defmodule ThreagileVisualizerWeb.ArchitectureLiveTest do
use ThreagileVisualizerWeb.ConnCase
import Phoenix.LiveViewTest
import ThreagileVisualizer.SystemsFixtures
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
defp create_architecture(_) do
... |
01f6f01311e7ff778cdd62cab66ababc1be63754 | 1,513 | [
985712448
] | [
"documented"
] | defmodule MyApp.Demo do
@moduledoc """
The Demo context.
"""
import Ecto.Query, warn: false
alias MyApp.Repo
alias MyApp.Demo.Counter
@doc """
Returns the list of counters.
## Examples
iex> list_counters()
[%Counter{}, ...]
"""
def list_counters do
raise "TODO"
end
@doc ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.