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 |
|---|---|---|---|---|
096b60031b4b8e0d13f17cb01d30b6cb8d98b2eb | 2,306 | [
87027
] | [
"documented",
"ecto"
] | defmodule Venieri.Archives.Snippets do
@moduledoc """
The Archives context.
"""
import Ecto.Query, warn: false
alias Venieri.Repo
alias Venieri.Archives.Models.Snippet
@doc """
Returns the list of snippets.
## Examples
iex> list()
[%Snippet{}, ...]
"""
def list() do
Repo.all(... |
096ba913f223dd3fa03c42ebbefec1651875eebf | 8,281 | [
969189171
] | [
"typespec",
"documented",
"ecto"
] | defmodule Logflare.Alerting do
@moduledoc """
The Alerting context.
"""
import Ecto.Query, warn: false
alias Logflare.Repo
require Logger
alias Logflare.Backends.Adaptor.WebhookAdaptor
alias Logflare.Backends.Adaptor.SlackAdaptor
alias Logflare.Alerting.AlertQuery
alias Logflare.User
alias Logfl... |
096c0687c69feedfb6d1c4b5ba36b560ab2cb959 | 5,575 | [
234309618
] | [
"test",
"ecto"
] | defmodule GraphBanking.BankTest do
use GraphBanking.DataCase
alias GraphBanking.Bank
describe "accounts" do
alias GraphBanking.Bank.Account
@valid_attrs %{current_balance: "120.5"}
@update_attrs %{current_balance: "456.7"}
@invalid_attrs %{current_balance: nil}
test "create_account/1 with ... |
096c390de798835f5bf77c1c16310bde6e8b3988 | 3,888 | [
71537359
] | [
"test"
] | defmodule RemsignBackendTest do
use ExUnit.Case
def test_nonce_store(a, n) do
case Agent.get(a, fn ms -> MapSet.member?(ms, n) end) do
true ->
false # already in store
false ->
Agent.update(a, fn ms -> MapSet.put(ms, n) end)
true
end
end
import TestUtils
setup do... |
096c463303d8ffeabd517e52fb9b091c76018232 | 1,565 | [
10550954
] | [
"test"
] |
defmodule Edeliver.CommonFunctions.Test do
use Edeliver.BashScript.Case, bash_script: Path.join([__DIR__, "..", "libexec", "erlang"])
test "trimming strings" do
assert "foo" = call "trim_string", " foo"
assert "bar" = call "trim_string", "bar "
assert "baz" = call "trim_string", " baz "
assert "do... |
096c6179e73a2326a3e6d2e99e52c2522a719145 | 2,811 | [
263754857
] | [
"genserver",
"typespec",
"documented"
] | defmodule Phylax.Zkillboard.WebsocketClient do
@moduledoc """
Zkillboard Websocket client
See https://github.com/zKillboard/zKillboard/wiki/Websocket for documentation on the Websocket and supported channels
"""
use WebSockex
require Logger
@url "wss://zkillboard.com/websocket/"
@process_name __MODUL... |
096c963371adf6c5d14fb53f29ac65f084eba035 | 2,640 | [
112890758
] | [] |
defmodule DiscTree do
# Parse a line
def parse_line(line) do
line_format = ~r/([a-z]+) \((\d+)\)( -> (.*))?/
[_line, name, weight | maybe_children] = Regex.run(line_format, line)
children = get_children(maybe_children)
{weight, _} = Integer.parse(weight)
{name, weight, children}
end
# Par... |
096d41d98f88203e95258ebe31ac589ba6829ff1 | 1,670 | [
249215830
] | [
"typespec",
"documented"
] | defmodule MoneyButton.Profile do
@moduledoc """
Defines a MoneyButton profile.
"""
@enforce_keys [
:id,
:name
]
@typedoc """
A MoneyButton profile.
"""
defstruct [
:id,
:name,
:avatar,
:bio,
:created_at,
:default_currency,
:default_language,
:primary_paymail
... |
096ddade60941e3fb1b913df285a56662fe2a158 | 1,896 | [
425139415
] | [
"test"
] | defmodule YourBotWeb.FileControllerTest do
use YourBotWeb.ConnCase
import YourBot.UniqueData
import YourBot.AccountsFixtures
import YourBot.BotFixtures
import YourBot.FileFixtures
setup [:setup_user, :setup_discord_oauth, :setup_api_token, :setup_bot]
test "list files", %{conn: conn, bot: bot} do
bo... |
096f12273553eaf5e5c49e2f6174f137966bb8e5 | 2,151 | [
128416446
] | [
"typespec",
"documented"
] | if Code.ensure_loaded?(Sidewalk) do
defmodule ActiveJorb.QueueAdapter.Sidekiq do
@moduledoc """
Uses the [sidewalk](https://hex.pm/packages/sidewalk) library to enqueue jobs
with Sidekiq.
## Example
```
iex> job = %ActiveJorb.Job{job_class: "MyJob", arguments: [1, 2, 3], queue_name: "high"}
... |
096f122a820fcae545a3e2fdd40cef3575d54cc8 | 1,846 | [
970817672
] | [
"phoenix"
] | defmodule Frestyl.Portfolios.EmbedCode do
def generate_embed_code(portfolio, options \\ %{}) do
token = generate_secure_token()
settings = %{
width: options[:width] || "100%",
height: options[:height] || "600px",
theme: options[:theme] || "light",
show_header: options[:show_header] || ... |
096f3df3ed37a8bcab8d629c6134942df0409ad9 | 4,141 | [
650889764
] | [
"documented"
] | defmodule BnApis.Helpers.HtmlHelper.Behaviour do
@callback generate_pdf_from_html_api(String.t(), String.t(), String.t(), boolean(), list()) :: String.t()
end
defmodule BnApis.Helpers.HtmlHelper do
alias BnApis.Helpers.ApplicationHelper
alias BnApis.Helpers.HtmlHelper.Behaviour
alias BnApis.Helpers.S3Helper
... |
096f966eb23a861f578d994edb540f89b9f7c1c5 | 3,257 | [
127781753,
917123261
] | [
"typespec",
"documented"
] | defmodule Level.Digests.UnreadTodaySection do
@moduledoc """
Builds an "unread today" section for a digest.
"""
import Ecto.Query
import LevelWeb.Router.Helpers
alias Level.Digests.Compiler
alias Level.Digests.Options
alias Level.Digests.Persistence
alias Level.Digests.Section
alias Level.Posts
... |
096fb53081ba5e962e460222255ebf83bbf0138e | 3,274 | [
650700339
] | [
"phoenix",
"documented"
] | if Application.get_env(:api, :tanbits_shim)[:include_vnext] do
defmodule JetzyApi.V2_0.Group.Controller do
import JetzyWeb.Helpers
use JetzyApi, :controller
use JetzyElixir.ApiBehaviour,
entity_module: Jetzy.Group.Entity
use PhoenixSwagger
#---------------------------------------
# def index/2
#-... |
097049bc8975b63644be84ad5e5e91e4d82cc5fb | 3,905 | [
572870877
] | [] | raw_jets = File.read!("input.txt")
|> String.trim_trailing |> String.graphemes
jets = raw_jets |> Stream.cycle
len_jets = length(raw_jets)
rocks = [
fn {x, y} -> [{x, y}, {x+1, y}, {x+2, y}, {x+3, y}] end, # -
fn {x, y} -> [{x+1, y}, {x, y+1}, {x+1, y+1}, {x+2, y+1}, {x+1, y+2}] end, # +
fn {x, y} -> [{x, y}, {x+1,... |
097111e40b665265415cff2edf6c2e0d67c9cb8b | 3,431 | [
179338306
] | [
"typespec",
"documented"
] | defmodule Brex.Result.Mappers do
@moduledoc """
Tools for combining `Enum` and result tuples.
"""
import Brex.Result.Base
alias Brex.Result.Base
@type s(x) :: Base.s(x)
@type t(x) :: Base.t(x)
@type p() :: Base.p()
@type s() :: Base.s()
@type t() :: Base.t()
@typedoc """
The type `t:Enum.t/0`... |
09716eb312c3df3e0652b8238da65f98a28c7aa8 | 5,471 | [
520435726
] | [
"typespec",
"documented"
] | defmodule TTEth do
@moduledoc """
Top level functions and helpers.
## Configuration
Configure TTEth using:
```elixir
config tt_eth,
chain_client: YourChainClientModule,
wallets: [
primary: "[private key]",
secondary: "[private key]"
]
```
"""
alias TTEth.{Wallet, Behaviour... |
097184f90af59eac520c6f7c30b7fb290ec8b83e | 1,669 | [
657125140
] | [
"documented",
"ecto"
] | defmodule Community.News do
@moduledoc """
The News context.
"""
import Ecto.Query, warn: false
alias Community.Repo
alias Community.News.Link
@doc """
Returns the list of links.
## Examples
iex> list_links()
[%Link{}, ...]
"""
def list_links do
Repo.all(Link)
end
@doc "... |
097208b524908d6a9c0910ab7acb76e6c416b84e | 2,100 | [
807634097,
59708985
] | [
"documented"
] | defmodule Nex.Opcodes.O229 do
@moduledoc """
SBC SBC Subtract memory from accumulator with borrow SBC
-
Operation: A - M - C -> A N Z C I D V
- / / / _ _ /
Note:C = Borrow (Ref:... |
097272401c5640edd612e513136af718bacb3dad | 2,458 | [
524350682
] | [] | import Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with esbuild to bundle .js and .css sources.
config :rate_limit, RateLimitWeb.Endpoint,
# Binding to loo... |
09729336936060d2fd589acbaa2100ff522d14d0 | 1,941 | [
782305737
] | [
"typespec",
"documented",
"ecto"
] | defmodule PiggyBank.Transactions.Transaction do
@moduledoc """
Schema and relationships for transactions
"""
use Ecto.Schema
alias Ecto.Changeset
alias PiggyBank.Accounts.Account
alias PiggyBank.Currencies.Currency
alias PiggyBank.LedgerEntries.LedgerEntry
@type t :: %__MODULE__{
account:... |
0972ae7740698cb9803d2c5552ce67d646f1affd | 2,317 | [
976814430
] | [] | defmodule PhoenixLit.MixProject do
use Mix.Project
def project do
[
app: :phoenix_lit,
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... |
0972b26faa259c09f2486322c08f3c87f8129159 | 3,343 | [
349521677
] | [
"typespec",
"ecto"
] | defmodule Beef.Access.Rooms do
import Ecto.Query
@fetch_limit 16
alias Beef.Queries.Rooms, as: Query
alias Beef.Users
alias Beef.UserBlocks
alias Beef.Repo
alias Beef.Schemas.User
alias Beef.Schemas.Room
alias Beef.Schemas.UserBlock
alias Beef.Schemas.RoomBlock
alias Beef.RoomPermissions
alias ... |
0972b9fd89e1fece2972e463f826bac8cace69f2 | 1,692 | [
259695632
] | [
"documented"
] | defmodule Dealief.Agreement do
@moduledoc """
The Agreement context.
"""
import Ecto.Query, warn: false
alias Dealief.Repo
alias Dealief.Agreement.Vendor
def list_vendors do
Repo.all(Vendor)
end
def get_vendor!(id), do: Repo.get!(Vendor, id)
def create_vendor(attrs \\ %{}) do
%Vendor{}
... |
0972dd3d3c5adb269de12826c95310f9513c2eb0 | 4,204 | [
195741418,
388511880,
603610250,
762131773,
970389734,
329355024,
579412520,
746798402,
385691311,
820624395,
682357176,
719664534,
609216219,
574323694,
394023530,
511371868,
675225385,
580235090,
823014073,
399631385,
417119332,
424214145,
424400274,
739033590,
5586... | [
"typespec",
"documented"
] | defmodule Pleroma.Clippy do
@moduledoc false
# No software is complete until they have a Clippy implementation.
# A ballmer peak _may_ be required to change this module.
def tip do
tips()
|> Enum.random()
|> puts()
end
def tips do
host = Pleroma.Config.get([Pleroma.Web.Endpoint, :url, :ho... |
0972f0bc11e18c49251d61871e3d569d43c25aa4 | 2,001 | [
565700464
] | [
"documented",
"ecto"
] | defmodule ProjectTrack.Salesagents do
@moduledoc """
The Salesagents context.
"""
import Ecto.Query, warn: false
alias ProjectTrack.Repo
alias ProjectTrack.Salesagents.Salesagent
@doc """
Returns the list of salesagents.
## Examples
iex> list_salesagents()
[%Salesagent{}, ...]
"""
... |
0972f4a0eebe3860900a2a474d20bef069e3f160 | 8,593 | [
631311040,
645931572,
616640391,
657606827,
621128907
] | [
"documented"
] | defmodule Mix.Tasks.Compile.ElixirMake do
@moduledoc """
Runs `make` in the current project.
This task runs `make` in the current project; any output coming from `make` is
printed in real-time on stdout.
## Configuration
This compiler can be configured through the return value of the `project/0`
functi... |
097389d30e1375f2b0987347aa352e7262f397d5 | 1,614 | [
640180401
] | [
"phoenix"
] | defmodule EventWeb.Router do
use EventWeb, :router
pipeline :api do
plug :accepts, ["json"]
plug EventWeb.Plugs.SetUser
end
pipeline :is_authenticated do
plug EventWeb.Plugs.IsAuthenticated
end
scope "/api", EventWeb do
pipe_through :api
post "/login", AuthController, :login
post ... |
0973ac45aff6c3bafceb996450848691326987cd | 1,919 | [
688919531
] | [] | # This file is responsible for configuring your umbrella
# and **all applications** and their dependencies with the
# help of the Config module.
#
# Note that all applications in your umbrella share the
# same configuration and dependencies, which is why they
# all use the same configuration file. If you want different... |
0973ae033e553346c5927ebf9eae32bf6e2a1592 | 22,334 | [
506149785
] | [
"documented"
] | defmodule Immudb.Schema.PermissionAction do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.10.0", syntax: :proto3
field(:GRANT, 0)
field(:REVOKE, 1)
end
defmodule Immudb.Schema.Key do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.10.0", syntax: :proto3
field(:ke... |
0973fc5662e7773168601d0c36af01c54c37a656 | 7,023 | [
175013067,
260155866
] | [
"test"
] | defmodule Stripe.ConverterTest do
use ExUnit.Case
alias Stripe.Converter
test "converts a 'customer.updated' event response properly" do
expected_result = %Stripe.Event{
account: "acct_0000000000000000",
api_version: "2016-07-06",
created: 1_483_537_031,
data: %{
object: %Str... |
0975043579805d18ce7002fa21407cb4f12623a6 | 2,601 | [
666095064
] | [
"liveview",
"test"
] | defmodule Surface.Components.LivePatchTest do
use Surface.ConnCase, async: true
alias Surface.Components.LivePatch
defmodule ComponentWithLink do
use Surface.LiveComponent
def render(assigns) do
~F"""
<div>
<LivePatch to="/users/1"/>
</div>
"""
end
def handle_ev... |
09751db8fc0d34d4302c011f02d2288ab315b972 | 2,427 | [
282691434
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule MysimplelistWeb 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 MysimplelistWeb, :controller
use MysimplelistWeb, :view
The definitions below will be executed for every view,... |
09754dada2b270724c1572f1789769cb5022362d | 1,745 | [
226429660
] | [
"documented"
] | defmodule Atree.Actions.Shared.BlockInFile do
@moduledoc """
Add a text-block to a file.
"""
@shortdoc "ShortDoc for #{__MODULE__}"
use Atree.Action,
header: [],
instruction: [],
text_block: [],
check_for: [type: [:string]],
target_file: [],
file_type: []
def screen(ctx, props... |
0975738f2cb7735e8cfa79de1ef583239dea346b | 2,584 | [
804402729
] | [
"test",
"ecto"
] | defmodule Crm.DevicesTest do
use Crm.DataCase
alias Crm.Devices
describe "devices" do
alias Crm.Devices.Device
import Crm.DevicesFixtures
@invalid_attrs %{serialno: nil, brand: nil, model: nil, currentlocation: nil, remarks: nil}
test "list_devices/0 returns all devices" do
device = dev... |
09758809082344c34f7a5932a024cd79c1710993 | 1,793 | [
49292670
] | [
"test"
] | defmodule Cog.Test.Commands.Group.Member.AddTest do
use Cog.CommandCase, command_module: Cog.Commands.Group
alias Cog.Commands.Group.Member
import Cog.Support.ModelUtilities, only: [user: 1, group: 1]
setup [:with_user, :with_group]
test "can be added to a group", %{user: user, group: group} do
{:ok, r... |
09759d501f0d356e695a5f9d95f2ab5d5d190224 | 1,538 | [
87002057
] | [
"macro",
"documented",
"phoenix"
] | defmodule Pocket.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Pocket.Web, :controller
use Pocket.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them short ... |
0976b8086dbf09c75edd0dacdeada197eca86df1 | 1,732 | [
537699113
] | [
"typespec",
"documented"
] | defmodule Ipnutils.Address do
def public_address?(<<0, rest::binary>>) when byte_size(rest) == 20, do: true
def public_address?(_), do: false
def internal_address?(<<1, rest::binary>>) when byte_size(rest) == 20, do: true
def internal_address?(_), do: false
def combined_address?(<<2, rest::binary>>) when by... |
09776a7b1aea7e50333918d3eef32c4701e217c7 | 2,084 | [
104448355
] | [] | defmodule Fw.MixProject do
use Mix.Project
@target System.get_env("MIX_TARGET") || "host"
def project do
[
app: :fw,
version: "0.1.0",
elixir: "~> 1.6",
target: @target,
archives: [nerves_bootstrap: "~> 1.0"],
deps_path: "deps/#{@target}",
build_path: "_build/#{@tar... |
0977e54cd4c92c1f7782444fdfe5aaf97b216254 | 3,051 | [
358082254
] | [
"test"
] | defmodule Pebble.TransactionsTest do
use Pebble.DataCase, async: true
alias Pebble.Accounts
alias Pebble.Transactions
describe "send_money/1" do
test "ensure money is sent as expected" do
value = Enum.random(100..100_000)
sender_info = %{
name: "Joe Doe",
email: "<EMAIL>",
... |
09780d292f0643970e145ccc581a603847f00c74 | 8,402 | [
308457589
] | [
"test",
"ecto"
] | defmodule Tq2.NotificationsTest do
use Tq2.DataCase
use Bamboo.Test
import Tq2.Fixtures, only: [default_account: 0, user_fixture: 1]
alias Tq2.Accounts.User
alias Tq2.Messages.Comment
alias Tq2.Notifications
alias Tq2.Notifications.Email
alias Tq2.Payments.Payment
alias Tq2.Sales.{Customer, Order}
... |
097859458a264feb5287727e74b1f4ed361ac8e0 | 10,107 | [
72556503
] | [
"test"
] | defmodule Pomerol.V1.OrganizationSalesCategoryControllerTest do
use Pomerol.ApiCase
alias Pomerol.Repo
alias Pomerol.OrganizationSalesCategory
describe "create" do
test "cannot create a sales category when user is not authenticated", %{conn: conn} do
organization = insert(:organization)
organiz... |
097866ce7075fe0bcdc957daa43cba58df5081f9 | 3,044 | [
157025839
] | [
"test",
"phoenix"
] | defmodule ElixirJobsWeb.EventControllerTest do
use ElixirJobsWeb.ConnCase
alias ElixirJobs.Events
@create_attrs %{begin_date: ~N[2010-04-17 14:00:00], is_approved: true, link: "some link", logo: "some logo", place: "some place", title: "some title"}
@update_attrs %{begin_date: ~N[2011-05-18 15:01:01], is_appr... |
0979193074f7706dbf2a89793053fadec578a4a6 | 1,650 | [
108375695
] | [
"macro",
"documented",
"phoenix"
] | defmodule TestPollingWeb 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 TestPollingWeb, :controller
use TestPollingWeb, :view
The definitions below will be executed for every view,
... |
09797eb0bb1847e0d508ad4d5bc3d1eeebee873d | 16,994 | [
416902200
] | [] | %{
"a11y_audit": {:hex, :a11y_audit, "0.2.3", "4a041eeeb9ae87967b30526b8bb9e4a1a3b0136b6e0f1324a029c47cc0938a21", [:mix], [{:hound, "~> 1.1", [hex: :hound, repo: "hexpm", optional: true]}, {:wallaby, "~> 0.30", [hex: :wallaby, repo: "hexpm", optional: true]}], "hexpm", "748ed5dcca3c4a20db2b4a71b3ca2130c66dcacb48cfabf... |
0979e69d988bd0a3a402e8da4a14d2068b3055d3 | 7,004 | [
71608796,
47486383
] | [
"genserver",
"documented"
] | # This is an Elixir module responsible for tracking references
# to modules, remote dispatches, and the usage of
# aliases/imports/requires in the Elixir scope.
#
# Note that since this is required for bootstrap, we can't use
# any of the `GenServer.Behaviour` conveniences.
defmodule Kernel.LexicalTracker do
@moduled... |
097b1a4a0c3ec32d5b06edfcb3d903efa71e202e | 1,714 | [
942811655,
920024200
] | [
"documented"
] | defmodule PipelinesAPI.LoghubClient do
@moduledoc """
Module is used for fetching logs for cloud jobs from loghub
"""
require Logger
alias PipelinesAPI.Util.{Metrics, ToTuple}
alias InternalApi.Loghub.GetLogEventsRequest
alias LogTee, as: LT
defp url(), do: System.get_env("LOGHUB_API_URL")
@wormhol... |
097b42abb375e19c386e472c55fe72b64cdf164b | 1,814 | [
505460103
] | [] | defmodule RecursionPractice do
# Function to calculate the length of a list
# Non tail-call-recursive form
def list_len_nonTC([]), do: 0
def list_len_nonTC([ _head | tail ]) do
1+list_len_nonTC(tail)
end
# Function to calculate the length of a list
# Tail-call-recursive form
def list_len_TC(input_... |
097c0ba3079d66ebdab6e52c4e99636fadb0bc52 | 2,273 | [
171503664
] | [
"test"
] | defmodule ExSDP.RepeatTimesTest do
use ExUnit.Case
alias ExSDP.RepeatTimes
describe "RepeatTimes parses compact format" do
test "process a valid compact declaration" do
assert {:ok, result} = RepeatTimes.parse("6d 6h 10s 90m")
assert %RepeatTimes{
active_duration: 21_600,
... |
097c4aee4566ccc911254fc6cb23dd0e58d7d1bd | 2,305 | [
422765799
] | [
"typespec"
] | defmodule AshJsonApiWrapper.Endpoint do
defstruct [
:action,
:path,
:entity_path,
:fields,
:fields_in,
:write_entity_path,
:get_for,
:runtime_sort?,
:limit_with,
:paginator,
:__identifier__
]
@type t :: %__MODULE__{}
def schema do
[
action: [
type:... |
097c4e199dc067e74c69c6f98a509820952022ac | 2,248 | [
904399333
] | [
"documented"
] | defmodule JSV.Vocabulary.V202012.Unevaluated do
alias JSV.Validator
use JSV.Vocabulary, priority: 800
@moduledoc """
Implementation for the
`https://json-schema.org/draft/2020-12/vocab/unevaluated` vocabulary.
"""
@impl true
def init_validators(_) do
[]
end
take_keyword :unevaluatedProperties... |
097cffffb974db587f72b5a1fba3d6785f120de7 | 5,107 | [
84788828
] | [
"test"
] | defmodule Legacy.Calls.StoreTest do
use Legacy.RedisCase, async: true
describe "Legacy.Calls.Store.incr/3" do
test "creates counters for new & old at the timestamp's base, with day granularity", %{redis: redis} do
now = DateTime.to_unix DateTime.utc_now
base = div(now, 86400) * 86400
Legacy.... |
097d145eed13720fa9ff88680cbde6ed944b62e0 | 9,367 | [
257787813
] | [
"ecto"
] | defmodule Domain.Actors.Actor.Query do
use Domain, :query
def all do
from(actors in Domain.Actors.Actor, as: :actors)
end
def not_deleted do
all()
|> where([actors: actors], is_nil(actors.deleted_at))
end
def not_disabled(queryable \\ not_deleted()) do
where(queryable, [actors: actors], i... |
097d4a1c9293a55ea323ad33db49b01867c23c64 | 2,617 | [
556695838
] | [
"documented"
] | defmodule TodoList.MixProject do
@moduledoc false
use Mix.Project
def project do
[
app: :todo_list,
version: "0.1.16",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end
# C... |
097dc020a0194a0faa0a93d40313a9a653d58ddf | 4,954 | [
146924140
] | [
"documented"
] | defmodule Reuse.Parse.CheckSpdx do
alias Reuse.Parse.CheckFile
@moduledoc """
A checker which gets all the single file licences out of the LICENSE.spdx file
"""
@doc """
Hello world.
## Examples
iex> CheckSpdx.check("debian/copyright")
[
%{has_copyright: true, license_found_in_debian_f... |
097dcfe3d3005bd77f3de253008e95fe843c33cd | 2,283 | [
196551554
] | [
"documented",
"ecto"
] | if Mix.env() == :test do
defmodule BlockchainAddresses.Flags.InMemoryStore.Record do
@moduledoc """
Copied verbatim from FunWithFlags.Store.Persistent.Ecto.Record
because the original one is not available in compile-time (due to some dependencies nonsense probably, since Ecto is not a hard dependency of F... |
097e37e2890403ef737c967bcf4fff0b914c3506 | 2,356 | [
1017475305
] | [] | # 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 :meerkat, :scopes,
user: [
default: true... |
097eb0fca085b421e32ff63539ac50b95a20e112 | 2,497 | [
160683261
] | [
"test"
] | defmodule Buzzword.Bingo.PlayerTest do
use ExUnit.Case, async: true
alias Buzzword.Bingo.Player
doctest Player
setup_all do
jim = Player.new("Jim", "cyan")
joe = Player.new("Joe", "#d3c5f1")
jay = Player.new("Jay", "rgb(211, 97, 41)")
encoded = %{
jim: ~s<{"name":"Jim","color":"cyan"}>... |
097f07a7a57cb557403ef01afd616a0596de053d | 2,458 | [
884344453
] | [] | # 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 :time_manager_api,
ecto_repos: [TimeManager... |
097f0be36871f99e999b39a99a921635afeda13d | 2,357 | [
866395877
] | [
"test",
"phoenix"
] | defmodule PeachWeb.EventControllerTest do
use PeachWeb.ConnCase, async: true
alias Peach.{Event, Repo, Ticket, TicketTier}
setup do
event =
Repo.insert!(%Event{
name: "Sample Event",
start: ~N[2024-11-10 09:00:00],
end: ~N[2024-11-12 17:00:00]
})
vip_tier =
Repo... |
097fc1b45645db2cccad23326b7a2512ba29efa8 | 1,548 | [
139261545
] | [
"macro",
"documented",
"phoenix"
] | defmodule BpServiceWeb 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 BpServiceWeb, :controller
use BpServiceWeb, :view
The definitions below will be executed for every view,
contro... |
097fdcf77dd067eabd1a25ceaa58c04429c078bb | 3,678 | [
235339541,
119544525
] | [
"genserver"
] | defmodule Astarte.DataUpdaterPlant.AMQPTestEventsConsumer do
require Logger
use GenServer
alias AMQP.Basic
alias AMQP.Channel
alias AMQP.Connection
alias AMQP.Exchange
alias AMQP.Queue
alias Astarte.DataUpdaterPlant.AMQPTestHelper
@connection_backoff 10000
# API
def start_link(args \\ []) do
... |
09800d1cd4dc52527cad8627372540ba22931d57 | 1,821 | [
644669871
] | [
"test",
"ecto"
] | defmodule BestCoffeeTruck.RatingsTest do
use BestCoffeeTruck.DataCase
alias BestCoffeeTruck.Ratings
describe "ratings" do
alias BestCoffeeTruck.Ratings.Rating
@invalid_attrs %{rating: nil}
test "list_ratings/0 returns all ratings" do
rating = insert(:rating) |> forget(:truck)
assert Ra... |
09809ed664bc645f6ae4f5a511317ff0c32fdd73 | 1,944 | [
176135112
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule PhoenixForecastrLiveViewWeb 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 PhoenixForecastrLiveViewWeb, :controller
use PhoenixForecastrLiveViewWeb, :view
The definitions be... |
0980ede7addfdcdb45fcf1bb96786dbd19269d49 | 5,159 | [
804439924
] | [
"test"
] | defmodule IncidentIo.IncidentRolesV2Test do
use IncidentIo.TestCase, async: true
import IncidentIo.IncidentRolesV2
doctest IncidentIo.IncidentRolesV2
@client IncidentIo.Client.new(%{api_key: "yourApiKeyGoesHere"})
describe "list/1" do
test "returns expected HTTP status code" do
use_cassette "inci... |
098114e48a83c881511f06acead4db809a170642 | 5,553 | [
542291437
] | [
"typespec",
"documented"
] | defmodule AshAuthentication.Verifier do
@moduledoc """
The Authentication verifier.
Checks configuration constraints after compile.
"""
use Spark.Dsl.Verifier
alias AshAuthentication.{Info, Strategy, Strategy.Password}
alias Spark.{Dsl.Transformer, Error.DslError}
import AshAuthentication.Utils
@do... |
09817f618c481959be95fb72e11ca90daabcabae | 2,977 | [
516770784
] | [
"typespec",
"documented"
] | defmodule Satellite do
@typedoc """
A tree, which can be empty, or made from a left branch, a node and a right branch
"""
@type tree :: {} | {tree, any, tree}
@doc """
Build a tree from the elements given in a pre-order and in-order style
"""
@spec build_tree(preorder :: [any], inorder :: [any]) :: {:o... |
0981842072a7e4ea1d3289631c643200ad8f69d1 | 3,349 | [
86372056
] | [
"test"
] | defmodule Til.PostControllerTest do
use Til.ConnCase
alias Til.{ Post, User }
@valid_credentials %{email: "<EMAIL>", password: "password"}
@valid_attrs %{title: "Sample post", body: "Sample body" }
describe "For general users" do
test "returns a list of posts when for an authorized user" do
conn = ... |
0981da4168aeed71ae8409e10a996d3bb81366a0 | 2,623 | [
583991492
] | [
"genserver",
"liveview"
] | defmodule QdfmsWeb.LiveItems do
use QdfmsWeb, :live_view
alias Phoenix.LiveView.JS
@topic "whats_inside:lobby"
@impl true
def mount(%{"container" => container_id} , _session, socket) do
{:ok,
socket
|> assign(items: Inventory.Items.get_items_in_container(String.to_integer(container_id)))
|> ... |
0981f498d497bc04b76c7ba88dd021bd347df143 | 1,512 | [
276942562
] | [
"test"
] |
defmodule MutationTest do
use ExUnit.Case
import Mock
doctest Mutation
defp create_mocked_uniform_max(link_name) do
Agent.start_link(fn -> 0 end, name: link_name)
mocked_uniform_max = fn(_number) ->
call_number = Agent.get(link_name, &(&1))
Agent.update(link_name, &(&1 + 1))
case ca... |
09821335c84de72f8f8417301aacc79f00ccb540 | 1,659 | [
135595785
] | [
"typespec",
"documented"
] | defmodule BarrelEx.Replication do
@moduledoc """
Manage database replication tasks
"""
alias BarrelEx.Request
@doc """
Get all replication tasks.
"""
@spec get() :: {atom(), map()}
def get do
with url <- make_url() do
Request.get(url)
end
end
@doc """
Get all replication tasks. R... |
0982201f39d6d368a918e692feba3a159e6cd6ec | 5,007 | [
123683458
] | [
"typespec",
"documented"
] | defmodule(Thrift.Generator.BinaryProtocolTest.Struct) do
_ = "Auto-generated Thrift struct struct.Struct"
_ = "1: struct.Val val"
_ = "2: map<struct.Val,struct.Val> val_map"
_ = "3: set<struct.Val> val_set"
_ = "4: list<struct.Val> val_list"
defstruct(val: nil, val_map: nil, val_set: nil, val_list: nil)
@... |
09823d453de80b1bbe04ad5ef3cc42e025d4728b | 1,532 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1ListLinkedSourcesResponse do
@moduledoc """
Response message for DocumentLinkService.ListLinkedSources.
## Attributes
* `documentLinks` (*type:* `list(GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1DocumentLink.t)`,... |
0982b10476b518e7b4a34c197e5c5efd663b67e6 | 9,116 | [
650700339
] | [
"documented",
"phoenix"
] | defmodule ApiWeb.Api.V1_0.FrequentlyAskedQuestionController do
@moduledoc """
Manage list of Frequently Asked Questions.
"""
#============================================================================
# Uses, Requires, Aliases
#======================================================================... |
0982f441717f1b297c231d4ba922066482ad7bdc | 8,662 | [
24534566
] | [
"test"
] | defmodule HeapQueueTest do
use ExUnit.Case
test "suite" do
q = HeapQueue.new()
assert HeapQueue.queue?(q)
assert 0 == HeapQueue.size(q)
q = q
|> HeapQueue.push(20, 200)
|> HeapQueue.push(19, 190)
|> HeapQueue.push(18, 180)
|> HeapQueue.push(17, 170)
|> HeapQueue.push(1... |
098345494b85e8a3b1cca3b019bd157125fda5d1 | 2,010 | [
332997531,
332107093
] | [
"typespec",
"documented"
] | defmodule UrlShortener.Decoder do
@moduledoc """
Handles decoding integers from base62 encoded strings.
"""
alias UrlShortener.Constants
@character_set Constants.base62_character_set()
@base Enum.count(@character_set)
@spec base62_to_int(String.t()) :: integer
def base62_to_int(base62_string) do
b... |
098381fc77f0b547185dc0d405e4e497fbfdc58f | 4,827 | [
350013104
] | [
"test",
"ecto"
] | defmodule TranslaTable.QueryTest do
use TranslaTable.RepoCase
import Ecto.Query
import TranslaTable.Query
alias TranslaTable.Fixture.Lang
alias TranslaTable.Fixture.Post
alias TranslaTable.Fixture.Schema.Post, as: PostSchema
alias TranslaTable.Fixture.Schema.PostTranslation, as: PostTranslationSchema
... |
0983b967687e1e18bf6afdb3d93ecdf7f306cbeb | 4,482 | [
875361495
] | [] | # Chandy-Misra shortest path algorithm
defmodule ChandyMisraSkeleton do
def deploy(topology) do
# Create network (use registered names for communication)
Process.register(spawn(__MODULE__, :cm, [{1, :a}, {nil, 0, :infinity}, [{:b,5}, {:c,1}, {:e,4}]]), :a)
Process.register(spawn(__MODULE__, :cm, [{2, :b}... |
0983d80db8bdebb08fda2a2284b3ec57a1362fba | 2,932 | [
187791952
] | [
"phoenix",
"ecto"
] | defmodule CrmWeb.OpportunityController do
use CrmWeb, :controller
alias Crm.Sales
alias Crm.Sales.Opportunity
alias Crm.Sales.Note
alias Crm.Sales.Account
def index(conn, _params) do
opportunities = Sales.list_opportunities()
render(conn, "index.html", opportunities: opportunities)
end
def ... |
098463435efd65ff0f7368ea9cd4944df5fd535e | 2,948 | [
173038798,
230943565
] | [
"test",
"phoenix"
] | defmodule PlatformWeb.PlayerControllerTest do
use PlatformWeb.ConnCase
alias Platform.Accounts
@create_attrs %{password: "some password", username: "some username"}
@update_attrs %{
display_name: "some updated display name",
password: "some updated password",
score: 43,
username: "some updated... |
0984a852ccdf66c7a44e36ffea94afd8c35e724a | 2,565 | [
155064543
] | [
"phoenix"
] | defmodule K2pokerIoWeb.GameController do
use K2pokerIoWeb, :controller
alias K2pokerIo.UserTournamentDetail
alias K2pokerIo.User
alias K2pokerIo.Commands.Game.JoinGameCommand
alias K2pokerIo.Commands.Game.QuitGameCommand
alias K2pokerIo.Commands.Game.GetOpponentProfileCommand
alias K2pokerIo.Commands.Gam... |
09853b855c9908bb56a1d34e9d7c7c020fb10d5a | 2,610 | [
1010011901
] | [] | defmodule Sui.Rpc.V2alpha.OpenSignatureBody.Type do
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
def descriptor do
# credo:disable-for-next-line
%Google.Protobuf.EnumDescriptorProto{
name: "Type",
value: [
%Google.Protobuf.EnumValueDescriptorProto{
... |
09856b30d4f050116e7cf60f15c159717f5b4d5e | 1,965 | [
204344067
] | [
"typespec",
"documented"
] | defmodule SRTM.DataCell do
@moduledoc """
Encapsulates an parsed HGT file.
"""
alias SRTM.Error
@opaque t :: %__MODULE__{}
defstruct [:hgt_data, :latitude, :longitude, :points_per_cell, :last_used]
@doc false
def new(name, data) do
with {:ok, ppc} <- get_ppc(data) do
{lat, lng} = reverse_c... |
0985cd23a12aee9e39860678308bf5dfede5fba6 | 10,689 | [
962716692
] | [] | %{
"ash": {:hex, :ash, "3.5.2", "953aebdaca92a00c5ec88988463ff80dc5ea06908b51e7b0e7e843f68bf7cb6c", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:igniter,... |
0985d44eae2391d975fda2a58834cf696f1a90ba | 2,169 | [
40847538
] | [
"test"
] | defmodule Steamex.Auth.PlugTest do
use ExUnit.Case, async: true
use Plug.Test
defmodule FailAuth do
def validate_payload(_) do
raise "fail"
end
end
@fail_opts Steamex.Auth.Plug.init(steamex_auth: FailAuth)
test "fails" do
conn = conn(:get, "/steamex/return_to")
conn = Steamex.Auth... |
0985d57d83189422e0721c99b47f613da4edcdd1 | 2,840 | [
746362673
] | [
"liveview",
"ecto"
] | defmodule TashkentAqNotifierWeb.SubscriberLive.FormComponent do
use TashkentAqNotifierWeb, :live_component
alias TashkentAqNotifier.Subscribers
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage subscriber records in your data... |
0985e115078f844faea1933c80f14f8f91afec60 | 3,876 | [
164319988
] | [
"test"
] | defmodule Almanack.Sources.USIOTest do
use Almanack.TestCase
alias Almanack.Sources.USIO
setup_all do
legislators = Fixtures.load("usio_legislators.json")
media = Fixtures.load("usio_social_media.json")
executives = Fixtures.load("usio_executives.json")
{:ok, legislators: legislators, media: medi... |
098627600f6875b316e7225894f8997e8f767e94 | 6,156 | [
589073552,
514687923,
589556621
] | [
"typespec",
"documented"
] | defmodule Expo.MO.Parser do
@moduledoc false
alias Expo.{Message, Messages, MO, Util}
alias Expo.MO.{InvalidFileError, UnsupportedVersionError}
@spec parse(binary(), [MO.parse_option()]) ::
{:ok, Messages.t()} | {:error, InvalidFileError.t() | UnsupportedVersionError.t()}
def parse(content, opts)
... |
09863c6a3cf56a1da893cc5986509186c543313e | 1,741 | [
584214465
] | [
"test",
"phoenix"
] | defmodule PasswordGeneratorWeb.Api.PageControllerTest do
use PasswordGeneratorWeb.ConnCase
setup %{conn: conn} do
{:ok, conn: put_req_header(conn, "accept", "application/json")}
end
describe "genetates a password" do
test "generates password with ony length passed", %{conn: conn} do
conn = post(... |
09864cacb807f3b159dd37148f8252c1bb7483ce | 1,561 | [
75036350
] | [
"test"
] | defmodule Pummpcomm.History.BolusNormalTest do
use ExUnit.Case
test "Bolus Normal - Smaller" do
{:ok, history_page} = Base.decode16("011D1D000785340D11")
decoded_events =
Pummpcomm.History.decode_records(history_page, %{large_format: false, strokes_per_unit: 10})
expected_event_info = %{
... |
09869a75ac304ea2052bb427e4c0240ef1531819 | 4,172 | [
17755990
] | [
"genserver",
"ecto"
] | defmodule Onthebeam.CommandHandler do
use GenServer
# Public API
def start_link do
:gen_server.start_link({ :local, :onthebeam_command_handler }, __MODULE__, [], [])
end
# Inner modules
defmodule Nodes do
def list do
Enum.map(all_nodes, fn(n) ->
:rpc.call(n, Nodes, :info, [])
e... |
0986ee666416d96f6347a46673d7ccb1a7e0f717 | 9,078 | [
162466193
] | [] | defmodule Day9 do
def solve2(input, pos, id, rb) do
opcode_digits = Enum.at(input,pos) |> Integer.digits()
opcode_digits_full = case Enum.count(opcode_digits) do
5 -> opcode_digits
4 -> [0] ++ opcode_digits
3 -> [0,0] ++ opcode_digits
2 -> [0,0,0] ++ opcode_digits
1 -> [0,0,0,0]... |
09873e60056e4b5656a7d877a183b92e6e661696 | 1,938 | [
487464133
] | [
"genserver",
"typespec"
] | defmodule BlitzElixirProject.Tracker.SummonerTracker do
use GenServer, restart: :temporary
alias BlitzElixirProject.Config
alias BlitzElixirProject.Tracker.TrackingList
def init(args) do
state = %{
summoner: args[:summoner],
last_match_id: "",
expiry: refresh_expiry(),
agent: args[... |
098762d6647b9d345cb3141f0b74742da1d87562 | 9,997 | [
505749383
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hex... |
0987f2069223ef8e0a0c4b540c2f7a5f7d68b660 | 1,572 | [
281059468
] | [
"documented"
] | defmodule FermoSlugger do
@moduledoc """
Create slugs from id and text
"""
@doc ~S"""
Returns a slug, combining id and title.
## Example
iex> FermoSlugger.slug(123, "ciao")
"123-ciao"
## Normalization
Punctuation is replaced by '-':
iex> FermoSlugger.slug(123, "S&P")
"123-s... |
0987fa5c7681d048dba4b97b4bacbb570e6c0d4e | 1,533 | [
489382373
] | [] | # 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 :pre_hack_ui,
namespace: PreHackUI,
ecto_r... |
0988c5a1bd552180d34586c32ee959208e323195 | 4,074 | [
927234821
] | [
"typespec",
"documented"
] | defmodule Livebook.Teams.Broadcasts do
alias Livebook.Teams.{Agent, AppDeployment, DeploymentGroup}
@type broadcast :: :ok | {:error, term()}
@agents_topic "teams:agents"
@app_deployments_topic "teams:app_deployments"
@clients_topic "teams:clients"
@deployment_groups_topic "teams:deployment_groups"
@do... |
0988d1a35518312a80d41129846b8331a5695cd3 | 1,812 | [
159989568
] | [] | input = File.read!("input")
chars = String.graphemes(String.trim(input, "\n"))
reacts? = fn c1, c2 ->
c1 != c2 and String.downcase(c1) == String.downcase(c2)
end
one_pass = fn chars ->
with_post = Enum.zip(chars, Enum.drop(chars, 1) ++ [" "])
reaction_index = Enum.find_index(with_post, fn {char, post} -> reacts... |
0988fba79994ccb11b20b4a783cd893ad76c4176 | 3,298 | [
438476457
] | [] | defmodule Quadblockquiz.MixProject do
use Mix.Project
def project do
[
app: :quadblockquiz,
description: "Descri'be",
version: "1.1.14-dev",
elixir: "~> 1.15.4",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
bui... |
098910dea51f775155726ee5a7e99a3a91db341e | 7,918 | [
363419449,
123528600
] | [
"documented"
] | defmodule OMG.Eth.RootChain.Fields do
@moduledoc """
Adapt to naming from contracts to elixir-omg.
I need to do this even though I'm bleeding out of my eyes.
"""
def rename(data, %ABI.FunctionSelector{function: "DepositCreated"}) do
# key is naming coming from plasma contracts
# value is what we use
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.