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 |
|---|---|---|---|---|
0a4e3ab0000e3e70efa2d682e48cb47a09640670 | 1,802 | [
744140777
] | [
"documented",
"ecto"
] | defmodule ReservaClases.Accounts.AdministratorNotifier do
import Swoosh.Email
alias ReservaClases.Mailer
# Delivers the email using the application mailer.
defp deliver(recipient, subject, body) do
email =
new()
|> to(recipient)
|> from({"ReservaClases", "<EMAIL>"})
|> subject(subj... |
0a4ef18038189e23b055b58026659477150c185e | 2,316 | [
237536259
] | [
"documented"
] | defmodule DataTasks.RetrieveResultContributions do
@moduledoc false
use Oban.Worker, queue: :git, max_attempts: 3
alias Yellr.Repo
alias Yellr.Data.Branch
alias Yellr.Data.BuildResult
alias Yellr.Data.Contribution
import Ecto.Query
@impl Oban.Worker
def perform(%{"build_result_id" => build_result_... |
0a4ef252784080be260e935ae5ed6a58879be93f | 3,524 | [
939202976
] | [
"documented",
"ecto"
] | defmodule GraphQLShorts.Absinthe do
@moduledoc """
# GraphQLShorts.Absinthe
## Installation
Add the `absinthe` dependency to `mix.exs`:
```elixir
def deps do
[
{:absinthe, "~> 1.0"}
]
end
```
Run `mix deps.get` to download the dependency.
## Introduction
Error handling in `Absi... |
0a4f39f34952418b485de6e90ae1266ea3a7cd12 | 6,360 | [
191612022
] | [
"documented"
] | defmodule GraphQL.Schema.MedicationTypes do
@moduledoc false
use Absinthe.Schema.Notation
use Absinthe.Relay.Schema.Notation, :modern
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
import GraphQL.Resolvers.Helpers.Load, only: [load_by_args: 2]
alias Absinthe.Relay.Node.ParseIDs
alias Core.Me... |
0a50889c786bb575642d5dbd30e016cdf359c906 | 2,801 | [
211097139,
180274417
] | [
"documented"
] | defmodule Mix.Tasks.Compile.Xref do
use Mix.Task.Compiler
alias Mix.Tasks.Compile.Elixir, as: E
@recursive true
@manifest "compile.xref"
@manifest_vsn 1
@moduledoc """
Performs remote dispatch checking.
It uses `mix xref` to check if any remote call does not exist or is
deprecated, and emits warnin... |
0a5118a102699312433c9fb4b3e7cf2e43a4a5f5 | 2,447 | [
896569425
] | [] | defmodule Mix.Tasks.Day7 do
require Timer
require InputUtils
@input "input.txt"
defp parse_input() do
__ENV__.file
|> InputUtils.read_lines(@input)
|> Enum.reduce([], fn line, equations ->
[result, tokens] = String.split(line, ":", trim: true)
numbers =
tokens
|> Strin... |
0a511a3ae10d5c2e07344a52f01e8a6c93868c79 | 1,524 | [
624875756
] | [
"ecto"
] | defmodule ExchangeZoo.Binance.Model.AccountConfigUpdateEvent do
use ExchangeZoo.Model
alias ExchangeZoo.Binance.Model.AccountConfigUpdateEvent.{TradePair, MarginMode}
@primary_key false
@fields %{
"E" => :event_time,
"T" => :transaction_time,
"ac" => :trade_pair,
"ai" => :margin_mode
}
em... |
0a519c7168f5b7e73c1400aad5030b85f2f05a30 | 7,348 | [
135463122
] | [
"typespec",
"documented"
] | defmodule VintageNet.IP do
@moduledoc """
This module contains utilities for handling IP addresses.
By far the most important part of handling IP addresses is to
pay attention to whether your addresses are names, IP addresses
as strings or IP addresses at tuples. This module doesn't resolve
names. While IP... |
0a519cf4793583de9e947ca2539974e7401f52a3 | 2,099 | [
922960360,
28735275
] | [
"typespec",
"documented"
] | defmodule KafkaEx.Utils.Murmur do
@moduledoc """
Utility module that provides Murmur hashing algorithm.
"""
import Bitwise
# Arbitrary constant for murmur2 hashing
# https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp#L39-L43
@m 0x5BD1E995
@r 24
# Default seed to hashing, copied fo... |
0a51b1186362b68a8a152730735497340b4e1e36 | 3,446 | [
627026889
] | [
"liveview"
] | defmodule MausgenWeb.AbilityScores do
use Phoenix.LiveComponent
def render(assigns) do
~H"""
<div class="container grid rounded-lg mx-auto">
<h1 class="font-mono text-3xl row-span-2 justify-self-center">
Roll for your ability bonuses:
</h1>
<div class="grid grid-cols-3 py-10">
... |
0a51d728bc2608dd7c22744dfdd39843ea203889 | 10,253 | [
316087194
] | [] | %{
"certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"},
"connection": {:hex, :connection, "1.0.... |
0a5247b79a617b16e66054cadb3be86b28231ac3 | 4,868 | [
173140892
] | [
"test"
] | defmodule Q3Reporter.GameServer.StateTest do
use ExUnit.Case, async: true
alias Q3Reporter.GameServer.State
alias Q3Reporter.Core.{Game, Results}
defp create_state do
State.new(path: "example.log")
end
defp create_pid do
:c.pid(0, :rand.uniform(99), :rand.uniform(5000))
end
test "should crea... |
0a525f526485e9dd9023d177cca2cdf42f905d87 | 3,745 | [
997222462
] | [
"test",
"ecto"
] | defmodule TodoList.TodosTest do
use TodoList.DataCase
alias TodoList.Todos
describe "lists" do
alias TodoList.Todos.List
import TodoList.TodosFixtures
@invalid_attrs %{name: nil}
test "list_lists/0 returns all lists" do
list = list_fixture()
assert Todos.list_lists() == [list]
... |
0a527233dc577070a8c0db314ceb75dfe209d78d | 2,415 | [
378636119
] | [
"ecto"
] | defmodule PlugsApp.Repo.Migrations.CreatePackerTysonPricing do
use Ecto.Migration
def change do
create table(:packer_tyson_pricing) do
add :mpc_week_end_date, :date
add :usda, :decimal, precision: 12, scale: 2, default: 0.00
add :reg_tyson_base_price, :decimal, precision: 1... |
0a52824ce697030c7d3acb82dc0000216f72139a | 1,627 | [
777891456
] | [
"test"
] | defmodule ExAzureSpeech.Auth.ClientTest do
use ExUnit.Case, async: true
import Tesla.Mock
alias ExAzureSpeech.Auth.Client, as: AuthClient
alias ExAzureSpeech.Auth.Config, as: AuthConfig
test "should authenticate successfully" do
mock(fn %{
method: :post,
url: "https://westeu... |
0a531013a72e703a12b18328f0c8f16c948a39e4 | 4,127 | [
231787589
] | [
"genserver",
"documented"
] | defmodule EventLog.Reader do
@moduledoc """
Reads entries of a log.
"""
use GenServer
require Logger
alias EventLog.{Segment, IndexReader}
@read_mode [:read, :binary, :read_ahead]
@doc """
Starts a log reader.
"""
def start_link(dir, offset \\ 0) do
GenServer.start_link(__MODULE__, {dir, off... |
0a532bf662f8d52a4edc1501eeec0c0fadfa8b58 | 4,935 | [
202846144
] | [
"test",
"ecto"
] | defmodule RpcTest do
use ExUnit.Case, async: false
alias Chain.Account
alias Chain.State
alias Chain.Transaction
alias Chain.Worker
alias Network.Rpc
setup_all do
TestHelper.reset()
end
test "dio_edgev2" do
Worker.set_mode(:poll)
Worker.work()
Worker.work()
Worker.work()
Work... |
0a536b34346885ea089ec10230a0b10a7b18064a | 1,601 | [
104123452
] | [
"macro",
"documented",
"phoenix"
] | defmodule TeneasyWeb 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 TeneasyWeb, :controller
use TeneasyWeb, :view
The definitions below will be executed for every view,
controller, ... |
0a53caca416129b68475c86d089ca0be1ce395d4 | 2,853 | [
968494392
] | [
"phoenix"
] | defmodule Kpwa002Web.Router do
use Kpwa002Web, :router
import Kpwa002Web.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {Kpwa002Web.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
... |
0a53cfd8d13cd3cd7f47c94c376630adfc55fada | 2,946 | [
333982952
] | [
"documented",
"ecto"
] | defmodule Dogistics.Legs do
@moduledoc """
The Legs context.
"""
import Ecto.Query, warn: false
alias Dogistics.Repo
alias Dogistics.Legs.Leg
alias Dogistics.Runs.Run
alias Dogistics.Points.Point
@doc """
Returns the list of legs.
## Examples
iex> list_legs()
[%Leg{}, ...]
"""
... |
0a54098701e7bc92bdd68b9a07746b2be5b3e304 | 1,894 | [
896840491
] | [] | defmodule Day18 do
def part1(input) do
solve(input, false)
end
def part2(input) do
solve(input, true)
end
def solve(input, precedence) do
Enum.map(input, &scan_expr/1)
|> Enum.map(fn line -> parse_expr(line, precedence) end)
|> Enum.map(&(elem(&1, 0)))
|> Enum.map(&eval_expr/1)
|... |
0a5531bf82857713bb8f287086e117b1293dd7d7 | 20,607 | [
416259673,
415908578
] | [
"typespec",
"documented"
] | defmodule Contex.BarChart do
@moduledoc """
Draws a barchart from a `Contex.Dataset`.
`Contex.BarChart` will attempt to create reasonable output with minimal input. The defaults are as follows:
- Bars will be drawn vertically (use `orientation/2` to override - options are `:horizontal` and `:vertical`)
- The... |
0a556441b8c2abe141387763e426d8f876bb0d13 | 2,560 | [
433034488
] | [
"documented"
] | # This wouldn't have been possible without Reddit and the hint that I wanted to use a summed-area table.
# https://en.wikipedia.org/wiki/Summed-area_table
# Well, it would have been, but my naive implementation literally took hours to come up with an answer.
# This takes a few seconds.
defmodule Y2018.Day11 do
use Ad... |
0a55c9e4db7aadb4499679c4a9d72da7d0a71ebc | 3,976 | [
369570293
] | [
"genserver",
"typespec",
"macro"
] | defmodule Cointrader.Exchanges.Client do #behaviour module (generic part)
use GenServer
@type t :: %__MODULE__{
module: module(),
conn: pid(),
conn_ref: reference(),
currency_pairs: [String.t()],
}
# set expections from callback module (specific parts)
@callback exchange_name() :: String.t()... |
0a5607c98f1f7d212faee5bc532d35e2cc127762 | 3,657 | [
78697813
] | [
"typespec",
"documented"
] | defmodule Number.Currency do
@moduledoc """
Provides functions for converting numbers into formatted currency strings.
"""
import Number.Delimit, only: [number_to_delimited: 2]
@doc """
Converts a number to a formatted currency string.
## Parameters
* `number` - A float or integer to convert.
* `... |
0a566acdce036cd477cd813facf073a86107d511 | 1,685 | [
237546205
] | [] | defmodule Day_05 do
def parse_input(filename) do
File.read!(filename)
|> String.split("\n\n", parts: 2)
|> then(fn [crates, instructions] ->
{parse_crates(crates), parse_instructions(instructions)}
end)
end
defp parse_crates(string) do
string
|> String.split("\n")
|> Enum.drop(... |
0a56df5892ea7455c72fe6c3e4ddf86c46e00653 | 1,637 | [
1003608077
] | [
"test"
] | defmodule VideoCompactor.InterfaceAdapters.Gateways.Clients.S3Test do
use ExUnit.Case, async: false
use Mimic
alias VideoCompactor.InterfaceAdapters.Gateways.Clients.S3
setup :set_mimic_global
setup :verify_on_exit!
describe "upload_file/2" do
test "returns :ok on success" do
File
|> stub... |
0a5712a771917a4998ca3f1e1bb43f0ddc54f56a | 2,697 | [
129961127
] | [
"phoenix"
] | defmodule CreditAppWeb.ClientController do
use CreditAppWeb, :controller
import Ecto.Query, only: [from: 2]
alias CreditApp.{Client, Repo}
plug :scrub_params, "client" when action in [:create, :update]
def create(%{assigns: %{version: :v1}}=conn, %{"client" => client_params}) do
changeset = Client.creat... |
0a57e7e288d93d9449dc06b2d5d07a0563570252 | 1,515 | [
54614318
] | [
"genserver",
"test"
] | defmodule AirbrakeServerTest do
use ExUnit.Case
alias Airbrakify.AirbrakeServer
setup do
server = AirbrakeServer.start
fake_conn = %{
params: %{"param1" => "foo", "param2" => "bar"},
private: %{
plug_session: %{"key" => "value"}
}
}
reason = %TestError{data: "Some Garba... |
0a57f8e8ec0152c8c24130faaf50030c104fe279 | 2,017 | [
56841784
] | [
"genserver"
] | defmodule Luckdragon.Store do
alias Luckdragon.Nginx.{Reloader, Server, Upstream}
alias Luckdragon.TemplateBuilder
use GenServer
### GenServer API
def init(state), do: {:ok, state}
def handle_cast({:add, server}, state) do
if server.name !== nil && server.name !== '' do
new_state = case Enum.a... |
0a584a59bca712522a09da1e696281161e141a41 | 1,899 | [
346547298
] | [
"macro",
"documented",
"phoenix"
] | defmodule GithubConsumerWeb 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 GithubConsumerWeb, :controller
use GithubConsumerWeb, :view
The definitions below will be executed for every... |
0a5874ebf23a1fded3d58cd3bb619f3f826855cc | 2,443 | [
156607763
] | [
"genserver",
"phoenix"
] | defmodule SweepIt.Scene.Sensor do
use Scenic.Scene
alias Scenic.Graph
alias Scenic.ViewPort
alias Scenic.Sensor
import Scenic.Primitives
import Scenic.Components
alias SweepIt.Component.Nav
alias SweepIt.Component.Notes
@body_offset 80
@font_size 160
@degrees "°"
@notes... |
0a588588d45caeeaf9e829a3aecdae9c400ea114 | 3,711 | [
65298680
] | [
"documented"
] | defmodule EspiDni.ArticleSlackMessenger do
@moduledoc """
Sends spike notifications to a user for their articles
"""
alias EspiDni.{
SlackWeb,
Repo,
NotificationMessage
}
import EspiDni.Gettext
@doc """
Sends a view spike message to an article's user
"""
def send_view_spike_message(ar... |
0a59218f0665d1b17fd5df036de13e2879c0bd57 | 4,843 | [
502489536
] | [
"supervisor",
"documented"
] | defmodule Nebulex.Adapters.Horde.Cache do
@moduledoc """
This defines a facade to access the desired horde cache implementation
"""
alias Nebulex.Adapters.Horde.DynamicSupervisor
alias Nebulex.Adapters.Horde.GenServerItem, as: Item
def get!(adapter_meta, key) do
Item.via(key, adapter_meta.registry_nam... |
0a5958f1bf1aa2e318520c258db88c6fed6ec8bf | 2,360 | [
616302651
] | [
"documented"
] | defmodule Azimutt.Utils.Mapx do
@moduledoc "Helper functions on Map."
alias Azimutt.Utils.Result
alias Azimutt.Utils.Stringx
@doc """
Same as `Map.fetch` but return a better error
## Examples
iex> %{foo: "bar"} |> Mapx.fetch(:foo)
{:ok, "bar"}
iex> %{foo: "bar"} |> Mapx.fetch(:bar)
... |
0a59bfbb9913269d73888cb98001db9d2bb7e21b | 2,583 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.VMMigration.V1.Model.Source do
@moduledoc """
Source message describes a specific vm migration Source resource. It contains the source environment information.
## Attributes
* `aws` (*type:* `GoogleApi.VMMigration.V1.Model.AwsSourceDetails.t`, *default:* `nil`) - AWS type source details.... |
0a59e565a094042fa237edfba2471d69292adc96 | 2,516 | [
406194785
] | [
"documented"
] | defmodule Mix.Tasks.FakeSamlIdp.GenerateCert do
@moduledoc "Generate a public cert and private key, suitable for use with SAML."
@shortdoc "Generate a public cert and private key."
use Mix.Task
import EEx
@cert_request_fields [
country: {"Country", "US"},
state: {"State/Province", "New York"},
... |
0a5a7ee1c01da40a416b8b9f168ffa94ed025647 | 4,070 | [
762366923
] | [
"typespec",
"documented"
] | defmodule Realtime.RTR do
@moduledoc """
for parsing data out of RTR's json feeds
"""
alias Realtime.Data.TripUpdate
alias Realtime.Data.VehiclePosition
alias Realtime.PollingServer
# Parse VehiclePositions from the enhanced json file. Special cased for empty files.
@spec parse_vehicle_positions(Strin... |
0a5a8f06ed9862fca27895f70d705310298e5342 | 2,518 | [
63659645
] | [] | defmodule FuckBeme do
# Reply to a specified tweet, making sure to add "@" and the username into the tweet text
defp reply(username, tweet_id) do
ExTwitter.update("@" <> username <> " Fuck Beme", in_reply_to_status_id: tweet_id)
insert_id(tweet_id)
end
# Pattern match on the ID, username, tweet conten... |
0a5add75aa913855b91972fe7769cce052902d4e | 3,637 | [
1015009442
] | [
"genserver",
"liveview"
] | defmodule EthExplorerWeb.AddressLive.Show do
use EthExplorerWeb, :live_view
alias EthExplorer.Repo
alias EthExplorer.Blockchain.Transaction
alias EthExplorer.Ethereum.Client
@impl true
def mount(%{"id" => address}, _session, socket) do
# Validate that it's a valid Ethereum address format
if valid_... |
0a5af7f7284a140e1d87d462d9635ee2cf73161d | 2,588 | [
75517646
] | [
"genserver"
] | defmodule CitizenAdvocateDataFetcher.Propublica.Worker do
use GenServer
@http Application.get_env(:citizen_advocate_data_fetcher, :propublica)[:http_client] || HTTPoison
@api_key Application.get_env(:citizen_advocate_data_fetcher, :propublica)[:api_key]
## Client API
def start_link(_args) do
GenServer... |
0a5bb0b5842ef3aeaf5c6cd73aa8650dac27acbc | 4,361 | [
114397303
] | [
"typespec",
"documented",
"ecto"
] | defmodule Adify.Environment.Operation do
@moduledoc """
Represents the data related to an environment operation. An environment
operation is when a tool is attempted to be installed or uninstalled.
"""
use Ecto.Schema
import Ecto.Changeset
@primary_key false
@valid_states ~w(new failed completed)
@... |
0a5c1c3ff2613bd2e7919d457e7fce3e92df7a0c | 1,610 | [
347764246
] | [
"genserver",
"documented"
] | defmodule Notifications.Boundary.JobManager do
@moduledoc false
alias Notifications.Boundary.SendNotification
alias Notifications.Core.Job
use GenServer
require Logger
def remove_job(id) do
GenServer.call(__MODULE__, {:remove, id})
end
def add_job(job = %Job{}) do
GenServer.call(__MODULE__, ... |
0a5c43f1a1d7353b056bcad4c8e30c4fc3801e36 | 5,869 | [
926237144
] | [
"genserver",
"typespec",
"macro"
] | defmodule Clr.Air do
@base ~w[slotref clobbers keep clobber squoted dquoted dstring identifier alpha alnum float int cs singleq doubleq comma space
colon dot lparen rparen langle rangle lbrace rbrace lbrack rbrack fatarrow newline equals null undefined
elision notnewline]a
@literal ~w[liter... |
0a5c47da864d111a0d3ed6f03dbb4daeb700682d | 3,052 | [
106624234
] | [
"typespec",
"documented"
] | defmodule Din.Resources.User do
alias Din.Error
@doc """
Returns the user object of the requester's account.
For OAuth2, this requires the `identify` scope, which will return the object without an email, and optionally the `email` scope, which returns the object with an email.
"""
@spec get_current_user :... |
0a5c85f9293e811d95d47e471b3d0da98fafd308 | 3,801 | [
501835946
] | [
"liveview",
"test"
] | defmodule MorkBorgWeb.LocationLiveTest do
use MorkBorgWeb.ConnCase
import Phoenix.LiveViewTest
import MorkBorg.WorldFixtures
@create_attrs %{description: "some description", name: "some name"}
@update_attrs %{description: "some updated description", name: "some updated name"}
@invalid_attrs %{description:... |
0a5cabb682fd0e62ea7ae0b579a363b9a63e65ac | 6,221 | [
80856783
] | [] | # 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.
use Mix.Config
# General application configuration
config :phrampu,
ecto_repos: [Phrampu.Repo],
... |
0a5d1d13b3d7ebfc2939fccc2aee8a171c8e7215 | 2,302 | [
193056720
] | [
"phoenix",
"ecto"
] | defmodule TransporterWeb.DeliveryLocationController do
use TransporterWeb, :controller
alias Transporter.Settings
alias Transporter.Settings.DeliveryLocation
def index(conn, _params) do
delivery_location = Settings.list_delivery_location()
render(conn, "index.html", delivery_location: delivery_locatio... |
0a5d6297bc1aa045aca20eb06d9e697b468e9eaa | 1,727 | [
112796597
] | [
"documented"
] | defmodule Day10 do
use Utils
def main() do
state = process("data/day10.txt")
(for bin <- ["output0", "output1", "output2"], do: get_in(state, [bin, :values]))
|> List.flatten()
|> Enum.reduce(&Kernel.*/2)
end
def process(name) do
normalize_file(name)
|> Stream.map(&normalize_command/1)... |
0a5df66912b8cddd05e3e698f2db06cadf600e5b | 2,655 | [
451028506
] | [] | import Config
# Configure your database
config :two_db_test, TwoDbTest.Repo.MySql,
username: "root",
password: "",
database: "two_db_test_dev",
hostname: "localhost",
show_sensitive_data_on_connection_error: true,
pool_size: 10
config :two_db_test, TwoDbTest.Repo.Scylla,
keyspace: "two_db_test_dev",
n... |
0a5df73597292868f3608722938aa578c1df027d | 2,604 | [
321463862
] | [
"test",
"supervisor",
"liveview"
] | defmodule PhoenixLiveSessionTest do
use ExUnit.Case, async: true
alias PhoenixLiveSession, as: LiveSession
@pub_sub PhoenixLiveSessionTestPubSub
setup_all do
Supervisor.start_link([{Phoenix.PubSub, name: @pub_sub}], strategy: :one_for_one)
:ok
end
test "subscribe to and modify session" do
op... |
0a5df8d4d0395ab27cfcf5bc9e7153b14d90f400 | 1,595 | [
131871220
] | [
"documented",
"ecto"
] | defmodule PostDeployScripts.PreviouslyRunScripts do
# Define a schema that works with the a table, which is schema_migrations by default
@moduledoc false
use Ecto.Schema
import Ecto.Query, only: [from: 2]
@primary_key false
schema "previously_run_scripts" do
field :version, :integer
timestamps upd... |
0a5e05631b5a029651bd678dbd3a472be897cac2 | 1,760 | [
862417902
] | [
"genserver"
] | defmodule TCPServer do
use GenServer
require Logger
def start_link(_) do
GenServer.start_link(__MODULE__, %{}, name: __MODULE__)
end
@impl true
def init(state) do
{:ok, state}
end
@impl true
def handle_cast({:add_connection, conn_uuid, pid}, state) do
new_state = Map.put(state, conn_uu... |
0a5e4c7bab1b85f31afeea96cd1517bc56a3a701 | 2,976 | [
896808707
] | [] | defmodule Part2 do
def solve do
grid =
File.read!("input.txt")
|> String.split()
|> Enum.map(&String.graphemes/1)
nrows = length(grid)
ncols = length(Enum.at(grid, 0))
{y, x} =
0..(nrows - 1)
|> Enum.reduce_while({0, 0}, fn row, _yx ->
{found?, col} =
... |
0a5ec9da2243c5aa85ce391c10ef2d58cb051752 | 1,599 | [
91304035
] | [
"test"
] | defmodule ExDocker.HTTPTest do
use ExUnit.Case
test "get" do
url = "http://httpbin.org/get"
{:ok, response} = ExDocker.Api.HTTP.get(url)
decoded = Poison.decode!(response.body)
assert response.status_code == 200
end
test "get with query params" do
url = "http://httpbin.org/get"
{:ok, ... |
0a5efd392dde3a9ed7a7fb3c174976b834720804 | 5,939 | [
185558207,
213229236,
1000104078,
982054619,
882572863,
217320195,
174991383,
540729553,
771023416,
887377354
] | [] | defmodule Pleroma.Web.ApiSpec.SearchOperation do
alias OpenApiSpex.Operation
alias OpenApiSpex.Schema
alias Pleroma.Web.ApiSpec.AccountOperation
alias Pleroma.Web.ApiSpec.Schemas.Account
alias Pleroma.Web.ApiSpec.Schemas.BooleanLike
alias Pleroma.Web.ApiSpec.Schemas.FlakeID
alias Pleroma.Web.ApiSpec.Schem... |
0a5f2cfe39d65c3ea5cbe8ae9117ab6ff392ac84 | 9,060 | [
803502084,
750475301
] | [
"typespec",
"documented"
] | defmodule NervesMOTD do
@moduledoc """
`NervesMOTD` prints a "message of the day" on Nerves devices.
To use, add `NervesMOTD.print()` to the `rootfs_overlay/etc/iex.exs` file in
your Nerves project.
"""
@logo """
\e[38;5;24m████▄▄ \e[38;5;74m▐███
\e[38;5;24m█▌ ▀▀██▄▄ \e[38;5;74m▐█
\e[38;5;24m█▌... |
0a5f75ef64be8eda29d43a9169fb7b160b1c834f | 2,612 | [
869664514
] | [
"documented"
] | defmodule BackendProjectWeb.Schema.Context.Accounts.Mutations do
@moduledoc """
This module contains mutations related to user accounts, including sign up, sign in and sign out.
"""
use Absinthe.Schema.Notation
alias BackendProjectWeb.Resolvers
alias BackendProjectWeb.Schema.Middleware
object :account_m... |
0a5f937d670c96bc954d6496d5325391c241429b | 1,677 | [
296295613
] | [
"documented"
] | defmodule Moon.Design.Pagination do
@moduledoc false
use Moon.StatelessComponent
@doc "Id attribute for DOM element"
prop(id, :string)
@doc "Data-testid attribute for DOM element"
prop(testid, :string)
@doc "Additional Tailwind classes"
prop(class, :css_class)
@doc "The value of current page"
p... |
0a5fe162ca7dd983a30c352843e4fd8267d59433 | 12,732 | [
239766794
] | [
"macro"
] | defmodule RasaSdk.Actions.FormAction do
alias RasaSdk.Actions.Context
alias RasaSdk.Model.Request
alias RasaSdk.Model.ResponseOk
alias RasaSdk.Model.{ParseResult, Tracker}
require Logger
@callback on_activate(Context.t()) :: Context.t()
@callback required_slots(Context.t()) :: [String.t()]
@callback s... |
0a5ffc45ebd682a469e96d228a4b80ccf7fae9e2 | 1,582 | [
984028116
] | [
"test",
"documented"
] | defmodule QueryCanary.Connections.Adapters.MySQLTest do
use ExUnit.Case, async: false
alias QueryCanary.Connections.Adapters.MySQL
@moduletag :database_adapters
@moduledoc """
CREATE DATABASE IF NOT EXISTS test_db;
CREATE USER 'test_user'@'localhost' IDENTIFIED BY 'test_pass';
GRANT SELECT ON test_db... |
0a60331b7c6a53ea8430ac0c97da2ee2ba619a87 | 6,045 | [
1002277727
] | [
"documented"
] | #!/usr/bin/env elixir
# Claude Code Integration Demo
# Demonstrates successful integration of Claude Code as Unix-style utility in Reactor workflows
Mix.install([
{:jason, "~> 1.4"},
{:reactor, "~> 0.15.4"}
])
Code.require_file("lib/self_sustaining/reactor_steps/claude_code_step.ex", __DIR__)
defmodule ClaudeIn... |
0a60960a15f37bd43b92b9669c89587d39baeb7d | 1,920 | [
291135459
] | [
"liveview"
] | defmodule NookBookWeb.NookBookLive do
use NookBookWeb, :live_view
alias NookBook.ACNH.Cache
@collection_functions %{
"bugs" => %{list: &Cache.bugs/0, record: &Cache.bug/1},
"fish" => %{list: &Cache.fish/0, record: &Cache.fish/1},
"sea_creatures" => %{list: &Cache.sea_creatures/0, record: &Cache.sea_c... |
0a60abecd0de88ff7cb487b216ed5e388048164a | 2,648 | [
169910509
] | [
"genserver",
"typespec",
"supervisor",
"documented"
] | defmodule MCP300X.Server do
@moduledoc """
Use a MCP300X family ADC in a GenServer so it can be supervised.
This is useful for long running applications that will need to
read from the ADC.
```elixir
children = [
{MCP300X.Server, ["spidev0.0", MCP300X.MCP3008, [name: MyApp.MCP3008]]}
]
opts = [st... |
0a60bb7fbb1410456aa6daf2db8f7950c625e577 | 8,649 | [
395289414
] | [
"documented"
] | defmodule CreateDeepAnalysis do
@moduledoc """
Deep analysis of DNS packet creation to find real optimization opportunities
"""
def run_analysis do
IO.puts("=== Deep DNS Create Performance Analysis ===\n")
# Focus on the real bottlenecks
analyze_enum_overhead()
analyze_function_call_overhe... |
0a610ee24ccf1b24b33b285a103cf661b20ba09e | 3,655 | [
924786497
] | [
"liveview",
"documented"
] | defmodule ZoonkWeb.AppSupportLive do
@moduledoc false
use ZoonkWeb, :live_view
alias Zoonk.Support
@impl Phoenix.LiveView
def render(assigns) do
~H"""
<ZoonkWeb.SettingsLayout.render
flash={@flash}
scope={@scope}
current_page={:support}
has_form={true}
form_id="support_... |
0a613cc0b5913ff5da3cdd36fca270d5830e4a54 | 3,553 | [
746798402,
682357176,
565246607
] | [
"phoenix"
] | defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do
import Plug.Conn
import Phoenix.Controller, only: [get_format: 1]
use Pleroma.Web, :verified_routes
alias Pleroma.Activity
alias Pleroma.Signature
alias Pleroma.Instances
require Logger
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
def ini... |
0a6185024a2164bf93dbb5cf188f5ff9bdb2e42a | 1,895 | [
64574258
] | [
"genserver",
"documented"
] | defmodule RallyServer do
@moduledoc """
Handles calls to the Rally Service
"""
use GenServer
require Logger
require IEx
alias Acceptunes.RoomChannel
alias Acceptunes.DailyRallyItems
@rally_project_id Application.get_env(:acceptunes, :rally_project_id)
def start_link(opts \\ []) do
GenServer.st... |
0a61ba4b9e3de378b1ae18f0b8dced431788cf74 | 1,943 | [
242592509
] | [
"phoenix",
"ecto"
] | defmodule ContactWeb.MediaTypeController do
use ContactWeb, :controller
alias Contact.Data
alias Contact.Data.MediaType
def index(conn, _params) do
media_types = Data.list_media_types()
render(conn, "index.html", media_types: media_types)
end
def new(conn, _params) do
changeset = Data.change_... |
0a620c9181815f98861c8bcde0281b7df3a85e16 | 2,859 | [
527104719
] | [
"documented"
] | defmodule HLS.IFrameStreamInf do
# type: :tag,
# tag_name: "EXT-X-I-FRAME-STREAM-INF",
# value: "AVERAGE-BANDWIDTH=183689,BANDWIDTH=187492,CODECS=\"avc1.64002a\",RESOLUTION=396x224,URI=\"v7/iframe_index.m3u8\"",
# attributes: %{
# "AVERAGE-BANDWIDTH" => "183689",
# "BANDWIDTH" => "187492",
# "CODECS... |
0a623a9228ddc156f9616c53792c8ce5e5f136ff | 4,132 | [
229193972
] | [
"typespec",
"ecto"
] | defmodule ExOpenTravel.Request.PCIProxies.ChannexPCI do
alias ExOpenTravel.Request
alias ExOpenTravel.Request.Helpers
@pci_url "https://pci.channex.io/api/v1/capture"
@type options :: keyword() | any()
@spec proxy_send({String.t(), map()}, map(), options) ::
{:ok, map(), map()} | {:error, map(), m... |
0a625ffe8992083a3801925847d0aea8148e57a0 | 1,776 | [
580470778
] | [
"liveview"
] | defmodule Palette.Components.Sidebar.Panel do
use Phoenix.Component
slot(:inner_block, required: true)
def sidebar_panel(assigns) do
assigns =
assigns
|> assign_new(:title, fn -> "Home" end)
~H"""
<div class="sidebar-panel">
<div class="flex h-full grow flex-col bg-white pl-[var(-... |
0a62eb387eb2e44374b391b9c3a8e2f2241df436 | 1,746 | [
190667844,
171961091
] | [
"test",
"phoenix"
] | defmodule Artemis.CreateAuthProviderTest do
use Artemis.DataCase
import Artemis.Factories
alias Artemis.CreateAuthProvider
describe "call!" do
test "returns error when params are empty" do
assert_raise Artemis.Context.Error, fn ->
CreateAuthProvider.call!(%{}, Mock.system_user())
end
... |
0a635c0bb52fd9ba8bd703998eb97ce83004e876 | 2,822 | [
257787813
] | [
"ecto"
] | defmodule Domain.Policies.Condition.Changeset do
use Domain, :changeset
alias Domain.Policies.Condition
def changeset(%Condition{} = condition, attrs, _position) do
condition
|> cast(attrs, [:property, :operator, :values])
|> put_default_value(:property, :remote_ip_location_region)
|> put_default... |
0a63973bcca474ecff2f9946994dfb4d94b3a408 | 2,158 | [
705052460
] | [
"test"
] | defmodule Inter.TokenManagerTest do
use ExUnit.Case, async: false
alias Inter.TokenManager
alias Inter.Client
import Mox
setup :set_mox_global
setup do
# Client "fake" para testar
client = %Client{
token: "initial_token",
client_id: "fake_id",
client_secret: "fake_secret",
... |
0a63bc716f3547ab9faaa41e854159366866d48d | 3,303 | [
351899007
] | [
"liveview",
"documented",
"ecto"
] | defmodule HygeiaWeb.OrganisationLive.Choose do
@moduledoc false
use HygeiaWeb, :surface_live_component
import Ecto.Query
alias Hygeia.OrganisationContext
alias Hygeia.OrganisationContext.Organisation
alias Hygeia.Repo
alias Phoenix.HTML.FormData
alias Surface.Components.Form
alias Surface.Component... |
0a64a17f6198baece6314392e7da4331ce0c0c8e | 2,502 | [
732545913,
740885881,
673306104,
762541145,
865067234,
666326648,
791013482
] | [
"test",
"phoenix"
] | defmodule DiscussWeb.CommentControllerTest do
use DiscussWeb.ConnCase
import Discuss.DiscussionsFixtures
@create_attrs %{content: "some content"}
@update_attrs %{content: "some updated content"}
@invalid_attrs %{content: nil}
describe "index" do
test "lists all comments", %{conn: conn} do
conn ... |
0a64a86bad459d21723ebae4ca4debd366d2b9db | 20,328 | [
592820688
] | [] | %{
"acceptor_pool": {:hex, :acceptor_pool, "1.0.0", "43c20d2acae35f0c2bcd64f9d2bde267e459f0f3fd23dab26485bf518c281b21", [:rebar3], [], "hexpm", "0cbcd83fdc8b9ad2eee2067ef8b91a14858a5883cb7cd800e6fcd5803e158788"},
"castore": {:hex, :castore, "0.1.22", "4127549e411bedd012ca3a308dede574f43819fe9394254ca55ab4895abfa1a2... |
0a64fb76f1e7dc7f8e609138ec57bd317c427619 | 1,922 | [
351899007
] | [
"documented"
] | # credo:disable-for-this-file Credo.Check.Readability.Specs
defmodule Hygeia.Repo.Migrations.CreateStatisticsNewCasesPerDay do
@moduledoc false
use Hygeia, :migration
def change do
execute(
"""
CREATE MATERIALIZED VIEW statistics_new_cases_per_day
(tenant_uuid, type, sub_type, date, coun... |
0a6558f20c3b87a4c78b3d6eacb87082a73b5367 | 1,670 | [
168377385
] | [] | defmodule Ello.Core.Contest.Preload do
alias Ello.Core.{
Repo,
Contest,
Content,
}
alias Contest.ArtistInvite
def artist_invites(nil, _), do: nil
def artist_invites([], _), do: []
def artist_invites(artist_invites, _) do
artist_invites
|> build_image_structs
end
defp build_image_s... |
0a65689cde8b96f160c31f2ec90ef2693305d18f | 1,626 | [
220594881
] | [
"macro",
"documented",
"phoenix"
] | defmodule TsheetWeb 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 TsheetWeb, :controller
use TsheetWeb, :view
The definitions below will be executed for every view,
controller, etc... |
0a65c8add0598324bab6b0d4fd05b41f638d263f | 1,940 | [
120321295
] | [] | # 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.
import Config
config :elixir, :time_zone_database, Tz.TimeZoneDatabase
# General application configurat... |
0a661bc0609912b6de780fadebf8fe6352ef4978 | 3,197 | [
90559172
] | [
"genserver"
] | defmodule WebApi.RequestConsumer do
use GenServer
use AMQP
alias WebApi.{RequestConductor, Widget, Repo, WebsocketClient, Producer}
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, :ok, opts)
end
def init(_opts) do
:erlang.send_after(5000, self(), :listen)
{:ok, []}
end
def... |
0a6640aec490ce15925604e9f0dbd2e07acbb309 | 6,291 | [
63643631,
63304973,
63885140,
67626331,
63335915
] | [
"typespec",
"macro",
"documented"
] | defmodule Ecto.Query.Builder.Join do
@moduledoc false
alias Ecto.Query.Builder
alias Ecto.Query.JoinExpr
@doc """
Escapes a join expression (not including the `on` expression).
It returns a tuple containing the binds, the on expression (if available)
and the association expression.
## Examples
... |
0a66a1c66f209d21a124bc29286cb2602d6650ab | 3,220 | [
349713367
] | [
"ecto"
] | defmodule VirtualOffice.Communication.Conversation do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query, warn: false
alias VirtualOffice.Repo
alias VirtualOffice.Communication.Conversation
alias VirtualOffice.Communication.ConversationUser
alias VirtualOffice.Communication.Message
@derive {Jason... |
0a670cbb0a9cdf0e70af08dc01a3dbdd3011dc58 | 3,408 | [
162775566
] | [] | defmodule Vesperia.Cooking.RecipeConflictFinder do
@recipes Vesperia.Info.Recipes.recipes()
@ingredients_used_in_recipes Vesperia.Info.Recipes.ingredients_used_in_recipes()
@ingredient_types Vesperia.Info.Ingredients.ingredient_types()
@ingredients_by_type Vesperia.Info.Ingredients.ingredient_groups()
def fi... |
0a67424e1580d3adcf2d23eeb44931285430c41e | 2,652 | [
190238737,
67430779
] | [
"test"
] | defmodule KVX.Bucket.ShardsTest do
use ExUnit.Case
use KVX.Bucket
doctest KVX
@bucket __MODULE__
require Ex2ms
setup do
@bucket = @bucket
|> new([n_shards: 4])
|> flush
on_exit fn ->
assert_raise ArgumentError, fn ->
@bucket
|> delete
|> find_all
end
... |
0a68b9dddb0eaad0c3b491d77538654001bace31 | 2,418 | [
119242296
] | [
"genserver",
"documented"
] | # https://medium.com/elixirlabs/registry-in-elixir-1-4-0-d6750fb5aeb
# https://github.com/amokan/registry_sample
defmodule Neko.UserHandler do
@moduledoc false
use GenServer
require Logger
@registry_name Application.get_env(:neko, :user_handler_registry)[:name]
# how long request can wait in the queue to be... |
0a68cc9b6ea9221d29f47405f5964f016ee425c5 | 9,537 | [
1015503420
] | [
"documented",
"ecto"
] | defmodule Blogging.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :binary_id, autogenerate: true}
@derive {Phoenix.Param, key: :id}
@foreign_key_type :binary_id
schema "users" do
field :email, :string
field :username, :string
field :password, :string, virtual: true, r... |
0a6914d95fe6d85926d8fde92b314fb94eeab2e0 | 3,692 | [
155310343
] | [
"phoenix",
"ecto"
] | defmodule DavosCharityApiWeb.PaymentController do
use DavosCharityApiWeb, :controller
alias DavosCharityApi.Donor
alias DavosCharityApi.Donation
alias DavosCharityApi.Donation.Payment
alias DavosCharityApi.Receipt
alias IEx
def create(conn, %{"data" => data = %{"type" => "payments", "attributes" => %{"... |
0a69268ab1d5f1609a1ff687a51448292fac3218 | 6,017 | [
481879028
] | [] | defmodule Cluster.Node do
import Emulation, only: [send: 2, whoami: 0]
import Kernel,
except: [spawn: 3, spawn: 1, spawn_link: 1, spawn_link: 3, send: 2]
require Logger
@snapshot_timeout 500
defstruct(
resource: nil,
# FCFS task_queue
task_queue: nil,
log: nil,
trace_log_file: nil,
... |
0a694a26e0be7fed8f3d68c022b474054ea73150 | 5,012 | [
41227823,
44181278,
75696014,
41243642
] | [
"documented",
"phoenix"
] | defmodule Phoenix.Transports.WebSocket do
@moduledoc """
Socket transport for websocket clients.
## Configuration
The websocket is configurable in your socket:
transport :websocket, Phoenix.Transports.WebSocket,
timeout: :infinity,
serializer: Phoenix.Transports.WebSocketSerializer,
... |
0a69a4b0dc7ef56f6cd2f461e1191b6a83344373 | 19,540 | [
796226129
] | [
"test"
] | Code.require_file("../../test_helper.exs", __DIR__)
defmodule Mix.Tasks.TestTest do
use MixTest.Case
describe "ex_unit_opts/1" do
test "returns ex unit options" do
assert ex_unit_opts_from_given(unknown: "ok", seed: 13) == [seed: 13]
end
test "returns includes and excludes" do
included = ... |
0a69af757f6086dbdb18e39fdebda0abc4456a9d | 5,900 | [
113021157
] | [
"test",
"ecto"
] | defmodule Associations.BlogsTest do
use Associations.DataCase
alias Associations.Blogs
describe "posts" do
alias Associations.Blogs.Post
@valid_attrs %{body: "some body", is_published: true, title: "some title", views: 42}
@update_attrs %{body: "some updated body", is_published: false, title: "some... |
0a69e3cbe765a9ef9b6fb2a668f9ad4f35db175c | 3,790 | [
389718079
] | [
"typespec",
"documented",
"ecto"
] | defmodule Screenplay.PaMessages.PaMessage do
@moduledoc """
Represents a PA Message that will be retrieved by RTS to play audio in stations.
"""
use Ecto.Schema
import Ecto.Changeset
@derive {Jason.Encoder, except: [:__meta__]}
@type message_type :: nil | :psa | :emergency
@type t() :: %__MODULE__{
... |
0a6a640e51c4219e9478a9b699f13c06b5425831 | 2,898 | [
595821359
] | [
"test"
] | defmodule TuningTroubleTest do
use ExUnit.Case
@packet_marker_length TuningTrouble.marker[:packet][:marker_length]
@message_marker_length TuningTrouble.marker[:message][:marker_length]
test "find first packet marker" do
assert TuningTrouble.marker(String.to_charlist(""), [], @packet_marker_length) == nil
... |
0a6a93c89d7f9e15af3b37d7f01617758aed9aeb | 3,205 | [
742555614
] | [
"phoenix",
"ecto"
] | defmodule FruitPickerWeb.AgencyController do
use FruitPickerWeb, :controller
alias FruitPicker.Partners
alias FruitPicker.Partners.{Agency}
alias FruitPicker.Accounts.{Person, Profile}
alias FruitPickerWeb.{PersonController, Policies}
plug(Policies, :is_agency when action in [:mine, :new, :edit, :udpate])... |
0a6b51b036f4ddb2342b26ee72a0606d9265e621 | 1,744 | [
408524755
] | [
"phoenix"
] | defmodule StatsWeb.PageController do
use StatsWeb, :controller
alias Stats.Stats
@sort_key "sort_by"
@sort_by_total_rushing_yards "Yds"
@sort_by_total_rushing_touchdowns "TD"
@sort_by_longest_rush "Lng"
@sort_by_default_sort "Player"
def index(conn, _params) do
conn = Plug.Conn.fetch_query_params... |
0a6bc6b1397d07b6984de773130e1a35a22d26d5 | 9,526 | [
47938846
] | [] | data = "v>v<vvv<<vv^v<v>vv>v<<<^^^^^<<^<vv>^>v^>^>^>^>^><vvvv<^>^<<^><<<^vvvv>^>^><^v^><^<>^^>^vvv^<vv>>^>^^<>><>^>vvv>>^vv>^<><>^<v^>^>^><vv^vv^>><<^><<v>><>^<^>>vvv>v>>>v<<^<><^<v<>v>^^v^^^<^v^^>>><^>^>v<>^<>>^>^^v^><v<v>>><>v<v^v>^v<>>^><v>^<>v^>^<>^v^^^v^^>>vv<<^^><^<vvv>^>^^<^>>^^^^^v^<v>vv<>>v^v<^v^^<><^<^vv^><>>... |
0a6bd6a8772a3165753e87d2d26326ecfc6909e2 | 1,946 | [
319456543
] | [] | defmodule Day10 do
def part1 do
grid = grid()
{{x,y} = first, _} = Enum.find(grid, fn {_coords, val} -> val == "S" end)
second = cond do
grid[{x, y - 1}] in ["|", "7"] ->
{x, y - 1}
grid[{x + 1, y}] in ["-", "7"] ->
{x + 1, y}
grid[{x, y + 1}] in ["|", "J"] ->
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.