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 |
|---|---|---|---|---|
0680d7da8fe1c3e7410d1347b77eb2978a0e19f0 | 11,525 | [
478522297
] | [
"typespec",
"macro",
"documented"
] | defmodule EEx.SyntaxError do
defexception [:message, :file, :line, :column]
@impl true
def message(exception) do
"#{exception.file}:#{exception.line}:#{exception.column}: #{exception.message}"
end
end
defmodule EEx do
@moduledoc ~S"""
EEx stands for Embedded Elixir.
Embedded Elixir allows you to em... |
0680df228e8194b9d6ffc004040ed90fcfa4c9e3 | 14,532 | [
274765346
] | [
"test"
] | defmodule NotSkull.GameEngineTest do
use ExUnit.Case
import Support.AssertionHelpers
alias NotSkull.{Factory, GameEngine}
alias GameEngine.{Game, Move}
alias NotSkull.Errors.{GameError}
@expected_phases_and_move_types %{
first_card: [:add],
add_or_bet: [:add, :bet],
bet_or_pass: [:bet, :pass],
... |
0680f75b8dd2f6c93ca6a072384b928b565e6137 | 5,050 | [
963280855
] | [
"test"
] | defmodule BeamMePrompty.Agent.Stage.ConfigTest do
use ExUnit.Case, async: true
alias BeamMePrompty.Agent.Stage.Config
alias BeamMePrompty.LLM.Errors.InvalidConfig
describe "default/0" do
test "returns default configuration struct with expected values" do
config = Config.default()
assert %Conf... |
0681332fa35ad885c499f494368fb84fe4b87a7e | 2,889 | [
153036127
] | [
"phoenix",
"ecto"
] | defmodule TaskTrackerWeb.TaskController do
use TaskTrackerWeb, :controller
alias TaskTracker.Tasks
alias TaskTracker.Tasks.Task
alias TaskTracker.Users
alias TaskTracker.Timeblocks
def index(conn, _params) do
tasks = Tasks.list_tasks()
current_user = get_session(conn, :user_id)
your_tasks = Ta... |
06818f940fdf057a3484c25a6b6044a41ec9e9a2 | 2,016 | [
159988826
] | [
"typespec",
"documented"
] | defmodule Day06 do
@type action :: :on | :off | :toggle
@doc """
iex> Day06.action_str_to_atom("toggle")
:toggle
iex> Day06.action_str_to_atom("on")
:on
"""
@spec action_str_to_atom(String.t()) :: action
def action_str_to_atom(str) when is_binary(str) do
case str do
"toggle" ->
... |
0681c6197e62d4eb1a65f8ec663622639e6b0e76 | 1,995 | [
60650632
] | [
"genserver"
] | defmodule Measurements do
use GenServer
@timeout 5000
@ljubljana_client Application.get_env(:measurements, :ljubljana_client)
@wroclaw_client Application.get_env(:measurements, :wroclaw_client)
# works, but :/
Code.require_file("test/mocks/ljubljana_mock.ex")
Code.require_file("test/mocks/wroclaw_mock... |
068262066703c513be06e482c69c079d38ba9654 | 2,120 | [
276451476
] | [
"typespec",
"documented"
] | defmodule EQL.AST.Union do
@moduledoc false
alias EQL.{AST.Union.Entry, Utils}
require EQL.Utils
defstruct query: nil,
children: []
@type t :: %__MODULE__{
query: EQL.expr(),
children: [Entry.t()]
}
@spec new(EQL.expr(), [Entry.t()]) :: t
def new(query, children ... |
0682e73eb3cd100ed795cd6736a1632cb1d2f214 | 2,600 | [
115469363
] | [
"macro",
"test"
] | defmodule Saxy.EmitterTest do
use ExUnit.Case, async: true
alias SaxyTest.ControlHandler
@events [
:start_document,
:start_element,
:characters,
:end_element,
:end_document
]
for event <- @events do
test "allows stopping the parsing process on #{inspect(event)}" do
data = "<?x... |
0683f54e2d3ed225980a65b3e3cbe7cfb6897303 | 6,737 | [
746212371
] | [] | defmodule Task2 do
def main do
input = File.read!("mini_sample.txt") |> String.split("\n")
{:parsed, grid} = Day3.parse_input(input)
sum = iterate_rows(grid,0)
{:ok, sum}
end
def iterate_rows(_, [], sum) do sum end
def iterate_rows(full_list, [{h, row_num}|t], sum) do
sum = iterate_row(f... |
06843dfcc6893f136f5f99fb1ddb73563e45002c | 1,926 | [
222026290
] | [
"phoenix",
"ecto"
] | defmodule SafedocWeb.CategoryController do
use SafedocWeb, :controller
alias Safedoc.Repo
alias Safedoc.Archive
alias Safedoc.Archive.Category
def index(conn, _params) do
categories = Archive.list_categories() |> Repo.preload([:category])
render(conn, "index.html", categories: categories)
end
d... |
06844f7ef9e4ff0d8870a52068f49aa8461dc381 | 10,830 | [
1003897615
] | [] | %{
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"castore": {:hex, :castore, "1.0.14", "4582dd7d630b48cf5e1ca8d3d42494db51e406b7ba704e81fbd401866366896a", [:mix], [], "hexpm... |
068522312ffe8db6b646a1609cf2246da64fe314 | 5,617 | [
422428800
] | [
"test",
"ecto"
] | defmodule CargoShipping.CargoBookingsTest do
use CargoShipping.DataCase
alias CargoShipping.CargoBookings
# TODO: Fix PostgreSQL Sandbox checkin/checkout errors.
describe "cargos" do
alias CargoShipping.CargoBookingService
alias CargoShippingSchemas.Cargo
import CargoShipping.CargoBookingsFixtur... |
06854db662f005f7a2db65e8001ddf4b5f7fda75 | 8,003 | [
635217069
] | [
"typespec",
"documented",
"ecto"
] | # credo:disable-for-this-file Credo.Check.Readability.Specs
# credo:disable-for-this-file Credo.Check.Refactor.ModuleDependencies
defmodule Connect4.Auth.Schema.Player do
@moduledoc """
Details of a player (or pair, team etc).
A unique code is generated for each player, which will map to their personal
API URL... |
068650ec027ff129b584c83acc3def6b422abd90 | 5,245 | [
568578073
] | [
"macro",
"documented"
] | defmodule Sleeky.Domain.Generator.CreateActions do
@moduledoc false
@behaviour Diesel.Generator
import Sleeky.Naming
@impl true
def generate(domain, _) do
create_funs(domain) ++
do_create_funs(domain) ++ bulk_create_funs(domain) ++ create_children_funs(domain)
end
defp create_funs(domain) do
... |
06865f5356702a34ef167578bd80e588c1839bf8 | 2,115 | [
165517500
] | [
"typespec",
"documented"
] | defmodule Ratatouille.Runtime.Command do
@moduledoc """
Commands provide a way to start an expensive call in the background and get
the result back via `c:Ratatouille.App.update/2`.
Commands should be constructed via the functions below and not via the struct
directly, as this is internal and subject to chan... |
06867e884f92bf42d867a4a146d833f7a91482f7 | 3,123 | [
246423252
] | [
"test",
"ecto"
] | defmodule Engine.DB.OutputTest do
use Engine.DB.DataCase, async: false
doctest Engine.DB.Output, import: true
alias Ecto.Changeset
alias Engine.DB.Output
describe "deposit/4" do
test "returns a deposit changeset" do
blknum = 1
token = <<0::160>>
depositor = <<1::160>>
amount = 10... |
06871f83bbbaa9012dd8bbbe7260bbe07cc9b9c4 | 1,765 | [
452455078
] | [
"test",
"phoenix"
] | defmodule D2CrucibleRouletteWeb.StratControllerTest do
use D2CrucibleRouletteWeb.ConnCase, async: true
describe "StratController" do
setup ~M{conn} do
user = insert(:user, admin: true)
strat = insert(:strat)
conn = log_in_user(conn, user)
~M{conn, strat}
end
test "redirects if ... |
068786d4d66a78cf661f1d91e073d8e84034da84 | 7,311 | [
1018054918
] | [
"liveview",
"test"
] | defmodule JapaneseWeb.StoryLive.ShowTest do
use JapaneseWeb.ConnCase, async: true
use Mimic
import Phoenix.LiveViewTest
alias Japanese.Corpus.Story
setup :verify_on_exit!
test "renders story if it exists", %{conn: conn} do
story_name = "test_story"
story = %Story{name: story_name}
Mimic.expec... |
0687a90e0f06653bac1c88d7a13c60f011c81fb7 | 1,622 | [
305091318
] | [
"documented"
] | defmodule RiddlerAdmin.Identities.IdentityNotifier do
# For simplicity, this module simply logs messages to the terminal.
# You should replace it by a proper email or notification tool, such as:
#
# * Swoosh - https://hexdocs.pm/swoosh
# * Bamboo - https://hexdocs.pm/bamboo
#
defp deliver(to, body) do... |
06880d6012477dd9ebbf286c06493b7182710db2 | 2,014 | [
118174223
] | [
"test"
] | defmodule PlanningPokerWeb.RoundControllerTest do
use PlanningPokerWeb.ConnCase
alias PlanningPoker.Factory
@update_attrs %{status: "closed"}
@invalid_attrs %{status: nil}
describe "index" do
@tag :authenticated
test "lists all rounds", %{conn: conn} do
conn = get conn, round_path(conn, :inde... |
06883f090b4ee7aa76e53c708a2dba51e84e49b1 | 1,711 | [
674238435
] | [] | # 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 :algokit,
ecto_repos: [Algokit.Repo]
# Conf... |
068842c596f3ed6aec89ac03c73d920268041b40 | 3,209 | [
7670698
] | [
"test"
] | defmodule ClusterTest do
use ExUnit.Case
defmodule ClusterServer do
use ExActor.GenServer, export: :cluster_pid
defstart start, do: initial_state(nil)
defmulticall sum(x, y), do: reply(x + y)
defmulticall timeout1, timeout: 10, do: (:timer.sleep(100); reply(:ok))
defmulticall timeout2, timeou... |
0688c061b3bb496d42eaa06cdf9bb4b998f5b9dc | 1,617 | [
58028629
] | [
"typespec",
"documented"
] | defmodule Himamo.Model.B do
@moduledoc ~S"""
Defines symbol emission probability distribution.
Symbol emission probability distribution, commonly denoted by `B`, defines
the probability of the model emitting the symbol `v_k` when in state `S_j`.
* `0 ≤ j < N` where `N` is the number of states.
* `0 ≤ k < ... |
068907fdb9d8f010a4a1fec95d0403e7d2fae439 | 15,906 | [
367278931
] | [
"documented"
] | defmodule Google.Cloud.Discoveryengine.V1.BigtableOptions.Type do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :TYPE_UNSPECIFIED, 0
field :STRING, 1
field :NUMBER, 2
field :INTEGER, 3
field :VAR_INTEGER, 4
field :BIG_NUMERIC, 5
field :BOOLEAN,... |
068945a256581136a4a12f2acb202aae68870a8e | 6,569 | [
542291437
] | [
"typespec",
"documented"
] | defmodule AshAuthentication.Validations do
@moduledoc """
Common validations shared by several transformers.
"""
import AshAuthentication.{Sender, Utils}
alias Ash.Resource.Attribute
alias Spark.{Dsl, Dsl.Transformer, Error.DslError}
@doc """
Given a map validate that the provided field is one of the ... |
068a09d34a96735bf5c5c6a24023cc428c68a431 | 2,464 | [
72531106
] | [
"test"
] | defmodule PriceCrawler.PriceControllerTest do
use PriceCrawler.ConnCase
alias PriceCrawler.Price
@valid_attrs %{price: 42, type: 42}
@invalid_attrs %{}
test "lists all entries on index", %{conn: conn} do
conn = get conn, product_price_path(conn, :index)
assert html_response(conn, 200) =~ "Listing pr... |
068acd628010a86063ea09a71220b4ba85c0172e | 1,930 | [
393781221
] | [
"genserver"
] | defmodule ElixirDrip.Storage.Workers.CacheWorker do
use GenServer
require Logger
@expire_time 60_000 * 120
def start_link(media_id, content) do
GenServer.start_link(__MODULE__, content, name: name_for(media_id))
end
def name_for(media_id), do: {:via, Registry, {ElixirDrip.Registry, {:cache, media_id}... |
068ae11b91f00ce6ec451c4511016fb75a58ceab | 3,277 | [
274637672
] | [
"test"
] | defmodule Fsmx.StructTest do
use ExUnit.Case
alias Fsmx.TestStructs.{Simple, WithCallbacks, WithSeparateFsm, WithFallback, MultiState}
describe "transition/2" do
test "can do simple transitions" do
one = %Simple{state: "1"}
{:ok, two} = Fsmx.transition(one, "2")
assert %Simple{state: "2"... |
068b3d29d22969bf5cbbf347ebe1f5dad9bb3225 | 2,745 | [
843696121
] | [
"phoenix"
] | defmodule PmTaskElixirWeb.Router do
use PmTaskElixirWeb, :router
import PmTaskElixirWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {PmTaskElixirWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secu... |
068b68ce7e93d13960638541d56465b9302ba7a1 | 6,672 | [
596355424
] | [
"test",
"ecto"
] | defmodule Repository.FulfillmentTest do
use Repository.DataCase
alias Repository.Fulfillment
describe "orders" do
alias Repository.Fulfillment.Order
import Repository.FulfillmentFixtures
@invalid_attrs %{archived_at: nil, fulfilled_at: nil, reference_id: nil}
test "list_orders/0 returns all o... |
068beaa8626224e0b0a8e7e9abab01b8a9c4c0f3 | 4,004 | [
744421640
] | [
"phoenix"
] | defmodule BlockScoutWeb.API.V2.BlockView do
use BlockScoutWeb, :view
alias BlockScoutWeb.BlockView
alias BlockScoutWeb.API.V2.{ApiView, Helper}
alias Explorer.Chain
alias Explorer.Chain.Block
alias Explorer.Counters.BlockPriorityFeeCounter
def render("message.json", assigns) do
ApiView.render("messa... |
068cb2ca3c1842ae1d413b220c102ae2e3b894d7 | 2,140 | [
817501616
] | [] | defmodule WithoutCeasing.MixProject do
use Mix.Project
def project do
[
app: :without_ceasing,
version: "0.1.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases... |
068d0f9ffb9d8f1033b6fe2e9289d352cd5b919f | 1,739 | [
809314488
] | [
"phoenix",
"ecto"
] | defmodule PlanetWeb.AssetController do
use PlanetWeb, :controller
alias Planet.Cosmos
alias Planet.Cosmos.Asset
plug PlanetWeb.Plugs.RequireAdmin when action in [:new, :create, :edit, :update, :delete]
def index(conn, _params) do
assets = Cosmos.list_assets()
render(conn, :index, assets: assets)
... |
068d3eda8ae4484815e0dc9228732272d4907815 | 1,746 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadComplianceStatus do
@moduledoc """
Represents the Compliance Status of this workload
## Attributes
* `acknowledgedResourceViolationCount` (*type:* `integer()`, *default:* `nil`) - Number of current resource violations which a... |
068d4d966cc146d49a366836f35c1049cdb172a0 | 1,658 | [
250923883
] | [
"macro",
"documented",
"phoenix"
] | defmodule CovidWeb 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 CovidWeb, :controller
use CovidWeb, :view
The definitions below will be executed for every view,
controller, etc, s... |
068d61a45c79fc93d239622d227917cbce74a96e | 2,430 | [
202856419
] | [
"test",
"ecto"
] | defmodule Discuss.AccountsTest do
use Discuss.DataCase
alias Discuss.Accounts
describe "users" do
@valid_attrs %{
username: "test",
email: "<EMAIL>",
active: true,
password: "test",
password_confirmation: "test"
}
def user_fixture(attrs \\ %{}) do
with create_attrs... |
068f2450cbcd38abaecc24f0334811871d5b4295 | 2,892 | [
221103712
] | [
"genserver"
] | defmodule LampControl.Lamp do
use GenServer
alias Blinkchain.Color
alias Blinkchain.Point
require Logger
# Client API
defmodule State do
defstruct [:color]
end
def start_link(opts \\ []) do
initial_state = %State{
color: "#4B0082"
}
{:ok, _pid} = GenServer.start_link(__MODULE__... |
068f783d380abe8ec0efe287a53a6789520722ac | 3,331 | [
233281203
] | [
"documented"
] | defmodule Tagger.Factory do
@moduledoc false
use ExMachina.Ecto,
repo: Tagger.Repo
alias Tagger.{Categorization.Tag, Github.Repository}
def tag_factory do
%Tag{
name: sequence(:tag_name, &"tag-#{&1}"),
repository_id: sequence(:repository_id, &"repository-#{&1}")
}
end
def example... |
068f7840e0fe436e83fb1096ce0cd2064d247804 | 1,728 | [
645972280
] | [
"typespec",
"documented"
] | defmodule WheelieGoodEats do
@moduledoc """
Top-level API for the Wheelie Good Eats application.
"""
alias WheelieGoodEats.Craving
alias WheelieGoodEats.Record
alias WheelieGoodEats.SodaApi
alias WheelieGoodEats.Truck
@type craving :: Craving.changeset()
@doc """
Generate a new craving changeset f... |
069033973e7f793f66b5e83cb34e87acab1201db | 7,056 | [
957237791
] | [
"liveview",
"documented"
] | defmodule DbkWeb.Components.Indicator do
@moduledoc """
The `DbkWeb.Components.Indicator` module provides a versatile component for visually highlighting
specific areas or elements in your Phoenix application.
It is designed to display small, circular indicators that can be used for notifications,
status upd... |
06906a28c73e05ff9b9632c8e79d9b49463e52c5 | 1,668 | [
400659903
] | [
"typespec"
] | defmodule CPSIM.CP.Status.State do
defstruct [:status, :status_reported_at, :connector_statuses, :connector_statuses_reported_at]
@ocpp_statuses ~w[available unavailable faulted]a
def ocpp_statuses, do: @ocpp_statuses
@type ocpp_status :: :available | :unavailable | :faulted
@ocpp_connector_statuses ~w[avai... |
0690af8b798d8d176d97cc400dcce1e71a6c13b5 | 3,398 | [
157897447
] | [
"documented",
"ecto"
] | defmodule BoardNerd.Games do
@moduledoc """
The Games context.
"""
import Ecto.Query, warn: false
alias BoardNerd.Repo
alias BoardNerd.Games.Product
@doc """
Returns the list of products.
## Examples
iex> list_products()
[%Product{}, ...]
"""
def list_products do
Repo.all(Pro... |
069106b851fd45697841561275659192b4fd818a | 10,204 | [
522082089
] | [] | %{
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mi... |
0691404b3ffe6c8d7a1c643d6f11d7d65a84335b | 1,594 | [
202903437
] | [
"macro",
"documented",
"phoenix"
] | defmodule MomoWeb 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 MomoWeb, :controller
use MomoWeb, :view
The definitions below will be executed for every view,
controller, etc, so k... |
069140a2347205541cf660ed4b0e6fe82aa09d3b | 12,872 | [
762131773,
970389734,
579412520,
746798402,
385691311,
820624395,
682357176,
719664534,
609216219,
394023530,
675225385,
823014073,
424400274,
739033590,
565246607
] | [
"test",
"ecto"
] | defmodule Pleroma.Conversation.ParticipationTest do
use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Conversation
alias Pleroma.Conversation.Participation
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web.CommonAPI
test "getting a participation will also preload things" do
... |
0691a2cfea6ddd2eb9b902180744fda658480442 | 5,233 | [
86020121
] | [
"documented",
"ecto"
] | defmodule Bamboo.SendcloudAdapter do
@moduledoc """
Sends email using Sendcloud’s API.
Use this adapter to send emails through Sendcloud’s API.
Requires an API user and an API key are set in the config.
## Example config
# In config/config.exs, or config.prod.exs, etc.
config :my_app, MyApp.Mai... |
0691e74516600984aec3b0470f1a039911b036c1 | 2,269 | [
413257663
] | [
"typespec",
"documented",
"ecto"
] | defmodule NflRushing.Stats.Player do
@moduledoc """
NflRushing.Stats.Player is a schema to handle information about a Player.
"""
use Ecto.Schema
import Ecto.Changeset
@type t :: %__MODULE__{}
@default_fields [
:name,
:team,
:position,
:rushing_attempts_per_game_average,
:rushing_at... |
0691ffc8488b2c9ae492f9cb0d636502ccbebdd8 | 2,248 | [
303556325,
121930860
] | [] | [
extends: [],
import: [],
mappings: [
"poxa.port": [
commented: false,
datatype: :integer,
default: 8080,
doc: "HTTP Port",
hidden: false,
env_var: "PORT",
to: "poxa.port"
],
"poxa.app_key": [
commented: false,
datatype: :binary,
default: "a... |
06925fe517df0355b94d30ae852f2a9424d2a6b5 | 5,629 | [
113956009,
114703850
] | [
"phoenix"
] | defmodule TwitterSimulator.TwitterChannel do
use Phoenix.Channel
require Logger
def join("twitter", _payload, socket) do
#DatabaseHandler.init();
{:ok, socket}
end
def handle_in("register_user", payload, socket) do
username = payload["username"];
passwo... |
069260bd3dc1130a8efb0e15edf02979e36fff6b | 2,066 | [
722630578
] | [
"phoenix"
] | defmodule FrankFerreiraWeb.RobotController do
use Phoenix.Controller,
formats: ~w[json txt xml webmanifest]a
use FrankFerreiraWeb, :verified_routes
import Plug.Conn
alias FrankFerreira.Blog
alias FrankFerreiraWeb.RSS
alias FrankFerreiraWeb.RobotXML
alias FrankFerreiraWeb.SEO
plug :accepts, ~w[js... |
069353fa051af0483f241f3f8edc7e466aa32386 | 1,744 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2DeltaPresenceEstimationQuasiIdValues do
@moduledoc """
A tuple of values for the quasi-identifier columns.
## Attributes
* `estimatedProbability` (*type:* `float()`, *default:* `nil`) - The estimated probability that a given individual sharing these quasi-i... |
06937fa832595b2157f9e214ac741fb46978bf3c | 1,972 | [
80993142
] | [
"documented",
"ecto"
] | defmodule LdnRent.Nestoria do
use LdnRent.Web, :model
schema "nestoria" do
field :bathroom_number, :integer
field :bedroom_number, :integer
field :car_spaces, :integer
field :commission, :float
field :construction_year, :integer
field :datasource_name, :string
field :floor, :float
f... |
069381471a94b2d9caf5d731c124525fc03af947 | 7,814 | [
316213521,
316206423
] | [
"test"
] | defmodule SPARQL.Functions.CastTest do
use SPARQL.Test.Case
alias SPARQL.Algebra.Expression
alias SPARQL.Algebra.FunctionCall
alias SPARQL.ExtensionFunction
test "xsd:integer" do
[
{XSD.true, XSD.integer(1)},
{XSD.false, XSD.integer(0)},
{XSD.integer(1), XSD.integer(1)},
{XSD.... |
06938e2f080b92d262c52a9a3b7f68751e83bf09 | 1,714 | [
914266050
] | [
"genserver"
] | defmodule Stack.ServiceA do
use MqttAsyncapi, schema_path: "test/schema/stack/schema_a.json"
def start_link(opts \\ []) do
MqttAsyncapi.start_link(__MODULE__, opts)
end
@impl true
def init(_opts) do
{:ok, %{stack: []}}
end
@impl true
def handle_message(%MqttAsyncapi.Message{operation_id: "pus... |
06940a38f7796cde5aa2d16631b2961c08607783 | 1,973 | [
67642981
] | [
"documented"
] | defmodule Collidex do
@moduledoc """
## Usage
### Points
Cartesian points are 2-tuples of the form {x, y}. I picked this format for
speed and for compatibility with [certrel/graphmath](https://hex.pm/packages/graphmath).
### Geometric primitives
Circles, Rects (grid-aligned rectangles), and Polygons a... |
069412b5c842a3296bb0cd685ec25ebd74ce2b08 | 20,518 | [
831995252
] | [
"test"
] | defmodule ColouredFlow.Runner.Enactment.Transitions.CompleteTest do
use ColouredFlow.RepoCase
use ColouredFlow.RunnerHelpers
alias ColouredFlow.Enactment.BindingElement
alias ColouredFlow.Enactment.Occurrence
alias ColouredFlow.Runner.Exceptions
alias ColouredFlow.Runner.Storage
describe "complete work... |
0694427f06aa3aa6369d62ee628be918e9a2f890 | 1,662 | [
912434647
] | [
"documented",
"ecto"
] | defmodule MyApp.Todos do
@moduledoc """
The Todos context.
"""
import Ecto.Query, warn: false
alias MyApp.Repo
alias MyApp.Todos.Todo
@doc """
Returns the list of todos.
## Examples
iex> list_todos()
[%Todo{}, ...]
"""
def list_todos do
Repo.all(Todo)
end
@doc """
Gets... |
06946aa6f2b7d9c4a8a97817ddf03ff96aabf681 | 1,758 | [
225052408
] | [
"documented"
] | defmodule Cards do
@moduledoc """
Provides methods for creating and handling a deck of cards
"""
@doc """
Returns a list of strings representing a deck of playing cards
"""
def create_deck do
values = ["Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen",... |
0694af7bba7d796b458abbedbdb4f89ca26cfdca | 2,709 | [
629075974
] | [] | defmodule Myna.MixProject do
use Mix.Project
def project do
[
app: :Myna,
version: "1.6.14",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(... |
0694b61362fab644763c62f021198f4c0d923f4d | 1,698 | [
559969137
] | [
"documented",
"ecto"
] | defmodule Timemanager.TeamContext do
@moduledoc """
The TeamContext context.
"""
import Ecto.Query, warn: false
alias Timemanager.Repo
alias Timemanager.TeamContext.Team
@doc """
Returns the list of teams.
## Examples
iex> list_teams()
[%Team{}, ...]
"""
def list_teams do
Rep... |
0694ef0048588da8a53ea2f919513f26fb72ea48 | 8,980 | [
343597227
] | [] | %{
"certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hexpm", "524c97b4991b3849dd5c17a631223896272c6b0af446778ba4675a1dff53bb7e"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mi... |
0695060f32de280b33852a8ba78fda5ff43cb2c0 | 1,982 | [
65794855
] | [] | defmodule RedisQueueReader.Mixfile do
use Mix.Project
def project do
[app: :redis_queue_reader,
version: "0.1.0",
elixir: "~> 1.3",
elixirc_paths: elixirc_paths(Mix.env),
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
description: description(),
package:... |
06950d10d2ba31c34fd964e2a9fe4e7019d4c83b | 1,962 | [
117171030
] | [
"phoenix",
"ecto"
] | defmodule TasktrackerWeb.UserController do
use TasktrackerWeb, :controller
alias Tasktracker.Accounts
alias Tasktracker.Accounts.User
def index(conn, _params) do
current_user = conn.assigns[:current_user]
users = Accounts.list_users()
manages = Tasktracker.Tasklist.manages_map_for(current_user.id)... |
0695c15ca9d6c7b75f25dc873577df41b990a46e | 3,092 | [
135825529
] | [] | defmodule Tulip do
def load_contract_artifacts(name, options) do
{abi_path, bin_path} =
if options[:build_path] do
path = "#{options[:build_path]}#{name}"
{"#{path}.abi", "#{path}.bin"}
else
{"./build#{name}.abi", "./build/#{name}.bin"}
end
abi = ExW3.load_abi abi_path
... |
06962e324f74868a76be3e1bfd8150351330d456 | 2,312 | [
257787813
] | [
"supervisor"
] | defmodule Domain.ComponentVersions do
alias Domain.ComponentVersions
use Supervisor
require Logger
def start_link(opts) do
Supervisor.start_link(__MODULE__, opts, name: __MODULE__.Supervisor)
end
@impl true
def init(_opts) do
pool_opts = Domain.Config.fetch_env!(:domain, :http_client_ssl_opts)
... |
06963f573a3ca9d8386a368652da5b23ea208f7a | 2,714 | [
152527699
] | [] | defmodule FCIdentity.MixProject do
use Mix.Project
def project do
[
app: :fc_identity,
name: "Freshcom Identity",
version: "0.1.0",
elixir: "~> 1.7",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs()
]
... |
0696f4f7ad57fb1f842994ab408da7e4a6c2d85a | 5,524 | [
49285872
] | [
"genserver",
"typespec",
"documented"
] | defmodule Gyro.Arena do
@moduledoc """
The `Arena` module is an implmentation of GenServer for tracking all active
players in the game.
It also implements public API for working with Arena's GenServer handler
without needing GenServer module. This allows the user of Arena to depends
solely on Arena module i... |
06976c0fff02d6f0f257e962d3cb326cc91b9576 | 1,552 | [
667992819
] | [] | defmodule Servy.Parser do
alias Servy.Conv
# import Servy.Helpers
def parse(request) do
# import Servy , only: [Conv :3]
# first_line = request |> String.split("\n") |> List.first
# [method, path, _ ] = String.split(first_line , " ")
[top, params_string] = String.split(request, "\n\n")
[requ... |
0697d8f90c60871000dd342ee6778068dc801b02 | 2,677 | [
829123507
] | [
"documented"
] | defmodule GovBidify.StaticData do
@moduledoc """
Module for loading and retrieving static data used throughout the application.
"""
@doc """
Get a list of opportunity types.
"""
def list_types do
load_json("types.json")
end
@doc """
Get a map of department codes to names.
"""
def list_depa... |
0697ead62d7884f138aef5b07d00ecbe56a6e101 | 9,576 | [
575747555
] | [
"genserver",
"typespec",
"documented"
] | defmodule Postgrex.Notifications do
@moduledoc ~S"""
API for notifications (pub/sub) in PostgreSQL.
In order to use it, first you need to start the notification process.
In your supervision tree:
{Postgrex.Notifications, name: MyApp.Notifications}
Then you can listen to certain channels:
... |
0698989114547c4052d4b7218fb6a077def30d3c | 2,692 | [
326147977
] | [
"typespec",
"documented"
] | defmodule AdventOfCode.Y2023.Day03 do
use AdventOfCode.Day
@moduledoc """
https://adventofcode.com/2023/day/3
"""
alias AdventOfCode.TwoDeeList
def make_nr_entry(nr) do
nr = Enum.reverse(nr)
{x_first, _y} = List.first(nr) |> elem(1)
{x_last, y} = List.last(nr) |> elem(1)
nr = Enum.map(nr,... |
0698a7d8722ef4cec4346f4a526867a48b6d28d1 | 3,446 | [
138089902
] | [
"test"
] | defmodule WandFileWithHelpTest do
use ExUnit.Case, async: true
import Mox
alias Wand.CLI.Error
alias Wand.CLI.WandFileWithHelp
alias WandCore.WandFile
alias Wand.Test.Helpers
setup :verify_on_exit!
describe "on success" do
test "load returns {:ok, file}" do
Helpers.WandFile.stub_load()
... |
0699228ccdb2cef125ea5f4eee4934e01d3909d5 | 2,724 | [
589634204
] | [] | defmodule Blackjack do
def draw do
# Not sure how to implement aces correctly, so just draw between 1 and 11
Enum.random(1..11)
end
def dealer_ai(dealer) do
current_score = Agent.get(dealer, fn state -> state end)
if current_score <= 16 do
Agent.update(dealer, fn state -> state + draw() en... |
06995737a0139f6ddde3b2c8aa8896b8eb4d91f2 | 3,255 | [
418515784
] | [
"test"
] | defmodule Gradient.ConfigCommentsTest do
use ExUnit.Case
alias Gradient.ConfigComments
import ExUnit.CaptureIO
describe "ignores_for_file/1" do
test "finds magic comments for entire file" do
assert ["test/examples/config_comments/whole_file.ex"] =
ConfigComments.ignores_for_file("test... |
0699592c50dfd55a888356ba570a9cdc53ae8e3a | 1,715 | [
52797857
] | [
"typespec",
"documented",
"ecto"
] | defmodule Air.Service.PrivacyPolicy do
@moduledoc "Service for managing the privacy policy"
alias Air.Repo
alias Air.Schemas.PrivacyPolicy
import Ecto.Query, only: [from: 2]
# -------------------------------------------------------------------
# API functions
# ------------------------------------------... |
06998024643d44af0d4d814acc230ec72fa912dd | 6,295 | [
463909124
] | [] | %{
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], ... |
0699cb71a7017fca42965c54b3aba5b20f4400ec | 3,151 | [
318945858
] | [
"typespec"
] | defmodule Pleroma.Web.ActivityPub.Relay do
alias Pleroma.Activity
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Visibility
alias Pleroma.Web.CommonAPI
require Logger
@nickname "relay"
@spec ap_id() :: String.t()
def ap_id, do: "#{Pleroma.Web.Endpoint.url(... |
069a32af7d2bd580f9075a8b191ab928d41bd23b | 12,629 | [
335072709
] | [] | defmodule Peer do
@manager_name :chord_manager
def start() do
spawn(__MODULE__, :join, [])
end
def join() do
send(:global.whereis_name(@manager_name), {:join, self()})
receive do
{:reject} ->
IO.puts("Oops, the network seems full!")
exit(self())
{:ok, node_numbers, id, s... |
069b00fd3dbf984db335e6949fbf4d922f4ba1f4 | 2,232 | [
954784381
] | [
"test",
"ecto"
] | defmodule CdGigalixir.CategoriesTest do
use CdGigalixir.DataCase
alias CdGigalixir.Categories
describe "categories" do
alias CdGigalixir.Categories.Category
import CdGigalixir.CategoriesFixtures
@invalid_attrs %{name: nil, description: nil}
test "list_categories/0 returns all categories" do
... |
069b09ea412940a54f349f4a99adbb6ec61d8e0e | 1,995 | [
488721763
] | [
"phoenix"
] | defmodule ExMonWeb.TrainerPokemonsView do
use ExMonWeb, :view
alias ExMon.Trainer.Pokemon
def render("create.json", %{pokemon: %Pokemon{
id: id,
inserted_at: inserted_at,
name: name,
nick_name: nick_name,
sprites: sprites,
trainer_id: trainer_id,
types: types,
weight: weight
}}... |
069b30a71b682dce9808cfc4cdeb35e3d9e84b22 | 2,134 | [
65206632
] | [
"documented"
] | defmodule Crawler.Fetcher do
@moduledoc """
Fetches pages and perform tasks on them.
"""
require Logger
alias Crawler.Fetcher.HeaderPreparer
alias Crawler.Fetcher.Policer
alias Crawler.Fetcher.Recorder
alias Crawler.Fetcher.Requester
alias Crawler.Snapper
alias Crawler.Store.Page
@doc """
Fet... |
069bb6862e0a6c1b894a21b836f04113596e4997 | 1,637 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1ListCatalogItemsResponse do
@moduledoc """
Response message for ListCatalogItems method.
## Attributes
* `catalogItems` (*type:* `list(GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1be... |
069bc7a9036ce217c82a62c55519435fc780b233 | 1,946 | [
838907457,
763575502
] | [] | defmodule Electric.Postgres.NameParser do
import NimbleParsec
identifier =
choice([
# quoted identifier
ignore(string(~s(")))
|> repeat(
choice([
string(~s("")) |> replace(~s(")),
utf8_char(not: ?")
])
)
|> ignore(string(~s(")))
|> tag(:qu... |
069bea8d40dfe5c652dbfaf8451de6d5429d3e2d | 6,603 | [
786846015
] | [
"test",
"documented"
] | defmodule Violacorp.Schemas.EmployeeTest do
use Violacorp.DataCase
alias Violacorp.Schemas.Employee
@moduledoc false
@valid_attrs %{
group_id: 1,
group_member_id: 12,
title: "Mr",
employeeids: "3422",
position: "Manager",
first_name: "Peter",
middle_name: "A",
last_name: "Capal... |
069c175fbfa1daf2ab192e78c2d2837c84582ee5 | 3,494 | [
228417870
] | [
"documented",
"ecto"
] | defmodule Tixdrop.Workspaces do
@moduledoc """
The Workspaces context.
"""
import Ecto.Query, warn: false
alias Tixdrop.Repo
alias Tixdrop.Workspaces.Workspace
@doc """
Returns the list of workspaces.
## Examples
iex> list_workspaces()
[%Workspace{}, ...]
"""
def list_workspaces ... |
069c289a705bdd3e518fb05fd95a009516cd717e | 1,681 | [
173377952
] | [
"typespec",
"documented",
"ecto"
] | defmodule Discogs.Models.Artist do
@moduledoc """
Ecto model representing a Discogs artist.
"""
use Ecto.Schema
import Ecto.Changeset
alias Discogs.Models.{Artist, ArtistRelease, Release}
alias Discogs.Repo
schema "artists" do
many_to_many(:releases, Release, join_through: ArtistRelease)
has_ma... |
069c8dae76a27c9bcea6bc14805ee72481ff9440 | 2,434 | [
615745091
] | [
"liveview"
] | defmodule LiveViewStudioWeb.BookingsLive do
use LiveViewStudioWeb, :live_view
alias LiveViewStudio.Bookings
import Number.Currency
def mount(_params, _session, socket) do
{:ok,
assign(socket,
bookings: Bookings.list_bookings(),
selected_dates: nil
)}
end
def render(assigns) do... |
069d6317d4941bbf62f9c244fc023fa527693742 | 9,270 | [
910853725
] | [
"typespec",
"documented",
"ecto"
] | defmodule ElixirRaft.Server.Leader do
@moduledoc """
Implementation of the Leader role in Raft.
Leaders:
- Send periodic heartbeats
- Manage log replication
- Track follower progress
- Handle client requests
- Step down when discovering higher term
"""
@behaviour ElixirRaft.Server.RoleBehaviour
... |
069d8d9f4323b8d97dc842abf504b6141b9b2425 | 3,151 | [
433873111
] | [
"documented"
] | defmodule Diagnostic do
@moduledoc false
alias ReadFile
def input, do: ReadFile.parse("day3.txt", "\n")
def part_one() do
frequencies =
input()
|> groups()
|> frequencies()
gamma =
frequencies
|> most_common()
|> string_list_to_integer()
epsilon =
frequ... |
069e6668fefcae9fd935c9117e84ef8407f2f8e5 | 9,190 | [
931252103
] | [
"documented"
] | defmodule Livekit.VideoCodec do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.0", syntax: :proto3
field(:DEFAULT_VIDEO, 0)
field(:H264_BASELINE, 1)
field(:H264_MAIN, 2)
field(:H264_HIGH, 3)
field(:VP8, 4)
end
defmodule Livekit.AudioCodec do
@moduledoc false
use Protob... |
069e95da9bee8ea596a1be98a31c05abb700d672 | 3,971 | [
580790622
] | [
"documented"
] | if Application.ensure_loaded(:prometheus_telemetry) === :ok do
defmodule Cache.Metrics do
@moduledoc """
Add the following metrics for elixir_cache into [prometheus_telmetery](https://hexdocs.pm/prometheus_telemetry),
this module will only be included if the library is included:
Metrics included:
... |
069ece6ecfa98a199b22d14d16e34af14dd265d6 | 2,018 | [
282066598
] | [] | import Config
# Only in tests, remove the complexity from the password hashing algorithm
config :bcrypt_elixir, :log_rounds, 1
# Configure your database
#
# The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
da... |
069f06192388a45f646510d88bfb4bf54078a089 | 1,742 | [
978987182
] | [
"liveview"
] | defmodule NlsqlWeb.NlsqlLive.History do
use NlsqlWeb, :live_view
@impl true
def mount(_params, _session, socket) do
# Retrieve query history from the database or session
# For simplicity, we're using a mock history
history = [
%{
query: "Show all customers from New York",
sql: "... |
069f2a2ec043296d2a683f5166e22b03f2774243 | 2,420 | [
99718164
] | [
"genserver",
"liveview",
"documented"
] | defmodule Samwise.Slack do
@moduledoc """
A helpful bot for Ogles
"""
use Slack
alias Slack.Web.Chat
alias Samwise.Slack.Commands
def handle_connect(slack, state) do
IO.puts "Connected to Slack as #{slack.me.name}"
:slack_state
|> :ets.new([:named_table])
|> :ets.insert({"slack", slac... |
069f38fe2b083dcbb826de9c27a6d4125aad6186 | 16,657 | [
190630683
] | [] | %{
"arc": {:hex, :arc, "0.10.0", "b2a5dbe4e684c27ce231e2228ea2cc640420eab91dbe6e27b5ed1016a8a39975", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:ex_aws_s3, "~> 2.0", [hex: :ex_aws_s3, repo: "hexpm", optional: true]}, {:httpoison, "~> 0.13", [hex: :httpoison, repo: "hexpm", optional:... |
069f4cc794efaeb07fcad65b4fa82407e3c0b2d5 | 2,002 | [
146170618
] | [
"documented"
] | defmodule ContentfulToNeo4jEx.ContentfulApi do
@moduledoc """
This is a simple api for fetching assets and content types from contentful.
I can't use the contentful supplied api as it fails to return the total number of items in a set.
This is critical for enumerating the api without missing items.
"""
@c... |
069f5ca1ea3feddf335530d3ef55b1540b21a3af | 2,742 | [
996509742
] | [] | import Config
# Configure your database
config :my_login_app, MyLoginApp.Repo,
database: Path.expand("../my_login_app_dev.db", __DIR__),
pool_size: 5,
stacktrace: true,
show_sensitive_data_on_connection_error: true
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watc... |
06a00775251dcc4d998877335235da8cc7d540eb | 1,759 | [
156727069
] | [
"macro",
"documented",
"phoenix"
] | defmodule PhoenixGraphqlServerWeb 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 PhoenixGraphqlServerWeb, :controller
use PhoenixGraphqlServerWeb, :view
The definitions below will be ... |
06a06bb7d3fed8d30c087cb40bce3d53077faa8a | 6,823 | [
407621205
] | [
"typespec",
"documented"
] | defmodule GraphqlMarkdown.SinglePage do
@moduledoc """
Single page generator from Graphql to Markdown
"""
alias GraphqlMarkdown.MarkdownHelpers
alias GraphqlMarkdown.OperationDetailsHelpers
alias GraphqlMarkdown.Renderer
alias GraphqlMarkdown.Schema
@spec render_schema(GraphqlMarkdown.Schema.t(), keywo... |
06a162e040a4839d51dcf7fdd371c4465916258c | 5,215 | [
521738503
] | [
"genserver",
"typespec"
] | defmodule NarwinChat.Dispatcher do
use GenServer
require Logger
import Ecto.Query
alias NarwinChat.Repo
alias NarwinChat.Accounts.User
alias NarwinChat.Chat.{Room, Message}
def start_link(opts \\ [name: __MODULE__]) do
GenServer.start_link(__MODULE__, nil, opts)
end
@spec join_lobby(integer()) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.