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 |
|---|---|---|---|---|
06e9ad64ddf8745edb5b4586b509cea39b50d01c | 11,927 | [
213407521
] | [
"test"
] | defmodule AshPostgres.Test.ComplexCalculationsTest do
use AshPostgres.RepoCase, async: false
require Ash.Query
test "complex calculation" do
certification =
AshPostgres.Test.ComplexCalculations.Certification
|> Ash.Changeset.new()
|> Ash.create!()
skill =
AshPostgres.Test.Comple... |
06ea3dab304dd88cc3edabc996b45033276596a5 | 2,425 | [
43247111
] | [
"typespec",
"test",
"documented"
] | defmodule Credo.Check.Warning.OperationOnSameValuesTest do
use Credo.Test.Case
@described_check Credo.Check.Warning.OperationOnSameValues
#
# cases NOT raising issues
#
test "it should NOT report expected code" do
"""
defmodule CredoSampleModule do
use ExUnit.Case
def some_fun do
... |
06ea8b94a24b88ee900c53bfe04e089ffd7ea08d | 2,008 | [
434371960
] | [] | input = File.stream!("day9/input.txt")
defmodule Input do
def parse(raw) do
raw
|> Stream.map(fn line ->
line
|> String.trim()
|> String.to_charlist()
|> Enum.map(&(&1 - 48))
end)
end
end
defmodule Grid do
defp to_indexed_map(list) do
list
|> Enum.with_index()
|> ... |
06eb3f15f477629fd82b1c286f89537a35f81ef1 | 14,275 | [
694781452,
574493719,
801567260,
612444079
] | [
"typespec",
"macro",
"documented"
] | defmodule Mint.HTTP2.Frame do
@moduledoc false
import Bitwise, only: [band: 2, bor: 2]
import Record
shared_stream = [:stream_id, {:flags, 0x00}]
shared_conn = [stream_id: 0, flags: 0x00]
defrecord :data, shared_stream ++ [:data, :padding]
defrecord :headers, shared_stream ++ [:exclusive?, :stream_depe... |
06eb6999293b673f002d2044ae992abe3b76409b | 1,994 | [
934834367
] | [
"liveview",
"phoenix"
] | defmodule MikeWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :mike
plug CORSPlug
socket "/stripe_socket", MikeWeb.StripeSocket
socket "/todos_socket", MikeWeb.TodosSocket
socket "/chat_socket", MikeWeb.ChatSocket
socket "/comments_socket", MikeWeb.CommentsSocket
socket "/fibo_socket", MikeWeb.Fibo... |
06ec2d3da9a6a4205a2ad8b5c2f1a56a606f0f74 | 1,816 | [
793527045
] | [] | defmodule Genetic do
def run(problem, opts \\ []) do
population = initialize(&problem.genotype/0, opts)
population
|> evolve(problem, 0, opts)
end
def initialize(genotype, opts \\ []) do
population_size = Keyword.get(opts, :population_size, 100)
for _ <- 1..population_size, do: genotype.()
... |
06ec61eb04c8e180a261e9025c7c477923ec9142 | 2,236 | [
455872535
] | [
"typespec",
"documented"
] | defmodule BlockScoutWeb.CurrencyHelpers do
@moduledoc """
Helper functions for interacting with `t:BlockScoutWeb.ExchangeRates.USD.t/0` values.
"""
alias BlockScoutWeb.CldrHelper.Number
@doc """
Formats the given integer value to a currency format.
## Examples
iex> BlockScoutWeb.CurrencyHelpers.... |
06ec695257321f0290cdaf5b75376f61bedabc12 | 3,480 | [
933544425
] | [
"phoenix"
] | defmodule TbjToPocketWeb.Controller do
use TbjToPocketWeb, :controller
require Logger
def healthz(conn, _), do: send_resp(conn, 200, "ok")
def show(conn, %{"id" => id}) do
case Cachex.get(:articles, id) do
{:ok, nil} ->
send_resp(conn, 404, "not found")
{:ok, article} ->
conn
... |
06ec7a572175d7746534f7fc55a3052c53bff7c9 | 3,641 | [
356803513
] | [
"genserver"
] | defmodule RestaurantWeb.Channels.BonCommandes do
use RestaurantWeb, :channel
alias Restaurant.System.{KitchenPrint, RestoBarPrint, MainBarPrint}
def join("bon_cmd:" <> dpt_name, _params, socket) do
send(self(), {:fetch_pending, dpt_name, false})
{:ok, %{joined: true}, socket}
end
def handle_in("fetc... |
06ec8dcc193e479de25fd20e1580f7a8e8cd5333 | 3,892 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.ServiceManagement.V1.Model.AuthProvider do
@moduledoc """
Configuration for an authentication provider, including support for [JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
## Attributes
* `audiences` (*type:* `String.t`, *default:* `nil`) - The l... |
06ec92438ba2f325ffc18c1447dc8e3213b5f8da | 1,516 | [
246166163
] | [] | defmodule PNGtoGB do
def doit(filename) do
File.read!(filename)
|> decodeit()
|> extractit()
end
def decodeit(bin, acc \\ [])
def decodeit(<<137,80,78,71,13,10,26,10, rest::binary>>, acc), do: decodeit(rest, acc)
def decodeit(<<length::32, type::binary-4, data::binary-size(length), crc::32, rest:... |
06ec9ab5e06debdd5bd3871c478020f1e1a1f117 | 4,140 | [
112957138
] | [] | # {[{Name,City,Country}],[{Rating,Birth,Name+Surname,Team}]}
defmodule Console do
def start do
{:ok, pid} = Team_Player.start_link
process("0",pid)
end
def process(num,pid) when num == "0" do
num = IO.gets "Please, enter desired option:\n 1. Add entry\n 2.Update entry\n 3.Delete entry\n 4.Show best players\n 5... |
06eca64356e35e8a28a10a9fcb327478f6245adb | 2,707 | [
681643379
] | [
"liveview",
"ecto"
] | defmodule BetwiseWeb.SportsLive.Selections.FormComponent do
use BetwiseWeb, :live_component
alias Betwise.Selections
alias Betwise.BetTypes
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Add Selection record.</:subtitle>
</.header>
... |
06eca89324c5a6068caa710df8a1c674ea1aa419 | 11,941 | [
533537020,
121001913
] | [
"documented"
] | defmodule AdminAppWeb.InputHelpers do
@moduledoc """
Form helpers to generate form elements like input, checkbox, select(with select2)
"""
use Phoenix.HTML
alias AdminAppWeb.ErrorHelpers, as: EH
alias Phoenix.HTML.Form
def input(form, field, name \\ nil, opts \\ []) do
validate_required =
form
... |
06ecd582b50105836eaa7d3ece2e1c734166ecf3 | 4,334 | [
400166738
] | [
"liveview",
"ecto"
] | defmodule BudgetTrackingToolWeb.TransactionLive.FormComponent do
use BudgetTrackingToolWeb, :live_component
alias BudgetTrackingTool.Transactions
alias BudgetTrackingTool.Payees
@impl true
def update(%{transaction: transaction} = assigns, socket) do
changeset = Transactions.change_transaction(transactio... |
06ed52578ea9152345667e3903db7a236bb1a827 | 14,075 | [
681691163
] | [
"liveview",
"documented"
] | defmodule PortfolioWeb.CustomComponents do
use Phoenix.Component
use PetalComponents
attr :image_src, :string, required: true
attr :logo_cloud_title, :string, default: nil
attr :max_width, :string, default: "lg", values: ["sm", "md", "lg", "xl", "full"]
slot :title
slot :description
slot :about_me_1
... |
06ee46ab83be0792c373f0fb837a66d49f05584d | 2,554 | [
333314863,
38776906
] | [] | defmodule MyEnum do
def all?([], _fun), do: true
def all?([head | tail], fun) do
if fun.(head), do: all?(tail, fun), else: false
end
def each([], _fun), do: :ok
def each([head | tail], fun) do
fun.(head)
each(tail, fun)
end
def filter([], _fun), do: []
def filter([head | tail], fun) do
... |
06ee4d3ce7e86adfe2ae5fab58b39b50fb8ad367 | 1,572 | [
514656080
] | [
"supervisor"
] | defmodule PiJuice.Adapter.VirtualBoard do
@behaviour PiJuice.Adapter
use Supervisor
alias PiJuice.Adapter.VirtualBoard
defstruct [:name]
def start_link(opts) do
name = Keyword.get(opts, :name) || raise ArgumentError, "A name must be supplied"
# todo: maybe remove it if not needed
board_name = ... |
06ee5b3d2498739189d2b4e52e704d3ad7516026 | 2,378 | [
70303017
] | [
"test"
] | defmodule PhxDiffWeb.ParamsTest do
use ExUnit.Case, async: true
import PhxDiff.TestSupport.Sigils
alias PhxDiff.AppSpecification
alias PhxDiffWeb.DiffSpecification
alias PhxDiffWeb.Params
describe "app specs" do
test "encoding an app spec with no params" do
app_spec = AppSpecification.new(~V|1.... |
06eeecb08cb4e35405790d76e929968ec3d22095 | 7,613 | [
638863870
] | [
"test",
"ecto"
] | defmodule Bright.DraftSkillUnitsTest do
use Bright.DataCase
alias Bright.DraftSkillUnits
describe "draft_skill_units" do
alias Bright.DraftSkillUnits.DraftSkillUnit
@invalid_attrs params_for(:draft_skill_unit) |> Map.put(:name, nil)
test "list_draft_skill_units/0 returns all draft_skill_units" do
... |
06ef444ccfe438781805fd529cbfa4df923f5002 | 2,301 | [
845949431
] | [
"phoenix",
"ecto"
] | defmodule BaselinePhoenixWeb.Admin.FacilityController do
use BaselinePhoenixWeb, :controller
alias BaselinePhoenix.Facility
def index(conn, params) do
params =
params
|> Map.put("page_size", 20)
|> Map.drop(["limit"])
case Facility.list_facility(params) do
{:ok, {facilities, met... |
06ef629021ca519d000130d6c6289ef1adc15324 | 7,221 | [
492752264,
327711808,
554455380
] | [
"test"
] | defmodule Livebook.Runtime.Evaluator.IOProxyTest do
use ExUnit.Case, async: true
import Livebook.TestHelpers
alias Livebook.Runtime.Evaluator
alias Livebook.Runtime.Evaluator.IOProxy
setup do
{:ok, object_tracker} = start_supervised(Evaluator.ObjectTracker)
{:ok, client_tracker} = start_supervised(... |
06eff0ffc47ef6e72a1548ea0cc80484730fb074 | 1,507 | [
841546488
] | [
"liveview",
"phoenix"
] | defmodule LatodoApiWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :latodo_api
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.
@session_options [
store: :cookie,
key: "_lato... |
06f0fa218b4be68f39c334aa2a99613b40e384b0 | 2,902 | [
753878101
] | [
"genserver",
"typespec",
"documented"
] | defmodule TwitchChat.OAuth.AuthCodeHandler do
@moduledoc """
This module is responsible for handling the OAuth2 authorization code flow.
"""
use GenServer
defmodule AuthCodePlug do
@moduledoc """
This module is a plug to handle Twitch auth code response
"""
import Plug.Conn
alias Plug.C... |
06f1762dc7b6406100b1ac8c7d4f9152990c1c7e | 5,249 | [
510909785
] | [
"typespec",
"documented"
] | defmodule Zendesk.Client do
@moduledoc """
Make requests to the API.
The requests are made using `Zendesk.Client.Operation`s.
"""
alias Zendesk.Client.{Operation, Result}
@doc """
Call the API with the given `Zendesk.Client.Operation`.
"""
@spec request(Operation.t()) :: Parser.parsed_result()
de... |
06f2454c3326afe43296490b676f0ac6856f0a58 | 2,584 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.CloudResourceManager.V2.Model.Expr do
@moduledoc """
Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary si... |
06f2b1a990c58bd3ff2b8513b771f02c4185de33 | 2,170 | [
427995576
] | [
"documented",
"phoenix"
] | defmodule Epgproxy.PromEx do
@moduledoc """
Be sure to add the following to finish setting up PromEx:
1. Update your configuration (config.exs, dev.exs, prod.exs, releases.exs, etc) to
configure the necessary bit of PromEx. Be sure to check out `PromEx.Config` for
more details regarding configuring Pro... |
06f2c02af7d5fdaa75ae84b97aa4bc841a256af4 | 3,080 | [
423818339
] | [
"test",
"phoenix"
] | defmodule InventoryWeb.CompanyControllerTest do
use InventoryWeb.ConnCase
import Inventory.WarehousingFixtures
alias Inventory.Warehousing.Company
@create_attrs %{
name: "some name"
}
@update_attrs %{
name: "some updated name"
}
@invalid_attrs %{name: nil, tenant_id: nil}
setup %{conn: con... |
06f2ce97456de8aebba3d13948854dcecc6b9fe7 | 3,258 | [
166092965
] | [
"test"
] | defmodule ApiWeb.AlertViewTest do
use ApiWeb.ConnCase
import ApiWeb.AlertView
import ApiWeb.ApiControllerHelpers, only: [split_include: 2]
@alert %Model.Alert{
id: "id",
effect: "effect",
cause: "cause",
url: "url",
header: "header",
short_header: "short header",
banner: "banner",
... |
06f30b6c1dd5e25f2bd7f0ca0618cf5e5977e12a | 2,212 | [
163681649
] | [] | defmodule PersistentList.Day13 do
alias PersistentList.Day13, as: List
defstruct [:head, :tail]
defimpl String.Chars, for: List do
def to_string(list), do: "[" <> stringify(list) <> "]"
defp stringify(%List{head: nil, tail: nil}), do: ""
defp stringify(
%List{
head: head,
... |
06f3307ccf2ddcb727914aec2c12183b90cc35e7 | 3,288 | [
765952288
] | [] | defmodule Fortune.Streamer do
use WebSockex
alias Fortune.{Parser, Streams}
alias Phoenix.PubSub
require Logger
@stream_endpoint "wss://stream.binance.com:9443/ws/"
@trades_topic "trades"
@klines_topic "klines"
def start_link([symbol]) do
symbol = String.downcase(symbol)
Logger.info("Start... |
06f428a3d6849279da7ef816c6f7d8c9f92725e4 | 2,215 | [
253357949
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule DohTrackerWeb 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 DohTrackerWeb, :controller
use DohTrackerWeb, :view
The definitions below will be executed for every view,
con... |
06f4cfe803035b0ddc8feaeda8962994d7b7c219 | 10,415 | [
193244709
] | [
"typespec",
"documented"
] | defmodule GoogleApi.PubSub.V1.Model.Subscription do
@moduledoc """
A subscription resource. If none of `push_config`, `bigquery_config`, or `cloud_storage_config` is set, then the subscriber will pull and ack messages using API methods. At most one of these fields may be set.
## Attributes
* `ackDeadlineSec... |
06f4fb62f8c6597efd75dc75848941c2bcf6af29 | 5,820 | [
856949149
] | [
"liveview",
"documented"
] | defmodule ProjWeb.AddFriendLive do
use ProjWeb, :live_view
alias Proj.Friends
alias Proj.Accounts
def render(assigns) do
~H"""
<div class="relative flex flex-col">
<nav class="flex min-w-[240px] flex-col gap-1 p-1.5">
<%!-- Search bar --%>
<div class="flex flex-col w-full px-4 py... |
06f5312d38c11a51459cb9ea318dfb8a1f279f53 | 3,436 | [
107670943,
741029361
] | [
"macro",
"documented"
] | defmodule GitGud.DataFactory do
@moduledoc """
This module provides functions to generate all kind of test data.
"""
alias GitGud.User
import Faker.Person, only: [name: 0]
import Faker.Company, only: [catch_phrase: 0]
import Faker.Internet, only: [user_name: 0]
import Faker.Lorem, only: [sentence: 1, ... |
06f6b3fdfa9b0ea165fc7f035d8348f0e65f1d95 | 2,584 | [
946480145
] | [
"documented"
] | defmodule Central.Config.DateTime do
@moduledoc """
Provides consistent DateTime handling and formatting across the application.
"""
@doc """
The timezone used throughout the application.
"""
def timezone, do: "Etc/UTC"
@doc """
Formats a DateTime for display in a consistent format (dd/mm/yyyy HH:MM... |
06f70b9e19c2c2e646de4c0c8ca3af599b0f19be | 1,625 | [
62950188
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule MyChatEx.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use MyChatEx.Web, :controller
use MyChatEx.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them ... |
06f72742965b620ad18504fbdc48d5b884555f42 | 6,376 | [
564784728
] | [
"typespec",
"documented"
] | defmodule ExRabbitMQAdmin.Vhost do
@moduledoc """
This module contains functions for interacting with RabbitMQ virtual hosts.
"""
import ExRabbitMQAdmin.Options,
only: [
pagination_definition: 0,
put_vhost_definition: 0,
put_vhost_permissions: 0,
format_error: 1
]
@api_namespa... |
06f7c539b2671192a2c25609e9c39ee186a13823 | 3,528 | [
317810849
] | [
"genserver",
"liveview",
"ecto"
] | defmodule ExcyteWeb.Property.Gallery do
alias Excyte.Properties.Property
use ExcyteWeb, :live_view
use ViewportHelpers
alias Excyte.{
Assets,
Properties
}
alias ExcyteWeb.{Helpers.SimpleS3Upload, Property.FC, PropertyView}
@impl true
def render(assigns), do: PropertyView.render("gallery.html"... |
06f804f6d3fec5f878437e840db6a9e94404c545 | 10,953 | [
91157211
] | [
"macro"
] | defmodule Credo.Check.Warning.UnusedFunctionReturnHelper do
@def_ops [:def, :defp, :defmacro]
@block_ops [:if, :unless, :case, :quote, :try, :after, :rescue]
alias Credo.Check.CodeHelper
alias Credo.SourceFile
def find_unused_calls(%SourceFile{ast: ast} = source_file, _params, required_mod_list, restrict_fu... |
06f82b0e52d492ce7daa86d15f978ad94b4eb731 | 2,583 | [
665653661
] | [
"documented"
] | defmodule LangChain.TextSplitter do
@moduledoc false
defp join_docs(docs, separator) do
text =
docs
|> Enum.join(separator)
|> String.trim()
if text != "", do: text
end
defp merge_split_helper(d, acc, text_splitter, separator) do
separator_len = text_splitter.tokenizer.(separato... |
06f849b1e1b36a67bf9c6a8f218950d0af17f8ca | 5,735 | [
129004779
] | [
"typespec"
] | defmodule JSONRPC2.Response.Receipt do
alias Blockchain.Transaction
alias Blockchain.Account.Address
alias Blockchain.Block
alias Blockchain.Transaction
alias Blockchain.Transaction.Receipt
alias Blockchain.Transaction.Signature
alias JSONRPC2.Response.Receipt.ByzantiumReceipt
alias JSONRPC2.Response.R... |
06f8500ebe6151a738c490c7dd688c8aa71c6725 | 1,725 | [
418515784
] | [
"typespec",
"macro",
"documented"
] | defmodule Gradient.TypedServer.CompileHooks do
@moduledoc false
defmacro __before_compile__(env) do
response_types = Module.get_attribute(env.module, :response_types)
# IO.inspect(response_types, label: "response types")
for {request_tag, response_type} <- response_types do
name = Macro.escape(:"... |
06f8af1e4bfadc338dbf9e8da6205eb6e72ddd53 | 1,526 | [
75415851
] | [
"test"
] | defmodule AOCRunnerTest do
use ExUnit.Case
alias AOC.{Velocity,Parser,Point,Runner}
test "initial config works after 1 run" do
[a, b, c, d] = Runner.run_for(simple_state(), 1)
assert(a == {%Point{x: 2, y: -1, z: 1}, %Velocity{vx: 3, vy: -1, vz: -1}})
end
test "initial config works after 10 runs" do
... |
06f8d83e7e274d38c8c904068ca4899d316aae67 | 7,626 | [
764901590
] | [
"documented",
"ecto"
] | defmodule Signbank.Dictionary.Phonology do
@moduledoc """
The phonology of a sign, actually stored as JSON in the database
"""
use Ecto.Schema
import Ecto.Changeset
@palm_orientations [
:towards,
:left,
:away,
:up,
:down,
:right
]
@finger_hand_orientations [
:up_left,
:u... |
06f8e70a4ae16042813dd4427194edb6f86b0f70 | 2,373 | [
930226856
] | [
"documented",
"ecto"
] | defmodule LiveViewStudio.Servers do
@moduledoc """
The Servers context.
"""
import Ecto.Query, warn: false
alias LiveViewStudio.Repo
alias LiveViewStudio.Servers.Server
def subscribe do
Phoenix.PubSub.subscribe(LiveViewStudio.PubSub, "servers")
end
# def broadcast(message) do
# Phoenix.Pub... |
06fa16c9f83eb033034ddd402847c8623c43cb76 | 2,112 | [
125938964
] | [
"phoenix",
"documented"
] | defmodule Accent.FormatController do
use Phoenix.Controller
import Canary.Plugs
alias Accent.Translation
plug(Plug.Assign, %{canary_action: :format})
plug(:load_resource, model: Accent.Project, id_name: "project_id")
plug(Accent.Plugs.MovementContextParser)
plug(:fetch_entries)
plug(:fetch_formatted_... |
06fa176909260100a88af4769a04302ccf3e21b5 | 2,767 | [
303286820
] | [
"typespec",
"documented",
"ecto"
] | defmodule Lifty.Organizations do
@moduledoc """
The Organizations context.
"""
import Ecto.Query, warn: false
alias Lifty.Repo
alias Lifty.Organizations.Organization
@doc """
Returns the list of organizations.
## Examples
iex> list_organizations()
[%Organization{}, ...]
"""
def l... |
06fa2366db955e9386b21916085a12463a0ff9de | 5,180 | [
248719329
] | [
"macro",
"typespec",
"test",
"documented"
] | defmodule ExUnited.Case do
@moduledoc """
This module makes it possible to seemlessly execute assertions and refutations
within spawned nodes.
You can setup your test module by either using `ExUnited.Case` instead of
`ExUnit.Case`:
defmodule MyNodesTest do
use ExUnited.Case
end
Or by ... |
06fa3a8b6d5e656cc19ab18996dee9d47f8a5a2e | 11,409 | [
459149506
] | [
"documented",
"ecto"
] | defmodule Aerotransit.Knowledge do
@moduledoc """
The Knowledge context.
"""
import Ecto.Query, warn: false
alias Aerotransit.Repo
def data() do
Dataloader.Ecto.new(Repo, query: &query/2)
end
def query(queryable, _params) do
queryable
end
alias Aerotransit.Knowledge.Country
@doc """
... |
06fa6d751823f43f62b1f1072f18e7f45794ac6d | 7,903 | [
213407521
] | [
"test"
] | defmodule AshPostgres.BulkUpdateTest do
use AshPostgres.RepoCase, async: false
alias AshPostgres.Test.{CSV, Post, Record}
require Ash.Expr
require Ash.Query
test "bulk updates can run with nothing in the table" do
Ash.bulk_update!(Post, :update, %{title: "new_title"})
end
test "bulk updates update ... |
06fa75f4f4fdf80708513d346519206f25110208 | 1,829 | [
856619666
] | [
"documented"
] | defmodule Conga.S3Upload do
@moduledoc """
Below is code from Chris McCord, modified for Cloudflare R2
https://gist.github.com/chrismccord/37862f1f8b1f5148644b75d20d1cb073
"""
@one_hour_seconds 3600
@doc """
Returns `{:ok, presigned_url}` where `presigned_url` is a url string
"""
def presigned_p... |
06fa795a8aae8bb3b08ac1f78098fda39040743a | 3,133 | [
482555587
] | [
"typespec",
"documented",
"ecto"
] | defmodule ExOAPI.Stripe.Schemas.ApiErrors do
use TypedEctoSchema
import Ecto.Changeset
@type params :: map()
@moduledoc """
**:charge** :: *ExOAPI.Stripe.Schemas.Charge*
For card errors, the ID of the failed charge.
**:code** :: *:string*
For some errors that could be handled programmatically, a s... |
06faad88e0510af8cc289aef699f6da59e250273 | 1,749 | [
992721621
] | [
"typespec",
"documented"
] | defmodule ExStreamClient.Model.Flag do
@moduledoc "Schema representing a Flag"
use ExStreamClient.JSON
use ExStreamClient.TypeInterner
@enforce_keys [:created_at, :entity_id, :entity_type, :result, :updated_at]
defstruct [
:created_at,
:custom,
:entity_creator_id,
:entity_id,
:entity_type,... |
06fb5704c9bd7b8cdd0801bcf90ba871c96d3eee | 11,462 | [
912478357
] | [
"liveview"
] | defmodule LightsOutWeb.Theme2 do
use Phoenix.LiveView
def render(assigns) do
~H"""
<head>
<style>
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Symbols+2&display=swap");
@import url("https://fonts.googleapis.com/css?family=Montserrat:400,700");
@import url("https://font... |
06fbd1c7643b9a919ac00efcca57491d170306fa | 2,944 | [
206297200
] | [
"typespec",
"documented"
] | defmodule Google.Ads.Googleads.V4.Errors.BiddingErrorEnum.BiddingError do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t ::
integer
| :UNSPECIFIED
| :UNKNOWN
| :BIDDING_STRATEGY_TRANSITION_NOT_ALLOWED
| :CANNOT_ATTACH_BIDDING_STRATEGY_TO_CAMPA... |
06fc5969dafcd4cf12864a076bda1d38c95494ed | 2,868 | [
214516903
] | [
"test"
] | defmodule ArnTest do
use ExUnit.Case
alias Sequins.Utils.Arn
doctest Sequins.Utils.Arn
@arn "arn:aws:s3:us-east-1:123456789012:abcdefg/hijkl"
describe "arns" do
test "parses an ARN" do
arn = Arn.parse(@arn)
assert(arn.scheme == "arn")
assert(arn.partition == "aws")
assert(arn.s... |
06fca2d1e8e329c83b1a8510ebb1b023bd1fcc4b | 7,684 | [
483460745
] | [
"test",
"documented"
] | defmodule EntityTest do
@moduledoc """
Test the creation of MLIR entities including attributes, types and locations.
"""
use Beaver.Case, async: true
alias Beaver.MLIR
alias MLIR.{Type, Attribute}
import Beaver.Sigils
doctest Beaver
doctest Beaver.Sigils
doctest Beaver.MLIR.Type
doctest Beaver.MLI... |
06fd0a2dd427012f3500ceb4ebc80cb8d740bd17 | 13,830 | [
497769481,
575873463,
482720652,
569522840
] | [
"documented"
] | # This module is the one responsible for converging
# dependencies in a recursive fashion. This
# module and its functions are private to Mix.
defmodule Mix.Dep.Converger do
@moduledoc false
@doc """
Topologically sorts the given dependencies.
"""
def topological_sort(deps) do
graph = :digraph.new()
... |
06fd11c576f728940e62bdf7742ff208e8565350 | 4,135 | [
941609941
] | [
"liveview"
] | defmodule DukkadeeWeb.StoreLive.ListLive do
use DukkadeeWeb, :live_view
alias Dukkadee.Stores
@impl true
def mount(_params, _session, socket) do
stores = Stores.list_stores()
{:ok,
socket
|> assign(:page_title, "Available Stores")
|> assign(:stores, stores)
}
end
... |
06fd14cdee4ddda37bf97cceb3766cd9e8e23f79 | 1,728 | [
988634206
] | [
"documented"
] | defmodule NBA.Stats.CommonTeamYears do
@moduledoc """
Fetches the years a team has played in the NBA.
"""
@moduledoc since: "0.1.0"
require NBA.Utils
NBA.Utils.def_get_bang(__MODULE__)
@endpoint "commonteamyears"
@accepted_types %{
LeagueID: [:string]
}
@default [LeagueID: "00"]
@doc """... |
06fd6cc370a65178a7e0f141751cb3fe957767e0 | 4,239 | [
726063986
] | [
"test",
"ecto"
] | defmodule SWAPI.PeopleTest do
use SWAPI.DataCase
alias SWAPI.People
describe "people" do
alias SWAPI.Schemas.Person
import SWAPI.PeopleFixtures
@invalid_attrs %{
name: nil,
birth_year: nil,
eye_color: nil,
gender: nil,
hair_color: nil,
height: nil,
mass: n... |
06fd8c101efcb4d10220dac95837b5234d803469 | 4,545 | [
180895284
] | [
"test"
] | defmodule FunctionExpressionTest do
import Toothpick.Parser.Expression, only: [expression: 1]
use ExUnit.Case
doctest Toothpick.Parser.Expression
test "corectly parses integer" do
{tree, _} = expression(integer: 1)
assert(tree == {:integer, 1})
end
test "corectly parses variable" do
{tree, _... |
06fdcdcaa1514a4cd26731df405e5364f969464d | 1,909 | [
362258800
] | [
"test"
] | defmodule I2cServerTest do
use ExUnit.Case
doctest I2cServer
# https://hexdocs.pm/mox/Mox.html
import Mox
# Any process can consume mocks and stubs defined in your tests.
setup :set_mox_from_context
# Make sure mocks are verified when the test exits
setup :verify_on_exit!
setup do
Mox.stub_wit... |
06fe0d19b0bb5a585f378c4e2e8987e1fe17640c | 3,561 | [
278622480
] | [
"liveview",
"documented"
] | defmodule Apps.TrelloClone.Web.Live.Todo.Components.ItemModal do
@moduledoc """
Show a modal for a single item
"""
use Phoenix.LiveComponent
alias Apps.TrelloClone.Contexts.Todo
@impl true
def render(assigns) do
~L"""
<div id="<%= @id %>" class="z-10 inset-0 overflow-y-auto"
:class="... |
06fe2bb8f63c280ef062cb79bfba7ac565a0d057 | 2,247 | [
162184550
] | [
"typespec",
"documented"
] | defmodule UBootEnv do
@moduledoc """
UBootEnv reads and writes U-Boot environment blocks
It's like the commandline tools `fw_setenv` and `fw_printenv` except in pure
Elixir. It also uses `/etc/fw_env.config` by default to figure out where the
environment exists so that you need not store the configuration in... |
06fe3d0b9e9d7ec97d2c793aef05173d76e1d7e3 | 1,719 | [
131777403
] | [
"liveview"
] | defmodule LiveViewStudioWeb.LightLive do
use LiveViewStudioWeb, :live_view
@impl true
def mount(_params, _session, socket) do
socket = assign(socket, :brightness, 60)
{:ok, socket}
end
@impl true
def render(assigns) do
~L"""
<h1>Front Porch Light</h1>
<div id="light">
<div class=... |
06feb1a4d6f3beff09c017cd58bf62c40afb9d88 | 1,671 | [
972597900
] | [
"phoenix"
] | defmodule UptimerWeb.UserSessionController do
use UptimerWeb, :controller
alias Uptimer.Accounts
alias UptimerWeb.UserAuth
def create(conn, %{"_action" => "registered"} = params) do
create(conn, params, "Account created successfully!")
end
def create(conn, %{"_action" => "password_updated"} = params)... |
06ff791d828d73128874ccb3e7d523400b6f9b0d | 3,534 | [
120321295
] | [
"test",
"ecto"
] | defmodule Igwet.AdminTest do
use Igwet.DataCase
doctest Igwet.Admin
alias Igwet.Admin
describe "users" do
alias Igwet.Admin.User
@valid_attrs %{
authid: "some authid",
avatar: "some avatar",
last_login: ~N[2010-04-17 14:00:00],
name: "some name",
email: "<EMAIL>"
}
... |
07000ec201377a9275408e363b8ad3e818f41e51 | 1,563 | [
116126690
] | [
"documented"
] | defmodule Poker do
alias Poker.Hand
@moduledoc """
Documentation for Poker.
"""
@doc """
Determines a winner basing on the two players with the highest score
and returns either Tie if their hands are equal or string containing
the name of the winner and the reason of the win.
## Examples
i... |
07003039c03b673de276807b54e19fa70e369621 | 1,826 | [
363325626
] | [
"macro",
"documented",
"phoenix"
] | defmodule MedirepoWeb 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 MedirepoWeb, :controller
use MedirepoWeb, :view
The definitions below will be executed for every view,
controlle... |
070033272b7c31756e8dd2eab6daeffeb4cd1b74 | 2,360 | [
607668050
] | [
"genserver",
"typespec",
"documented"
] | defmodule Jelly.Guess.Timer do
@moduledoc """
Implements a timer using GenServer were receive a total time in milliseconds,
sends a message every second until the total time is 0, and implements the
possibility to restart or cancel the timer
"""
use GenServer
import Jelly.Guess.Notifier
require Logger
... |
0700980d9ab4821166ce69fe5a43db1336d29110 | 2,123 | [
222337665
] | [
"documented"
] | age = IO.gets("What is your age? ")
{age, _} = Integer.parse(age)
# message =
# cond do
# age < 18 -> "You can't vote yet"
# age < 25 -> "You can vote!"
# true -> "You can vote and you can run for office!"
# end
# case Integer.parse(age) do
# {age, _} when age < 18 -> "You can't vote yet"
# ... |
0700c097ddbf512406d3d97b48cfaafcc13422f3 | 1,667 | [
417664530,
444472658
] | [
"macro",
"test",
"documented"
] | defmodule Legendary.CoreWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build common data structures and query the data layer.
Finally... |
0700f2c9c2179efef6eef8604c649a6aa48cee51 | 6,813 | [
265725168
] | [] | %{
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"},
"cowboy": {:hex, :cowboy, "2.7.0", "91e... |
0700feead34d5fd814b2b700dc40942b1a169f63 | 2,350 | [
260066086
] | [] | defmodule XDR.MixProject do
use Mix.Project
@github_url "https://github.com/kommitters/elixir_xdr"
@version "0.3.12"
def project do
[
app: :elixir_xdr,
version: @version,
elixir: ">= 1.7.0",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
name: ... |
0701023f73c1a953eed3287a94da20df72c96c96 | 8,963 | [
174621235
] | [
"documented"
] | defmodule RubiksTimer do
@moduledoc """
Documentation for Rubiks Timer.
"""
@behaviour Ratatouille.App
import Ratatouille.View
import Ratatouille.Constants, only: [key: 1, color: 1, attribute: 1]
import RubiksTimer.{Helper, Scrambler, Stats, TextRenderer}
alias Ratatouille.Runtime.Subscription
@spa... |
07025a7fcd2eb3a5664b0411330230115b9229a5 | 6,306 | [
572959269
] | [] | defmodule Day18 do
## Day 18 - part one was ok. Instead of using the simple way of
## keeping one map of all pixels {x,y,z} I organized the map in
## three maps. One map view the scene in z-direction, another in x-
## and the third in y-direction. A map then held one map for each
## column and each column he... |
0702c71d283668ec5393b29f284772ce29624856 | 1,769 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented",
"phoenix"
] | defmodule GoogleApi.DFAReporting.V33.Model.CustomViewabilityMetricConfiguration do
@moduledoc """
The attributes, like playtime and percent onscreen, that define the Custom Viewability Metric.
## Attributes
* `audible` (*type:* `boolean()`, *default:* `nil`) - Whether the video must be audible to count an i... |
07037a62d6cd82f61b7a2df53cace84435c1b725 | 6,489 | [
870673148
] | [
"test"
] | defmodule BatchServingTest do
use ExUnit.Case
describe "inline" do
test "simple inline" do
serving = BatchServing.new(fn a -> Enum.map(a.stack, &(&1 * &1)) end)
batch = BatchServing.Batch.stack([1, 2, 3, 4])
assert [1, 4, 9, 16] == BatchServing.run(serving, batch)
end
test "pre/post-... |
0704998ad20a13b291a39be47c1afc02f0ff31c3 | 4,151 | [
1004256260
] | [
"typespec",
"liveview",
"documented"
] | defmodule CrimeToGoWeb.LocaleHelpers do
@moduledoc """
Helper functions for locale management in LiveViews.
This module provides utilities for handling internationalization across
the application, including locale detection, validation, and display helpers.
It integrates with the Plug.Locale plug to maintain... |
0704aaa70a89f43cf9d1fde75d997ea64f3d69f4 | 4,092 | [
693701365
] | [
"test",
"phoenix"
] | defmodule SimpleBankWeb.Router.Accounts.ReadTest do
use SimpleBankWeb.ConnCase, async: true
alias SimpleBank.{Account, User}
@user_params %{
"first_name" => "John",
"last_name" => "Doe",
"cpf" => "12345678900",
"birth" => "2000-01-01",
"address" => "Rua A, 123",
"cep" => "80000000"
}
... |
0704c1b00c521f3d6642d1abb86fa7f3e0831a81 | 12,116 | [
217272064
] | [
"genserver",
"typespec",
"supervisor",
"documented"
] | defmodule Stargate.Producer do
@moduledoc """
Provides a producer websocket process and functions for producing
messages to the cluster.
Pass a keyword list of configuration options to the `start_link/1`
function or simply call `produce/2` passing a valid
Pulsar producer URL in place of a producer process.... |
07058cff97f8b34f0cc28dac7642a7ae9adaf0d4 | 11,336 | [
430116849
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse... |
07059bb57e4f57a4a759b4ce0d5edef78c34358a | 3,026 | [
245118017
] | [
"test",
"ecto"
] | defmodule PlateSlateWeb.Schema.Mutation.CreateMenuItemTest do
use PlateSlateWeb.ConnCase, async: true
alias PlateSlate.{Repo, Menu}
import Ecto.Query
setup do
PlateSlate.Seeds.run()
category_id =
from(t in Menu.Category, where: t.name == "Sandwiches")
|> Repo.one!
|> Map.fetch!(:id)... |
0705a837ee4fab6ac629f158807debdf71af462f | 1,875 | [
890464157
] | [
"phoenix",
"ecto"
] | defmodule FinancialAppWeb.DespesaController do
use FinancialAppWeb, :controller
alias FinancialApp.Finance
alias FinancialApp.Finance.Despesa
def index(conn, params) do
despesas =
if Enum.empty?(params) do
Finance.list_despesas()
else
Finance.filter_despesas(params)
end
... |
0705dfad0bed9548b2faa0c7621bb80348c86ae4 | 1,647 | [
45282478
] | [
"supervisor"
] | defmodule Gatekeeper.Application do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
doorlock_config = Application.get_env(:gatekeeper, :doorlock)
doorbell_conf... |
0705e7f4220536e745c040d79906e0ea7e58aea5 | 3,966 | [
898602190
] | [] | defmodule Day24 do
import Bitwise
def parse(file) do
text = File.read!(Path.join(Path.dirname(__ENV__.file), file))
[initial, gates] = text |> String.split("\n\n")
initial =
initial
|> String.split("\n")
|> Enum.map(fn line ->
[wire, value] = line |> String.split(": ")
... |
0705ed9aa4c9cb870d583f9273f1d662cd04e72e | 3,415 | [
184431703
] | [] | defmodule Koala.Wallet.Account do
alias Koala.Wallet.Account, as: Account
alias Koala.Nano.Tools, as: Tools
alias Koala.Wallet.Data.Blocks, as: Blocks
alias Koala.Wallet.Data, as: Data
require Logger
use Agent
## feed in wallet name as an Atom
def start(wallet_name, account_info) do
name = {:via, Re... |
0705f496a224cbfdb46b9f0e24a363ec3665d544 | 1,841 | [
131137648
] | [
"test",
"ecto"
] | defmodule TodoServer.PaloTest do
use TodoServer.DataCase
alias TodoServer.Palo
describe "todos" do
alias TodoServer.Palo.Todo
@valid_attrs %{text: "some text"}
@update_attrs %{text: "some updated text"}
@invalid_attrs %{text: nil}
def todo_fixture(attrs \\ %{}) do
{:ok, todo} =
... |
0705f82ad47a459b88d7236cf1aa0be1c09736dc | 17,245 | [
651977372,
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.YouTube.V3.Api.ChannelSections do
@moduledoc """
API calls for all endpoints tagged `ChannelSections`.
"""
alias GoogleApi.YouTube.V3.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@doc """
Deletes a resource.
... |
0706ebcdd00e93925e2efb795f7756fee4f977de | 4,863 | [
819789392
] | [
"test"
] | defmodule Exa.Color.Col3fTest do
use ExUnit.Case
import Exa.Color.Col3f
alias Exa.Color.ColorSpace
alias Exa.Color.Col1b
alias Exa.Color.Col3b
alias Exa.Color.Col3name
test "simple" do
assert {1.0, 1.0, 1.0} == white()
assert {1.0, 1.0, 1.0} == new("white")
assert {1.0, 0.0, 0.0} == red()
... |
0706ed50de6669594a9927e0644f2da873a4b1db | 4,951 | [
48190064
] | [
"test"
] | import Evolvr.Maths
import Evolvr.Data
defmodule MathsTest do
use ExUnit.Case, async: true
doctest Evolvr.Maths
### basic tests ###
import :math
test "should return integer sum" do
assert sum([1,2,3]) == 6
end
test "should return float sum" do
assert Float.round(sum([1.1,2.2,3]),1) == 6.3
en... |
0707469c5987b382de83f1c9ca9687e5e42db8b3 | 2,529 | [
972810178,
390166925
] | [
"test"
] | defmodule Game.Session.EffectsTest do
use ExVenture.SessionCase
import Test.DamageTypesHelper
alias Game.Character
alias Game.Session.Effects
setup do
start_and_clear_damage_types()
insert_damage_type(%{
key: "slashing",
stat_modifier: :strength,
boost_ratio: 20,
reverse_st... |
0707d9889239ba0143297ebf971a841c34158902 | 4,757 | [
145865004
] | [
"test"
] | defmodule AwsMetricCollectorTest do
use ExUnit.Case, async: false
import Mock
alias StreamingMetrics.AwsMetricCollector, as: MetricCollector
@inbound_records "Inbound Records"
describe("count_metric") do
test "Has MetricName of 'Inbound Records'" do
%{metric_name: name} = MetricCollector.count_met... |
070830f8f38e552060f2d9a4ecb4e939f0eacb84 | 3,058 | [
411488795
] | [
"phoenix"
] | defmodule MereWeb.Router do
use MereWeb, :router
use Pow.Phoenix.Router
use PowAssent.Phoenix.Router
use Pow.Extension.Phoenix.Router,
extensions: [PowPersistentSession]
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {MereWe... |
070839b2dd11f3cba5564aa09f881aeca0d8406c | 1,646 | [
247674923
] | [
"macro",
"documented",
"phoenix"
] | defmodule CronjobAsAServiceWeb 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 CronjobAsAServiceWeb, :controller
use CronjobAsAServiceWeb, :view
The definitions below will be executed ... |
0708acb1ed065b570334fea5bc3416f21d576b3d | 2,778 | [
256866257
] | [
"typespec"
] | defmodule ApiGateway.ClubsService do
alias ApiGateway.Contracts
alias ApiGateway.Contracts.ClubsService
@behaviour ClubsService
@spec list() ::
{:ok, [map()]}
| {:error, Contracts.error()}
def list() do
{:error, %{reason: "NotImplemented"}}
end
@spec get(id :: String.t()) ::
... |
0708e8329aeb5aea238755ca868fe1844b1675fb | 3,818 | [
194030369
] | [
"typespec",
"documented"
] | defmodule Coinpeer.Base58 do
# copy from `Bitcoin.Base58Check` module in comboy/bitcoin-elixir
# Base58 alphabet, without 0,O,l,I
@code '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
@code_0 @code |> List.first
# optimization to avoid browsing code list each time, with this we have O(1)
@num... |
0708f35ec69853a882c83e2099c5de2c35e7abcc | 10,063 | [
50982997
] | [
"liveview",
"supervisor",
"documented",
"phoenix"
] | #!/usr/bin/env elixir
{:ok, handler_config} = :logger.get_handler_config(:default)
handler_config =
handler_config
|> put_in([:config, :type], :standard_error)
|> put_in([:formatter], Logger.Formatter.new(format: "$message\n"))
:ok = :logger.remove_handler(:default)
:ok = :logger.add_handler(:default, :logger_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.