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 |
|---|---|---|---|---|
051788e916359fcddf0ca0884454d405c03250ab | 3,763 | [
910241206
] | [
"typespec",
"documented"
] | defmodule FlyMachineClient.Volumes do
@moduledoc """
API client for managing Fly.io volumes.
"""
import FlyMachineClient.Helpers
@doc """
List all volumes associated with a specific app.
"""
@spec list(app_name :: String.t(), opts :: keyword(), FlyMachineClient.options()) ::
FlyMachineClient... |
05179f9db83d03f2a20811ca86de92eba2ae2e4c | 2,645 | [
155104682
] | [
"genserver"
] | defmodule ColorCycling.Component.ColorCycling.Palette do
use ScenicME.Component
alias Scenic.Graph
import Scenic.Primitives, only: [{:rect, 3}, {:group, 3}, {:update_opts, 2}]
def verify(pid) when is_pid(pid), do: {:ok, pid}
def verify({scene, _} = data) when is_atom(scene), do: {:ok, data}
def verify(_),... |
0517def97d8ad28c5563b32cc21b28b1cae6103a | 3,743 | [
953221956
] | [
"typespec",
"documented"
] | defmodule Rizz.Builder do
@moduledoc """
Handles the generation of RIZZ-compliant XML from Feed structs.
"""
alias Rizz.Feed
require SweetXml
@doc """
Converts a Feed struct to RIZZ-compliant XML.
## Example
iex> feed = Rizz.Feed.new(title: "AI News", link: "https://example.com", description: ... |
0518b2c3173faf2de6fc587bde78422f0f64d007 | 4,977 | [
697935185
] | [
"test",
"ecto"
] | defmodule WarehouseEx.BatcherTest do
use WarehouseEx.BatcherCase
alias WarehouseEx.Batcher
alias WarehouseEx.BatcherSup
alias WarehouseEx.BatchedEvent
alias WarehouseEx.Client
use Mimic
describe "BatcherSup" do
setup do
pid = start_supervised!(BatcherSup)
{:ok, pid: pid}
end
test... |
0518b3567ac6360f491e9e785dafb230c4cf5fa3 | 1,777 | [
317493744
] | [] | %{
"benchee": {:hex, :benchee, "1.2.0", "afd2f0caec06ce3a70d9c91c514c0b58114636db9d83c2dc6bfd416656618353", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm",... |
0518b74012554e1ddcd75f674576dc09855e7c0f | 3,071 | [
627213057
] | [
"documented"
] | defmodule DAOSystemBasedOnGithub.Contracts.DorahacksGrantInteractor do
@moduledoc """
See Examples in Web3_Aptos_Ex
"""
alias Web3AptosEx.Aptos.RPC
import Web3AptosEx.Aptos
alias Web3AptosEx.Aptos
alias DAOSystemBasedOnGithub.Project
@contract_addr Constants.get_dorahacks_grant_addr... |
0519a330951489ff4cb70c427be177e665f6b39b | 3,776 | [
583397737
] | [
"test",
"phoenix"
] | defmodule UserApiV3Web.UserControllerTest do
use UserApiV3Web.ConnCase
import UserApiV3.AccountsFixtures
alias UserApiV3.Accounts.User
@create_attrs %{
birthdate: "some birthdate",
id_auth0: "some id_auth0",
language: "some language",
last_name: "some last_name",
middle_name: "some middle... |
0519b3a4a7db47f0a272dec6177d3eabd40c99be | 3,989 | [
660355954
] | [
"test",
"ecto"
] | defmodule Pento.FAQTest do
use Pento.DataCase
alias Pento.FAQ
describe "questions" do
alias Pento.FAQ.Question
import Pento.FAQFixtures
@invalid_attrs %{question_text: nil, vote_count: nil}
test "list_questions/0 returns all questions" do
question = question_fixture()
assert FAQ.l... |
051a9e093018780e5385bcb3182b8b616badf90b | 1,933 | [
229928630
] | [
"phoenix",
"ecto"
] | defmodule SchoolWeb.StudentController do
use SchoolWeb, :controller
alias School.RRBP
alias School.RRBP.Student
alias School.Repo
def index(conn, params) do
#students = RRBP.list_students()
page = Student
|> Repo.paginate(params)
#render(conn, "index.html", students: students)
render(conn, "ind... |
051b1317118afd8930c55181d4da1a7db9171bce | 3,767 | [
964614213
] | [
"liveview"
] | defmodule KanbanWeb.ThemeTestLive do
use KanbanWeb, :live_view
import Phoenix.HTML.Form
def mount(_params, _session, socket) do
# Create a form using a basic map with Phoenix.Component.to_form/1
form = to_form(%{"text" => "", "select" => "", "checkbox" => false, "textarea" => ""})
{:ok, assign(s... |
051b5b5c15d09865da46933b536fec3f6f7bd50f | 1,860 | [
64636257
] | [
"genserver",
"supervisor"
] | defmodule Test 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
# Define workers and child supervisors to be supervised
children = [
# Starts a worker ... |
051b6781bd0a1ba3a674c7e8783eede6abb7e293 | 2,566 | [
305091318
] | [
"documented",
"ecto"
] | defmodule RiddlerAdmin.Workspaces do
@moduledoc """
The Workspaces context.
"""
import Ecto.Query, warn: false
alias RiddlerAdmin.Repo
alias RiddlerAdmin.Workspaces.Workspace
def generate_definition!(workspace_id) when is_binary(workspace_id) do
map =
Workspace
|> preload([:conditions, ... |
051bcc47fd319385c05616a3ab988ed73ea7fbfc | 4,107 | [
263249309
] | [] | %{
"cowboy": {:hex, :cowboy, "2.7.0", "91ed100138a764355f43316b1d23d7ff6bdb0de4ea618cb5d8677c93a7a2f115", [:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
"cowlib": {:hex, :cowlib, "2.8.0", "fd0ff1787db... |
051bd0fbc2d1dd6f4daa64c4f1cfacc9e68636c5 | 2,939 | [
113948285
] | [] | defmodule KVServer do
import Application
def hello do
:world
end
def put(key, value) do
case [valid_key?(key), valid_value?(value)] do
[true, true] ->
call_worker(choose_worker(key), :put, [key, value])
[false, true] ->
{:error, {:bad_args, %{key: key}}}
[t... |
051c06900d7dd6391e708839d13d0c0a208305c7 | 5,550 | [
1013321258
] | [
"documented"
] | defmodule RubberDuck.Memory.UserProfile do
use Ash.Resource,
otp_app: :rubber_duck,
domain: RubberDuck.Memory,
data_layer: AshPostgres.DataLayer
@moduledoc """
Long-term memory storage for user profiles and preferences.
Uses PostgreSQL for persistence across sessions.
"""
postgres do
table... |
051c1679c46e0003b7a388a94b5b4a686bdb3fc3 | 2,219 | [
781598071
] | [] | defmodule ExtractSummoners do
alias RiotApiCalls, as: Calls
@behaviour ExtractSummonersBehaviour
def get_puuid(name, region) do
cond do
is_invalid_region?(region) ->
{:error,
"Invalid region. Try a popular region like 'KR' (Korea), 'NA1' (North America) or 'TW2' (Taiwan)"}
true... |
051c37573f4d4cd1e761ecaf7278637752a0c2d2 | 2,762 | [
86259154
] | [
"documented"
] | defmodule StripePost.Url do
@moduledoc """
Generate the appropriate StripePost URL based on the sending
domain, and the desired resource.
"""
@base_url "https://api.stripe.com/v1"
alias StripePost.Opts
@doc """
The API url for your domain, configurable using several `opts`
(Keyword list of options)... |
051c49be886d89f2bf423392606f3b3fb122c0fc | 4,952 | [
160617949
] | [
"test",
"phoenix"
] | defmodule NestedformWeb.InternetConnectionControllerTest do
use NestedformWeb.ConnCase
alias Nestedform.Stores
@create_attrs %{account_password: "some account_password", account_pin: 42, account_username: "some account_username", int_conn_type: "some int_conn_type", isp: "some isp", isp_account: "some isp_accou... |
051c4e6922b817886b93009d22bef5d35056fbf3 | 6,337 | [
106712767
] | [
"genserver",
"liveview",
"ecto"
] | defmodule SanbaseWeb.TweetsPredictionLive do
use SanbaseWeb, :live_view
alias Sanbase.TweetsApi
alias Sanbase.TweetPrediction
import SanbaseWeb.TweetPredictionComponents
@impl true
def mount(_params, _session, socket) do
if connected?(socket) do
# Initial fetch on page load
send(self(), :f... |
051c737c47c25c14e39eb74cd633bb2561d5b07c | 10,842 | [
49414920
] | [
"documented"
] | ## These are the components for the stream library
defmodule FastTS.Stream do
alias RiemannProto.Event
# TODO: I think the block need to be able to receive the module
# the pipeline is living in to read module attributes, to pass or
# overload special configuration informations
# == Output functions =... |
051c90266c63f984bdaf64f3875bd3a67528ab22 | 3,405 | [
198671935
] | [
"documented",
"ecto"
] | defmodule Horizon.Schema.Upload do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias __MODULE__, as: Upload
alias Horizon.Schema.Blob
@primary_key {:id, Ecto.UUID, autogenerate: true}
@default_content_type "application/octet-stream"
schema "uploads" do
field :filename, :string, size:... |
051ca4c635530eb3c5c7205c519c0735ac0c8cf7 | 2,516 | [
66467062,
87683657,
99106424,
87457687,
207847106,
297237670,
77253880,
86030418,
95605888,
123950289,
77785313,
86063602,
63643631,
70405590,
72784914,
96857265,
71519558,
73516692,
80629259,
86415043,
133864047,
145635147,
242077992,
17908039,
68463570,
80284638,
... | [
"documented",
"phoenix"
] | defmodule Phoenix.Logger do
@moduledoc """
Instrumenter to handle logging of various instrumentation events.
## Parameter filtering
When logging parameters, Phoenix can filter out sensitive parameters
in the logs, such as passwords, tokens and what not. Parameters to
be filtered can be added via the `:fil... |
051d0e0d28b6250650d014a25f7ad4b95345ac36 | 4,428 | [
649439520
] | [
"test"
] | defmodule Gameplatform.AccountTest do
use Gameplatform.DataCase
alias Gameplatform.Account
alias Gameplatform.ApiToConfig
alias Gameplatform.Test.Support.Helpers.Helper
alias Gameplatform.Accounts.Schema.User
import Gameplatform.Factory
describe "create new user/1" do
test "creation fails on missin... |
051d3222cf95605ff82a3b3f5eb3ad5a43827fe7 | 2,144 | [
910378071
] | [
"documented"
] | # lib/game_2048/game.ex
defmodule Game2048.Game do
@moduledoc """
Game logic for 2048
"""
def new_game do
empty_board()
|> add_random_tile()
|> add_random_tile()
end
def empty_board do
List.duplicate(0, 16)
end
def add_random_tile(board) do
empty_positions = Enum.with_index(board)... |
051d3930858442ed53a6f28b2a727590f9e164a2 | 14,082 | [
577855876
] | [
"documented"
] | defmodule Aquebra.Logistic do
@moduledoc """
The Logistic context.
"""
import Ecto.Query, warn: false
alias Aquebra.Repo
alias Aquebra.Logistic.Document
def list_documents do
Repo.all(Document)
end
def get_document!(id), do: Repo.get!(Document, id)
def create_document(attrs \\ %{}) do
%... |
051d5aa42eeb079af4a459c08ef8e39fb0c9a96d | 9,743 | [
575873463,
569522840
] | [
"genserver",
"liveview",
"documented"
] | defmodule Logger.Backends.Console do
@moduledoc ~S"""
A logger backend that logs messages by printing them to the console.
## Options
* `:level` - the level to be logged by this backend.
Note that messages are filtered by the general
`:level` configuration for the `:logger` application first.
... |
051d86f393de0e76972bbb7069fcdd7da5234e0f | 2,298 | [
498675807
] | [
"ecto"
] | defmodule AppCount.Exports.Utils.Documents do
alias AppCount.Repo
alias AppCount.Exports.Document
alias AppCount.Exports.Recipient
import Ecto.Query
def insert_document(params) do
%Document{}
|> Document.changeset(params)
|> Repo.insert()
|> maybe_send_to_recipients(params)
end
def updat... |
051d98548ae21f6c46080d765e66e102d4757b1f | 4,284 | [
403222903
] | [
"phoenix",
"ecto"
] | defmodule TokaiMonitorBackend.VideoStatisticCollector.Service.VideoStatisticService do
import Ecto.Query, only: [from: 2]
import TokaiMonitorBackend.TokaiMonitorCommon.Helper.ConditionHelper, only: [if_not_nil: 2]
alias TokaiMonitorBackend.TokaiMonitorDB.Schema.{Video, VideoStatistic}
def switch_is_latest_to_f... |
051f0da6222a1550a21e0ac48e0a8a0c45a0a6a9 | 2,351 | [
253283791
] | [
"test",
"documented",
"phoenix"
] | defmodule FoodGeekWeb.My.PublicationControllerTest do
use FoodGeekWeb.ConnCase
use FoodGeekWeb.AuthorizedCase
@moduledoc logged_as: "<EMAIL>"
setup %{conn: conn} do
chef = conn.assigns.current_user
published_at = TestHelper.truncated_date_time()
draft = insert!(:recipe, chef: chef)
published ... |
05200635784b77732c3f738dfabc2ebd4a9f2b1a | 3,325 | [
798315490
] | [
"liveview",
"test"
] | defmodule SkoolWeb.CourseLiveTest do
use SkoolWeb.ConnCase
import Phoenix.LiveViewTest
import Skool.CoursesFixtures
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
defp create_course(_) do
course = course_fixture()
%{course: course}
en... |
0520171eed8d52c3557fd6529f7162286282ac17 | 16,467 | [
198546741,
207503388,
286403536,
206622886,
183581270,
269555512,
211908555,
184338071,
210409473,
196217759,
183450017
] | [
"typespec",
"macro",
"documented"
] | defmodule Guardian.Token.Jwt do
@moduledoc """
Deals with things JWT
This module should not be used directly.
It is intended to be used by Guardian on behalf of your implementation
as it's token module.
Token types are encoded in the `typ` field.
### Configuration
Configuration should be added to the... |
05202143f2e3f659f8d804254cae61d489b1e0af | 2,593 | [
743304438
] | [
"liveview",
"documented",
"ecto"
] | defmodule EasyBillsWeb.UserRegistrationLive do
@moduledoc false
use EasyBillsWeb, :live_view
alias EasyBills.Accounts
alias EasyBills.Accounts.User
alias EasyBillsWeb.OnboardingLive.Shared.SharedComponents
alias EasyBillsWeb.OnboardingLive.UserRegistration
@impl Phoenix.LiveView
def mount(_params, _s... |
05206be1feaaf8740bd308282bad59f1bb9477bd | 2,185 | [
239822890,
419435907,
376959663,
459291087
] | [
"typespec",
"documented"
] | defmodule Oli.Delivery.Attempts.PageLifecycle.AttemptState do
@moduledoc """
The complete state of a page attempt
resource_attempt - The resource attempt record itself
attempt_hierarchy - The state of the activity attempts required for rendering
"""
alias Oli.Delivery.Attempts.Core.ResourceAttempt
ali... |
0520a169e1680841c471e82d39d0508ce016682f | 2,157 | [
432328541
] | [
"liveview"
] | defmodule AocWeb.Year2020.Day2Live do
use AocWeb, :live_view
def mount(_params, _session, socket) do
socket = assign(socket, result_1: "", result_2: "")
{:ok, socket}
end
def render(assigns) do
~H"""
<h1>Day One</h1>
<h3>Part one:</h3>
<p>Find the number of valid passwords. Each passwo... |
0520cdf3d2371a7fc32479ca037fd198673e74c2 | 4,860 | [
906430058
] | [] | defmodule FeelEx.UnaryParser do
require Logger
alias FeelEx.{Token, Parser, Helper, Expression}
def parse_unary_expression(tokens) do
tokens =
if List.last(tokens).type == :eof do
List.delete_at(tokens, -1)
else
tokens
end
cond do
hd(tokens).type == :left_square_b... |
05217d1469b353f32059195ed837fa8b651772af | 2,617 | [
423848082
] | [
"phoenix",
"documented"
] | defmodule KefisWeb.Auth do
import import Phoenix.Controller, only: [redirect: 2]
alias KefisWeb.Router.Helpers, as: Routes
alias KefisWeb.Router.Helpers, as: Routes
import Phoenix.Controller
import Plug.Conn
@moduledoc """
Plug that associates
"""
def init(opts) do
opts
end
def call(conn, _... |
0521992fd1d7289820c6b4c9a0eb9af5f367033a | 2,714 | [
573119086
] | [
"test"
] | defmodule AdventOfCode.Day13Test do
use ExUnit.Case
import AdventOfCode.Day13
describe "in_order? list of integers" do
test "in order" do
input = [[1, 1, 3, 1, 1], [1, 1, 5, 1, 1]]
result = in_order?(input)
assert result == true
end
test "out of order" do
input = [[1, 1, 5... |
0521ca034e566e3ebac3ceb97403f2a4b4592f34 | 2,674 | [
481236614
] | [
"test"
] | defmodule ExMon.Game.ActionTest do
use ExUnit.Case
import ExUnit.CaptureIO
alias ExMon.{Game, Player}
alias ExMon.Game.Actions
describe "heal/0" do
setup do
player = Player.build("Leo", :kick, :punch, :heal)
computer = Player.build("Crazy Rooster", :kick, :punch, :heal)
capture_io(fn... |
05226682c59aa02f37762282cdc67fec804190b7 | 7,038 | [
523955946
] | [
"typespec",
"documented"
] | defmodule AshGenServer.DataLayer do
@moduledoc """
An Ash Datalayer backed by individual GenServers.
If you merely want in-memory storage of resources then take a look at
`Ash.DataLayer.Ets`.
## Caveats
* When a resource using this datalayer is created it spawns an instance of
`AshGenServer.Server` a... |
0522c691fe070ac4bae592f157aae9244335e246 | 4,901 | [
981067434
] | [
"documented"
] | defmodule AshCommanded.Commanded.Transformers.GenerateDomainRouterModule do
@moduledoc """
Generates a domain-specific router module based on the commands defined in a domain's resources.
For each Ash.Domain containing resources with commands, this transformer will generate
a domain router module that:
... |
05231bbb14137ae91642a8c94b1cf9f2e846eda7 | 19,599 | [
567369526
] | [] | import Config
import Bitwise
indexer_memory_limit_default = 1
indexer_memory_limit =
"INDEXER_MEMORY_LIMIT"
|> System.get_env(to_string(indexer_memory_limit_default))
|> Integer.parse()
|> case do
{integer, ""} -> integer
_ -> indexer_memory_limit_default
end
config :indexer,
memory_limit: index... |
05233c7f561fbf1ac278f86e84b84be6bf7c5c3a | 3,065 | [
239586175
] | [] | defmodule BenchVersion do
import Kernel, except: [match?: 2]
def lexer(string) do
string
|> Version.Parser.lexer([])
|> Enum.map(fn
op when is_atom(op) -> op
version when is_binary(version) -> elem(Version.Parser.parse_version(version, true), 1)
end)
end
def match?(version, string,... |
05234a1124d67f1918e0cde8a6fe02fe0dfdb6ec | 8,848 | [
279715065
] | [
"test"
] | Code.require_file("../test_helper.exs", __DIR__)
defmodule Mix.RebarTest do
use MixTest.Case
# rebar_dep and git_rebar are loaded dynamically
@compile {:no_warn_undefined, [:rebar_dep, :git_rebar]}
defmodule RebarAsDep do
def project do
[
app: :rebar_as_dep,
version: "0.1.0",
... |
0523bef8a61e0614e0de653be696ca7ddc03f8fc | 4,674 | [
911264133
] | [
"test"
] | defmodule Lux.Agent.Companies.DefaultImplementationTest do
use UnitCase, async: true
alias Lux.Agent.Companies.SignalHandler.DefaultImplementation
alias Lux.AgentHub
alias Lux.Schemas.Companies.ObjectiveSignal
alias Lux.Schemas.Companies.TaskSignal
alias Lux.Signal
describe "signal routing" do
setup... |
0523dd876d39902951d1b00f3eec5cf216ba89db | 3,476 | [
168753881,
333694281
] | [
"test",
"phoenix"
] | defmodule CforumWeb.AdventCalendarControllerTest do
use CforumWeb.ConnCase
alias CforumWeb.Router.Helpers, as: Routes
setup [:setup_login]
describe "index_years" do
test "lists all years with advent_calendar_days", %{conn: conn} do
insert(:advent_calendar_day, date: %Date{year: 2019, month: 12, day... |
0524035dae33ca17cbfa97bb24111d68d192156e | 3,401 | [
523176488
] | [
"documented",
"ecto"
] | defmodule Panic.Repo.Migrations.MigrateUserTokensToApiTokens do
@moduledoc """
Migrates existing user tokens to the new APIToken resource.
This migration:
1. Creates an APIToken for each user that has at least one token
2. Copies all token values from the user to the new APIToken
3. Creates the join table ... |
0524f6075ba4624e74ca1fe1757144b19886e75a | 2,921 | [
125679223
] | [
"test"
] | defmodule MovieWagerBackendWeb.RoundControllerTest do
use MovieWagerBackendWeb.ConnCase
alias MovieWagerBackend.Movie
alias MovieWagerBackend.Movie.Round
@create_attrs %{box_office_amount: 42, code: "some code", end_date: ~D[2010-04-17], start_date: ~D[2010-04-17], title: "some title"}
@update_attrs %{box_o... |
052534f0ea685139d1f09f246bcb9138ac014ad5 | 1,891 | [
369557754
] | [
"macro",
"documented",
"phoenix"
] | defmodule TestFigmaWeb 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 TestFigmaWeb, :controller
use TestFigmaWeb, :view
The definitions below will be executed for every view,
contro... |
05257032ed7d38c44c4ed480167e0a7c0b142e0a | 2,132 | [
237380205
] | [
"test"
] | defmodule Exldap.UpdateTest do
use Exldap.UpdateCase
alias Exldap.Update
import Assertions
describe "Add an entry" do
setup %{conn: conn, attrs: attrs} do
result = Update.add(conn, "OU=NewOrgUnit,OU=test,DC=example,DC=org", attrs)
{:ok, [entry]} = conn |> load("OU=NewOrgUnit,OU=test,DC=example,... |
0525f99f9bdd136f223c35f678215dc1178c3e7a | 2,306 | [
131877358
] | [] | defmodule PW.Server do
require Logger
alias State.DataState
def listen(tcp_wrapper \\ :gen_tcp, port_number \\ 5000) do
Logger.info("Opening listener on port #{port_number}")
DataState.new()
case tcp_wrapper.listen(port_number, [:binary, packet: :line, active: false, reuseaddr: true]) do
{... |
05262ce1fd96a5731fb08c545b7ac0d9cbf0cf54 | 7,229 | [
989613741
] | [
"test",
"ecto"
] | defmodule SocialScribe.CalendarTest do
use SocialScribe.DataCase
alias SocialScribe.Calendar
describe "calendar_events" do
alias SocialScribe.Calendar.CalendarEvent
import SocialScribe.CalendarFixtures
import SocialScribe.AccountsFixtures
@invalid_attrs %{
status: nil,
description:... |
05267ce1d5e1354ecb9e514c6c37e21f72515927 | 5,886 | [
188109335
] | [
"typespec",
"documented"
] | defmodule IntSort.Test.Common do
import Mox
alias LargeSort.Shared.IntegerFile
alias LargeSort.Shared.TestData
@moduledoc """
Contains functionality that is used in multiple tests
"""
@doc """
Calculates the chunks that should be created from a chunking operation
## Parameters
- integers: the i... |
05269b2ee6e34b10a2fdf2330c17b6bfc0db5447 | 2,243 | [
830781938
] | [] | defmodule AdventOfCode.Day8 do
import AdventOfCode.Util
import Aja
alias Aja.Vector, as: Vector
defp read_input() do
resource_path("day-8-input.txt")
|> File.stream!()
|> Enum.map(&String.trim/1)
|> Enum.map(fn s -> {String.to_charlist(s), String.length(s)} end)
|> Enum.reduce({Vector.new()... |
05269f81a095ffef47f2736aad56dca7d4666f2d | 3,011 | [
728946693
] | [] | defmodule ReadInput do
def readfile(filename) do
case File.read(filename) do
{:ok, content} -> {:ok, content}
{:error, reason} -> {:error, reason}
end
end
end
defmodule Engine do
def run(filename) do
case ReadInput.readfile(filename) do
{:ok, data} ->
String.split(data, "\... |
0526a9a471b1184aa8a4f6d70f5e3e0f4129f6d1 | 2,555 | [
875295990
] | [
"documented"
] | defmodule Cashu.Serializer.V4 do
@moduledoc """
Serializes v4 tokens with CBOR.
"""
@v4_prefix "cashuB"
@behaviour Cashu.Serializer
alias Cashu.ProofV4
alias Cashu.TokenV4, as: Token
@impl true
def serialize(%Token{} = token, include_witness \\ false) do
{
:ok,
token
|> form... |
0526b5c00a8b1f1a4efdb14cce8343e2dff06a57 | 2,257 | [
43581088
] | [
"typespec",
"documented"
] | defmodule Stripe.SourceTransaction do
use Stripe.Entity
@moduledoc "Some payment methods have no required amount that a customer must send.\nCustomers can be instructed to send any amount, and it can be made up of\nmultiple transactions. As such, sources can have multiple associated\ntransactions."
(
defstru... |
05271635ed4fbf8143a3e22cd9d6aa97f91ab2ae | 18,725 | [
651977372
] | [
"typespec",
"documented"
] | defmodule GoogleApi.YouTube.V3.Api.Playlists do
@moduledoc """
API calls for all endpoints tagged `Playlists`.
"""
alias GoogleApi.YouTube.V3.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@doc """
Deletes a resource.
## Parame... |
0527c71cd3b0d09d838687775b45952e9353890e | 3,290 | [
440585484
] | [
"documented"
] | # https://github.com/phoenixframework/phoenix_live_dashboard/blob/9140f56c34201237f0feeeff747528eed2795c0c/lib/phoenix/live_dashboard/controllers/assets.ex
defmodule Beacon.Web.AssetsController do
@moduledoc false
import Plug.Conn
@brotli "br"
@gzip "gzip"
def init(asset) when asset in [:css_config, :css, ... |
0528207476d8fdeaf43f00fece0e4b8465a71ec7 | 4,229 | [
506916944
] | [
"typespec",
"documented",
"phoenix"
] | defmodule Web3.Contract do
@moduledoc """
Smart contract functions executed by Dispatcher
"""
require Logger
alias Web3.Dispatcher
@spec execute(Map.t() | Keyword.t(), Keyword.t(), Keyword.t()) :: {:ok, [{:ok, any()}, {:error, any()}]}
def execute(request, abi, options) when is_map(request), do: execut... |
052844e5321d569bf699ab202f97032cfd8dee4b | 1,502 | [
369491146
] | [
"genserver",
"liveview"
] | defmodule DemoWeb.UserLive.IndexNav do
use Phoenix.LiveView, layout: {DemoWeb.LayoutView, "live.html"}
alias Demo.Accounts
alias DemoWeb.UserView
alias DemoWeb.Router.Helpers, as: Routes
def render(assigns), do: UserView.render("index_nav.html", assigns)
def mount(_params, _session, socket) do
{:ok, ... |
05292d85e9760b2f7209c4ab9cc4572ebf2fffd0 | 2,206 | [
72776924
] | [
"documented"
] | defmodule OAuth2.Strategy.AuthCode do
@moduledoc """
The Authorization Code Strategy.
http://tools.ietf.org/html/rfc6749#section-1.3.1
The authorization code is obtained by using an authorization server
as an intermediary between the client and resource owner. Instead of
requesting authorization directly... |
052952317ebc1eb98ef3fec38ca58f83a1d806ef | 2,489 | [
723942909
] | [] | defmodule OriginalSlimHandler do
@string :string
@object_start :object_start
@object_key :object_key
@object_end :object_end
@array_start :array_start
@array_end :array_end
# In truth soon it wont matter? We just want a number because you'll cast it to whatever
# per field anway. So like you should alre... |
0529641a525d376e59634ed2b220450733eaee88 | 10,001 | [
978576109
] | [
"documented",
"ecto"
] | defmodule PodcastMcp.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias PodcastMcp.Repo
alias PodcastMcp.Accounts.User
@doc """
Returns the list of users.
## Examples
iex> list_users()
[%User{}, ...]
"""
def list_users do
Repo.all(User)
... |
05296a3ae99c17a4a70a8cb7eb408ebbf92a909f | 2,127 | [
367278931
] | [
"documented"
] | defmodule Google.Ads.Googleads.V18.Services.MutateAssetGroupsRequest do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :customer_id, 1, type: :string, json_name: "customerId", deprecated: false
field :operations, 2,
repeated: true,
type: Google.Ads.Googleads... |
0529ca8e7dfc90ef67d703dfa3132e7c639e4f12 | 1,929 | [
330416065
] | [
"macro",
"documented",
"phoenix"
] | defmodule AuthSampleWeb 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 AuthSampleWeb, :controller
use AuthSampleWeb, :view
The definitions below will be executed for every view,
con... |
052a20a2cf962bf07c7c62f68f103573656bdf14 | 3,165 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Dataflow.V1b3.Model.DisplayData do
@moduledoc """
Data provided with a pipeline or transform to provide descriptive info.
## Attributes
* `boolValue` (*type:* `boolean()`, *default:* `nil`) - Contains value if the data is of a boolean type.
* `durationValue` (*type:* `String.t`, *def... |
052a95edfb2bb4adb52772093bb5faf896e234df | 3,388 | [
317546749
] | [] | defmodule AdventOfCode.Solutions.Y24.Day12 do
alias AdventOfCode.Grid
alias AoC.Input
def parse(input, _part) do
input |> Input.stream!() |> Grid.parse_lines(fn c -> {:ok, <<c>>} end) |> elem(0)
end
def part_one(full_grid) do
regions = compute_regions(full_grid)
regions
|> Enum.map(&cost_p1... |
052b6de42e74e425c4b374576e947567c5354f5a | 3,501 | [
949664843
] | [
"typespec",
"documented"
] | defmodule Raxol.Terminal.Manager.ScreenHandler do
@moduledoc """
Handles screen updates and batch operations.
This module is responsible for:
- Processing screen updates
- Handling batch screen updates
- Managing screen state transitions
- Coordinating with notification system
"""
require Raxol.Core... |
052bbf5e37788da2b9b153d48f55574ce22aa295 | 2,410 | [
609537075
] | [
"genserver"
] | defmodule Hnkeywords.Lambda.Poller do
alias Hnkeywords.Lambda
use GenServer, restart: :temporary
@await_timeout 120_000
def start_link([]) do
GenServer.start_link(__MODULE__, [])
end
def init([]) do
case Application.get_env(:hnkeywords, :poller) do
:lambda -> send(self(), :lambda)
:ti... |
052c0847f0ac4447cd549ca938de143b6a392f82 | 1,637 | [
217150120
] | [
"macro",
"documented",
"phoenix"
] | defmodule NossoChurrascoWeb 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 NossoChurrascoWeb, :controller
use NossoChurrascoWeb, :view
The definitions below will be executed for every... |
052c1f41c136bb21f51bdd9f10e5a816e4f047fa | 2,263 | [
352202394
] | [
"test",
"ecto"
] | defmodule FirstApi.HerosTest do
use FirstApi.DataCase
alias FirstApi.Heros
describe "tb_hero" do
alias FirstApi.Heros.Hero
@valid_attrs %{first_name: "some first_name", last_name: "some last_name", nick_name: "some nick_name"}
@update_attrs %{first_name: "some updated first_name", last_name: "some ... |
052cdc0f993240d76c9b256dddca115aaac09537 | 2,877 | [
405765201
] | [
"macro"
] | defmodule Nats.Rpc.Client do
defmacro __using__(opts \\ []) do
base = __MODULE__
quote do
@opts unquote(opts)
@base unquote(base)
def child_spec(config \\ []) do
%{
id: __MODULE__,
start: {__MODULE__, :start_link, [config]}
}
end
def start_... |
052d5705d5db465a4b1691e8305de13c2aa545be | 2,391 | [
128136110
] | [
"test",
"ecto"
] | defmodule Frmwrk.AuthTest do
use Frmwrk.DataCase
alias Frmwrk.Auth
describe "users" do
alias Frmwrk.Auth.User
@valid_attrs %{email: "some email", name: "some name", provider: "some provider", role: 42, token: "some token"}
@update_attrs %{email: "some updated email", name: "some updated name", prov... |
052d85286bffaec70d4fd60999129ab92753018f | 2,557 | [
734765873
] | [] | import Config
# Configure your database
config :cacheable_liveviews, CacheableLiveviews.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "cacheable_liveviews_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
# For development, we disab... |
052d8ad8dff71729b4d2bc0956016cb23b11734d | 2,038 | [
748495924
] | [
"documented",
"ecto"
] | defmodule Blog.Stories do
@moduledoc """
The Stories context.
"""
import Ecto.Query, warn: false
alias Blog.Repo
alias Blog.Stories.Story
@doc """
Returns the list of stories.
## Examples
iex> list_stories()
[%Story{}, ...]
"""
def list_stories do
Repo.all(Story) |> Repo.prel... |
052ec9308b3492dfd32868f19486246354491078 | 1,617 | [
64084093
] | [
"phoenix"
] | defmodule Server.ClientController do
use Server.Web, :controller
alias Server.Client
def index(conn, _params) do
clients = Repo.all(Client) |> Repo.preload([:appointments])
render(conn, "index.json", clients: clients)
end
def create(conn, %{"client" => client_params}) do
changeset = Client.chan... |
052ed2c18140216161ee3fe7befbf920e12da3e2 | 2,328 | [
177316839
] | [
"test",
"ecto"
] | defmodule NewCareersApi.JobsTest do
use NewCareersApi.DataCase
alias NewCareersApi.Jobs
describe "jobs" do
alias NewCareersApi.Jobs.Job
@valid_attrs %{company: "some company", description: "some description", location: "some location", title: "some title"}
@update_attrs %{company: "some updated com... |
052ed6985d01714c1a7159cb94374eb12674c48f | 4,609 | [
593501021
] | [
"ecto"
] | defmodule Javex.Parser do
alias Javex.ClassFile
alias Javex.ClassFile.{
Attribute,
ConstantPool,
Field,
Method
}
def parse(binary) when is_binary(binary) do
{class_file, _} =
{%ClassFile{}, binary}
|> parse_header()
|> parse_constant_pool()
|> parse_class()
|>... |
052ef422c9b89d461bed9518a3501ad4e260a589 | 2,111 | [
134963600
] | [
"supervisor"
] | defmodule Procon.MessagesProducers.Realtime do
@procon_realtime_topic_name "procon-realtime"
def realtime_topic(), do: @procon_realtime_topic_name
def send_rtevent(
%Procon.Schemas.ProconRealtime{} = event_data,
processor_name,
threshold \\ 1000
) do
key = {
processor_nam... |
052f16856ffdf1094becbf5937fef6d1411de0d0 | 1,732 | [
149497682
] | [
"test"
] | defmodule InfrastructureTest do
use ExUnit.Case
test "Generate SOTT" do
test_sott_response = LoginRadius.Infrastructure.generate_sott()
assert elem(test_sott_response, 0) == :ok
end
test "Generate SOTT 2" do
test_sott_response = LoginRadius.Infrastructure.generate_sott(60)
assert elem(test_sot... |
052fd47098c716d8b0a66ee7d74487a7cb007df1 | 1,580 | [
128101706
] | [
"documented"
] | defmodule Cards do
@moduledoc """
Provides methods for creating and handling a deck of cards
"""
@doc """
Returns a list of strings representing a deck of play cards
"""
def create_deck do
values = ["Ace", "Two", "Three", "Four",
"Five", "Six", "Sevem", "Eight", "Nine", "Ten"]
... |
052fd86b955839713bd1ac9d3177530958eaeed4 | 2,264 | [
346242439
] | [] | defmodule ProductivityReport do
alias ProductivityReport.Parser
@shallow_fields [:all_hours]
@deep_fields [:hours_per_month, :hours_per_year]
def build(file_name) do
file_name
|> Parser.call()
|> Enum.reduce(initialize_report(), &accumulate_fields/2)
end
def fetch_max_from_field(report, fiel... |
053033c352862ea1116e79f97e3a0286385109fb | 2,564 | [
135441726
] | [
"genserver",
"typespec",
"documented"
] | defmodule BShare.Tables do
@moduledoc """
this implments the bike database (ETS) and the genserver interface
"""
use GenServer
@name TABLES
##############
# Client API #
##############
@doc """
"""
@spec start_link(list) :: {atom, pid}
def start_link(opts \\ []) do
GenServer.start_link... |
053095c79754ce75c49c9740a02a64a1882f4c56 | 4,187 | [
289957416,
433464550,
424070340,
257175703,
428417149,
423345662,
452852184,
425181504,
428718186,
421049744,
420734234,
453189145,
415202580,
423134340,
426219018,
443168471,
421526769,
422361906,
421351298,
432297899,
442071574,
453162461
] | [
"genserver",
"documented",
"ecto"
] | defmodule Swoosh.Adapters.Local.Storage.Memory do
@moduledoc ~S"""
In-memory storage driver used by the
[Swoosh.Adapters.Local](Swoosh.Adapters.Local.html) module.
The emails in this mailbox are stored in memory and won't persist once your
application is stopped.
"""
use GenServer
@doc """
Starts t... |
0530a274e93a9182f160c435349ed88b352c5114 | 2,686 | [
438011251
] | [
"phoenix"
] | defmodule CuberacerLiveWeb.UserSettingsController do
use CuberacerLiveWeb, :controller
alias CuberacerLive.Accounts
alias CuberacerLiveWeb.UserAuth
plug :assign_changesets
def edit(conn, _params) do
render(conn, "edit.html")
end
def update(conn, %{"action" => "update_profile", "user" => user_param... |
0530e46cab65b3c7effde11f770c29ab0a5e2f92 | 5,152 | [
792561350
] | [] | #Imanol Santisteban
#24/05/2024
defmodule Lexer2 do
def file_input(path)do
files = File.ls!(path)
Enum.map(files, fn file ->
full_path = Path.join(path, file)
read_file(full_path)
end)
end
# Reads a file and writes syntax-highlighted HTML output.
def read_file(file) do
output = fil... |
0530fd8d5e833a9429267f50686363d3ed8ed96e | 6,435 | [
815530633
] | [
"test",
"ecto"
] | defmodule NefroControl.ControlTest do
use NefroControl.DataCase
alias NefroControl.Control
describe "intakes" do
alias NefroControl.Control.Intake
import NefroControl.ControlFixtures
@invalid_attrs %{timestamp: nil, type: nil, quantity: nil}
test "list_intakes/0 returns all intakes" do
... |
0531337f9c0e1d7e1880a9d760f0ace68296f083 | 13,419 | [
125843928
] | [
"macro",
"test"
] | Code.require_file("../test_helper.exs", __DIR__)
defmodule Kernel.QuoteTest do
use ExUnit.Case, async: true
test "list" do
assert quote(do: [1, 2, 3]) == [1, 2, 3]
end
test "tuple" do
assert quote(do: {:a, 1}) == {:a, 1}
end
test "keep line" do
# DO NOT MOVE THIS LINE
assert quote(locati... |
053221b10456bd51a9b51d36efe44e03999152a8 | 1,607 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.GKEOnPrem.V1.Model.BareMetalAdminStorageConfig do
@moduledoc """
BareMetalAdminStorageConfig specifies the cluster storage configuration.
## Attributes
* `lvpNodeMountsConfig` (*type:* `GoogleApi.GKEOnPrem.V1.Model.BareMetalLvpConfig.t`, *default:* `nil`) - Required. Specifies the config... |
0532a43c9f09de0fddc5ae210ab889d40a207ac0 | 2,128 | [
23784797
] | [
"genserver"
] | # Please consult this page: http://elixir-lang.org/docs/stable/elixir/GenServer.html
# If not enough (and not afraid of Erlang): http://erldocs.com/current/stdlib/gen_server.html?i=0&search=gen_ser#undefined
defmodule Cat do
defstruct name: "", color: :green, description: nil
end
defmodule KittyShop do
use GenS... |
05335aad7a09dbfca8ad8aadedcc724b57312bf3 | 1,618 | [
229928630
] | [
"macro",
"documented",
"phoenix"
] | defmodule SchoolWeb 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 SchoolWeb, :controller
use SchoolWeb, :view
The definitions below will be executed for every view,
controller, etc... |
0533ab9abb7b2f0c467710c91984084ab66bb16d | 1,653 | [
1004418215
] | [
"liveview",
"phoenix"
] | defmodule PotamoiWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :potamoi
# 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: "_potamoi_k... |
0533bdd32230ae688c682c2187b5a0ce8e1c2360 | 1,518 | [
573811508
] | [
"test"
] | defmodule WhatlangexTest do
use ExUnit.Case, async: true
import Whatlangex
@sentences %{
eng: "Start with a simple sentence, it's good enough for now.",
fra: "Commence avec une phrase simple, ça suffit pour le moment.",
spa: "Comience con una oración simple, es lo suficientemente bueno por ahora."
... |
05340cd32e7dcf45d8db0957eed5784eb5fa7eb9 | 8,507 | [
310810277
] | [] | defmodule :cowboy_static do
use Bitwise
require Record
Record.defrecord(:r_file_info, :file_info, size: :undefined,
type: :undefined, access: :undefined,
atime: :undefined, mtime: :undefined,
ctime: :und... |
05341be48a2048cf502fb3bdcaf1a3b809ffaae2 | 2,959 | [
449539307
] | [
"test"
] | defmodule UserTest do
use ExUnit.Case, async: true
describe "ProtocolUser" do
alias ProtocolUser, as: User
test "valid init" do
assert {:ok, foo} = Entity.init(%User{email: "<EMAIL>", username: "foo"})
assert {:ok, bar} = Entity.init(%User{email: "<EMAIL>", username: "bar"})
assert is_b... |
05348924bf6eb2caacb837ca3bf3f30ec384ffab | 2,101 | [
938349679,
54749959
] | [
"test"
] | defmodule Commanded.ProcessManagers.ResumeProcessManagerTest do
use ExUnit.Case
import Commanded.Assertions.EventAssertions
alias Commanded.Helpers.{ProcessHelper, Wait}
alias Commanded.ProcessManagers.{
ProcessManagerInstance,
ProcessRouter,
ResumeApp,
ResumeProcessManager,
ResumeRouter
... |
0534e49ae6b742a25ff7f2c072aa863cc7e355a2 | 1,749 | [
587740389
] | [] | defmodule CocktailIndexWeb.Cocktails.UpdateCocktailTest do
use CocktailIndexWeb.FeatureCase, async: true
feature "user updates a cocktail successfully", %{session: session} do
[glass1, glass2] = insert_pair(:glass)
[source1, source2] = insert_pair(:source)
cocktail = insert(:cocktail, glass: glass1, so... |
05353998577f768cee2822496b1ca06f762b35f2 | 2,865 | [
286116474
] | [
"test",
"phoenix"
] | defmodule YicWeb.Html.Iam.GroupsControllerTest do
use YicWeb.ConnCase
import Yic.IamFixtures
@create_attrs %{comment: "some comment", name: "some name"}
@update_attrs %{comment: "some updated comment", name: "some updated name"}
@invalid_attrs %{comment: nil, name: nil}
describe "index" do
test "list... |
05366ce13ad644fa97d0bf4ffa3c4db35386c187 | 3,070 | [
269577894
] | [
"typespec",
"documented"
] | defmodule WeChat.SDK.Template do
@moduledoc """
消息管理 - 模板消息
[API Docs Link](https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html){:target="_blank"}
"""
import Jason.Helpers
alias WeChat.SDK
@doc_link "#{SDK.doc_link_prefix()}/offiaccount/Message_Management/... |
05371dad6965aac99c631e9329553b4097d43a11 | 2,651 | [
302891270
] | [
"test"
] | defmodule CtiKaltura.ServersActivityServiceTest do
use CtiKaltura.MnesiaTestCase
use CtiKaltura.DataCase
alias CtiKaltura.ServersActivityService, as: Service
describe "ServersActivityService " do
test "get_server_activity #1" do
{:ok, server} =
Factory.insert(:server, %{
:domain_na... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.