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 |
|---|---|---|---|---|
019ea5d0d1f24646d270c207dcd0cf9ed7e860db | 1,649 | [
882389691
] | [
"liveview",
"phoenix"
] | defmodule ReviveSchedulerWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :revive_scheduler
# 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,
... |
019ea683e7db614a7a67e19ed8cf1864917a0c17 | 3,324 | [
624901343
] | [
"typespec",
"documented"
] | defmodule Identicon do
use TypeCheck
@moduledoc """
Provides methods for generating and saving an `Identicon` similar to the github one.
"""
@doc """
Returns the final image when used
"""
@spec! main(String.t()) :: :ok
def main(input) do
input
|> hash_input
|> pick_color
|> build_gri... |
019f30ce8157e69d26b8517f15144da56adf05e9 | 1,858 | [
75985206
] | [
"test"
] | defmodule Noizu.RuleEngine.Operation.SwitchOperationTest do
alias Noizu.RuleEngine.Op.SwitchOp
alias Noizu.RuleEngine.Op.ValueOp
alias Noizu.RuleEngine.State.InlineStateManager
use ExUnit.Case
@fixture %InlineStateManager{global_state: %{a: 1}, entity_state: %{entity_module: %{b: 2}}} |> put_in([Access.key(:... |
019f78644616559d3c7f01d63cc7888e3bad5ed9 | 2,654 | [
233431593
] | [
"typespec",
"documented"
] | defmodule PromEx.MetricTypes.Polling do
@moduledoc """
This struct defines the fields necessary to export a group
of pollable metric sources from a plugin.
"""
require Logger
@typedoc """
- `group_name`: A unique identifier for the collection of metrics.
- `measurements_mfa`: An MFA tuple that defines... |
019f8ce0fbc4948641347d2809743cf846603720 | 3,055 | [
992359468
] | [
"documented"
] | defmodule CompoundFile.Debug do
@moduledoc """
Debugging utilities for the Compound File structure.
Used while developing and testing the library, but kept in case you'd like to inspect the
internals of a compound file.
"""
alias CompoundFile.Reader
def print_header(bin) do
header = Reader.parse_he... |
019ff45ee751a86af25ff4e279dcaa05200241fc | 1,776 | [
550300469
] | [
"test",
"ecto"
] | defmodule AuctionTest do
import Ecto.Query
use ExUnit.Case
alias Auction.{Item, Repo}
doctest Auction, import: true
setup do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo)
end
describe "list_items/0" do
setup do
# You can have an additional setup block inside a describe block.
# Thi... |
01a013dc5a19dc85040583f0dc76d25f58605050 | 2,551 | [
334387837,
808443482
] | [
"test",
"documented"
] | defmodule Teiserver.Logging.Tasks.PersistServerDayTaskTest do
@moduledoc false
use Teiserver.DataCase
alias Teiserver.{Logging, Account, CacheUser}
alias Teiserver.Logging.Tasks.PersistServerDayTask
test "perform task" do
# Make some data
create_minute_data()
# Run the task
assert :ok == Per... |
01a0317761f7d33c5db1fa5762816883b1e69a2c | 9,282 | [
80831301
] | [
"test"
] | if !System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("bowling.exs", __DIR__)
end
ExUnit.start
ExUnit.configure exclude: :pending, trace: true
defmodule BowlingTest do
use ExUnit.Case
defp roll_reduce(game, rolls) do
Enum.reduce(rolls, game, fn(roll, game) -> Bowling.roll(game, roll) end)
end
... |
01a07b5ac461ec77eca9eea6f28201cc95f00e5b | 1,889 | [
541322709
] | [
"ecto"
] | defmodule RichardBurton.Repo.Migrations.ExtractOriginalBook do
use Ecto.Migration
def up do
alter table(:translated_books) do
add(:original_book_id, references(:original_books))
end
execute("""
CREATE FUNCTION _insert_original_book(tb translated_books)
RETURNS bigint
LANGUAGE plpgsql... |
01a0d5ec2a9e9bdcc3149130cacb7bd5bbd5dfd9 | 2,670 | [
392657747
] | [
"test",
"ecto"
] | defmodule Hotelverse.BookingsTest do
use Hotelverse.DataCase
alias Hotelverse.Bookings
describe "bookings" do
alias Hotelverse.Bookings.Booking
@valid_attrs %{adults: 42, checkin: ~D[2010-04-17], checkout: ~D[2010-04-17], kids: 42, property_id: 42, user_id: 42}
@update_attrs %{adults: 43, checkin: ... |
01a0e24d73cb94dcdb45499b07b7ee56ef3410db | 5,361 | [
392225877,
436553571
] | [
"test"
] | defmodule RealtimeWeb.JwtVerificationTest do
use ExUnit.Case
alias RealtimeWeb.JwtVerification
alias RealtimeWeb.Joken.CurrentTime.Mock
@jwt_secret "secret"
@alg "HS256"
setup_all do
Application.put_env(:realtime, :jwt_secret, @jwt_secret)
Application.put_env(:realtime, :jwt_claim_validators, %{}... |
01a14ecbcc57c16138eccb26df485330de475ccc | 7,810 | [
473701108,
430660917
] | [
"test"
] | defmodule HandTest do
use ExUnit.Case
doctest Hand
test "format hand as string" do
hand = [[:heart, :two], [:spade, :ace], [:club, :king], [:club, :two], [:diamond, :ten]]
assert "2H AS KC 2C TD" == Hand.format(hand)
end
test "format any number of cards" do
hand = [[:heart, :two], [:spade, :ace... |
01a1ef1559cf3d33f0098ec6b250afa0d1b51682 | 1,923 | [
107560979
] | [
"documented"
] | defmodule ZohomailApi.BodyData do
@derive [Poison.Encoder]
defstruct [toAddress: nil, subject: nil, content: nil, fromAddress: nil]
end
defmodule ZohomailApi.ZohomailResponse do
defstruct [
status: [code: nil, description: nil],
data: [subject: nil, fromAddress: nil, toAddress: nil, content: nil]
]
end... |
01a2ec2fb3cbb6a5a8de307d1e47f0948f547d7d | 2,470 | [
130749740
] | [
"test"
] | defmodule ApiWeb.AuthorControllerTest do
use ApiWeb.ConnCase
alias Api.User
alias Api.User.Author
@create_attrs %{image: "some image", name: "some name"}
@update_attrs %{image: "some updated image", name: "some updated name"}
@invalid_attrs %{image: nil, name: nil}
def fixture(:author) do
{:ok, aut... |
01a33bad707b3b1d6f89649d1af79fbd8265c027 | 3,948 | [
387525744
] | [] | %{
"bunch": {:hex, :bunch, "1.3.0", "51b4423088b7fb9e21eae6d6bc5e5d219d955ea5556fbd6130bfb6213df4be32", [:mix], [], "hexpm", "9ad233a2bacc0dae8aa6553a9b9057f27446443b1c5903c3479b6f9f3820ce2d"},
"bunch_native": {:hex, :bunch_native, "0.3.0", "a292baf340608d07bf2f2bbc7928a29648c15c90192e8f4c50b77ea16366d61c", [:mix],... |
01a343c30cb00a44eff6a49144304c85d940afbe | 2,890 | [
50987182
] | [
"macro",
"test",
"phoenix"
] | defmodule TransformChannelTest do
use Phoenix.ChannelTest
use Phoenix.ConnTest
use ExUnit.Case
use Plug.Test
import TestHelpers
alias Transform.Router
alias Phoenix.Socket.Message
@endpoint Transform.Endpoint
@opts Router.init([])
@headers [
{"Content-Type", "text/plain"}
]
defp make_sock... |
01a42e2db06e1875636bf4bbb5c47016898c5743 | 10,473 | [
357783630
] | [] | %{
"certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hexpm", "524c97b4991b3849dd5c17a631223896272c6b0af446778ba4675a1dff53bb7e"},
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mi... |
01a4c0632dfb4fa0b768ea949f53819168df16d1 | 2,418 | [
933055252
] | [
"documented"
] | defmodule Solution11 do
import Enum
@moduledoc """
Solution for Day 11 of Advent of Code.
## What are we learning?
Function caching can be useful for problems like this, but is not easy
in functional languages. In python, you can simply write your recursive
function and decorate it with the `@lur_cache... |
01a4f08ca510ec803fcbc9753d79d47a9e8485b3 | 8,882 | [
138562706,
99375517,
140890391,
139498406
] | [
"typespec",
"macro",
"supervisor",
"documented"
] | defmodule Plug.Adapters.Cowboy2 do
@moduledoc """
Adapter interface to the Cowboy2 webserver.
## Options
* `:ip` - the ip to bind the server to.
Must be either a tuple in the format `{a, b, c, d}` with each value in `0..255` for IPv4
or a tuple in the format `{a, b, c, d, e, f, g, h}` with each ... |
01a500c993b9dfdf9860b91df1c07400b9ea7afd | 2,210 | [
258530558
] | [
"test",
"ecto"
] | defmodule Waiter.DashboardTest do
use Waiter.DataCase
alias Waiter.Dashboard
describe "requests" do
alias Waiter.Dashboard.Request
@valid_attrs %{body: "some body", table: "some table"}
@update_attrs %{body: "some updated body", table: "some updated table"}
@invalid_attrs %{body: nil, table: ni... |
01a540cdbb486a26ee94a2eb7391950fbcfcd2ac | 4,230 | [
925978875
] | [
"genserver",
"documented"
] | defmodule Irchub.Chat.Irc.ConnectionBaseHandler do
@moduledoc """
IRCHub base connection handler
"""
alias Irchub.Chat.Irc.ConnectionPool
def start_link(client) do
GenServer.start_link(__MODULE__, [client])
end
def init([client]) do
ExIRC.Client.add_handler client, Kernel.self
{:ok, client}
... |
01a57612a6f2793f594939076d26e779c0a87895 | 2,412 | [
587855109
] | [
"liveview"
] | defmodule LiveViewStudioWeb.BoatsLive do
use LiveViewStudioWeb, :live_view
alias LiveViewStudio.Boats
def mount(_params, _session, socket) do
{:ok, socket, temporary_assigns: [boats: []]}
end
def handle_event("filter", %{"type" => type, "prices" => prices}, socket) do
params = %{type: type, prices:... |
01a5cf02cc14f01d660c8ab238709e44473a851c | 1,952 | [
79828701
] | [
"typespec",
"documented"
] | # Best Practice
# Adding documentation should be added within the Best practices guidelines of the language. Since Elixir is a fairly young language many standards are still to be discovered as the ecosystem grows. The community, however, tried to establish best practices. To read more about best practices see The Elix... |
01a61f45a320eb53439ff2979168d52e3edda47a | 1,619 | [
364367091
] | [
"genserver"
] | defmodule Mag.Cache do
use GenServer
# Client
def start_link(_) do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
end
def exists?(name) do
GenServer.call(__MODULE__, {:exists, name})
end
def get(name) do
if exists?(name), do: GenServer.call(__MODULE__, {:get, name}), ... |
01a62f85f6765b3439312e9a1cc9b2319b8809b7 | 6,312 | [
88605544,
182398778
] | [
"test"
] | defmodule Bitcoin.Protocol.Messages.BlockTest do
use ExUnit.Case
alias Bitcoin.Protocol.Messages.Block
alias Bitcoin.Protocol.Messages.Tx
alias Bitcoin.Protocol.Types.TxInput
alias Bitcoin.Protocol.Types.TxOutput
alias Bitcoin.Protocol.Types.Outpoint
test "block 100_000" do
# Block no 100_000 from ... |
01a66e8ff97ba9cc7cd1edc06716f7b81f5b33f7 | 5,581 | [
482555587
] | [
"typespec",
"documented",
"ecto"
] | defmodule ExOAPI.Stripe.Schemas.Invoiceitem do
use TypedEctoSchema
import Ecto.Changeset
@type params :: map()
@moduledoc """
**description**: Sometimes you want to add a charge or credit to a customer, but actually
charge or credit the customer's card only at the end of a regular billing
cycle. This is... |
01a68b1e54161a65a1c1e0e336bb88a0ade86a2e | 1,881 | [
119708367
] | [
"test",
"phoenix"
] | defmodule ReWeb.RelatedControllerTest do
use ReWeb.ConnCase
alias ReWeb.Guardian
import Re.Factory
setup %{conn: conn} do
conn = put_req_header(conn, "accept", "application/json")
admin_user = insert(:user, email: "<EMAIL>", role: "admin")
user_user = insert(:user, email: "<EMAIL>", role: "user")... |
01a6aeedbe85d180db11a32e2a56d325ee33f07c | 2,109 | [
949664843
] | [
"typespec",
"documented"
] | defmodule Raxol.UI.Components.Input.SelectList.Search do
@moduledoc """
Handles search and filtering functionality for the SelectList component.
"""
import Raxol.Guards
@type option :: {String.t(), any()}
@type options :: [option()]
@doc """
Filters options based on search text and optional searchabl... |
01a6e3ca6d355c26db1366b4096c0c9700fa66a1 | 2,805 | [
910386303
] | [] | import Config
# Configure your database
config :travel_journal, TravelJournal.Repo,
username: "sabyabhoi",
password: "sabya123",
hostname: "localhost",
database: "dateplace",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
# For development, we disable any cache and enable... |
01a6f1282a4114544d6fa235ef6a29530c47224f | 2,668 | [
297086245
] | [
"test",
"ecto"
] | defmodule Agento.Basedata.CountryContextTest do
use Agento.DataCase
alias Agento.Basedata.CountryContext
describe "countries" do
alias Agento.Basedata.CountryContext.Country
@valid_attrs %{alpha2: "some alpha2", alpha3: "some alpha3", name: "some name", numeric3: "some numeric3"}
@update_attrs %{al... |
01a830cc64858a9abdd4af686d5369fe42331d4c | 1,765 | [
243100751
] | [
"macro",
"documented"
] | defmodule Stripper.Parser.WhitespaceParser do
@moduledoc false
# This houses private parse functions;
# these are functions deal specifically with normalizing whitespace.
# These implementations of `parse/3` are meant to be composable:
# multiple Parser modules could be mixed and matched to fulfill a complex... |
01a84a0ef95597b6f302427721da4a39456dd63b | 2,139 | [
95407211
] | [
"documented",
"ecto"
] | defmodule PhxSite.Posts do
@moduledoc """
The boundary for the Posts system.
"""
import Ecto.Query
alias PhxSite.Repo
alias PhxSite.Posts.Post
@doc """
Returns the list of posts.
## Examples
iex> list_posts()
[%Post{}, ...]
"""
def list_posts do
Repo.all(from Post, order_by: ... |
01a87e4dfd97e0ccedea1e627c6ce8be96c7e039 | 4,456 | [
1005218853
] | [] | #!/usr/bin/env elixir
# Simple CLI Integration Test
# Tests the HTTP API integration between CLI and Core
Mix.install([
{:httpoison, "~> 2.0"},
{:jason, "~> 1.4"}
])
defmodule CLIIntegrationTest do
def run do
IO.puts("🔨 CLI Integration Test")
IO.puts("========================")
# Test 1: HTTP... |
01a8cdba9ec66fbe4d25e714cfa7a48d5b080401 | 1,864 | [
373411342
] | [
"typespec",
"documented"
] | defmodule DeepThought.Slack do
@moduledoc """
The Slack context.
"""
import Ecto.Query, warn: false
alias DeepThought.Repo
alias DeepThought.Slack.{Translation, User}
@doc """
Find users by user_ids.
"""
@spec find_users_by_user_ids([String.t()]) :: [User.t()]
def find_users_by_user_ids(user_ids... |
01a9cf2600342e3c2305b945f868b671d5e2f2b3 | 3,574 | [
297121840
] | [
"typespec",
"documented"
] | defmodule DigitalOcean.Volume do
alias DigitalOcean.{ Operation }
@doc """
Create a volume.
## Examples
iex> DigitalOcean.Volume.create(
...> name: "example",
...> region: "nyc1",
...> size_gigabytes: 10
...> ) |> DigitalOcean.request()
{ :ok, %DigitalOcean.Response{... |
01aa2aa6d87479e7b65d2d580ff9dd9e7ce50d14 | 3,161 | [
832082385
] | [
"typespec",
"documented"
] | defmodule Nosedrum.Converters.Role do
@moduledoc false
alias Nosedrum.Converters
alias Nostrum.Api
alias Nostrum.Cache.GuildCache
@doc """
Convert a Discord role mention to an ID.
This also works if the given string is just the ID.
## Examples
iex> Nosedrum.Converters.Role.role_mention_to_id("<@... |
01aa362a9a908e1d6be12426212e2d22dfaa0ea5 | 2,250 | [
82629456
] | [] | defmodule Chaperon.Mixfile do
use Mix.Project
def project do
[
app: :chaperon,
version: "0.3.1",
elixir: "~> 1.16",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
deps: deps(),
package: package(),
description: "An Elixir based HTTP load ... |
01aa40284094aa178b165dcbc20ba742bab7ccf6 | 2,629 | [
271156947
] | [
"macro",
"documented"
] | defmodule NimbleTemplate.Addons.Phoenix.Web.SvgSprite do
@moduledoc false
use NimbleTemplate.Addons.Addon
@impl true
def do_apply!(%Project{} = project, _opts) do
project
|> edit_files!()
|> copy_files!()
end
defp edit_files!(%Project{} = project) do
project
|> edit_assets_package!()
... |
01aac09bc372c215f1478a1bae291d03ee8c6486 | 2,514 | [
293380959
] | [
"genserver"
] | defmodule PlaymaMeSignaling.Channels.Channel do
@enforce_keys [:id, :user_id]
defstruct [
:id,
:name,
:user_id,
:updated_at,
:last_active_at,
:pid,
users: []
]
alias PlaymaMeSignaling.{
Channels,
Channels.Channel,
Users,
Users.User
}
use GenServer
def start_l... |
01aad8226fa1f2a28f0a92b67a0735e6cde53dc4 | 10,581 | [
224428977
] | [
"test"
] | defmodule ApxrIoWeb.API.ArtifactControllerTest do
use ApxrIoWeb.ConnCase, async: true
alias ApxrIo.Accounts.AuditLog
alias ApxrIo.Serve.Artifact
alias ApxrIo.Serve.Artifacts
setup do
user = insert(:user)
unauthorized_user = insert(:user)
team = insert(:team)
nbteam = insert(:team, billing_a... |
01aaed58f1f3c90cec101ee32f1df77949d3a448 | 1,879 | [
249221099
] | [] | # Import all plugins from `rel/plugins`
# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
~w(rel plugins *.exs)
|> Path.join()
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))
use Distillery.Releases.Config,
... |
01aaf7a204a9b7939d0c6f750088803be031e975 | 1,749 | [
19429279
] | [] | ExUnit.start
defmodule Th do
def receive_stats(socket, values) do
case :gen_tcp.recv(socket, 0) do
{:ok, data} ->
case Enum.reduce(String.split(data, "\r\n"), {false, values}, fn(item, acc) ->
case acc do
{false, values} ->
case String.split(item, " ") do
... |
01ab149f6586626852a767692acfd7f23a8d44e4 | 1,855 | [
876769604
] | [] | %{
"file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"},
"git_cli": {:hex, :git_cli, "0.3.0", "a5422f9b95c99483385b976f5d43f7e8233283a47cda13533d7c16131cb14df5", [:mix... |
01ab3e0de27620cb6e59872bf4e4cc7164112cb8 | 3,532 | [
177357514
] | [
"documented"
] | defmodule Exentbrite do
use HTTPoison.Base
alias Exentbrite.Client
@user_agent [{"User-agent", "exentbrite"}]
@doc """
Send a GET request
"""
def get(path, client, query_params \\ []) do
url =
client |> add_path_to_endpoint(path)
|> add_params_to_url(query_params)
make_request(
... |
01ac1b14ab8b450168dc024b86f85445d6b2a9a3 | 9,955 | [
422428800
] | [
"documented",
"ecto"
] | defmodule CargoShipping.CargoBookings.Delivery do
@moduledoc """
A VALUE OBJECT.
The actual transportation of the cargo, as opposed to
the customer requirement (RouteSpecification) and the plan (Itinerary).
"""
use Ecto.Schema
import Ecto.Changeset
require Logger
alias CargoShipping.{Utils, Voyage... |
01ac21837e9067645d96d71f74f90984515a3b89 | 9,871 | [
285465102
] | [
"documented"
] | defmodule NodePing.Schedules do
@moduledoc """
Schedules are used for setting time windows for notifications. This module
manages schedules for your account/subaccounts
"""
alias NodePing.Helpers, as: Helpers
alias NodePing.HttpRequests, as: HttpRequests
@api_url "https://api.nodeping.com/api/1/schedules... |
01ac558403be068d485f4cfad3471f879954ddd2 | 1,555 | [
685358879
] | [
"liveview",
"phoenix"
] | defmodule ExRentCarsWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :ex_rent_cars
# 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: "_e... |
01ac8797505e963d08cbeaa5e3a211d3c662ebea | 2,093 | [
847926036
] | [] | defmodule Rolex.MixProject do
use Mix.Project
@source_url "https://github.com/knotfield/rolex"
@version "0.5.3"
def project do
[
app: :rolex,
version: @version,
elixir: "~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: ali... |
01acc9b3a3437d313fac7e1199e6aac41d8cd3d9 | 2,728 | [
908539721
] | [
"liveview"
] | defmodule BeepboopWeb.OgpLive do
use BeepboopWeb, :live_view
alias Phoenix.LiveView.AsyncResult
def render(assigns) do
~H"""
<form phx-submit="submit_url">
<div class="flex-grow flex items-center border rounded-l overflow-hidden">
<span class="bg-gray-100 text-gray-500 px-3 py-2 h-full fle... |
01accedec82f39f7474b0948018dc96343d35687 | 1,880 | [
367998055
] | [
"macro",
"documented",
"phoenix"
] | defmodule EliriaWeb 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 EliriaWeb, :controller
use EliriaWeb, :view
The definitions below will be executed for every view,
controller, etc... |
01acde2ed4d147d4998e339d0ae8244f2ef2d280 | 4,711 | [
141637097
] | [
"test"
] | defmodule SideProjectTracker.Storage.ProjectsAdapterTest do
use ExUnit.Case, async: false
import SideProjectTracker.Factory
alias SideProjectTracker.Storage.ProjectsAdapter
setup do
project = build(:project)
{:ok, file_path} = ProjectsAdapter.save(project)
%{project: project, file_path: file_path... |
01ace1b435412fe773d86417bfcde2a4c92bf9f8 | 6,125 | [
941717903
] | [
"liveview",
"ecto"
] | defmodule PortfolioHubWeb.FieldLive.FormComponent do
use PortfolioHubWeb, :live_component
alias PortfolioHub.Workspace
alias PortfolioHub.Portfolios.Field
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %> - action: <%= @action %>
<:subtitle>Create or edit a ... |
01ad4650f1412c6cd8e1c3f7ec992c5b6e47adb9 | 1,864 | [
325865264
] | [
"phoenix",
"ecto"
] | defmodule BookmarksWeb.WebsiteController do
use BookmarksWeb, :controller
alias Bookmarks.Bookmark
alias Bookmarks.Bookmark.Website
def index(conn, _params) do
websites = Bookmark.list_websites()
render(conn, "index.html", websites: websites)
end
def new(conn, _params) do
changeset = Bookmark... |
01adfd9fd73760fce7f2a6e8e264824c10b553b1 | 1,504 | [
815468879
] | [
"supervisor",
"documented"
] | defmodule InertiaVue.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
InertiaVueWeb.Telemetry,
InertiaVue.Repo,
{Ecto.Migrator,
repos: ... |
01ae743d1f71616474d3e93e66827097736d0d30 | 3,575 | [
87814816
] | [
"test"
] | defmodule Phauxth.RememberTest do
use ExUnit.Case
use Plug.Test
import ExUnit.CaptureLog
alias Phauxth.{Authenticate, Remember, SessionHelper}
@max_age 7 * 24 * 60 * 60
setup do
conn =
conn(:get, "/")
|> SessionHelper.sign_conn()
|> Remember.add_rem_cookie("1")
{:ok, %{conn: c... |
01aef09dae651dec17796cb167e91ff1b1d8cd39 | 1,610 | [
985853139
] | [] | # Generated by Mochi compiler v0.10.26 on 2025-07-16T17:36:53Z
defmodule Main do
def main do
# web_sales :: list(map())
web_sales = [
%{cat: "A", class: "B", net: 40},
%{cat: "A", class: "B", net: 46},
%{cat: "A", class: "C", net: 10},
%{cat: "B", class: "B", net: 20}
]
# resu... |
01aefc18591f8e0c1d15d5575315db14458cd946 | 3,099 | [
557987076
] | [] | defmodule OpentelemetryAvalanche.MixProject do
use Mix.Project
@name "OpentelemetryAvalanche"
@source_url "https://github.com/HGInsights/opentelemetry_avalanche"
@version_file Path.join(__DIR__, ".version")
@external_resource @version_file
@version (case Regex.run(~r/^([\d\.\w-]+)/, File.read!(@version_fi... |
01af0810960cb2c69df6975c4bc2fc64a0ff2575 | 2,146 | [
82578627
] | [] | defmodule Errorio.ErrorioHelper do
use Timex
import Errorio.Router.Helpers
def humanize_atom(atom) do
case is_atom(atom) do
:true ->
atom
|> Atom.to_string
|> String.replace("_", " ")
_ ->
atom
end
end
def format_date(date) do
Timex.local(date)
|> ... |
01af1e866a75e3a3ba21361e59801a4ed25acc35 | 2,106 | [
242712527
] | [
"test"
] | defmodule CommutoxApiWeb.Graphql.Queries.ChatMembersTest do
use CommutoxApiWeb.ConnCase
import CommutoxApi.Fixtures
import CommutoxApiWeb.ConnHelpers
import CommutoxApiWeb.GraphqlHelpers
@chat_members_query """
query ChatMembers($first: Int) {
chatMembers(first: $first) {
edges {
... |
01af45d3051eb27e17ea75a946821ba1b587d43d | 1,662 | [
104223581
] | [] | defmodule IcdCode.ICDCode.Codes_L01 do
alias IcdCode.ICDCode
def _L0100 do
%ICDCode{full_code: "L0100",
category_code: "L01",
short_code: "00",
full_name: "Impetigo, unspecified",
short_name: "Impetigo, unspecified",
category_name: "Impetigo, unspecified"
... |
01afd07d63490ce2e5dc74d2048a2a9e45a8200f | 1,589 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Dataproc.V1.Model.SourceProgress do
@moduledoc """
## Attributes
* `description` (*type:* `String.t`, *default:* `nil`) -
* `endOffset` (*type:* `String.t`, *default:* `nil`) -
* `inputRowsPerSecond` (*type:* `float()`, *default:* `nil`) -
* `latestOffset` (*type:* `String.... |
01afd13e2db799ffc24e576f5a442e1e9cbe3d7b | 5,309 | [
713786777
] | [
"phoenix",
"ecto"
] | defmodule JourneyWeb.LMController do
use JourneyWeb, :controller
require Logger
alias Journey.Prospects
alias Journey.Comms
alias Journey.Comms.LM
alias Journey.URLs
alias Journey.Activities
def index(conn, _params) do
lms = Comms.list_lms(conn.assigns.current_user)
render(conn, :index, lms: ... |
01b068af103078467f17aceebbf2706532ed8236 | 3,516 | [
343959665
] | [
"ecto"
] | defmodule GodwokenIndexer.Worker.CheckUpdateTransactionMethodIdName do
use Oban.Worker, queue: :default, max_attempts: 3
import Ecto.Query
import GodwokenRPC.Util,
only: [
import_timestamps: 0
]
alias GodwokenExplorer.Chain.{Import}
alias GodwokenExplorer.{Repo, Account, Transaction, SmartCon... |
01b08df0c34d8116a1536cd5104535aa31ce4381 | 3,030 | [
107583555
] | [
"phoenix"
] | defmodule OnlineEditorWeb.AuthController do
use OnlineEditorWeb, :controller
alias OnlineEditor.User.Query
plug(Ueberauth)
alias OnlineEditorWeb.Models.AuthUser
alias OnlineEditor.User
alias OnlineEditor.Folder
alias OnlineEditor.Repo
alias OnlineEditor.Guardian
plug(:scrub_params, "user" when acti... |
01b093a32c28038141bbb621308e62bc334f1464 | 4,710 | [
141150118
] | [
"test"
] | defmodule Cryptozaur.Connectors.PoloniexTest do
use ExUnit.Case
import OK, only: [success: 1]
import Cryptozaur.Case
alias Cryptozaur.{Connector, Metronome}
alias Cryptozaur.Model.{Trade}
# @any_secret "secret"
@exchange "POLONIEX"
setup do
{:ok, metronome} = start_supervised(Metronome)
{:ok,... |
01b0d0d95bd81904e2c19b3e47f35968d905da56 | 1,968 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.FirebaseAppDistribution.V1.Model.GdataBlobstore2Info do
@moduledoc """
Information to read/write to blobstore2.
## Attributes
* `blobGeneration` (*type:* `String.t`, *default:* `nil`) - The blob generation id.
* `blobId` (*type:* `String.t`, *default:* `nil`) - The blob id, e.g., /bl... |
01b12aacff12dcf9a994431a68e5d659f259bedf | 3,511 | [
88660854
] | [
"phoenix"
] | defmodule Guisso do
def request_auth_code(conn, redirect) do
guisso_settings = Application.get_env(:active_monitoring, :guisso)
conn = set_client_state(conn, redirect)
csrf_token = generate_csrf_token(conn)
auth_params = %{
client_id: guisso_settings[:client_id],
response_type: "code",
... |
01b19701f1b57071fe90e36ea64caafc5989e20a | 1,924 | [
190499547
] | [
"phoenix"
] | defmodule Bookmarker.FolderController do
use Bookmarker.Web, :controller
alias Bookmarker.Folder
def index(conn, _params) do
folders = Folder.with_bookmarks_count_query() |> Repo.all()
render(conn, "index.html", folders: folders)
end
def new(conn, _params) do
changeset = Folder.changeset(%Fold... |
01b1a414060c9774494b73368787f3813b5ed5c3 | 3,996 | [
897099735
] | [] | defmodule Day8 do
def read_input(name) do
map =
File.read!("./input/#{name}")
|> String.split("\r\n", trim: true)
%{map: map}
end
def setup_match(map) do
joined = Enum.join(map) |> String.split("", trim: true)
row_length = map |> Enum.at(0) |> String.length()
{joined, row_length}... |
01b2a6ba3f5f6ab711d9a8a71d368d8ec8b93cc8 | 3,475 | [
520932864
] | [
"typespec",
"documented"
] | defmodule Livebook.Runtime.Attached do
@moduledoc false
# A runtime backed by an Elixir node managed externally.
#
# Such node must be already started and available, Livebook doesn't
# manage its lifetime in any way and only loads/unloads the
# necessary elements. The node can be an ordinary Elixir runtime... |
01b2abd507a2110bbd2fe8247a610917d16c2c8f | 1,973 | [
202263991
] | [] | defmodule OLED.MixProject do
use Mix.Project
@version "0.3.6"
def project do
[
app: :oled,
version: @version,
elixir: "~> 1.7",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
deps: deps(),
aliases: aliases(),
description: descrip... |
01b2d96de0d19483159f27738b59e5d9ba032e4b | 1,586 | [
143940545
] | [
"genserver"
] | defmodule Periodic.Runner do
use GenServer
def start_link({ task_spec, interval, options }) when is_list(options) do
start_opts = case options[:name] do
nil -> []
name -> [ name: name ]
end
GenServer.start_link(__MODULE__, { task_spec, interval, options }, start_op... |
01b34ee8bc60de6bef5b379d29885f12a556be3c | 1,768 | [
110555354
] | [] | require Logger
defmodule KVServer do
def accept(port) do
# The options below mean:
#
# 1. `:binary` - receives data as binaries (instead of lists)
# 2. `packet: :line` - receives data line by line
# 3. `active: false` - block on `:gen_tcp.recv/2` until data is avalaible
# 4. `reuseaddr: true`... |
01b364c32ed6616d391fb18862bff26bea0985a9 | 7,015 | [
550862948
] | [] | %{
"bunch": {:hex, :bunch, "1.6.0", "4775f8cdf5e801c06beed3913b0bd53fceec9d63380cdcccbda6be125a6cfd54", [:mix], [], "hexpm", "ef4e9abf83f0299d599daed3764d19e8eac5d27a5237e5e4d5e2c129cfeb9a22"},
"bunch_native": {:hex, :bunch_native, "0.5.0", "8ac1536789a597599c10b652e0b526d8833348c19e4739a0759a2bedfd924e63", [:mix],... |
01b36ecb85d97c6763a022da8cf9e99ac9eb067e | 19,121 | [
81580546
] | [] | %{"arc": {:hex, :arc, "0.7.0", "36ba65e390c2f869b98ebbe79d66eedf383788875986a20a546f19d87e4f13ac", [:mix], [{:ex_aws, "~> 1.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:httpoison, "~> 0.11", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.1", [hex: :poison, repo: "hexpm", optional... |
01b3a2f8da4223cf7c4769316c3a7f4b75ffc5ac | 9,216 | [
107273442
] | [] | %{
"bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: f... |
01b3e4af895a715001ef31b6cf5cd87c4b4a8f9d | 8,788 | [
129896763
] | [
"typespec"
] | defmodule ChessPlus.Dto.Waves do
import ChessPlus.Result, only: [<~>: 2]
alias ChessPlus.Dto.Well
alias ChessPlus.Result
@type dto :: term
@type dto_location :: %{required(String.t) => %{required(String.t) => String.t}}
@spec export_location({atom, atom}) :: Result.result
def export_location({domain, in... |
01b3fdb490f163c115266aa721a2af23c6837ba4 | 1,836 | [
54978673
] | [
"phoenix"
] | defmodule Birdie.UserController do
use Birdie.Web, :controller
alias Birdie.User
plug :scrub_params, "user" when action in [:create, :update]
def index(conn, _params) do
users = Repo.all(User)
render(conn, "index.html", users: users)
end
def new(conn, _params) do
changeset = User.changeset(%... |
01b49247818d3bbbeaf81a1dad969fa39aaad724 | 8,579 | [
737328184
] | [
"test"
] | defmodule HttpCookieTest do
use ExUnit.Case, async: true
alias HttpCookie
import HttpCookie.Parser, only: [latest_expiry_time: 0]
describe "from_cookie_string/2" do
test "sets expiry_time and persistent? flag" do
latest_expiry_time = latest_expiry_time()
assert %{
expiry_time: ... |
01b4fc9461804ca289c4bdd571cb412ea50c0c06 | 14,666 | [
114788113
] | [
"test"
] | Code.load_file("beer_song.exs", __DIR__)
ExUnit.start
ExUnit.configure exclude: :pending, trace: true
defmodule BeerSongTest do
use ExUnit.Case
test "getting the first verse (99 bottles)" do
assert BeerSong.verse(99) == """
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it... |
01b51dd52910e2f156ca16bc04179534883cb26a | 19,920 | [
970817672
] | [
"genserver",
"documented"
] | #frestyl/studio/recording_engine.ex
defmodule Frestyl.Studio.RecordingEngine do
@moduledoc """
Enhanced recording engine that integrates with the existing Media system
for intelligent file storage, metadata extraction, and multi-track collaboration.
"""
use GenServer
require Logger
alias Frestyl.Media
... |
01b546e115352b5c6c4f17ff29663c9c6bed3c66 | 3,333 | [
824109793
] | [
"phoenix",
"ecto"
] | defmodule EpisodicalWeb.EpisodicController do
use EpisodicalWeb, :controller
alias Episodical.External
alias Episodical.Model
alias Episodical.Model.Episodic
alias Episodical.Repo
alias Episodical.Workers.EpisodicalUpdate
alias Episodical.Local
def index(conn, _) do
episodics = Model.list_episodic... |
01b59b4c59ef0a22a3d44315334f564c69939904 | 1,595 | [
116615423
] | [
"macro",
"documented",
"phoenix"
] | defmodule BullServerWeb 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 BullServerWeb, :controller
use BullServerWeb, :view
The definitions below will be executed for every view,
con... |
01b5af9eaf7a2a91b44c5ed35cab6285e4aad8d9 | 10,322 | [
1006980846
] | [
"genserver",
"liveview"
] | defmodule PersonalWebWeb.GlobalSearchLive do
use PersonalWebWeb, :live_component
alias PersonalWeb.Search
def mount(socket) do
socket =
socket
|> assign(:query, "")
|> assign(:results, %{publications: [], posts: [], total_count: 0})
|> assign(:suggestions, [])
|> assign(:show_... |
01b5e73f02331be0e9b49eb187d4a37c3ce64611 | 4,693 | [
803502084,
750475301
] | [
"typespec",
"documented"
] | defmodule Toolshed.Core.SpeedTest do
@typedoc "Options for speed_test/1"
@type speed_test_options :: [
duration: pos_integer(),
ifname: String.t(),
url: String.t() | URI.t()
]
@doc """
Perform a download speed test
Calling this with no options measures the download spee... |
01b677b8b706dca97f27c4f42e80bab183c62058 | 8,869 | [
947907795
] | [
"liveview",
"documented"
] | defmodule MySuperAppWeb.SiteConfigsPage do
@moduledoc """
AdminPage
"""
use MySuperAppWeb, :admin_surface_live_view
alias Moon.Design.Table.Column
alias MySuperApp.CasinosAdmins
alias Moon.Design.{Table, Snackbar, Button, Modal, Pagination, Form, Search}
alias Moon.Icons.{GenericInfo, ControlsChevronRi... |
01b690fd0c12159b9afa52718cd8104dee5fdcfe | 2,672 | [
42385950
] | [
"test"
] | defmodule TodoList2Test do
use ExUnit.Case
setup do
todo_list = TodoList2.new
|> TodoList2.add_entry(%{date: {2013, 12, 19}, title: "Dentist"})
|> TodoList2.add_entry(%{date: {2013, 12, 20}, title: "Shopping"})
|> TodoList2.add_entry(%{date: {2013, 12, 19}, title: "Movies"})
{:ok, todo_list: t... |
01b6c0bfac6df29707e06596d7e303b22bb96668 | 1,671 | [
899677842
] | [] | import Enum, only: [reverse: 1, map: 2, any?: 2, uniq: 1]
import String, only: [split: 2, to_integer: 1]
defmodule BubbleSort do
def sort(l, rls) do
sort(l, [], rls)
end
defp must_swap?(a,b, rules) do
any?(rules, fn {b_r, a_r} -> a == a_r and b == b_r end)
end
defp sort(l, acc, rls) when length(l) ... |
01b6ca5d5ae6c69c1258be7fc6cd50e90a008f5e | 5,717 | [
732161447
] | [
"macro",
"liveview",
"documented"
] | defmodule Meadow.Kino.RemoteExecutionCell do
@moduledoc false
use Kino.JS, assets_path: "lib/assets/remote_execution_cell/build"
use Kino.JS.Live
use Kino.SmartCell, name: "Meadow: Run Code"
alias Kino.AttributeStore
@default_code ":ok"
@global_key __MODULE__
@global_attrs ["node", "cookie", "cookie_... |
01b74c98f2a670b2b352f33535a2e64b9ab9a52e | 1,993 | [
113116972
] | [
"test",
"ecto"
] | defmodule Notable.NotesTest do
use Notable.DataCase
alias Notable.Notes
describe "notes" do
alias Notable.Notes.Note
@valid_attrs %{body: "some body", title: "some title"}
@update_attrs %{body: "some updated body", title: "some updated title"}
@invalid_attrs %{body: nil, title: nil}
def no... |
01b75b341b743b26a48aa6e99cf6ed14a361a30b | 3,045 | [
745521775
] | [] | defmodule Philosophers.Benchmark do
alias Philosophers.Main, as: Main
alias Philosophers.Resource, as: Resource
alias Philosophers.Process, as: PProcess
@step 10
@i 10
@k 1
@warmup 0
def main() do
IO.puts("Benchmark Started!")
Enum.each(1..(@warmup + 1), fn x ->
message = "Run #{x}:" |>... |
01b77244e0255691eb98b7032cbad25ea70812f2 | 3,937 | [
549892425
] | [] | defmodule MyList do
def max([]), do: nil
def max([a, b]) when a > b, do: a
def max([_, b]), do: b
def max([h | t]), do: max([h, max(t)])
def reduce([],v,_), do: v
def reduce([h|t],v,func), do: reduce(t,func.(h,v),func)
def mapsum(l,f), do: reduce(l,0,&(&2 + f.(&1)))
#Enum.map 1.59x slower
#1.27x ... |
01b7c8f39c838d17e477dfe12ae64498e08f8bb4 | 3,030 | [
635279165
] | [
"phoenix"
] | defmodule MyAppWeb.Router do
use MyAppWeb, :router
import MyAppWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {MyAppWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :fetch... |
01b7ca1e9e6059bb2d8c45737db453505fe9fc22 | 1,638 | [
172288559
] | [
"macro",
"documented",
"phoenix"
] | defmodule FalconFansWeb 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 FalconFansWeb, :controller
use FalconFansWeb, :view
The definitions below will be executed for every view,
con... |
01b816db20c764ef1ac8c247b6670ca2993b69f4 | 1,799 | [
519168400
] | [] | # 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 :gpx_phoenix,
ecto_repos: [GpxPhoenix.Repo]
... |
01b8181f1aa5a4b506a39d0562fce4aab8871e74 | 1,547 | [
550598638
] | [
"typespec"
] | defmodule Day06 do
@spec get_raw_data(boolean()) :: [String.t()]
defp get_raw_data(_test_data = true) do
["3,4,3,1,2"]
end
defp get_raw_data(_test_data = false) do
Tools.read_file("day06.txt")
end
@spec get_data(boolean()) :: [integer()]
def get_data(test_data) do
get_raw_data(test_data)
... |
01b82dd43a75458a44b8f293607c701e5ecb0a23 | 3,484 | [
160435670
] | [] | import AOC
aoc 2021, 19 do
# https://www.euclideanspace.com/maths/algebra/matrix/transforms/examples/index.htm
orientations = [
[[1, 0, 0], [0, 1, 0], [0, 0, 1]], # Unmodified
[[1, 0, 0], [0, 0, -1], [0, 1, 0]], # 90
[[1, 0, 0], [0, -1, 0], [0, 0, -1]], # 180
[[1, 0, 0], [0, 0, 1], [0, -1, 0]], ... |
01b88adab76eb912295bee3e5ed9c69cfc71cb4e | 2,102 | [
16525947
] | [
"test"
] | defmodule BeamToolbox.ProjectControllerTest do
use BeamToolbox.ConnCase
alias BeamToolbox.Project
@valid_params project: %{category_id: 42, details: "some content", key: "some content"}
@invalid_params project: %{}
setup do
conn = conn()
{:ok, conn: conn}
end
test "GET /projects", %{conn: conn}... |
01b89d1cf8f7fe4f33424c3a4ec1e115fd971ba6 | 3,924 | [
696124997
] | [
"macro",
"liveview",
"documented",
"test"
] | defmodule QuizGame.TestSupport.GenericTests do
@moduledoc "This project's generic/reusable tests."
use QuizGameWeb.ConnCase
# import Phoenix.LiveViewTest
# @doc """
# A macro that wraps the 'auth-required' test functionality into a single line.
# Use this function if the route under test does not have any... |
01b8b26e61330b62c1aedb62c9ea559292d9e7bf | 1,953 | [
927292687
] | [
"typespec",
"documented"
] | defmodule Elixirlang.Token do
@moduledoc """
Defines all token types used in the lexical analysis.
Includes:
- Operators (+, -, *, /, =, ==, etc.)
- Delimiters (parentheses, braces, brackets)
- Keywords (def, do, end, if, else)
- Literals (integers, strings, atoms)
- Identifiers
"""
@type t :: %__... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.