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 |
|---|---|---|---|---|
09e4efe729da12636081d709f9f3e589b5281bef | 1,793 | [
433691760
] | [] | Code.require_file("../util/util.ex", __DIR__)
defmodule Day04 do
def parse_draw(line) do
String.split(line, ",", trim: true)
end
def parse_boardline(line) do
String.split(line, " ", trim: true)
end
def parse_board(lines) do
lines
|> Enum.map(&parse_boardline/1)
end
def parse_bingo(list... |
09e5c5f4da40715b6e476c1b09c6ca00f4a0bf26 | 9,904 | [
131710102
] | [
"genserver",
"supervisor",
"documented"
] | defmodule Chroxy.ChromeServer.Supervisor do
@moduledoc """
`DynamicSupervisor` for `Chroxy.ChromeServer`
"""
@sup __MODULE__
@worker Chroxy.ChromeServer
def child_spec() do
{DynamicSupervisor, name: @sup, strategy: :one_for_one}
end
def start_child(args) do
DynamicSupervisor.start_child(@sup,... |
09e5decf6394b9257683849d46c75a925c283419 | 2,240 | [
217036955
] | [
"supervisor",
"documented"
] | defmodule ClickhouseEcto.Storage do
@behaviour Ecto.Adapter.Storage
def storage_up(opts) do
database = Keyword.fetch!(opts, :database) || raise ":database is nil in repository configuration"
opts = Keyword.put(opts, :database, nil)
command = ~s[CREATE DATABASE IF NOT EXISTS "#{database}"]
ca... |
09e6082590ea766877dd37dfc5b6be2b3a7d0afd | 2,878 | [
649945050
] | [
"liveview",
"ecto"
] | defmodule StoreManagementSystemWeb.ProductLive.FormComponent do
use StoreManagementSystemWeb, :live_component
alias StoreManagementSystem.SMS
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage product records in your database.... |
09e69490f869685b30c533bc9f45255f33f963c1 | 2,802 | [
918997632
] | [] | %{
"earmark_parser": {:hex, :earmark_parser, "1.4.42", "f23d856f41919f17cd06a493923a722d87a2d684f143a1e663c04a2b93100682", [:mix], [], "hexpm", "6915b6ca369b5f7346636a2f41c6a6d78b5af419d61a611079189233358b8b8b"},
"ex_doc": {:hex, :ex_doc, "0.36.1", "4197d034f93e0b89ec79fac56e226107824adcce8d2dd0a26f5ed3a95efc36b1",... |
09e6af50b2bae9375e9ab5d11b1b4cd93b0da510 | 8,353 | [
25726976
] | [
"typespec",
"documented"
] | defmodule MimeMail do
@type header :: {:raw,binary} | MimeMail.Header.t #ever the raw line or any term implementing MimeMail.Header.to_ascii
@type body :: binary | [MimeMail.t] | {:raw,binary} #ever the raw body or list of mail for multipart or binary for decoded content
@type t :: %MimeMail{headers: [{key::binar... |
09e6e9a16ada3d84b9e30014e2f13ddbbf813d54 | 2,086 | [
607981709
] | [] | defmodule Fullstack.Algos.Btree.Node do
defstruct [:value, :left, :right]
end
defmodule Fullstack.Algos.Btree do
alias Fullstack.Algos.Btree.Node
"""
## Example
6
/ \
4 8
/ \ / \
1 5 - 9
"""
def init() do
node_b = %Node{value: 1}
node_c = %Node{value: 5}
... |
09e70e5afbb59aa12de6e578c248d16bc2619e6d | 6,643 | [
897844917
] | [] | defmodule Solution do
@max_fences 4
def read_file(path) do
path
|> File.read!()
|> String.split("\n")
end
def parse_input(lines) do
lines
|> Stream.map(&String.split(&1, "", trim: true))
|> Stream.with_index()
|> Stream.flat_map(fn {line, y} ->
Enum.reduce(line, {[], 0}, fn e... |
09e7677c1ddd7716d5e8b74147115cb76433243b | 3,187 | [
218509582
] | [
"test",
"supervisor"
] | defmodule SingletonSupervisorTest do
use ExUnit.Case
defmodule MySingleSupervisor do
use Supervisor
def start_link(init_arg) do
SingletonSupervisor.start_link(__MODULE__, init_arg)
end
def init(_init_arg) do
children = []
Supervisor.init(children, strategy: :one_for_one)
end... |
09e7798ec5cbbf8348d3b798bd21d114b30f3780 | 2,394 | [
902218933
] | [
"liveview"
] | defmodule ElixirGistWeb.AllGistsLive do
# implements live view behaviour
use ElixirGistWeb, :live_view
alias ElixirGist.Gists
alias ElixirGistWeb.Utilities.DateFormat
# mount takes params, session, and socket
# don't need params or session (call it uri)
def mount(_params, _uri, socket) do
{:ok, socke... |
09e79b91ed072fc4b4327a146044dbbae033ea51 | 3,259 | [
805037758
] | [
"genserver",
"typespec",
"documented"
] | defmodule TakeANumberDeluxe do
@moduledoc """
Module that keeps track of currently queued numbers
"""
alias ElixirSense.Core.State
# Client API
use GenServer
alias TakeANumberDeluxe.State
@spec start_link(keyword()) :: {:ok, pid()} | {:error, atom()}
def start_link(init_arg) do
GenServer.start_l... |
09e7c08d5177428fd4bc9b41f383d7c4f27726b9 | 6,046 | [
69680712
] | [] | defmodule Issuer.CLI.IO.Ncurses do
@title_color 36
@chosen_color 32
@chosen_many_no "☐"
@chosen_many_yes "☑"
@chosen_one_no "◎"
@chosen_one_yes "🔘" # ● ◉ ⬤ 🔘
defstruct title: "Hello, please answer our survey:",
questions: []
defimpl Issuer.Survey, for: Issuer.CLI.IO.Ncurses do
# FI... |
09e7c37216f9c24a7516e3492f3455b8fefa7440 | 8,041 | [
830050847
] | [
"documented",
"ecto"
] | defmodule Rms.Locomotives do
@moduledoc """
The Locomotives context.
"""
import Ecto.Query, warn: false
alias Rms.Repo
alias Rms.Locomotives.Locomotive
@doc """
Returns the list of tbl_locomotive.
## Examples
iex> list_tbl_locomotive()
[%Locomotive{}, ...]
"""
def list_tbl_... |
09e7f5c9fb31da3712df0a2971bb1dc14ef5224d | 1,794 | [
896967867
] | [] | [rules, sequences] =
IO.read(:stdio, :eof)
|> String.trim()
|> String.split("\n\n")
rules = rules
|> String.split("\n")
|> Enum.map(fn line -> String.split(line, "|") |> List.to_tuple() end)
|> MapSet.new()
sequences = sequences
|> String.split("\n")
|> Enum.map(fn line -> String.split(line, ",") end)... |
09e8fc60a91880317efbc9f4550a4c935feb144e | 2,459 | [
898627314
] | [] | defmodule PlaygroundElixir.DayEight do
def solve(input_file) do
grid =
input_file
|> File.read!()
|> String.trim()
|> String.split("\n")
# Grid dimensions
rows = length(grid)
cols = String.length(Enum.at(grid, 0))
positions =
grid
|> Enum.with_index()
|>... |
09e9012b9ec5e1cf1ab476f671ee4efdd2c7097f | 2,124 | [
823058089
] | [
"documented"
] | defmodule AddTwoLists do
@moduledoc """
Provides functionality to add two lists of single-digit integers where the digits are stored in reverse order.
Each list represents a non-negative integer. The sum is returned as a new list in the same reverse order.
"""
@doc """
Adds two lists of single-digit intege... |
09e9415b151089982f781d2180bf28e10d98387b | 7,660 | [
575214595
] | [
"test",
"phoenix"
] | defmodule ApiWeb.EntryControllerTest do
use ApiWeb.ConnCase
import Api.Factory
alias Api.Accounting.Entry
@id_not_found Ecto.UUID.generate()
setup %{conn: conn} do
{:ok, conn: put_req_header(conn, "accept", "application/json")}
end
describe "index/2 returns success" do
setup [:insert_entry, :... |
09e943c877ed284c886ac2280baac3307ee13f1d | 3,424 | [
316213521,
125919835,
316206423
] | [
"test"
] | defmodule SPARQL.Algebra.AlternativeGraphPatternTest do
use SPARQL.Test.Case
import SPARQL.Language.Decoder, only: [decode: 1]
test "group consisting of a union of two basic graph patterns" do
query = """
PREFIX : <http://example.com/>
SELECT *
WHERE { { ?s :p1 ?v1 } UNION {?s :p2 ?v2 } }
... |
09eae7832c2a6f4eff988c1dfbca88804ef35454 | 4,631 | [
721325242
] | [
"test"
] | defmodule BiomeJSTest do
use ExUnit.Case, async: true
doctest BiomeJS
test "format js string" do
assert {:ok, text} =
BiomeJS.format_js_string("""
const a = 1;
const b = () => {
console.log(
1, "Hallo"
)
}
... |
09eb247b4eeb4ec5f00622b2c37535c8ba415391 | 1,512 | [
482734302
] | [] | defmodule LmHttpHackney.MixProject do
use Mix.Project
@source_url "https://github.com/LucidModules/elixir-http-hackney"
@version "0.1.0"
def project do
[
app: :lm_http_hackney,
version: @version,
elixir: "~> 1.13",
start_permanent: Mix.env() == :prod,
deps: deps(),
# H... |
09eb2ea673e997ebd2287281c3e6a09775279273 | 2,485 | [
92661469
] | [] | defmodule Mix.Tasks.Cli do
use Mix.Task
require Logger
@shortdoc "return cli"
defp parse_args(args) do
parse = args
|> OptionParser.parse(
switches: [force: :boolean, mode: :string, logpath: :string , concurrency: :integer, max_connection: :integer, delay: :integer, host: :string, port: :strin... |
09eb410f45d3b732606128a2aeacbfbd0ed0b291 | 5,099 | [
82440935
] | [
"test"
] | defmodule Payjp.PlanTest do
use ExUnit.Case
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
@moduletag :plan
setup_all do
use_cassette "plan_test/setup", match_requests_on: [:query, :request_body] do
Payjp.Plans.delete_all
Helper.create_test_plan "specific-test-plan"
Helper.create_test_pl... |
09eb4aafc8406a07a3f3cf5990e60a1e8795bbd0 | 2,967 | [
99126072,
99860320
] | [
"documented"
] | defmodule JSON.Parser.Charlist.Number do
@doc """
parses a valid JSON numerical value, returns its elixir numerical representation
## Examples
iex> JSON.Parser.Charlist.Number.parse ''
{:error, :unexpected_end_of_buffer}
iex> JSON.Parser.Charlist.Number.parse 'face0ff'
{:error, {:unexp... |
09eb72825045b7b5cc0de8bebb2432c159b79670 | 2,772 | [
594524196
] | [] | defmodule EnvTree do
def add(nil, value, key) do
{:node, key, value, nil, nil}
end
def add({:node, k, _, left, right}, value, key) when k == key do
{:node, k, value, left, right}
end
def add({:node, k, v, left, right}, value, key) when key < k do
{:node, k, v, add(left, value, key), right}
... |
09ec0cd9483017b95db8dd4670c855e721226ceb | 3,556 | [
389101999
] | [
"typespec",
"documented"
] | defmodule Doctor.ModuleReport do
@moduledoc """
This module exposes a struct which encapsulates all the results for a doctor report. Whether
the module has a moduledoc, what the doc coverage is, the number of author defined functions,
and so on.
"""
alias __MODULE__
alias Doctor.ModuleInformation
@typ... |
09ed411ab22487358aec885009f1ca8fe944d886 | 1,914 | [
432497020
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
# General application configuration
import Config
config :phoenix_slime_test,
ecto_repos: [PhoenixSli... |
09ee042b793bdd7041223fcdf2cf6d76a8a3292c | 2,693 | [
135832997
] | [
"liveview"
] | defmodule Data.Article.Blog.BarrierearmerAlsterradweg do
use Article.Default
def created_at(), do: ~D[2022-03-16]
def title(), do: "Barrierearmer Alsterrradweg"
def summary(),
do:
"Bis 2025 sollen vom Lattenkamp bis Ohlsdorf Treppen und steile Anstiege ersetzt werden oder Alternativen bekommen"
... |
09ee1d75a4e36adba3eac975f95cf74282d1be34 | 1,722 | [
122641473
] | [
"phoenix"
] | defmodule AsciinemaWeb.ApiTokenController do
use AsciinemaWeb, :controller
alias Asciinema.Accounts
alias Asciinema.Accounts.User
plug :require_current_user
def show(conn, %{"api_token" => token}) do
case Accounts.get_or_create_api_token(token, conn.assigns.current_user) do
{:ok, api_token} ->
... |
09eec586afbb92d6c61fd7375c6a2db473fed3ff | 3,242 | [
803502084,
750475301
] | [
"typespec",
"macro",
"documented"
] | defmodule Toolshed do
@moduledoc """
Making the IEx console friendlier one command at a time
To use the helpers, run:
iex> use Toolshed
Add this to your `.iex.exs` to load automatically.
The following is a list of helpers:
* `cat/1` - print out a file
* `cmd/1` - run a sys... |
09ef79b94183f35ebf4bfc9ac66d7eaeae921cbb | 2,272 | [
562030130
] | [
"phoenix"
] | defmodule ScrumPokerWeb.Router do
use ScrumPokerWeb, :router
import ScrumPokerWeb.UserAuth,
only: [redirect_if_user_is_authenticated: 2, put_anonymous_user: 2]
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {ScrumPokerWeb.Layout... |
09f1033d6b90d716c31ddbc1e2e89f674ae070b9 | 3,078 | [
81935444
] | [
"documented"
] | defmodule Mix.Tasks.Nbx.Gen.Cache do
@shortdoc "Generates a new cache"
@moduledoc """
Generates a new cache.
The cache will be placed in the `lib` directory.
## Examples
$ mix nbx.gen.cache -c MyApp.Cache
## Command line options
* `-c`, `--cache` - The cache to generate.
"""
use Mix.Ta... |
09f140903c4c92b78c0bffca93479472ff0c138c | 2,534 | [
611073863
] | [
"typespec",
"supervisor",
"documented"
] | defmodule Pillminder.ReminderSender.TimerManager do
@moduledoc """
A supervisor used to keep track of interval timers.
"""
require Logger
use Supervisor
alias Pillminder.ReminderSender.SendServer
alias Pillminder.ReminderSender.ReminderTimer
@timer_supervisor_name __MODULE__.TimerSupervisor
@regist... |
09f1bb26d27a3966d45c5e49258cc3e60d9744c6 | 1,893 | [
122303596
] | [
"documented",
"ecto"
] | defmodule Poller.Answers.Answer do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias Poller.Answers.Answer
alias Poller.Auth.User
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "answers" do
field(:content, :string)
field(:v... |
09f1f2d8b119162c1640580448b13375f0576686 | 5,795 | [
942811655,
920024200
] | [
"typespec"
] | defmodule Zebra.Apis.InternalTaskApi.Schedule do
require Logger
alias Semaphore.Jobs.V1alpha.Job.Spec, as: Spec
alias Zebra.LegacyRepo, as: Repo
@default_job_priority 50
# in seconds
@default_job_execution_time_limit 24 * 60 * 60
# in minutes
@max_job_execution_time_limit 24 * 60
@spec schedule(Int... |
09f2159c274c271498e309caabdfbed9297f846e | 7,400 | [
691513949
] | [] | defmodule Blockchain.Storage do
alias Blockchain.Type
alias Elixireum.{AuxiliaryNode, CompilerState, Variable, YulNode}
alias Elixireum.Library.Utils
def get(
%AuxiliaryNode{
type: :storage_variable,
value: %Variable{type: %Type{encoded_type: 1}} = variable,
access_keys: a... |
09f21c568ab99fae64e1a35a689a3e0a7b8c38ff | 6,425 | [
230068427
] | [
"test"
] | defmodule EnrollmentTest do
use ExUnit.Case
import Mox
@mock_result """
{
"data": {
"enrollment": {
"client": {
"name": "Super Client"
},
"data": [
{
"name": "Activation.PublicCode",
"value": "2cd4c436-599d"
},
{
... |
09f21ea6a4a679a737c618e0230191e9769f3808 | 2,912 | [
924911936
] | [] | import Config
# Configure your database
config :pintelier, Pintelier.Repo,
username: "postgres",
password: "postgres",
socket_dir: System.get_env("PGHOST"),
database: "pintelier_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
# For development, we disable any cache a... |
09f225b3c55166116b97375403ced2638c8773f1 | 5,087 | [
161703639,
159884345
] | [
"documented"
] | defmodule WebSockex.Utils do
@moduledoc false
# Startup
def spawn(link, conn, module, state, opts) do
case List.keyfind(opts, :name, 0) do
{:name, name} ->
case whereis(name) do
nil ->
do_spawn(link, [self(), name, conn, module, state, opts])
pid ->
... |
09f23f423b4bef421443c2038465d06602b39c33 | 1,672 | [
572974111
] | [
"test"
] | defmodule I18nTest do
use ExUnit.Case
doctest I18n
test "parse extracts dates with timezones" do
assert I18n.parse("Departure: Europe/London Mar 04, 2020, 10:00") ==
DateTime.from_naive!(~N[2020-03-04T10:00:00], "Europe/London")
assert I18n.parse("Arrival: Europe/Paris Mar 04, 2020, 11... |
09f253cc383658b8c909ba6b853e4b42dbb2761a | 2,697 | [
104968072
] | [
"test"
] | defmodule CncfDashboardApi.SourceKeyProjectsControllerTest do
use CncfDashboardApi.ConnCase
alias CncfDashboardApi.SourceKeyProjects
@valid_attrs %{new_id: 42, source_id: "some content", source_name: "some content"}
@invalid_attrs %{}
setup %{conn: conn} = config do
signed_conn = Guardian.Plug.api_sign_... |
09f279fd53bc9e5b32f586710c0c6b92b05ce203 | 7,265 | [
633861562
] | [
"typespec",
"documented"
] | defmodule Soroban.Contract.RestoreFootprint do
@moduledoc """
`RestoreFootprint` implementation to extend a contract.
"""
alias Soroban.Contract.RPCCalls
alias Soroban.RPC
alias Soroban.RPC.{SendTransactionResponse, Server}
alias Stellar.TxBuild.{
Account,
LedgerFootprint,
LedgerKey,
Res... |
09f2f655ae26ac20816b17c28c51c1b8d532c763 | 2,144 | [
83612883
] | [
"typespec",
"macro",
"documented"
] | defmodule Telebacon.SimpleAPI do
@moduledoc false
alias Telebacon.HTTP, as: HTTP
alias Telebacon.SimpleAPI, as: Simple
defmacro call(name, in_ty, out_ty) do
{fun_name, api} = api_name(name)
make_fun(fun_name, in_ty, api, out_ty)
end
def handle_result(:ok, response, parsefn) do
with results = ... |
09f31f56821f4e7d0ee3d44de9b7f8e4838ea0bb | 4,933 | [
989865012
] | [
"test",
"phoenix"
] | defmodule InotesWeb.UserSettingsControllerTest do
use InotesWeb.ConnCase, async: true
alias Inotes.Accounts
import Inotes.AccountsFixtures
setup :register_and_log_in_user
describe "GET /users/settings" do
test "renders settings page", %{conn: conn} do
conn = get(conn, ~p"/users/settings")
r... |
09f3a9c36377b9cf1a4a6b9eaea5ad689b9b58df | 2,487 | [
1012188255
] | [
"liveview",
"ecto"
] | defmodule MyAppWeb.PostLive.FormComponent do
use MyAppWeb, :live_component
alias MyApp.Content
alias MyApp.Accounts
@impl true
def render(assigns) do
~H"""
<div>
<.header>
{@title}
<:subtitle>Use this form to manage post records in your database.</:subtitle>
</.header>
... |
09f3f369abef32ba14c8561231ff9d4d9d52de46 | 1,571 | [
105783894
] | [
"test"
] | defmodule PangramTest do
use ExUnit.Case
# @tag :pending
test "empty sentence" do
refute Pangram.pangram?("")
end
# @tag :pending
test "pangram with only lower case" do
assert Pangram.pangram?("the quick brown fox jumps over the lazy dog")
end
# @tag :pending
test "missing character 'x'" do... |
09f46509effe6f549afd090ffd8d209b8f405482 | 6,804 | [
650438646
] | [
"documented"
] | defmodule Mockingjay.Strategies.GEMM do
@moduledoc false
import Nx.Defn
alias Mockingjay.Tree
alias Mockingjay.DecisionTree
@behaviour Mockingjay.Strategy
@impl true
def init(ensemble, opts \\ []) do
opts = Keyword.validate!(opts, reorder_trees: true)
trees = DecisionTree.trees(ensemble)
n... |
09f46b2b3225ca87071f1e067a4e9ac4b4e1f485 | 1,588 | [
128260569
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Chup.Web 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 Chup.Web, :controller
use Chup.Web, :view
The definitions below will be executed for every view,
controller, etc, s... |
09f4b7ae6f32f2bef5237087445d30450dd1b61a | 1,504 | [
375276349
] | [
"typespec",
"test",
"documented"
] | defmodule Membrane.VideoMerger.Support do
@moduledoc false
import Membrane.Testing.Assertions
import ExUnit.Assertions
alias Membrane.{Buffer, Testing}
@maximal_error Membrane.Time.millisecond()
@spec run_test(
[Membrane.ChildrenSpec.structure_builder_t()],
Enum.t(),
{integer... |
09f5daa385a52e1dd9ffa7210fe20c4195c424db | 8,038 | [
130057840,
112387443,
153922468
] | [
"test"
] | defmodule Bamboo.MailerTest do
use ExUnit.Case
alias Bamboo.Email
defmodule FooAdapter do
def deliver(email, config) do
send :mailer_test, {:deliver, email, config}
end
def handle_config(config), do: config
def supports_attachments?, do: true
end
defmodule CustomConfigAdapter do
... |
09f673e0c8977aa992528d9afa3706233a5ce14c | 5,603 | [
632451208
] | [
"typespec",
"documented"
] | defmodule ZhrDevs.Submissions.Aggregates.Submission do
@moduledoc """
Represents a submission of the certain task by the certain user.
Validates, that user can submit the solution only twice.
An aggregate is comprised of its state, public command functions, and state mutators.
In a CQRS application all stat... |
09f71439fe1fb228bf4cd8370a819ccecbdabd2f | 1,763 | [
73516692,
78030894
] | [] | defmodule Timex.Mixfile do
use Mix.Project
@version "3.1.5"
def project do
[ app: :timex,
version: @version,
elixir: "~> 1.3",
description: description(),
package: package(),
deps: deps(),
docs: docs(),
compilers: [:gettext] ++ Mix.compilers,
test_coverage: [t... |
09f797761658916a85dd84fca7f3d9bce79a7d0d | 1,551 | [
559764804
] | [
"liveview",
"ecto"
] | defmodule AttendanceWeb.SessionLive.AssignCourseFormComponent do
use AttendanceWeb, :live_component
alias Attendance.Catalog
alias Attendance.Lecturers
@impl true
def update(%{assign_course_to_lecturer: %{course: course_id}} = assigns, socket) do
course = Catalog.get_courses!(course_id)
changeset = ... |
09f79b4fdfd37e46b60fcee120b8cad7af7d47d0 | 7,003 | [
84200794
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
"bus": {:hex, :bus, "0.1.4", "52ae883734ae94badc7c01a7884f9c5a9040d7e8eda63a321b04746764a8e09e", [:mix], [], "hexpm"},
"calendar": {:hex, :calendar, "0.17.4", "22c5e8d98a4db9494396e5727108df... |
09f8728cde2433a16f35a04010951f31dc4ff621 | 5,306 | [
87101450
] | [
"documented",
"ecto"
] | defmodule Man.Templates.API do
@moduledoc """
The boundary for the TemplateAPI system.
"""
import Ecto.{Query, Changeset}, warn: false
alias Man.Repo
alias Man.Templates.Template
alias Ecto.Multi
alias Ecto.Paging
@fields [:title, :description, :syntax, :body, :validation_schema, :labels]
@required... |
09f885546e178cc005c8eceaf78c1c502a520d63 | 4,947 | [
97278164
] | [
"documented"
] | defmodule Llixer.Evaluator.Stdlib do
@moduledoc """
The standard library of function for Llixer
"""
alias Llixer.Env
# def i__quote(env, arg) do
# ast_to_value(env, arg)
# end
def escape_name(name) when is_binary(name) do
name # TODO: Escape this
end
def ast_to_value(env, ast)
def ast_t... |
09f8b471fa2ba4094dd098714ebfe7af0135335b | 15,637 | [
194069712
] | [
"test",
"ecto"
] | defmodule QueryBuilderTest do
use ExUnit.Case
doctest QueryBuilder
alias Ecto.Changeset
alias QueryBuilder.{Repo, User}
import Ecto.Query
@valid_sort ["desc,birthdate", "asc,inserted_at"]
@valid_params %{
"search" => "clubcollect",
"adult" => "true",
"sort" => @valid_sort,
"page" => "1... |
09f8bf60293f6319572304648a7cea924c7d893d | 1,936 | [
455930174
] | [] | defmodule HackerNewsAggregator.MixProject do
use Mix.Project
def project do
[
app: :hacker_news_aggregator,
version: "0.1.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:boundary, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,... |
09f90a853b5ae015129dfec32dd7f20319abb2c7 | 3,546 | [
846793042
] | [
"documented",
"ecto"
] | defmodule Lessthanseventy.FoodTrucks do
@moduledoc """
The FoodTrucks context.
"""
import Ecto.Query, warn: false
alias Ecto.Multi
alias Lessthanseventy.Repo
alias Lessthanseventy.FoodTrucks.FoodTruck
@doc """
Returns the list of food_trucks.
## Examples
iex> list_food_trucks()
[%F... |
09f925db97a3ba472d7131dbb92b2c3126dc83ce | 5,133 | [
206297200
] | [
"typespec",
"documented"
] | defmodule Google.Ads.Googleads.V8Availabilities.Resources.ChangeEvent.ChangedResource do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
ad: Google.Ads.Googleads.V8Availabilities.Resources.Ad.t() | nil,
ad_group: Google.Ads.Googleads.V8Availabilities.Resources.AdGroup.t... |
09f973350f1e0f2bf49c64972b718780fc49f2f8 | 5,302 | [
135832997
] | [
"liveview"
] | defmodule Data.Article.Blog.StormarnerStrasseEulenkamp do
use Article.Default
def name(), do: "#{created_at()}-6-stormarner-strasse-eulenkamp"
def created_at(), do: ~D[2019-10-18]
def updated_at(), do: ~D[2022-07-29]
def title(), do: "Stormarner Straße und Eulenkamp West (Veloroute 6)"
def type(), do: :fi... |
09f9a124b2b5e1658e5ca638e729101d2c0d44fb | 4,321 | [
376736818
] | [] | %{
"absinthe": {:hex, :absinthe, "1.4.13", "81eb2ff41f1b62cd6e992955f62c22c042d1079b7936c27f5f7c2c806b8fc436", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "ddb55fba830d5a25add2d707a81d11b40096bf6... |
09fa61bf52fd0c3cab76cc56e5a6e717df352734 | 1,839 | [
571776611
] | [
"test"
] | defmodule Pleroma.MigrationHelper.NotificationBackfillTest do
use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.MigrationHelper.NotificationBackfill
alias Pleroma.Notification
alias Pleroma.Repo
alias Pleroma.Web.CommonAPI
import Pleroma.Factory
describe "fill_in_notif... |
09fa6e6a5bbcc1a7a544de1793fb81dae2a22c15 | 4,004 | [
489499073
] | [
"typespec",
"liveview",
"documented"
] | defmodule Moar.Sugar do
# @related [test](/test/sugar_test.exs)
@moduledoc """
Syntactic sugar functions.
These functions are intended to be used by importing the functions or the whole module:
```
import Moar.Sugar, only: [noreply: 1]
def handle_event("foo", _params, socket) do
socket |> assign(f... |
09facd8554e27e11a232d3830c8af76c852269a3 | 1,545 | [
1007659462
] | [
"liveview"
] | defmodule PhoenixRaffleyWeb.UserLive.Login do
use PhoenixRaffleyWeb, :live_view
def render(assigns) do
~H"""
<div class="mx-auto max-w-sm">
<.header class="text-center">
Log in to account
<:subtitle>
Don't have an account?
<.link navigate={~p"/users/register"} clas... |
09fb51e0d5553e00895e7d7cb5cd901bc0de296c | 6,954 | [
788955707
] | [] | defmodule Codificador do
def codificar_data_vencimento(data_str) do
# Converte em um objeto do tipo Date
data_lista = data_str |> String.split("/") |> Enum.map(&String.to_integer/1)
data_entrada = Date.new(Enum.at(data_lista,2), Enum.at(data_lista,1), Enum.at(data_lista,0)) |>
elem(1)
# Data base... |
09fc611608dc9b225acd45e949b10093bd3a4248 | 2,440 | [
82197728
] | [
"test"
] | defmodule AdventOfCode.Puzzle7 do
@bracket_pattern ~r/\[.+?\]/
def supports_tls?(address) do
{bracket_segments, no_bracket_segments} =
split_into_segments(address)
Enum.any?(no_bracket_segments, &abba_present?/1) &&
!Enum.any?(bracket_segments, &abba_present?/1)
end
def supports_ssl?(addre... |
09fc6481fd4977e5309a8922a6463bdc213ccf93 | 1,770 | [
206452166,
373975587
] | [
"phoenix",
"ecto"
] | defmodule InkfishWeb.Admin.UserController do
use InkfishWeb, :controller
alias Inkfish.Users
plug InkfishWeb.Plugs.RequireUser, admin: true
plug InkfishWeb.Plugs.Breadcrumb, {"Admin Users", :admin_user, :index}
def index(conn, _params) do
users = Users.list_users()
render(conn, "index.html", u... |
09fe17180501dd53e41c0ee0cad4977bd878358c | 2,417 | [
525940205
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule VultusWeb 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 VultusWeb, :controller
use VultusWeb, :view
The definitions below will be executed for every view,
controller, etc... |
09fe8558d035338312a88d1f8d2e6bb9097a8c41 | 8,866 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Compute.V1.Model.ServiceAttachment do
@moduledoc """
Represents a ServiceAttachment resource. A service attachment represents a service that a producer has exposed. It encapsulates the load balancer which fronts the service runs and a list of NAT IP ranges that the producers uses to represent th... |
09fe9b3dd8e69956bc7733d37a33f11acf6d1f09 | 1,639 | [
893954245
] | [] | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Vimperfect.Repo.insert!(%Vimperfect.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as the... |
09fef6e626eef4749b4a9a83c9b40eb43e5b17ae | 1,664 | [
936658145
] | [
"liveview",
"phoenix"
] | defmodule InstagramCloneMDWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :instagram_clone_m_d
# 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,... |
0a013befae8e00e60bc1406cbc3ed1e3082ec1b3 | 3,121 | [
300100817
] | [
"genserver",
"documented"
] | defmodule ExAirtable.RateLimiter do
@moduledoc """
The RateLimiter ensures that no requests go to Airtable fast enough to trigger API rate-limiting.
Requests will be handled immediately until more than 5 happen, at which point they go onto a queue which flushes every second. This ensures that no more than 5 requ... |
0a014d5e5fb880536dded63f9d41f603d1b4cba5 | 2,834 | [
95405447
] | [
"phoenix"
] | defmodule Plug.TinyServiceGateway do
import Plug.Conn
alias TinySvc.Model.Model
alias TinySvc.Model.Request
alias TinySvc.Model.Cookie
@deps [
invoker: TinySvc.Invoker,
router: TinySvc.FunctionRouter,
service_manager: TinySvc.ServiceManager
]
def init(_) do
@deps
end
def call(conn, ... |
0a017cd422e36813f1db5c23369a99601e2ed9d2 | 4,868 | [
186691004
] | [
"genserver",
"typespec",
"documented"
] | defmodule WE.DocumentLibrary do
use GenServer
use TypedStruct
@moduledoc false
@document_registry_name :document_registry
# client
@spec store_document(String.t(), WE.Document.t()) :: {:ok, any()}
def store_document(history_id, document) do
GenServer.call(via_tuple(history_id), {:store, document})
... |
0a01a6f2f65e0ca6897b3d8a65debc855a658a1f | 2,514 | [
897959614
] | [] | defmodule Year2024.Day5 do
require Logger
# 4027 too low
def run(mode \\ :sample) do
rules = load_rules(mode)
file_name = if mode == :actual, do: "day5.queue.txt", else: "day5.sample.queue.txt"
AOC.read_file(file_name)
|> Enum.map(&AOC.parse/1)
|> Enum.reject(&is_valid(&1, rules))
|> En... |
0a01a7f804dc409b4efc046b184c13647a2935f4 | 1,647 | [
74335267
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule ScraperWeb.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use ScraperWeb.Web, :controller
use ScraperWeb.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep... |
0a021e6548280462b69af9ac50b4e5f965a89080 | 1,509 | [
187263849
] | [
"macro",
"phoenix"
] | defmodule QuotesAppWeb.V1.QuoteController do
use QuotesAppWeb, :controller
def index(conn, %{"format" => "html"}) do
case QuotesApp.Quotes.get_quote_of_the_day do
{:ok, quote} ->
conn
|> assign(:quote, quote)
|> render(:index)
_ ->... |
0a023fff4352ec2ecd76a8318052e4492dbed889 | 2,481 | [
65017194
] | [
"test"
] | defmodule Eskwela.QuestionControllerTest do
use Eskwela.ConnCase
alias Eskwela.Question
@valid_attrs %{item: "some content"}
@invalid_attrs %{}
test "lists all entries on index", %{conn: conn} do
conn = get conn, question_path(conn, :index)
assert html_response(conn, 200) =~ "Listing questions"
en... |
0a026c1022cb8eaafdc19d9b45395b3d379a7032 | 3,477 | [
884146896
] | [
"documented",
"ecto"
] | defmodule AttendanceApi.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias AttendanceApi.Repo
alias AttendanceApi.Accounts.{User, UserToken}
## Database getters
@doc """
Gets a user by email and password.
## Examples
iex> get_user_by_email_and_passw... |
0a029719f610406c1d9d66f4551c61b9fcbc9a3c | 3,947 | [
87027
] | [
"liveview"
] | defmodule VenieriWeb.VirtualWorld do
alias VenieriWeb.VirtualWorld
use VenieriWeb, :live_view
require Logger
import VenieriWeb.Components.Navbar
def mount(_params, _session, socket) do
{:ok, socket |> assign(:bg_color, "bg-black")}
end
def render(assigns) do
~H"""
<div class="mx-auto p-3 px... |
0a02fa412f65ddf3d41b62d5d726ca0f45c2a2c5 | 3,102 | [
206573807
] | [
"genserver"
] | defmodule Cluster.Strategy.GoogleComputeEngine do
use GenServer
use Cluster.Strategy
alias Cluster.Strategy.State
@default_polling_interval 10_000
@metadata_base_url 'http://metadata.google.internal/computeMetadata/v1'
@google_api_base_url 'https://www.googleapis.com/compute/v1'
@default_release_name :n... |
0a04750cc31406bafdbe4bf765114fa1229d7a78 | 2,763 | [
141614612
] | [
"test"
] | defmodule Joken.Signer.Config.Test do
use ExUnit.Case, async: true
import Joken.Signer.Config
doctest Joken.Signer.Config
@valid_token "eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzb21lX2lzc3VlciIsIm5hbWUiOiJKYW5lIERvZSJ9.fisuQaN9_e9wkeDlRBRAi0YhCPt4gSmTSa0IZq-wNj8"
@near_blank_token "eyJhbGciOiJIUzI1NiJ9.e30.2ROr1Q6T... |
0a0494fcd42c1585833b2c125cebb8982484b2fa | 4,027 | [
200644394
] | [
"test",
"liveview"
] | defmodule IslandsInterface.BoardHandlerTest do
use ExUnit.Case
import Mox
alias IslandsInterface.{GameContext, BoardHandler}
alias IslandsEngine.{Coordinate}
@game_name "<EMAIL>"
@player_islands %{
atoll: %{name: "Atoll", state: :_, type: :atoll},
dot: %{name: "Dot", state: :_, type: :dot},
l_... |
0a04c2595e2775c122a36a2c13cac106f08961a2 | 1,701 | [
370813738,
450993182
] | [
"test"
] | defmodule StellarBase.XDR.ClaimableBalanceEntryExtV1Test do
use ExUnit.Case
alias StellarBase.XDR.{Ext, UInt32, ClaimableBalanceEntryExtV1}
describe "ClaimableBalanceEntryExtV1" do
setup do
ext = Ext.new()
flags = UInt32.new(1)
%{
ext: ext,
flags: flags,
claimable_... |
0a04d1f4df2edbba252f8ae119ecde67d0ab05f3 | 1,661 | [
53983520
] | [
"test"
] | defmodule ExPrometheusIo.QueryTest do
use ExUnit.Case, async: true
import ExPrometheusIo.Query, only: [query_params: 2,
endpoint: 1,
build_url: 2]
test "query_params builds proper query string" do
curr_time = :os.system_time(:second... |
0a04d22be477f31bcd6ffdcbe3dd1cee4af2c613 | 2,882 | [
81803361
] | [
"test"
] | defmodule Phoenix.ConfigTest do
use ExUnit.Case, async: true
import Phoenix.Config
setup meta do
config = [parsers: false, custom: true, otp_app: :phoenix_config]
Application.put_env(:config_app, meta.test, config)
:ok
end
@defaults [static: [at: "/"]]
test "reads configuration from env", met... |
0a04e88fb9a1bc6d682023ed94158e4acb4d6251 | 4,921 | [
507986713
] | [
"test"
] | defmodule BankOcr.Impl.DigitTest do
use ExUnit.Case, async: true
alias BankOcr.Impl.Digit
doctest Digit, import: true
describe "from_string/1" do
test "resolves 2" do
string = "2"
assert Digit.from_string(string) == %Digit{
scan: [
" _ ",
" _|",... |
0a04f6da2a7faf4eafcc471d1e7ef376aec2bba2 | 15,352 | [
196437827
] | [] | %{
"abt_did_elixir": {:hex, :abt_did_elixir, "0.3.6", "9abb36f4fe0c07452fe96f21356631bd70c11f3a05f212d758849e2b48fa6953", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:mcrypto, "~> 0.2", [hex: :mcrypto, repo: "hexpm", optional: false]}, {:multibase, "~> 0.0.1", [hex: :multibase, repo: ... |
0a051967e7c4160b86bf97fb5b4903a8afa68ec0 | 2,161 | [
305961260
] | [
"test",
"documented"
] | # defmodule AcqdatCore.Schema.EntityManagement.AssetCategoryTest do
# @moduledoc false
# use ExUnit.Case, async: true
# use AcqdatCore.DataCase
# import AcqdatCore.Support.Factory
# alias AcqdatCore.Schema.EntityManagement.AssetCategory
# describe "changeset/2" do
# test "returns a valid changeset" do... |
0a061c91e889188eaf6280a9b683cb0011945fee | 1,625 | [
79348383
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Digester.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Digester.Web, :controller
use Digester.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them ... |
0a073b560f2731ffe257ca7059a3760c1a1dba00 | 3,094 | [
737186361
] | [
"typespec",
"test",
"documented"
] | defmodule Umwelt.Parser.AttrsTest do
use ExUnit.Case, async: true
alias Umwelt.Felixir.{Attribute, Call, Literal, Structure, Value, Variable}
alias Umwelt.Parser.Attrs
test "parse module doc" do
{:ok, ast} =
"""
@moduledoc "Calculator"
"""
|> Code.string_to_quoted()
assert %... |
0a07aef40112cd464c5d4e600bcf6d772db3795d | 12,070 | [
224428977
] | [
"test"
] | defmodule ApxrIoWeb.API.ReleaseControllerTest do
use ApxrIoWeb.ConnCase, async: true
alias ApxrIo.Accounts.AuditLog
alias ApxrIo.Repository.Project
setup do
user = insert(:user)
team = insert(:team)
project =
insert(:project,
team: team,
project_owners: [build(:project_owner... |
0a080abd8ee8738cee7213e94064b294e5fe4a29 | 4,346 | [
570929791
] | [
"test"
] | defmodule PaymentApiWeb.AccountControllerTest do
use PaymentApiWeb.ConnCase, async: true
alias PaymentApi.Models.{Account, User}
describe "deposit" do
setup %{conn: conn} do
params = %{
nickname: "includevitor",
email: "<EMAIL>"
}
{:ok, %User{account: %Account{id: account_i... |
0a083e76fbaba37aaf97c58518b2322fc830556c | 2,266 | [
432152566
] | [
"documented"
] | defmodule Exfwghtblog.Markdown do
@moduledoc """
Converts `EarmarkParser` Abstract Syntax Trees to HTML or plain text
"""
# ============================================================================
# Traversal of elements
# ============================================================================
# ... |
0a08e5520a3f4c818b22b017c8ef0baee95c100d | 6,495 | [
189411874
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse... |
0a0911a9fb28aa8e7f31c646b12bace11f732275 | 7,904 | [
118819250
] | [] | %{
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"},
"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea9703... |
0a094e56878a85a422d6d811d61d36ae7eb7fb2f | 3,348 | [
609570820
] | [
"phoenix"
] | defmodule ManagementServerWeb.Router do
use ManagementServerWeb, :router
use Plug.ErrorHandler
defp handle_errors(conn, %{reason: %Phoenix.Router.NoRouteError{message: message}}) do
conn |> json(%{errors: message}) |> halt()
end
defp handle_errors(conn, %{reason: %{message: message}}) do
conn |> jso... |
0a09606eddbef69d528887bae7e9d26ea1f7c6f7 | 2,438 | [
607729034
] | [] | defmodule OperatelyWeb.Logger do
require Logger
import Plug.Conn
@behaviour Plug
def init(opts), do: opts
def call(conn, _opts) do
start_time = System.monotonic_time()
register_before_send(conn, fn conn ->
stop_time = System.monotonic_time()
duration = System.convert_time_unit(stop_tim... |
0a0968f65c5bb10d7dbf2e52728bb44eee3c89d5 | 2,667 | [
984214921
] | [] | defmodule BtcpayTracker.ParsingUtils do
require Logger
alias Decimal
def parse_fiat_string(nil), do: %{amount: nil, currency: nil}
def parse_fiat_string(value) when is_number(value) do
%{amount: cast_to_decimal(value), currency: nil} # Assuming USD or default if only number
end
def parse_fiat_string(fi... |
0a099bba47d532f6a5980d6396528fd53d23d462 | 1,741 | [
213935403
] | [
"typespec",
"documented"
] | defmodule NodoRemoto do
@moduledoc """
modulo de gestión de ciclo de vida de nodos VM Elixir remotos
"""
# Constantes
@timeout_rpc 50
@doc """
Poner en marcha un nodo VM remoto con ssh
- Se tiene en consideracion los puertos disponibles,
debido al cortafuegos, en el laboratorio ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.