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 |
|---|---|---|---|---|
058dab4965d5238f003b2400d0e620ab1da6cef4 | 7,385 | [
1010715737
] | [
"typespec",
"documented"
] | defmodule Aesir.CharServer.Character do
@moduledoc """
Character data structure for Ragnarok Online characters.
Based on the rathena mmo_charstatus structure, this represents
all character data needed for the char server.
"""
@type job_class :: 0..999
@type stat_value :: 0..255
@type point_value :: 0.... |
058e32d76836f8cce4fd76f4558154ba8031d5a6 | 1,864 | [
197758765
] | [
"genserver",
"documented"
] | defmodule DistributedRegistry.GlobalSupervisor do
use GenServer
@moduledoc """
Monitor Global Jobs
"""
def start_link() do
GenServer.start_link(__MODULE__, :ok, name: __MODULE__)
end
@impl true
def init(:ok) do
{:ok, %{}}
end
def monitor(module, args \\ :ok) do
GenServer.call(__MODUL... |
058e3a1d8d856d01d04f33bbb07567613fa34394 | 4,359 | [
360705510
] | [
"documented",
"ecto"
] | defmodule DirectoryAnalyzer.Directories do
@moduledoc """
The Directories context.
"""
import Ecto.Query, warn: false
alias Ecto.Multi
alias DirectoryAnalyzer.Repo
alias DirectoryAnalyzer.Directories.Directory
alias DirectoryAnalyzer.Words
alias DirectoryAnalyzer.Words.Word
@doc """
Returns th... |
058e3eaeddcc8af87a4f09815097e769a98b5d53 | 3,254 | [
118212478
] | [
"typespec",
"phoenix"
] | defmodule CadetWeb.AdminStoriesController do
use CadetWeb, :controller
use PhoenixSwagger
alias Cadet.Stories.Stories
def create(conn, %{"course_id" => course_id, "story" => story}) do
result =
story
|> to_snake_case_atom_keys()
|> Stories.create_story(course_id |> String.to_integer())
... |
058e849d2f9ca085dbc7167b943819dc8b58c126 | 4,447 | [
771090085
] | [] | import ByMove
defmodule Node3 do
def main_bymove(nodes, db_server) do
wait_till_start()
if !ByMove.have_func?(Transaction, {:authenticate, 3}) do
ByMove.i_need_func({:authenticate, 3}, nodes, self())
ByMove.module_wait_for_func(Transaction,{:authenticate, 3}, nodes, self())
end
authenti... |
058ecd7517db9ef39cb335a82acf50327c9c5758 | 2,587 | [
110597224
] | [] | defmodule Sim do
@data "data.csv"
@context "context.csv"
def read_csv(data) do
File.stream!(data)
|> CSV.decode
|> Enum.map(&(&1 |> elem(1)))
end
def get_metrics(user_id) do
Enum.map(1..40, &(get_sim(user_id, &1)))
|> Enum.zip(1..40)
end
def get_sim(u, v) do
Enum.zip(get_user(u)... |
058eda846b5a713c1dfd11109eab22ec44aac65f | 2,952 | [
826063302
] | [
"typespec",
"documented"
] | defmodule GoChampsScoreboard.Sports.Basketball.Reports.FibaScoresheet.UpdatePlayerStatProcessor do
@moduledoc """
Processes player statistics updates in the FIBA scoresheet.
"""
alias GoChampsScoreboard.Sports.Basketball.Reports.FibaScoresheet.FibaScoresheetManager
alias GoChampsScoreboard.Sports.Basketball.... |
058f35e9643257766ac7eb44f87f3bd4e02cc815 | 10,263 | [
236852798,
366872029
] | [
"test"
] | Code.require_file("../../test_helper.exs", __DIR__)
defmodule Mix.Tasks.ArchiveTest do
use MixTest.Case
defmodule ArchiveProject do
def project do
[app: :archive, version: "0.1.0", elixir: "~> 0.1.0"]
end
end
defmodule ArchiveProject2 do
def project do
[app: :archive, version: "0.2.0"... |
0590ecc049e617c85ec9fdaf0ef2c80623900940 | 1,551 | [
155789685
] | [
"macro",
"documented",
"phoenix"
] | defmodule ScrumpokerWeb 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 ScrumpokerWeb, :controller
use ScrumpokerWeb, :view
The definitions below will be executed for every view,
con... |
0591405058abc0ab8bccce8fdc98e9c06c996703 | 7,759 | [
129004779
] | [
"test"
] | defmodule EVM.Operation.SystemTest do
use ExUnit.Case, async: true
doctest EVM.Operation.System
alias EVM.AccountRepo
alias EVM.{Address, ExecEnv, MachineCode, MachineState, Operation, Stack, SubState, VM}
alias EVM.Mock.MockAccountRepo
alias EVM.Mock.MockBlockHeaderInfo
describe "selfdestruct/2" do
... |
05915c79f3be4ac582bdc052c0410487ee50fef3 | 2,104 | [
128477486
] | [
"typespec",
"macro",
"documented"
] | defmodule Loggex.Logger do
@moduledoc ~S"""
A logger.
"""
alias Loggex.Logger
@doc ~S"Dynamically configure module."
@callback configure(opts :: Keyword.t()) :: Keyword.t()
@doc @moduledoc
defmacro __using__(opts \\ []) do
otp_app = opts[:otp_app]
adapters = Loggex.prepare_adapters(opts[:adapt... |
059172c7763b12e2c161dcf07fd9c03c08e4dea5 | 1,667 | [
662743431
] | [
"typespec",
"documented"
] | defmodule SamuelWillis.Metrics do
@moduledoc """
A minimal webpage metrics engine
"""
import Ecto.Query, only: [from: 2]
alias SamuelWillis.Repo
alias SamuelWillis.Metrics.Metric
alias SamuelWillis.Metrics.Supervisor
defdelegate track_metrics(path), to: Supervisor, as: :track_metrics
@spec get_path... |
05918c8f56f522c228252876cbe8f95018a2e070 | 2,223 | [
910864373
] | [
"documented"
] | #!/usr/bin/env elixir
# Add the project to the code path so we can use it as a library
Code.prepend_path("_build/dev/lib/heckler/ebin")
# Required dependencies
Code.prepend_path("_build/dev/lib/jason/ebin")
Code.prepend_path("_build/dev/lib/httpoison/ebin")
Code.prepend_path("_build/dev/lib/hackney/ebin")
Code.prepen... |
05918e83f74daa95386a14543a1a01db2c6c5a89 | 7,209 | [
624054242
] | [
"typespec",
"documented"
] | # Code generated by protox. Don't edit.
# credo:disable-for-this-file
defmodule PgQuery.ExplainStmt do
@moduledoc false
if function_exported?(Protox, :check_generator_version, 1) do
Protox.check_generator_version(1)
else
raise "This code was generated with protox 2 but the runtime is using an older versio... |
05921c209085b3205c255ef5ac3352857d5f8e71 | 1,921 | [
972810178,
390166925
] | [
"typespec",
"documented"
] | defmodule Game.Mail do
@moduledoc """
Helpers for dealing with the mail system
"""
import Ecto.Query
alias Data.Character
alias Data.Mail
alias Data.Repo
alias ExVenture.Mailer
alias Game.Emails
alias Game.Events.MailReceived
alias Game.Session
@doc """
Get mail for a character
"""
@spe... |
059238c52cbc1e44eb297c487241b63cd2ac6c0c | 2,900 | [
942811655,
920024200
] | [
"test"
] | defmodule Looper.StateResidency.Impl.Test do
use ExUnit.Case, async: false
import Mock
alias Looper.StateResidency.Test.Entity
alias Looper.StateResidency.Test.EntityTrace
alias Looper.Test.EctoRepo
alias Looper.StateResidency.Impl
alias Looper.Util
setup do
assert {:ok, _} = Util.clean_test_db(... |
0592417b6fef246bbc064785da3f43a72979c2f6 | 1,502 | [
134645462
] | [] | defmodule NervesHubCA.Release.Tasks do
alias Ecto.Migrator
@otp_app :nerves_hub_ca
@start_apps [:logger, :ssl, :postgrex, :ecto_sql]
def migrate_and_seed do
init(@otp_app, @start_apps)
run_migrations_for(@otp_app)
run_seed_script("#{seed_path(@otp_app)}/seeds.exs")
stop()
end
defp init(... |
0592e4a714522efb2206ad1d6a61732cd7234fc3 | 2,930 | [
112394158
] | [] | # Reads historical prediction data and generates a CSV with a minute-by-minute breakdown of the
# closest prediction at the specified stops during the specified time period.
Mix.install([
{:ex_aws_s3, "~> 2.0"},
{:ex_aws, "~> 2.0"},
{:configparser_ex, "~> 4.0"},
{:hackney, "~> 1.18.1"},
{:sweet_xml, "~> 0.7.... |
059403b37f949e9e9baacc91cd50ef5508c67a68 | 1,642 | [
96117673
] | [
"macro",
"documented",
"phoenix"
] | defmodule BaseballWeb 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 BaseballWeb, :controller
use BaseballWeb, :view
The definitions below will be executed for every view,
controlle... |
059455515e5c1ae6e44b8b94834627cbfffe4855 | 1,930 | [
567820404
] | [] | defmodule Chess.MixProject do
use Mix.Project
def project do
[
app: :chess,
version: "0.1.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end... |
05949499d2876036f6fb2498b95643446598736f | 2,705 | [
50307615
] | [
"typespec",
"documented",
"phoenix"
] | defmodule ClubHomepage.Extension.Common do
@moduledoc """
Provides some global functions.
"""
alias ClubHomepage.Repo
alias ClubHomepage.User
@doc """
Returns the lowercased controller name without higher module names.
"""
def controller_name(conn) do
conn
|> Phoenix.Controller.controller_mo... |
05954d4d1cb1296fdab5afc1fa8a05e416d1aac3 | 2,163 | [
719450425
] | [
"documented"
] | defmodule Interpol do
require Logger
@moduledoc """
Documentation for `Interpol`.
"""
@doc """
Interpolation Search v.0
"""
def run() do
timer = System.monotonic_time()
walk()
runtime = System.monotonic_time()
Logger.debug("** ran #{runtime - timer} **")
Process.exit(self(), :k... |
05954eb3e948a42a6d4c4d9f352ee3d6228c6402 | 3,095 | [
311255430
] | [
"documented"
] | defmodule Mpesa.LipaNaMpesa do
@moduledoc """
Defines the function for transacting a lipa na mpesa using the stk
"""
alias Mpesa.Oauth
@doc """
Initiates a lipa na mpesa stk request
"""
def initiate_payment(sender_msisdn, amount, account_ref, transaction_desc \\ "Lipa na mpesa online") do
# get ... |
0595851d00b789a20010dd72319f59343485aadb | 3,469 | [
62804165
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the paren... |
0595f34df9c17fe7fbace6b6759565302f59a111 | 3,776 | [
572959269
] | [] | defmodule Day6 do
## Day 6 first part was a quick and dirty implementation since we
## only had four positions to scan. The second part was more tricky
## in that we had to implement a general solution (well, ok one
## could have done an explicit implementation but that would be
## ... a lot of code). T... |
05961a697d163947c165858521ee7440a1019a4a | 3,694 | [
60101160
] | [
"typespec",
"documented"
] | defmodule BlocktrailCom do
@moduledoc """
Collection of API wrappers and helpers
"""
use HTTPoison.Base
alias BlocktrailCom.{BlockData, PagedResponse}
@spec latest_block(String.t) :: BlockData.t
def latest_block(_) do
url = "/btc/block/latest?"
with {:ok, response} <- BlocktrailCom.get(url),
... |
0596ca92a31d9cb6d44fd4472ea1bf6b22ade4d6 | 3,396 | [
114567355
] | [
"documented"
] | defmodule AOC.Day22 do
@moduledoc """
- If the current node is infected, it turns to its right. Otherwise, it turns to its left.
(Turning is done in-place; the current node does not change.)
- If the current node is clean, it becomes infected. Otherwise, it becomes cleaned.
(This is done after the node is... |
0596eba4be1696cf02938fb0ff20563ed4fbae71 | 1,791 | [
335151011
] | [
"typespec",
"documented"
] | defmodule Lti_1p3.Claims.PlatformInstance do
@moduledoc """
A struct representing the platform instance claim in an LTI 1.3 request.
https://www.imsglobal.org/spec/lti/v1p3#platform-instance-claim
"""
@enforce_keys [:guid]
defstruct [
:guid,
:contact_email,
:description,
:name,
:url,
... |
05974fa59622623fbf2aee0678dfe5338b97512d | 4,867 | [
736324624
] | [
"typespec",
"documented",
"ecto"
] | defmodule Teiserver.Game.MatchSettingTypeLib do
@moduledoc """
TODO: Library of match_setting_type related functions.
"""
use TeiserverMacros, :library
alias Teiserver.Game.{MatchSettingType, MatchSettingTypeQueries}
@doc """
Returns the list of match_setting_types.
## Examples
iex> list_match_... |
0598112ea36333c612eaecc9bb855f3f367556b5 | 1,702 | [
163582640
] | [
"test"
] | defmodule E2ETests do
use ExUnit.Case
# @tag :skip
test "chapter, notes, slides" do
code = """
>Chapter(main, title): This is <i>the</i> title of the Chapter
>Notes(important): Some notes to the prev chapter
>Slide:
* <b>Point 1</b>
* Point 2
* Point 3
>Slide: One-Liner, ... |
0598449bc9fadb6971477bd2fef33053d45d2633 | 2,984 | [
103798463
] | [
"macro",
"documented"
] | defmodule UiGraph.Relay.Node.Notation do
@moduledoc """
Macros used to define Node-related schema entities
See `UiGraph.Relay.Node` for examples of use.
"""
alias Absinthe.Schema.Notation
@doc """
Define a node interface, field, or object type for a schema.
See the `UiGraph.Relay.Node` module docum... |
059922c6212c11cc9fe2218682998cf0d0c87f40 | 3,296 | [
402134949
] | [
"test"
] | defmodule Exercism.Nil.BinarySearchTreeTest do
use ExUnit.Case
alias Exercism.Nil.BinarySearchTree
doctest Exercism.Nil.BinarySearchTree
use ExUnit.Case
test "data is retained" do
root = BinarySearchTree.new(4)
assert root.data == 4
assert root.left == nil
assert root.right == nil
end
d... |
059948787c0697f88ca75a438c7ad402ef6d535d | 16,330 | [
310810277
] | [
"genserver"
] | defmodule :m_eprof do
use Bitwise
@behaviour :gen_server
require Record
Record.defrecord(:r_bpd, :bpd, n: 0, us: 0, p: :gb_trees.empty(), mfa: [])
Record.defrecord(:r_state, :state,
profiling: false,
pattern: {:_, :_, :_},
rootset: [],
trace_opts: [],
fd: :undefined,
start_ts: :undefi... |
0599cafb1b2b17ef4d68e7add0b91d2c61ba79dd | 3,374 | [
596668075
] | [
"documented",
"ecto"
] | defmodule Backend.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias Backend.Repo
alias Backend.Accounts.User
alias Backend.Accounts.Guardian
import Pbkdf2
defp get_user_by_username(phone_number) when is_binary(phone_number)do
case Repo.get_by(User, phone_... |
059a3d9e0c87f21ab9b3cb59cb4f2316e3b115c6 | 1,652 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.VMwareEngine.V1.Model.DnsBindPermission do
@moduledoc """
DnsBindPermission resource that contains the accounts having the consumer DNS bind permission on the corresponding intranet VPC of the consumer project.
## Attributes
* `name` (*type:* `String.t`, *default:* `nil`) - Required. Out... |
059a67dd9b1cc9ee7f24fceb346956e705909be3 | 1,724 | [
114565703
] | [
"genserver"
] | defmodule CrackerServer do
use GenServer
# ----------------------------------------- #
# Client - API #
# i.e. Client calls the following functions #
# ----------------------------------------- #
def pick_lock(socket) do
GenServer.call(__MODULE__, {:pick, socket})
end
... |
059b94bf3b71f5cddbaee010fac1c31e4fcec0ae | 2,468 | [
415369960
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule ReadingListExWeb 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 ReadingListExWeb, :controller
use ReadingListExWeb, :view
The definitions below will be executed for every vi... |
059beee132b70fd832c1193d009bfa105947c576 | 3,972 | [
57161303
] | [
"documented",
"phoenix"
] | defmodule PhoenixTCP.Transports.TCP do
require IEx
require Logger
@moduledoc """
Socket transport for tcp clients.
## Configuration
the tcp is configurable in your socket:
transport :tcp, PhoenixTCP.Transports.TCP,
timeout: :infinity,
serializer: Phoenix.Transports.WebSocketSerializer,
... |
059c749117c74bba3a76beeab255e4fe48f16fa9 | 2,407 | [
478773736,
712471189,
623249349,
640128868,
498332934,
382178833,
495307379,
403650584,
498062200,
537290385,
83909386,
556547350,
618185043,
493034973
] | [
"test",
"ecto"
] | defmodule Pento.CatalogTest do
use Pento.DataCase
alias Pento.Catalog
describe "products" do
alias Pento.Catalog.Product
import Pento.CatalogFixtures
@invalid_attrs %{description: nil, name: nil, sku: nil, unit_price: nil}
test "list_products/0 returns all products" do
product = product... |
059c77372377151e9860a400f70ee4ffc6ac09ab | 1,781 | [
80679091
] | [
"typespec",
"documented"
] | defmodule Prime do
@moduledoc """
Function to calculate prime numbers
"""
@spec factors(integer) :: List
def factors(number) do
limit = :math.sqrt(number)
factors(number, sieve(up_to: limit), [])
end
@spec factors(integer, List, List) :: List
def factors(1, [], found), do: found
def factor... |
059db80d69ab269547967915602fed5de8ef6232 | 4,467 | [
146905014
] | [
"typespec",
"documented"
] | defmodule Shmex.Native do
@moduledoc """
This module provides natively implemented functions allowing low-level
operations on Posix shared memory. Use with caution!
"""
use Bundlex.Loader, nif: :shmex
@doc """
Creates shared memory segment and adds a guard for it.
The guard associated with this memor... |
059dfc39ecdc0e1872bd83555e0eecdf958a6328 | 4,616 | [
50263476
] | [
"documented"
] | defmodule YahooFinance.Quote do
@moduledoc """
Contains the functions needed to pull quote data.
"""
import Utils
def get_full_quote(""), do:
{:error, "Cannot provide empty string as argument"}
def get_full_quote(symbol) when not is_string_like(symbol), do:
{:error, "Symbol argument must be gi... |
059e0cbed485d14166b02a9325d63e4c48c36609 | 1,771 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.ToolResults.V1beta3.Model.ToolOutputReference do
@moduledoc """
A reference to a ToolExecution output file.
## Attributes
* `creationTime` (*type:* `GoogleApi.ToolResults.V1beta3.Model.Timestamp.t`, *default:* `nil`) - The creation time of the file. - In response: present if set by creat... |
059ec1d01daf5e475111b080bbafc48d2bbb4102 | 11,377 | [
277032289
] | [
"test",
"ecto"
] | defmodule Kaibosh.SessionsTest do
use Kaibosh.DataCase
alias Kaibosh.Sessions
alias Kaibosh.Sessions.Session
describe "managing sessions for base" do
@valid_attrs %{day: "some day", time: ~T[00:00:00]}
@update_attrs %{day: "some updated day", time: ~T[12:00:00]}
@invalid_attrs %{day: nil, time: ni... |
059ef17ccaac81a969e4ed648514bbfc41c10b6a | 4,635 | [
189450801
] | [
"typespec",
"documented"
] | defmodule Grizzly.ZWave.Commands.UserCodeCapabilitiesReport do
@moduledoc """
This command is used to advertise User Code capabilities.
## Params
* `:admin_code_supported?` - Whether the lock supports admin code functionality.
* `:admin_code_deactivation_supported?` - Whether the lock supports deactivating ... |
059efbc28fc6d8ca08cc4fd215c389fa11f85b20 | 1,835 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Sheets.V4.Model.DataExecutionStatus do
@moduledoc """
The data execution status. A data execution is created to sync a data source object with the latest data from a DataSource. It is usually scheduled to run at background, you can check its state to tell if an execution completes There are seve... |
059f4a43fc0251ec525f62192eabd72a6fc0b022 | 16,592 | [
1005802895
] | [
"test",
"ecto"
] | defmodule Kawa.Core.SagaRecoveryTest do
use ExUnit.Case, async: false
use Kawa.DataCase
alias Kawa.Core.{SagaRecovery, SagaSupervisor, ClientRegistry}
alias Kawa.Schemas.{Saga, SagaStep, SagaEvent, WorkflowDefinition, Client}
alias Kawa.Repo
import Ecto.Query
@moduletag :integration
setup do
# C... |
059f7008b3bed533356e6258586045a64d3f2f8e | 12,295 | [
47517539
] | [
"typespec",
"documented"
] | defmodule IPFS.Client do
@moduledoc """
A client library for interacting with an IPFS node via its HTTP API.
"""
@user_agent "/elixir-ipfs-client/0.0.1/"
defstruct [host: "localhost", port: 5001,
user_agent: @user_agent]
@typedoc "A TCP port"
@type port_number :: 0..65535
@typedoc "A con... |
059f8bcfe289a49c00f6cee3de80878dd279a8e1 | 2,075 | [
752890970
] | [
"supervisor"
] | # Simple benchmark for quick testing
# Run with: mix run bench/simple_bench.exs
#
# This benchmark provides a quick performance overview of the Phoenix Session Process library.
# It tests session creation, communication, memory usage, and cleanup in under 10 seconds.
alias Phoenix.SessionProcess
alias Phoenix.SessionP... |
05a03cdadf18e05f719f5750638d50871fa041a4 | 3,760 | [
389051436
] | [
"typespec",
"documented",
"ecto"
] | defmodule WUE.Pictures.PictureV2 do
@moduledoc """
Alternative approach to polymorphic embed. This one defines the shape field as
a plain map, but uses the same embedded schemas as V1 to cast the params
depending on the `"type"` field.
Once the shape is cast and is deemed valid, it is converted back to a map... |
05a10a51d5ad6794aec3c76d345445101a3142c5 | 7,911 | [
192407200
] | [
"test"
] | defmodule DiscoveryApiWeb.DataController.DownloadTest do
use DiscoveryApiWeb.ConnCase
use Placebo
import Checkov
import SmartCity.TestHelper
alias DiscoveryApi.Data.{Model, SystemNameCache}
alias DiscoveryApi.Services.PrestoService
@dataset_id "1234-4567-89101"
@system_name "foobar__company_data"
@or... |
05a112d68cc0e78db63e37c7dac8be7b18f070b7 | 6,627 | [
815713173
] | [
"test"
] | defmodule Test.Geminex.UtilsTest do
use ExUnit.Case, async: true
use ExUnitProperties
alias Geminex.Utils
@max_runs 100
describe "maybe_put/3" do
property "returns the same map when value is nil" do
check all(
map <- map_with_standard_keys_and_values(),
key <- standard... |
05a1444d6172cbc41693db1c7d09f527dea72b79 | 2,410 | [
20833422
] | [
"genserver"
] | defmodule UserSession do
use GenServer
defstruct name: "", posts: [], following: [], followers: []
def start_link({name}) do
GenServer.start_link(__MODULE__, name, name: RegistryHelper.create_key(name))
end
def init(name) do
Process.flag(:trap_exit, true)
{:ok, %UserSession{name: name, posts: []... |
05a1505ef8408b750c7eb762f42955bc5e484f46 | 2,576 | [
365956503
] | [
"documented"
] | defmodule SupabaseSurface.Components.Typography.Text do
use Surface.Component
import Surface.Components.Utils
@doc "The type (color) of the text"
prop type, :atom, values: [:default, :success, :danger, :secondary, :warning]
@doc "Apply `disabled` style"
prop disabled, :boolean, default: false
@doc "Ap... |
05a1e352320dada99bc1993f95eac7579cadc362 | 7,260 | [
726019744
] | [] | defmodule AdventOfCode2023.Day17.Utility do
def get_file do
{:ok, file} = File.open("assets/day17.in")
IO.read(file, :eof)
|> String.split("\n", trim: true)
|> Enum.map(&String.to_charlist/1)
|> Enum.map(&Enum.map(&1, fn x -> x - ?0 end))
end
end
defmodule AdventOfCode2023.Day17.Part1 do
imp... |
05a281211a5b9b0bc28e6bbdc55743d0148c9d34 | 1,734 | [
406082897,
296911065,
424246610,
406733747
] | [] | # 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.
# General application configuration
import Config
config :sakavault,
namespace: SakaVault,
ecto... |
05a2e33fe0f4653c1d760229e50e4b1a07487331 | 7,676 | [
615734619
] | [
"liveview"
] | defmodule DedalosPhoenixWeb.NavbarLive do
use DedalosPhoenixWeb, :live_component
def mount(_params, _sessions, socket) do
{:ok, assign(socket, message: "HI")}
end
def render(assigns) do
~H"""
<div>
<nav class="z-50 bg-dedalos-green fixed flex flex-wrap w-full items-center content-be... |
05a42d7d1ffa5954cec0749a01464608ffa41850 | 1,603 | [
248248138
] | [
"typespec",
"documented"
] | defmodule Day2 do
@moduledoc """
Day 2 of Advent of Code 2019.
An attempt to learn Elixir.
"""
@type address :: integer
@type noun :: integer
@type verb :: integer
@type memory :: %{address => integer}
@spec load() :: memory
def load() do
{:ok, memory} = File.read('2.data')
memory
|> ... |
05a4b4eec5969a2762d2d724c200f86a20dc73fa | 2,088 | [
827031403
] | [
"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 playing cards
"""
def create_deck do
values = ["Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", ... |
05a62bce81360878577b26fe16a3d4896fd550fa | 1,739 | [
951416746
] | [
"documented"
] | defmodule Readmix.Generators.BuiltIn.AppDep do
alias Readmix.Context
@moduledoc false
def generate_app_dep(params, context) do
otp_app = app_dep_otp_app(params, context)
vsn = app_dep_vsn(params, otp_app)
only = app_dep_only(params)
runtime = app_dep_runtime(params)
elems =
[inspect(o... |
05a6551cf822662aa8bc10d9c825ca807602135b | 4,679 | [
177206154
] | [] | %{
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [... |
05a6acdfdc9a71f9f37741282e64402b0adf14dd | 2,214 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PipelineTaskExecutorDetailContainerDetail do
@moduledoc """
The detail of a container execution. It contains the job names of the lifecycle of a container execution.
## Attributes
* `failedMainJobs` (*type:* `list(String.t)`, *default:* `nil`) -... |
05a7053ef5edd9d46c1e94de2ed8ca898e2a1827 | 3,035 | [
217071313,
213747032
] | [
"test"
] | defmodule Civo.NetworksTest do
use ExUnit.Case
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney, options: [clear_mock: true]
alias Civo.{Networks, Request, Response}
doctest Networks
setup do
ExVCR.Config.cassette_library_dir("test/fixture/vcr_cassettes/networks")
:ok
end
test "lists networks" do
... |
05a7245c00853192cbd535ae761bdda47985aefa | 6,284 | [
64444110
] | [
"documented"
] | defmodule ByteBuffer do
@moduledoc """
Defines a bytebuffer struct and helper functions to building a byte
buffer from basic data types.
"""
@doc """
Buffer structure. data
"""
defstruct data: <<>>, debug: false
@doc """
Appends a binary or string to a byte buffer. Returns a new ByteBuffer.
## ... |
05a7e0d32b486e635c9b77508d10cc9ba5a1f804 | 5,640 | [
789615227
] | [
"test"
] |
defmodule DynamoTest do
use ExUnit.Case
import Emulation, only: [spawn: 2, send: 2, timer: 2]
import Kernel,
except: [spawn: 3, spawn: 1, spawn_link: 1, spawn_link: 3, send: 2, exit: 2]
# test "check basic functionaly of kv-store : gets and puts" do
# Emulation.init()
# Emulation.append_fu... |
05a7f254a6eae78076fb50cf202dc1e34e508212 | 2,679 | [
719738648
] | [] | defmodule GameClient do
def play(initial_stones_num \\ 30) do
GameServer.start(initial_stones_num)
start_game!()
end
defp start_game!() do
send :game_server, {:info, self()}
receive do
{player, current_stones} ->
IO.puts "Starting the game! Its player #{player} turn.
There a... |
05a84eea71db3fc07a7b71144483ea71dd9ec10f | 11,766 | [
107638632
] | [
"genserver",
"typespec",
"supervisor",
"documented"
] | defmodule RigKafka.Client do
@moduledoc """
The Kafka client that holds connections to one or more brokers.
"""
alias RigKafka.Config
alias RigKafka.Serializer
alias RigMetrics.EventsMetrics
require Logger
@type callback :: (any -> :ok | any)
@reconnect_timeout_ms 20_000
@metrics_target_label "k... |
05a85426c319f40c946e2152f8f083084fef0dda | 5,983 | [
361103891
] | [
"genserver",
"documented"
] | defmodule Lights do
@moduledoc """
Module for setting lights. The module receives a list of active orders
and sets the corresponding lights high.
The module must receive messages from elevator and master. Lights are set based on updates
from these modules. All other lights are cleared, and by updating which ... |
05a8f93605364b4f13e1b867b62681b0f26fbbba | 12,687 | [
217320195
] | [] | defmodule Pleroma.Mixfile do
use Mix.Project
def project do
[
app: :pleroma,
version: version("2.9.1"),
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
elixirc_options: [warnings_as_errors: warnings_as_errors(), prune_code_paths: false... |
05a8fcc20e36697f19366aaaa578b41d214050ee | 6,391 | [
942468823
] | [
"documented"
] | defmodule GameBot.Domain.Events.TestEvents.ValidatorTestEvent do
@moduledoc """
Test event struct for validation tests
"""
defstruct [:game_id, :guild_id, :mode, :timestamp, :metadata, :count, :score]
end
defmodule GameBot.Domain.Events.TestEvents.ValidatorOptionalFieldsEvent do
@moduledoc """
Test event w... |
05a99c89d2cd56b88d80183733db92eb23d5969e | 13,969 | [
317056450
] | [] | %{
"bcrypt_elixir": {:hex, :bcrypt_elixir, "2.3.0", "6cb662d5c1b0a8858801cf20997bd006e7016aa8c52959c9ef80e0f34fb60b7a", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "2c81d61d4f6ed0e5cf7... |
05a9e042a68c3d0cf22f48645c5f7fb43d90f34d | 1,765 | [
158019121
] | [
"phoenix",
"ecto"
] | defmodule AkediaWeb.TagController do
use AkediaWeb, :controller
alias Akedia.Tags
alias Akedia.Tags.Tag
plug :check_auth when action not in [:show]
plug :put_layout, :admin when action not in [:show]
def index(conn, _params) do
tags = Tags.list_tags()
render(conn, "index.html", tags: tags)
end
... |
05a9fb68acbafefbf97c0a55e6ef9101124b3cda | 4,041 | [
726152125
] | [
"documented"
] | defmodule Aoc.Day3 do
@moduledoc """
https://adventofcode.com/2023/day/3
The strategy here is to parse the "schematic" of parts into a `%SchematicMap{}`
struct that uses coordinates to track if a given location contains a part-number
or a symbol. I tracked symbols not only as a point, but as ALL THE SPACE ar... |
05aa487fb7f3652f4dc2a8b56cb14422ecb04a39 | 4,331 | [
427621082
] | [
"typespec",
"documented"
] | defmodule CodesOnChain.NftRender.NType do
@moduledoc """
This module is use for render abstract NFT to an rendered NFT.
"""
alias Components.NFTHandler
@traits %{
n: "<text",
img: "<image"
}
@header %{
origin: "<svg xmlns=\"http://www.w3.org/2000/svg\" preserveAspectRatio=\"xMinYMin mee... |
05aab7888dbc731713bfcc4651f649a965bd64e6 | 5,310 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.CloudTasks.V2.Model.Policy do
@moduledoc """
An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user ac... |
05ab0fc5a88b64f950f17ff12d99e1d93276e56f | 2,925 | [
191192998
] | [
"test",
"ecto"
] | defmodule Budgeting.DirectoryTest do
use Budgeting.DataCase
alias Budgeting.Directory
describe "transactions" do
alias Budgeting.Directory.Transaction
@valid_attrs %{amount: 120.5, category: "some category", date: ~D[2010-04-17], description: "some description", id: 42}
@update_attrs %{amount: 456.... |
05ab4daba2e4df319875a8f7ce41e4f786ef2b32 | 2,930 | [
945577229
] | [
"liveview"
] | defmodule AddressWatcherWeb.Components.Chart do
use Phoenix.Component
# Safe value formatting
def format_value(value, _) when is_nil(value), do: "nil"
def format_value(value, _) when not is_number(value), do: "#{inspect(value)}"
def format_value(value, :btc) do
"#{:erlang.float_to_binary(value, [decimal... |
05abe47cdd7a7aa6673b1704a409e08adf77f557 | 2,644 | [
512450161
] | [
"test",
"phoenix"
] | defmodule BillCrudWeb.EventsControllerTest do
use BillCrudWeb.ConnCase
import BillCrud.PagesFixtures
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
describe "index" do
test "lists all events", %{conn: conn} do
conn = get(conn, Routes.ev... |
05ac84e1c076cf74fa6c0c3eb6d27a41eaeb80af | 2,553 | [
583344097
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule BugSlotWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, components, channels, and so on.
This can be used in your application as:
use BugSlotWeb, :controller
use BugSlotWeb, :html
The definitions below will be executed for every controller,
... |
05acbe875f0c979ec6283c1f89dddf68fbe00c6d | 2,472 | [
645066693
] | [
"liveview"
] | defmodule MaydayWeb.ProvisionedNumberFormLive do
use MaydayWeb, :live_view
alias Mayday.Campaigns
@impl true
def mount(params, _, socket) do
params
|> case do
%{"id" => id} ->
number = Campaigns.get_provisioned_number!(id)
[
number: number,
changeset: Campaig... |
05acd4ed78a148b51417f610e943f7e83aa60da8 | 1,534 | [
762744930
] | [
"phoenix"
] | defmodule FastFormsWeb.Router do
use FastFormsWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {FastFormsWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do... |
05acedf2588bb35482c20ac4be19334528cd0dc5 | 1,772 | [
66803210
] | [
"typespec",
"documented"
] | defmodule Essence.Tokenizer do
@moduledoc """
The `Essence.Tokenizer` module exposes useful functions for transforming
text into `tokens` and for dealing with `tokens`.
"""
@doc """
Splits a given String into tokens. A token is a sequence of characters to
be treated as a group. The `tokenize` method will... |
05adab995e848a5ce5da676f47190ca90ba54454 | 1,676 | [
124926473
] | [
"phoenix"
] | defmodule ConsoleWeb.MembershipController do
use ConsoleWeb, :controller
alias Console.Teams
alias Console.Teams.Membership
plug :put_auth_item when action in [:update, :delete]
plug ConsoleWeb.Plug.AuthorizeAction
action_fallback(ConsoleWeb.FallbackController)
def index(conn, _params) do
current_... |
05adbb1701be2442b8501fb718a114c3c8ec9768 | 2,062 | [
150947330
] | [
"phoenix",
"ecto"
] | defmodule IssuetrackerWeb.IssueController do
use IssuetrackerWeb, :controller
alias Issuetracker.Tracker
alias Issuetracker.Tracker.Issue
alias Issuetracker.Accounts
alias Issuetracker.Accounts.User
def index(conn, _params) do
issues = Tracker.list_issues()
render(conn, "index.html", issues: issue... |
05ade12e7d9478b8c67726b2dc0abf27065be481 | 2,819 | [
871236867
] | [
"phoenix"
] |
defmodule ChessWeb.Router do
use ChessWeb, :router
import ChessWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {ChessWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
plug... |
05ae004481c81d6f93fc6d091dfa44cf9040e5f1 | 5,071 | [
257787813
] | [
"test"
] | defmodule Web.Live.Settings.IdentityProviders.Okta.EditTest do
use Web.ConnCase, async: true
setup do
Domain.Config.put_env_override(:outbound_email_adapter_configured?, true)
account = Fixtures.Accounts.create_account()
{provider, bypass} =
Fixtures.Auth.start_and_create_okta_provider(account:... |
05ae1199b17280b67894e877a1cb725579c33545 | 2,606 | [
941388269
] | [
"test"
] | defmodule EasyRpc.WrapperConfigTest do
use ExUnit.Case
alias EasyRpc.{WrapperConfig, NodeSelector}
setup_all do
setup_config()
{:ok, state: :ok}
end
defp setup_config do
config1 =
[
nodes: [Node.self()],
module: DateTime,
functions: [
{:utc_now, 0},
... |
05af21b370e49bbcfae1028365c14fced1164657 | 3,081 | [
527172382
] | [
"liveview",
"ecto"
] | defmodule PentoWeb.ProductLive.FormComponent do
use PentoWeb, :live_component
alias Pento.Catalog
@impl true
def update(%{product: product} = assigns, socket) do
changeset = Catalog.change_product(product)
{:ok,
socket
|> assign(assigns)
|> assign(:changeset, changeset)
|> assign(... |
05af3a2ad48fd4b66f975eefb99fa75483fe5070 | 2,444 | [
378744379
] | [
"documented"
] | defmodule BanchanWeb.Email.Commissions do
@moduledoc """
Rendering emails related to the Commissions context.
"""
use BanchanWeb, :html
alias Banchan.Commissions
alias Banchan.Payments
alias BanchanWeb.Components.RichText
def render("receipt.html", assigns) do
estimate = Commissions.line_item_est... |
05af77976eecf3be6849ee16f6754ffc46fc9510 | 10,929 | [
444073306
] | [
"liveview",
"documented"
] | defmodule TailwindLiveComponents.RadioGroup do
use Phoenix.Component
alias Phoenix.LiveView.JS
alias TailwindLiveComponents.Label
@doc """
Renders the vertical radio group element
```
<.radio_group form={f} field={:fruit} label="Horizontal Radio Group" options={[
%{value: "apple", display: "Apple",... |
05af7880f6d837a4fe2030cf99349e6075632ed0 | 2,793 | [
70405590
] | [
"test"
] | defmodule Rumbl.VideoController_Test do
use Rumbl.ConnCase
alias Rumbl.Video
@valid_attrs %{url: "http://youtu.be", title: "vid", description: "a vid"}
@invalid_attrs %{title: "invalid"}
setup %{conn: conn} = config do
if username = config[:login_as] do
user = insert_user(username: username)
... |
05af83bf2f571e93de2c81bd2dde0019e25472b1 | 11,136 | [
78348037
] | [
"documented"
] | defmodule RecurringEvents.Date do
@moduledoc """
Helper module responsible for common date manipulations.
"""
@time {0, 0, 0}
@week_days [
:monday,
:tuesday,
:wednesday,
:thursday,
:friday,
:saturday,
:sunday
]
@doc """
Shifts date by `:days`, `:weeks`, `:months` and `:year... |
05b06fabc9283450e9bbfb3ee4e26c9263ee72c0 | 1,856 | [
1004408983
] | [] | #!/usr/bin/env elixir
# Simple test script to verify game persistence
IO.puts("Testing game persistence...")
# Start the application
{:ok, _} = Application.ensure_all_started(:pento)
alias Pento.Games
alias Pento.Game
# Test 1: Create a new session
IO.puts("\n1. Creating new game session...")
session_id = "test-#{... |
05b0f7bd419eb2bacad0302789859342ab686f63 | 3,875 | [
473697525,
677687005
] | [
"typespec",
"documented"
] | defmodule Tentacat.Pulls do
import Tentacat
alias Tentacat.Client
@doc """
List pull requests
## Example
Tentacat.Pulls.list "elixir-lang", "elixir"
Tentacat.Pulls.list client, "elixir-lang", "elixir"
More info at: https://developer.github.com/v3/pulls/#list-pull-requests
"""
@spec list(... |
05b27d0884384546d7a8dba670903d3dfa22ae52 | 1,727 | [
897276541
] | [
"liveview"
] | defmodule TickettingWeb.TicketDetailsLive.FormComponent do
use TickettingWeb, :live_component
alias Ticketting.Tickets
@impl true
def update(%{ticket: ticket} = assigns, socket) do
{:ok,
socket
|> assign(assigns)
|> assign_new(:form, fn ->
to_form(Tickets.change_ticket(ticket))
... |
05b283daa68439ea68a73dee3e213c12769dd183 | 4,046 | [
677106495
] | [
"ecto"
] | defmodule Walkaround.Data.User do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias Walkaround.Data
schema "users" do
field(:slug, :string)
field(:name, :string)
field(:email, :string)
field(:password, :string, virtual: true)
field(:password_confirmation, :string, virtual: tru... |
05b2a0fd01c0a1ad1320690789d744806faff86c | 1,747 | [
225230123
] | [] | defmodule Advent.Password do
def problem1() do
find_passwords(367479, 893698)
|> Enum.count()
end
def find_passwords(range_start, range_end) do
for password <- range_start..range_end, validate(password), do: password
end
def validate(password) do
with true <- validate_length(password),
... |
05b2a51a3ec9053c2ed9290693b985a421065623 | 4,501 | [
270286908
] | [] | # In this file, we load production configuration and secrets
# from environment variables. You can also hardcode secrets,
# although such is generally not recommended and you have to
# remember to add this file to your .gitignore.
import Config
config :policr_mini,
# 通过空格间隔的可选项配置列表
opts: String.split(System.get_en... |
05b2a90c6c0c92394732375a02365ae4f40277b3 | 1,691 | [
760510569
] | [
"liveview"
] | defmodule TradebearWeb.PropertyManagement.AddContactLive do
use TradebearWeb, :live_view
alias Tradebear.PropertyManagement.Contact
def render(assigns) do
~H"""
<h2 class="py-5">Create Contact for Client <%= @client.name %></h2>
<.form for={@form} phx-change="validate_contact" phx-submit="create_cont... |
05b3bcad2711bd2b6dbd4da461154b4a049adabf | 2,178 | [
784519310
] | [] | defmodule ControlStructures do
def if_and_unless(arg) do
if String.valid?(arg) do
IO.puts("The string is valid")
else
IO.puts("The string is invalid")
end
unless is_integer(arg) do
IO.puts("The arg is not an integer")
else
IO.puts("The arg is an integer")
end
IO.i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.