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 |
|---|---|---|---|---|
ffc1b56ad9501574ce584b1642886cec330c2faa | 10,255 | [
744421640
] | [
"phoenix"
] | defmodule BlockScoutWeb.API.V2.VerificationController do
use BlockScoutWeb, :controller
import Explorer.SmartContract.Solidity.Verifier, only: [parse_boolean: 1]
alias BlockScoutWeb.AccessHelper
alias BlockScoutWeb.API.V2.ApiView
alias Explorer.Chain
alias Explorer.SmartContract.Solidity.PublisherWorker, ... |
ffc278638935aeb11c608d43b68d209780f7b0c4 | 4,693 | [
151700497
] | [
"typespec",
"documented"
] | defmodule Membrane.RawVideo do
@moduledoc """
This module provides a struct (`t:#{inspect(__MODULE__)}.t/0`) describing raw video frames.
"""
require Integer
@typedoc """
Width of single frame in pixels.
"""
@type width :: pos_integer()
@typedoc """
Height of single frame in pixels.
"""
@type ... |
ffc2b86c6c704fdb60815c4eba2f28f93592d7e7 | 2,003 | [
282066598
] | [
"phoenix",
"ecto"
] | defmodule GlimeshWeb.UserSocialController do
use GlimeshWeb, :controller
import GlimeshWeb.Gettext
alias Glimesh.Socials
def twitter(conn, params) do
with {:ok, access_token} <-
ExTwitter.access_token(params["oauth_verifier"], params["oauth_token"]),
{:ok, _} <-
Glimesh.Soc... |
ffc3788848c8d7eea80d3d2c3fb563fbc1d6b996 | 3,060 | [
830050847
] | [
"test",
"phoenix"
] | defmodule RmsWeb.SurchageControllerTest do
use RmsWeb.ConnCase
alias Rms.Surchages
@create_attrs %{code: "some code", description: "some description", status: "some status"}
@update_attrs %{
code: "some updated code",
description: "some updated description",
status: "some updated status"
}
@in... |
ffc43338fafdb82eefa68395689fff3257c8ae3e | 3,233 | [
66694128
] | [
"test"
] | defmodule NationalWeatherServiceTest do
use ExUnit.Case
doctest Weather
import Weather.NationalWeatherService, only: [ current_obs_url: 1,
decode_response: 1 ]
test "current_obs_url" do
assert current_obs_url("KALB") == "http://w1.weather.gov/xml/current_ob... |
ffc4745f9d02787886f4d99682b6fdcd9b91a779 | 2,897 | [
933982233
] | [
"liveview"
] | defmodule RaffleyWeb.RaffleLive.Index do
alias Raffley.Charities.Charity
use RaffleyWeb, :live_view
alias Raffley.Raffles
alias Raffley.Charities
import RaffleyWeb.CustomComponents
def mount(_params, _session, socket) do
socket =
assign(socket, :charity_options, Charities.charity_names_and_slugs()... |
ffc4e20eef021e04413475229e070fe5df42f0c9 | 3,077 | [
168593134
] | [
"test"
] | defmodule ResponseTest do
alias GcpRegistry.Response
use ExUnit.Case
describe "make!" do
test "works with empty manifest" do
expected = %GcpRegistry.Response{
child: ["branch2", "branch1"],
manifest: %{},
name: "project1/company1/repo1",
tags: []
}
params = ... |
ffc53534b0258b1284a0f42a00c317f98e814892 | 10,444 | [
96208654
] | [
"genserver",
"documented"
] | defmodule ExUnitJsonFormatter do
use GenServer
@moduledoc """
Formats ExUnit output as a stream of JSON objects (roughly compatible
with Mocha's json-stream reporter)
"""
# GenServer callbacks that receive test runner messages
def init(opts) do
config = %{
seed: opts[:seed],
trace: opts[... |
ffc53dced5559916bc3476ffda0edbef00f9d283 | 1,755 | [
664716838
] | [
"typespec",
"documented"
] | defmodule SszEx.Error do
@moduledoc """
Error messages for SszEx domain.
"""
alias SszEx.Error
defstruct [:message, stacktrace: []]
@type t :: %__MODULE__{message: String.t(), stacktrace: list()}
def format(%Error{message: message, stacktrace: []}), do: "#{message}\n"
def format(%Error{message: messag... |
ffc65aae4a1ad0cda39f368a2b52c4ee6f80ccc0 | 3,277 | [
112765011
] | [
"documented"
] | defmodule TicTacToe.Board do
@moduledoc false
alias TicTacToe.Board
defstruct [
:player_1,
:player_2,
:tiles,
:scale
]
@doc """
Inits a board with given scale and player tiles
"""
def init(scale, p1 \\ :X, p2 \\ :O) do
%Board{
player_1: p1,
player_2: p2,
tiles: ... |
ffc6da467be3e0fc6328c8f34528407c90e2ec97 | 1,602 | [
71446985
] | [
"macro"
] | defmodule Brain.BlackBox.Status do
defmacro __using__(_opts) do
quote do
defp system_status do
{uptime, _} = :erlang.statistics(:wall_clock)
{:ok, %{
memory: :erlang.memory() |> Enum.into(%{}),
processes: processes(),
uptime: uptime
}}
end
d... |
ffc7c946f3fe3cfe9de494907792fad307c5ce23 | 6,833 | [
137464738
] | [
"ecto"
] | defmodule Mix.Tasks.Procon.Init do
use Mix.Task
import Mix.Generator
@shortdoc "Initialize Procon in your project"
def run(_args) do
app_name = Mix.Project.config[:app] |> to_string
app_module = app_name |> Macro.camelize
host_app_main_repo = Mix.Ecto.parse_repo([]) |> List.first
migrations_p... |
ffc7f2cccfd34b9d81d611b366c5210cdb6c4945 | 2,133 | [
877371857
] | [
"phoenix",
"ecto"
] | defmodule TimeManagerWeb.RolesController do
use TimeManagerWeb, :controller
alias TimeManager.Rights
alias TimeManager.Rights.Roles
alias TimeManager.Accounts
action_fallback TimeManagerWeb.FallbackController
def index(conn, _params) do
role = Rights.list_role()
render(conn, :index, role: role)
... |
ffc8a507d5395cfb5a64f1dc2e213a76d7d7cc7b | 2,453 | [
988087308
] | [] | # 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 :counter_1,
ecto_repos: [Counter1.Repo],
g... |
ffc8add8436f3cf238e93ae07ba2d833e9f916fd | 2,294 | [
211390448
] | [] | defmodule Re.SellerLeads.DuplicityChecker do
require Ecto.Query
alias Re.{
Address,
Addresses,
Repo,
SellerLeads.DuplicatedEntity
}
alias Ecto.{
Changeset
}
defdelegate authorize(action, user, params), to: Re.SellerLeads.Policy
def duplicated?(%Address{} = address, complement) do
... |
ffc93fbbf0d90c8b1012c6b8d691be1d37722ea7 | 1,674 | [
102135717
] | [
"documented",
"ecto"
] | defmodule Shipping.HandlingEvents.HandlingEvent do
@moduledoc """
A domain event representing a particular handling of a Cargo.
"""
use Ecto.Schema
import Ecto.Changeset
# The Aggregate is HandlingEvents
alias Shipping.HandlingEvents.HandlingEvent
# Cargoes Aggregates
alias Shipping.Cargoes
# Note ... |
ffca1b3e6cf9c5caecfdd8a8409a968e88a2f538 | 1,702 | [
19458007
] | [] | defmodule SandCat.Words do
use SandCat.Core
alias SandCat.Core
defprimitive :+, [a, b], do: [a + b]
defprimitive :-, [a, b], do: [a - b]
defprimitive :*, [a, b], do: [a * b]
defprimitive :/, [a, b], do: [a / b]
defprimitive :===, [a, b], do: [b === a]
defprimitive :!==, [a, b], do: [b !== a]
defpri... |
ffccae1dd030d6590754b04f61e5b1bef9cce2e2 | 3,689 | [
985853139
] | [
"typespec"
] | # Generated by Mochi compiler v0.10.26 on 2025-07-16T12:46:41Z
defmodule Main do
@spec initGrid(integer()) :: list(list(String.t()))
def initGrid(size) do
try do
# g :: list(list(String.t()))
g = []
_ = g
y = 0
_ = y
t1 = fn t1, g, y ->
try do
if y < size d... |
ffccfa4d323c6a343c97455f635fd3f24e536dd7 | 1,564 | [
267181649
] | [] | defmodule ElixirEcommerce.Authorization do
alias __MODULE__
alias ElixirEcommerce.UserManager.User
defstruct role: nil, create: %{}, read: %{}, update: %{}, delete: %{}
def grant(role), do: %Authorization{role: role}
# Enable permissions
def create!(authorization, resource), do: permit!(authorization, :c... |
ffcd69ec63fd9939a33e3dcf49a4577277b57bec | 1,565 | [
416383998
] | [
"test"
] | defmodule BikeBrigade.MailchimpApiTest do
use BikeBrigade.DataCase
alias BikeBrigade.MailchimpApi
alias BikeBrigade.MailchimpApi.FakeMailchimp
@list_id "ABCDEF123"
@members [%{email: "<EMAIL>", id: "123"}, %{email: "<EMAIL>", id: "347"}]
setup do
on_exit(fn -> FakeMailchimp.clear_members(@list_id) en... |
ffce4af21d0cc9881245919a3f0cd48b86d8a1e2 | 6,389 | [
642974477
] | [
"documented",
"ecto"
] | defmodule Physio.Categories do
@moduledoc """
The Categories context.
"""
import Ecto.Query, warn: false
alias Physio.Repo
alias Physio.Categories.Category
@doc """
Returns the list of categories.
## Examples
iex> list_categories()
[%Category{}, ...]
"""
def list_categories do
... |
ffce59d4c95e36015c3cc66ce9e239192b0fe0c1 | 2,806 | [
434371960
] | [] | input = File.read!("day16/input.txt")
defmodule Input do
def parse(hex) do
hex
|> String.split("", trim: true)
|> Enum.flat_map(&hex_to_binary/1)
|> parse_packet()
end
defp hex_to_binary(hex_char) do
hex_char
|> Integer.parse(16)
|> elem(0)
|> Integer.digits(2)
|> pad_zero()
... |
ffcf1772b77e8aded1f6c1ba691d5003f116b827 | 3,232 | [
537699309
] | [
"phoenix"
] | defmodule PcrmWeb.Router do
use PcrmWeb, :router
import PcrmWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {PcrmWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :fetch_... |
ffcf69544b34e83483893cd1a7115487cbbe261d | 3,022 | [
334696761
] | [
"test"
] | defmodule ExDoc.CLITest do
use ExUnit.Case, async: true
import ExUnit.CaptureIO
@ebin "_build/test/lib/ex_doc/ebin"
defp run(args) do
ExDoc.CLI.main(args, &{&1, &2, &3})
end
test "minimum command-line options" do
assert {"ExDoc", "1.2.3", [app: :ex_doc, source_beam: @ebin]} ==
run(["... |
ffcfd8c8c591ce10b2ae06d61f60dc73ec2d0550 | 2,363 | [
440939920
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule ArclockWeb 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 ArclockWeb, :controller
use ArclockWeb, :view
The definitions below will be executed for every view,
controller, ... |
ffd019480de5be00116773f3a04722c7c0151353 | 2,883 | [
882462584
] | [
"genserver",
"documented"
] | defmodule ServerlogDaemon.LoglineWorker do
@moduledoc false
use GenServer, restart: :transient, shutdown: 10_000
alias Phoenix.PubSub
alias ServerlogDaemon.LoglineMapper
require Logger
@pubsub_server Application.compile_env!(:serverlog_daemon, :pubsub_server)
@impl true
def init(args) do
# Process... |
ffd01c907e3492a0241d4e06c3ce061b8ae2f454 | 2,418 | [
438890494
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule TaskAppAuthWeb 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 TaskAppAuthWeb, :controller
use TaskAppAuthWeb, :view
The definitions below will be executed for every view,
... |
ffd06f8ad7e5290b222bcb9fc93c17823a0f3782 | 3,269 | [
197641667
] | [
"phoenix",
"ecto"
] | defmodule AmazonOneWeb.API.AuthorsController do
use AmazonOneWeb, :controller
import Ecto.Query
alias AmazonOne.Repo
alias AmazonOne.Author
def index(conn, _params) do
case Repo.all from g in Author, preload: [:books] do
authors ->
conn
|> put_status(:ok)
|> render("inde... |
ffd15b541a4404c4cdf2059d4a795157592d1415 | 2,923 | [
820192032
] | [
"documented"
] | defmodule Sequin.Posthog do
@moduledoc """
A client for interacting with Posthog analytics.
"""
require Logger
@doc """
Captures a single event.
"""
def capture(event, properties, opts \\ [])
def capture(event, properties, opts) when is_list(opts) do
body = build_event(event, properties, Keywor... |
ffd17e11d1dc846ba982a9a43d5de016e2bd5c06 | 2,123 | [
22924248
] | [
"genserver",
"test"
] | defmodule Zookeeper.ElectionTest do
use ExUnit.Case
alias Zookeeper.Client, as: ZK
alias Zookeeper.Election, as: E
defmodule TestServer do
use GenServer
require Logger
def start_link(identifier, test_pid, opts \\ []) do
GenServer.start_link(__MODULE__, {test_pid, identifier}, opts)
end... |
ffd25b6ccc1eb339951ae0c100350f7f61b0721d | 6,544 | [
660999006
] | [
"genserver",
"typespec",
"documented"
] | defmodule ExKits.Cache.LRU do
@moduledoc ~S"""
This modules implements a simple LRU cache, using 2 ets tables for it.
For using it, you need to start it:
iex> LRU.start_link(:my_cache, 1000)
Or add it to your supervisor tree, like: `worker(LRU, [:my_cache, 1000])`
## Using
iex> LRU.start_link... |
ffd38c9779ed1ebc493760035fab57e77d7a7e17 | 1,576 | [
796768093
] | [
"macro",
"documented",
"phoenix"
] | defmodule TheDancingPonyWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, components, channels, and so on.
This can be used in your application as:
use TheDancingPonyWeb, :controller
use TheDancingPonyWeb, :html
The definitions below will be executed for... |
ffd3974840adc8d985920a479461f8a17a1333e6 | 2,130 | [
243110073
] | [] | defmodule RankEm.Scrapers.NCAAF.FPI do
@behaviour RankEm.Scrapers.Scraper
import RankEm.Scrapers.TableHelpers
@url "http://www.espn.com/college-football/statistics/teamratings/_/year/2019/key/20191215040000"
@impl RankEm.Scrapers.Scraper
def scrape() do
with {:ok, %HTTPoison.Response{body: html, status... |
ffd4c69fd8977adf3a5d2c8bdcd6cf3c42eaf2a8 | 2,565 | [
98602422
] | [
"typespec"
] | defmodule Tai.VenueAdapters.Bitmex.AmendBulkOrders do
alias Tai.Orders.Responses
@type credentials :: Tai.Venues.Adapter.credentials()
@type order :: Tai.Orders.Order.t()
@type attrs :: Tai.Orders.Worker.amend_attrs()
@type response :: Responses.AmendBulk.t()
@type reason ::
:timeout
| ... |
ffd571e06caff0a359c9f25cba441d2d0aed47f6 | 6,232 | [
18281293
] | [
"typespec",
"documented"
] | defmodule Stripe.Subscription do
@moduledoc """
## Attributes
- `id` - string
- `object` - string, value is "subscription"
- `cancel_at_period_end` - boolean - If the subscription has been
canceled with the at_period_end flag set to true,
cancel_at_period_end on the subscription will be tru... |
ffd5743da78d5c89a5aa717cf9fdb5624d942ad6 | 5,049 | [
190379118
] | [
"macro",
"documented",
"ecto"
] | defmodule Vecto.Schema do
@moduledoc """
A wrapper around `Ecto.Schema` that provides inline field
options and better schema reflection.
"""
@keys [:default, :virtual, :editable, :required, :displayed, :primary_key]
defmacro __using__(opts \\ []) do
Module.put_attribute(__CALLER__.module, :strict, Key... |
ffd64f4de0a6a274b9e3e42a2ba9542e7dad091d | 2,411 | [
267408628
] | [
"phoenix"
] | defmodule ClaytonWeb.PageController do
use ClaytonWeb, :controller
alias Clayton.Upload
alias Clayton.Repo
def index(conn, _params) do
render(conn, "index.html")
end
def success(conn, _params) do
conn |> html("URL is ok")
end
def get_random_code(length) do
Enum.shuffle(~w( A B C D E G H ... |
ffd6a9e14b17edfaa0e0bbff87e54bff5cfc26f4 | 1,820 | [
51272059
] | [] | defmodule OneShotListenerSpec do
use ESpec, async: false
describe "listen_for" do
let :event, do: %{bus: :cec, command: :cec_version, destination: :audio_system, source: :tuner_2, version: "1.1"}
let :state, do: %{filter: filter(), caller: self()}
subject do: Devices.OneShotListener.handle_events([even... |
ffd7dcfdd2640f733a83fa7ae7af0b4fc9353aa0 | 1,544 | [
50945543
] | [
"ecto"
] | defmodule Review.Repo.Migrations.SetUpSchema do
use Ecto.Migration
def change do
create table(:authors) do
add :name, :string
add :email, :string
add :username, :string
add :created_at, :datetime
add :updated_at, :datetime
end
create table(:comments) do
add :payload... |
ffd802c4fed3aa112da6da3418c90a3aa3c16e0a | 3,994 | [
969845159
] | [
"test"
] | defmodule AuthorizeDomainTest do
use ExUnit.Case
alias AuthorizeDomain
alias Result
describe "from_object/1" do
setup do
valid_input = %{
"response_type" => "code",
"client_id" => "123",
"redirect_uri" => "https://example.com/callback",
"scope" => "openid profile",
... |
ffd812e4f32c92d88d1e2d717fd3006c2bb77a35 | 8,928 | [
447934475
] | [] | %{
"cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65... |
ffd83b9e58902ea1e3f121dc114a85984afac8f2 | 12,209 | [
997178529
] | [
"test",
"documented"
] | defmodule DSPEx.SignatureSchemaIntegrationTest do
use ExUnit.Case, async: true
doctest DSPEx.Signature.SchemaIntegration
alias DSPEx.Signature.SchemaIntegration
describe "schema DSL integration" do
defmodule TestMLSignature do
@moduledoc "Test signature with ML-specific types"
use DSPEx.Signat... |
ffd870e6b9897916235fae67fedeb7f58bc000ac | 11,453 | [
192407200
] | [
"test",
"liveview"
] | defmodule DiscoveryApi.Event.EventHandlerTest do
use ExUnit.Case
use Placebo
import SmartCity.Event,
only: [
dataset_update: 0,
organization_update: 0,
user_organization_associate: 0,
user_organization_disassociate: 0,
dataset_delete: 0,
dataset_query: 0,
dataset_acc... |
ffd8dad1a7504ffb16d135fc99d01d84e7b10ebd | 2,448 | [
959192401
] | [
"phoenix"
] | defmodule PhoenixGuidesWeb.Router do
use PhoenixGuidesWeb, :router
alias PhoenixGuides.ShoppingCart
pipeline :browser do
plug :accepts, ["html", "json"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {PhoenixGuidesWeb.Layouts, :root}
plug :protect_from_forgery
plu... |
ffd9156ba556bebb9ca5ee433f964d5790b1da5c | 1,876 | [
888628980,
95709744
] | [
"typespec",
"documented"
] | defprotocol Prioqueue.Protocol do
@type prioqueue :: t
@doc """
Inserts `item` at the correct ordering place inside `prioqueue`,
according to the ordering introduced by the Priority Queue's `cmp_fun`.
Runs in O(log n).
"""
@spec insert(prioqueue, item :: any) :: prioqueue
def insert(prioqueue, item)
... |
ffda4a1cacd6f62813bd4e5d60bddee821796d94 | 4,996 | [
412285229
] | [
"typespec",
"documented"
] | defmodule DTask.TUI.Views.TaskCommon do
@moduledoc false
alias DTask.Task.DTO.Progress
alias DTask.TUI
alias Ratatouille.Constants
import DTask.Util.Syntax
@default_color Constants.color(:default)
@pending_label "pending"
@pending_color @default_color
@running_label "running"
@running_color Con... |
ffda74b9c20be05c8dde9b33201a624f8b48247e | 2,047 | [
552557718
] | [
"liveview"
] | defmodule SelectoComponents.Views.Aggregate.Form do
use Phoenix.LiveComponent
import SelectoComponents.Components.Common
def render(assigns) do
~H"""
<div>
Group By
<.live_component
module={SelectoComponents.Components.ListPicker}
id="group_by"
fieldname="g... |
ffda9186b228580a83d95fb5778b1a2bb61c90fa | 3,645 | [
389613302
] | [
"typespec",
"macro",
"documented"
] | defmodule AstraeaVirgo.Cache.Utils.NamespaceSet do
@moduledoc """
Interface for Cache Namespace Set
- Problem
- ProblemSubject
- ProblemTestcase
Generate `index/1` and `show/1` operation for Cache
Note: Callback functions can be private
"""
@doc """
Cache Index Key
Example:
```elixir
... |
ffdaed9f2ca3bf53771357157a24b53b2f0f1110 | 2,199 | [
426446320
] | [] | defmodule Content.Downloader do
alias Content.RemoteFileStreamer
import System, only: [os_time: 0]
import Path, only: [extname: 1]
@upload_directory Application.get_env(:content, :uploads_directory)
def download(""), do: ""
def download(nil), do: nil
def download(url)do
url
|> RemoteFileStreamer.... |
ffdaf278319e33327c14e0d73543581502aac395 | 1,733 | [
351899007
] | [
"typespec",
"documented",
"ecto"
] | defmodule HygeiaWeb.Helpers.Region do
@moduledoc """
countries and subdivisions
"""
@spec countries :: [{String.t(), String.t()}]
def countries do
locale = HygeiaCldr.get_locale().language
Cadastre.Country.ids()
|> Enum.map(&{&1 |> Cadastre.Country.new() |> Cadastre.Country.name(locale), &1})
... |
ffdb079f3596ca691dd1fc5fc261e9a3df3733d1 | 3,501 | [
111415024
] | [
"test"
] | defmodule GroupherServer.Test.CMS.Hooks.MentionInJob do
use GroupherServer.TestTools
import GroupherServer.CMS.Delegate.Helper, only: [preload_author: 1]
alias GroupherServer.{CMS, Delivery}
alias CMS.Delegate.Hooks
@article_mention_class "cdx-mention"
setup do
{:ok, user} = db_insert(:user)
{:o... |
ffdb20e1c9d57d54c368a977422304995bb8f2ee | 2,939 | [
942811655,
920024200
] | [
"documented"
] | defmodule Ppl.PplSubInits.STMHandler.ConceivedState do
@moduledoc """
Moves PplSubInit to created state.
"""
import Ecto.Query
alias Ppl.Ppls.Model.PplsQueries
alias Ppl.PplSubInits.Model.PplSubInits
alias Ppl.PplRequests.Model.PplRequestsQueries
alias Ppl.PplSubInits.STMHandler.Common
alias Ppl.Rep... |
ffdb2b9fce8591ecc627cf26a1da11bfb3e12e15 | 8,259 | [
199195485
] | [
"phoenix"
] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
import Config
# Customize non-Elixir parts of the firmware. See
# https://hexdocs.pm/nerves/advanced... |
ffdbe3f7970d11ded59ea8136fcc0a2fa23016ff | 2,415 | [
188307269
] | [
"documented"
] | defmodule Gimel do
@moduledoc """
Gimel finds Unicode characters by name.
"""
@doc """
Build list of uppercase words from a string, splitting hyphenated words.
"""
def tokenize(text) do
text
|> String.upcase()
|> String.replace("-", " ")
|> String.split()
end
@doc """
Parse line fr... |
ffdc107a1ac2692181c5f9017af37c263e025b14 | 1,614 | [
29061008
] | [] | %{"certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0df0979153cbafcd853ababaf", [:rebar3], []},
"espec": {:hex, :espec, "1.3.2", "20c96d580df671860bd8e7de1523be9ead34bbdca4912689a54f295add56d683", [:mix], [{:meck, "0.8.4", [hex: :meck, optional: false]}]},
"hackney": {:hex, :hackney, "1.6... |
ffdc4443c6f8e17e338ba5c08b9eec59091b2425 | 5,092 | [
221571220
] | [
"typespec",
"documented"
] | defmodule Stein.Storage do
@moduledoc """
`Stein.Storage` covers uploading, downloading, and deleting remote files
## Available backends
### FileBackend
The `Stein.Storage.FileBackend` is available for development purposes.
For the file backend, you can configure the folder Stein should use. This
shou... |
ffde0aac700696e11af8f76eecde94695704f0f6 | 5,094 | [
637995285
] | [] | %{
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"},
"earmark_parser": {:hex, :earmark_parser, "1.4.38", "b42252eddf63bda05554ba8be93a1262dc0920c721f1aaf989f5de0f73a2e... |
ffdf5e56f14ee27c56820d9e2a3faf7aebcdaa82 | 1,759 | [
44122596
] | [
"documented"
] | defmodule Neo4j.Sips.Response do
@moduledoc ~S"""
Defines the structure for a raw REST response received from a Neo4j server.
"""
# @derive Access
defstruct [:results, :transaction, :commit, :errors]
def to_rows(sip) do
get_results(sip, "row")
end
def to_graph(sip) do
get_results(sip, "graph"... |
ffdfacbd66a118caa3d224470d75986d41a035ce | 2,937 | [
317658548
] | [
"genserver",
"test"
] | defmodule LruCacheTest do
use ExUnit.Case
# doctest LruCache
test "Basic use case, support any type of object as value" do
# assert {:ok, _} = LruCacheGenServer.start_link(10)
initializeCache(10)
assert :ok == LruCacheGenServer.put(:v1, "test")
assert "test" == LruCacheGenServer.get(:v1)
asser... |
ffe0b264acb603e2a059be59feeb8fb4e7f99033 | 5,316 | [
428034854
] | [
"macro",
"test"
] | defmodule DataSchemaXmlTest do
use ExUnit.Case
use ExUnit.Case, async: true
def to_upcase(s), do: {:ok, String.upcase(s)}
defmodule Cheese do
require DataSchema
@data_accessor XpathAccessor
DataSchema.data_schema(field: {:mouldy?, "./@Mouldy", fn "true" -> {:ok, true} end})
end
defmodule Sa... |
ffe0d8c5bc1ed310370d4205bd48156869c2a23b | 1,795 | [
779430222
] | [
"typespec",
"documented"
] | defmodule Peridio.RAT.WireGuard.Interface do
@moduledoc """
The Wireguard [Interface] definition for the local machine
"""
alias Peridio.RAT.Utils
alias Peridio.RAT.Network
alias Peridio.RAT.Network.IP
defstruct [
:id,
:ip_address,
:port,
:table,
:private_key,
:public_key
]
... |
ffe12e22725e8c21af349e836922f27f8e653ff3 | 2,250 | [
229193972
] | [] | defmodule ExOpenTravel.Composers.OtaHotelAvailQuery.Mapping do
@behaviour ExOpenTravel.Response.Converter
alias ExOpenTravel.Response.Converter
import SweetXml
@room_types [
~x"./*[local-name() = 'RoomTypes']/*[local-name() = 'RoomType']"ol,
"@RoomTypeCode": ~x"./@RoomTypeCode"os,
RoomDescription: ... |
ffe13428b258ea1df3306b350cc38a0915205aff | 4,505 | [
337393312
] | [
"documented"
] | defmodule CryptoApis.IndependentReserve do
@moduledoc """
https://www.independentreserve.com/products/api#public-methods
"""
@root_url "https://api.independentreserve.com/Public"
alias CryptoApis.Pair
defp process_pair(pair), do: pair |> Pair.new() |> Pair.to_tuple()
defp parse_crypto("BTC"), do: "xbt"... |
ffe1ac464b0a0f9517d9a9272cb46b7be672fbae | 6,611 | [
771078002
] | [
"liveview",
"ecto"
] | defmodule LanguageTranslatorWeb.UserLive.Index do
use LanguageTranslatorWeb, :live_view
import LanguageTranslatorWeb.FilterComponents
alias LanguageTranslatorWeb.Router.Helpers, as: Routes
alias LanguageTranslator.Accounts.User
alias LanguageTranslator.Accounts
alias LanguageTranslatorWeb.Util
alias Lang... |
ffe1e6c1f7a092ca60e258015013a8ed788df29c | 7,127 | [
879782401
] | [
"test"
] | defmodule ExLedger.ConcurrencyTest do
use ExLedger.DataCase
@moduletag :no_sandbox
describe "confirm_deposit/1" do
setup do
%{account: create_account!()}
end
test "ensures database locks are handled correctly for single deposit", %{account: account} do
%Transaction{id: transaction_id} =
... |
ffe23ac16597c060cd7a60a0271a326f0c9e9958 | 6,681 | [
81005561
] | [
"typespec",
"documented"
] | defmodule Apprentice.HireFire.Manager do
@moduledoc """
HireFire Manager.
"""
use Napper.Resource
@derive [Poison.Encoder]
# The updatable fields common to all manager types.
@basic_updatable_fields [
:name,
:type,
:enabled,
:minimum,
:maximum,
:notify,
:notify_quantity,
... |
ffe2f62b0c12d6eb414093528dd292a0aa472db7 | 3,906 | [
129425057
] | [
"genserver",
"phoenix"
] | defmodule JukeeWeb.PlayerChannel do
use JukeeWeb, :channel
alias Jukee.Players
alias JukeeWeb.PlayerView
alias Jukee.TrackSearch
alias Jukee.Tracks
alias JukeeWeb.PlayerPresence
require Logger
def join("player:" <> player_id, payload, socket) do
if authorized?(player_id, payload) do
send(self... |
ffe32b20f3ec279cca1b2d5513ac4b3d3155da66 | 1,989 | [
97377698
] | [
"test",
"documented"
] | defmodule Helpers.MapHelperTest do
@moduledoc false
use ExUnit.Case, async: true
alias Express.Helpers.MapHelper
test "reduce_keys/2: changes map keys with function" do
map = %{"2" => 1, "3" => 2, "4" => %{"5" => 4}}
assert %{"1" => 1, "2" => 2, "3" => %{"5" => 4}} == MapHelper.reduce_keys(map, fn(k... |
ffe33cc71e1de74e7f91a76cf88fa151e6870a81 | 1,730 | [
81257546
] | [
"typespec",
"documented"
] | defmodule ProteinTranslation do
@doc """
Given an RNA string, return a list of proteins specified by codons, in order.
"""
@spec of_rna(String.t()) :: {atom, list(String.t())}
def of_rna(rna) do
{ ok, peptides } = translate_rna(rna, [])
cond do
ok == :error -> { :error, "invalid RNA" }
tru... |
ffe37800affd2ca35177fe7972e730695cf1a6ae | 8,173 | [
371812917
] | [
"typespec",
"documented"
] | defmodule HostCore.Policy.Manager do
@moduledoc false
require Logger
alias HostCore.Policy.Manager
use Gnat.Server
@policy_table :policy_table
# Deny actions by default
@default_permit false
def request(%{
body: body,
reply_to: _reply_to,
topic: _topic
}) do
case Ja... |
ffe3b66c96ef86a50da1ef4695ce4dc759b1c174 | 1,674 | [
100142512
] | [
"macro",
"documented",
"phoenix"
] | defmodule CourseCatalogWeb 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 CourseCatalogWeb, :controller
use CourseCatalogWeb, :view
The definitions below will be executed for every vi... |
ffe48d140366dd3a0585b9a87d314a5d03e5efac | 2,993 | [
111212509
] | [
"typespec",
"documented"
] | defmodule FunFunc.Nilable do
@moduledoc ~S"""
Functions for Nilable valeu.
"""
@type nilable :: nil | any
@type func :: (nilable -> nilable)
@doc ~S"""
Maps if the first argument is not nil. Otherwise returns nil.
## Examples
iex> FunFunc.Nilable.map(1, &Integer.to_string/1)
"1"
iex... |
ffe4a83967041b1b6a6aee0219e39e6d6806fb23 | 2,701 | [
138523651
] | [
"genserver"
] | defmodule Magnetissimo.Crawler.WorldWideTorrents do
use GenServer
alias Magnetissimo.Torrent
import Magnetissimo.Crawler.Helper
require Logger
def start_link(_) do
queue = initial_queue()
GenServer.start_link(__MODULE__, queue, name: __MODULE__)
end
def init(queue) do
Logger.info IO.ANSI.mag... |
ffe55eb897248f863c3d02cfa5da833780a479f0 | 4,878 | [
50815365
] | [
"documented"
] | defmodule Gizmo.Netstream.Property do
alias Gizmo.Netstream.Property, as: Self
alias Gizmo.Reader, as: Reader
defstruct [
:id,
:name,
:type,
:stuff
]
@doc """
Properties are read like this:
- Compressed property id (max value pulled from the Class Net Cache).
- If the property is a static array, ser... |
ffe58de33bdb3e86dc931d0bee8aada8922aa15e | 4,684 | [
234462278
] | [
"test"
] | defmodule Screens.V2.WidgetInstance.AudioOnly.AlertsIntroTest do
use ExUnit.Case, async: true
import ExUnit.CaptureLog
alias ScreensConfig.Screen
alias Screens.V2.WidgetInstance
alias Screens.V2.WidgetInstance.AudioOnly.AlertsIntro
alias Screens.V2.WidgetInstance.{MockWidget, SubwayStatus, ReconstructedAle... |
ffe63c4c65514f9ec1255928f6ad47066bd3a043 | 1,716 | [
169760137
] | [
"macro",
"documented",
"phoenix"
] | defmodule NoRouteTestingWeb 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 NoRouteTestingWeb, :controller
use NoRouteTestingWeb, :view
The definitions below will be executed for every... |
ffe664b86966aaba899682ff6202300d7ea31e5a | 10,026 | [
997093956
] | [
"documented"
] | defmodule Arty.CLI do
@moduledoc """
Main CLI interface for Arty - an AI-powered command line assistant.
Based on the Claude Code architecture but implemented in Elixir,
this module handles command parsing, session management, and
orchestrates the main interaction loop.
"""
alias Arty.{Context, ControlL... |
ffe713704332baf12b9b8519adb55e49f1ba16c1 | 7,020 | [
23015536
] | [
"typespec",
"documented"
] | defmodule ExParsec.Text do
@moduledoc """
Provides common parsers that operate on text.
These parsers all require that the input data is codepoints.
"""
import ExParsec.Base
import ExParsec.Helpers
alias ExParsec.Parser
@doc """
Parses a codepoint. Returns the codepoint as result... |
ffe7176d1caccbceb7939fd12b3123cc0298a0d7 | 9,634 | [
167133665
] | [
"ecto"
] | defmodule Dungeon do
defmodule State do
defstruct [
:doors,
:keys,
:distances_between_keys,
:doors_between_keys
]
end
defmodule Crawler do
def all_keys_min_distance_dp(graph, source_node, key_set) do
{:ok, path_cache_pid} = Agent.start_link(fn -> %{} end)
shortest_... |
ffe73eee4286e2460bb4dec750b1d35cdde4d616 | 3,072 | [
573508000
] | [
"liveview",
"ecto"
] | defmodule PentoWeb.ProductLive.FormComponent do
use PentoWeb, :live_component
alias Pento.Catalog
@impl true
def update(%{product: product} = assigns, socket) do
changeset = Catalog.change_product(product)
{:ok,
socket
|> assign(assigns)
|> assign(:changeset, changeset)
|> allow_u... |
ffe767d7579bc2dc9e40bbcebc77d8dd78acc1cf | 1,777 | [
317586676
] | [
"test"
] | defmodule AdventOfCode.Day04PassportProcessingTest do
use ExUnit.Case
doctest AdventOfCode.Day04PassportProcessing
import AdventOfCode.Day04PassportProcessing
@test_input ["ecl:gry pid:860033327 eyr:2020 hcl:#fffffd",
"byr:1937 iyr:2017 cid:147 hgt:183cm",
"",
"iyr... |
ffe76a69216e56bedfd69a88036af624ca5055b6 | 2,332 | [
492823415
] | [
"phoenix",
"ecto"
] | defmodule OceanconnectWeb.Admin.FuelController do
use OceanconnectWeb, :controller
alias Oceanconnect.Auctions
alias Oceanconnect.Auctions.Fuel
def index(conn, params) do
page = Auctions.list_fuels(params)
render(
conn,
"index.html",
fuels: page.entries,
page_number: page.page... |
ffe7b8af7bba01eeb9a55cff77e43e7a86c44266 | 3,216 | [
77746850
] | [
"typespec",
"documented"
] | defmodule SftpEx.Types do
@moduledoc """
All the types and things to deal with types
"""
# Errors
@type reason :: atom | charlist | tuple | binary
@type error_tuple :: {:error, reason}
# Data Types
@type host :: charlist | ip_address | :loopback
@type hostname :: atom | charlist
@type ip_addr... |
ffe87e2f1226d6c9185459d4a152c8ea721a7e6d | 2,840 | [
582461876
] | [] | # Solution to Advent of Code 2023, Day 19
# https://adventofcode.com/2023/day/19
Code.require_file("Util.ex", "..")
Code.require_file("Recurse.ex", ".")
# returns a list of non-blank BLOCKS from the input file
read_input = fn ->
filename = "input.txt"
File.read!(filename) |> String.split("\n\n", trim: true)
end
... |
ffe9cf6b2af87ef4d882518055344c9dd2e79913 | 6,166 | [
78787036
] | [
"typespec",
"documented"
] | defmodule Blogit.Models.Configuration do
@moduledoc """
A module for managing and reading the blog configuration.
A repository containing the blog data can also contain an 'yml' configuration
file. The file should be in the form
```
title: <title>
sub_title: <a-sub-title-for-the-blog>
logo_path: <path ... |
ffea11ce9474493c1699a6ea06e6c7fec02a6313 | 3,280 | [
208835507
] | [
"test",
"supervisor"
] | defmodule Robot do
import ExUnit.Assertions
require Logger
defstruct name: nil
def start_link() do
children = [
{Registry, [keys: :unique, name: Client.Bucket]}
]
opts = [strategy: :one_for_one, name: Robot]
{:ok, _} = Supervisor.start_link(children, opts)
:ok
end
def start(na... |
ffeab2f0b7b38b391a7eeeb48bd16198ea6f15f8 | 2,068 | [
125414041,
130589196,
136527959,
161703639,
139498406,
159884345,
116997670
] | [
"documented"
] | if Code.ensure_loaded?(Plug) do
defmodule Guardian.Plug.EnsureAuthenticated do
@moduledoc """
This plug ensures that a valid token was provided and has been verified on the request.
If one is not found, the `auth_error` will be called with `:unauthenticated`
This, like all other Guardian plugs, requ... |
ffebdf3792c1f137fc53af4f1add7d1ed7cbaf7f | 2,147 | [
360898005
] | [
"test",
"ecto"
] | defmodule CoinRates.CurrenciesTest do
use CoinRates.DataCase
alias CoinRates.Currencies
describe "coins" do
alias CoinRates.Currencies.Coin
@valid_attrs %{cmc_id: 42, name: "some name", slug: "some slslugud"}
@update_attrs %{cmc_id: 43, name: "some updated name", slug: "some updated slug"}
@inv... |
ffed19c3f498d82e1871da7d1113a2fd5df96b29 | 1,847 | [
46932258
] | [
"macro",
"test",
"documented"
] | {:ok, _} = Application.ensure_all_started(:ex_machina)
ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter])
ExUnit.start()
Ecto.Adapters.SQL.Sandbox.mode(Registrations.Repo, :manual)
defmodule Registrations.ApplicationEnvHelpers do
@moduledoc false
use ExUnit.CaseTemplate
def put_application_en... |
ffed62dfd670f808f23b8c385b0746c7edde884b | 18,946 | [
75767893
] | [
"macro",
"test"
] | Code.require_file("test_helper.exs", __DIR__)
defmodule CodeTest do
use ExUnit.Case, async: true
doctest Code
import PathHelpers
def genmodule(name) do
defmodule name do
Kernel.LexicalTracker.references(__ENV__.lexical_tracker)
end
end
contents =
quote do
defmodule CodeTest.Sampl... |
ffee2fa0e7578d9662ac9770d659178f11565dcc | 4,511 | [
275791028
] | [
"genserver",
"typespec"
] | defmodule Geneity.ContentDiscovery.ScrapeWorker do
use GenServer
require Logger
alias Geneity.ContentDiscovery
defstruct [
:type,
:operator_id,
:interval,
events: MapSet.new()
]
@type milliseconds :: non_neg_integer()
@type t() :: %__MODULE__{
type: :pre | :li... |
ffef125d737aa569caf93e08d2efe60f823c05e7 | 2,281 | [
72841254,
80811189
] | [
"phoenix"
] | defmodule Playdays.Api.V1.Admin.EventTagController do
use Playdays.Web, :controller
import Playdays.Utils.MapUtils
alias Playdays.EventTag
alias Playdays.Api.V1.ErrorView
alias Playdays.Queries.EventTagQuery
plug :put_event_tag when action in [:show, :update]
plug :create_event_tag when action in [:crea... |
ffef13e51923f67fa3ae1305543b65f166a27986 | 3,067 | [
248895472
] | [
"genserver"
] | defmodule Tlc59116.Ticker do
defmodule State do
defstruct mode: :normal,
start_time: 0,
last_event: 0,
fade_start: nil,
fade_end: nil,
value: 0
end
use GenServer
require Logger
alias Tlc59116.LedString
@interval 100
@two_hours 1... |
ffef51998b10cdf00726c6e12f2f1313741c45dd | 3,563 | [
141150118
] | [
"test"
] | defmodule Cryptozaur.Connectors.BlockTest do
use ExUnit.Case
alias Cryptozaur.Model.Ticker
alias Cryptozaur.Drivers.BlockRest
alias Cryptozaur.Connectors.Block
import Mock
setup do
{:ok, _} = start_supervised(Cryptozaur.DriverSupervisor)
:ok
end
test "get_tickers" do
with_mocks [
{B... |
ffefa70fcffaae4c16c39e5bc348f3043c96b098 | 6,324 | [
949664843
] | [
"test"
] | defmodule Raxol.Terminal.Operations.ScrollOperationsTest do
use ExUnit.Case
alias Raxol.Terminal.{Operations.ScrollOperations, TestHelper}
# Add a simple test to verify the test infrastructure
test "test infrastructure is working" do
emulator = TestHelper.create_test_emulator()
# Verify emulator has r... |
fff000cd62c106e20d5d31b5d35a3722a21b0376 | 4,917 | [
118212478
] | [
"test",
"documented"
] | defmodule Cadet.AccountsTest do
@moduledoc """
Some of the test values (i.e. tokens) in this file are specified in
config/test.exs.
"""
use Cadet.DataCase
alias Cadet.{Accounts, Repo}
alias Cadet.Accounts.{Query, User}
import Mock
setup_all do
HTTPoison.start()
end
test "get existing user... |
fff0af793e6a1071de10219590fca9eba297948e | 1,908 | [
131115152
] | [
"phoenix",
"ecto"
] | defmodule WerewolfApiWeb.FriendController do
use WerewolfApiWeb, :controller
alias WerewolfApi.User.Friend
alias WerewolfApi.Repo
def create(conn, %{"user_id" => friend_id}) do
user = Guardian.Plug.current_resource(conn)
changeset = Friend.changeset(%Friend{}, %{user_id: user.id, friend_id: friend_id}... |
fff0e74f68ce3e584d633b3864006770c5f3f830 | 1,911 | [
433858225
] | [] | defmodule Aoc2021.Day11.Octopus do
@deltas for x <- -1..1, y <- -1..1, {x, y} != {0, 0}, do: {x, y}
def flashes(map) do
Enum.count(map, &match?({_position, 0}, &1))
end
def step(map) do
map = Map.map(map, fn {_, energy} -> energy + 1 end)
map
|> Enum.reduce(map, fn
{position, 10}, map -... |
fff29dc1efef54117b5e3ca1496662cfafd6a3eb | 1,675 | [
445229377
] | [
"test",
"phoenix"
] | defmodule BlogWeb.AuthControllerTest do
use BlogWeb.ConnCase
@ueberauth %Ueberauth.Auth{
credentials: %{
token: "123"
},
info: %{
email: "<EMAIL>",
first_name: "Rick",
last_name: "Oliveira",
image: "image.com/fake-image"
},
provider: "google"
}
@ueberauth_erro... |
fff31499f665f3af66408fc919d485f74e983d45 | 2,920 | [
785112910
] | [
"documented",
"ecto"
] | defmodule PointPulse.Users do
@moduledoc """
The Users context.
"""
import Ecto.Query, warn: false
alias PointPulse.Repo
alias PointPulse.Users.User
@doc """
Returns the list of users.
## Examples
iex> list_users()
[%User{}, ...]
"""
def list_users do
Repo.all(User)
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.