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 |
|---|---|---|---|---|
00dcfc7737527508ac0646d9393b8c912e3635af | 3,910 | [
117153636
] | [] | %{
"certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hexpm", "524c97b4991b3849dd5c17a631223896272c6b0af446778ba4675a1dff53bb7e"},
"eiconv": {:hex, :eiconv, "1.0.0", "ee1e47ee37799a05beff7a68d61f63cccc93101833c4fb94b454c23b12a21629", [:rebar3], [... |
00ddcd1b1f6aab91dd85e6e1c6796ce5a3abbce4 | 2,348 | [
654412363
] | [
"liveview",
"ecto"
] | defmodule ArchiveWeb.AuthorLive.FormComponent do
use ArchiveWeb, :live_component
alias Archive.Authors
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage author records in your database.</:subtitle>
</.header>
<.s... |
00dde01adfdcc69967fd13f2959e0281a2bd4b60 | 1,847 | [
818575411
] | [
"typespec",
"documented"
] | defmodule ExCvm do
@moduledoc """
Documentation for `ExCvm`.
The CVM Algorithm for Estimating Distinct Elements in Streams.
https://cs.stanford.edu/~knuth/papers/cvm-note.pdf
"""
@spec __struct__() :: %ExCvm{buffer: [], p: float(), t: 0}
# Step D1: Initialize t = 0, p = 1, B = []
defstruct t: 0, p: De... |
00de2613d3c5266c8d4ea7f43ea677935770a0a0 | 1,738 | [
633251977
] | [] | # This file is responsible for configuring your umbrella
# and **all applications** and their dependencies with the
# help of the Config module.
#
# Note that all applications in your umbrella share the
# same configuration and dependencies, which is why they
# all use the same configuration file. If you want different... |
00de2a2bf3fb17c52f12c8e1fbeb3edb74564717 | 2,708 | [
104698876
] | [
"test"
] | defmodule TechTalksWeb.TopicControllerTest do
use TechTalksWeb.ConnCase
alias TechTalks.Talks
@create_attrs %{description: "some description", name: "some name"}
@update_attrs %{description: "some updated description", name: "some updated name"}
@invalid_attrs %{description: nil, name: nil}
def fixture(:... |
00de303a376c9ad8472d7b4e37b3caa607eabea9 | 1,858 | [
677845133
] | [
"test",
"ecto"
] | defmodule YouCongress.HallsTest do
use YouCongress.DataCase
alias YouCongress.Halls
describe "halls" do
alias YouCongress.Halls.Hall
import YouCongress.HallsFixtures
@invalid_attrs %{name: nil}
test "list_halls/0 returns all halls" do
hall = hall_fixture()
assert Halls.list_halls(... |
00de3205ddedc9a157cd0cb839ef9b09a75bbfcb | 14,419 | [
949664843
] | [
"typespec",
"documented"
] | defmodule Raxol.Terminal.Input.Manager do
import Raxol.Guards
@moduledoc """
Manages terminal input processing including character input, key events, and input mode handling.
This module is responsible for processing all input events and converting them into appropriate
terminal actions.
"""
alias Raxol... |
00debfffbc9d2199274dfed40dda615c800b15e1 | 7,034 | [
87683657,
99106424,
87457687,
297237670,
86030418,
95605888,
123950289,
86063602,
96350285,
96857265,
97959122,
133864047,
145635147,
242077992,
17908039,
85355617,
95606261,
96716916,
115417830,
134052042,
159038989,
90091062,
92660269,
153922468,
202664844,
940311... | [
"documented"
] | defmodule Plug.CSRFProtection do
@moduledoc """
Plug to protect from cross-site request forgery.
For this plug to work, it expects a session to have been
previously fetched. It will then compare the plug stored
in the session with the one sent by the request to determine
the validity of the request. For an... |
00df0785fa52ad666f6899813251be27f06ab06d | 1,643 | [
106735690
] | [
"documented"
] | defmodule Norma.Utils do
@masked_ports ["443", "80", "8080", "21"]
def port_handler(port) do
case port do
443 -> "https"
80 -> "http"
8080 -> "http"
21 -> "ftp"
_ -> "http"
end
end
@doc """
At first, I tried to do this with just the standard library
```
"mazing.stud... |
00df3d319178ae76dc429bc97b8ced1ede74ca32 | 2,734 | [
302817563
] | [
"genserver"
] | defmodule Slurpee.BlockchainStatistics do
use GenServer
defmodule State do
defstruct ~w[last_head_received_at new_heads_received_total events_received_total started_at]a
end
defmodule Stats do
defstruct ~w[last_head_received_at block_cadence_seconds events_per_second]a
end
def start_link(_) do
... |
00df4823c85384500633c0338b6c6e41eb3c2efb | 1,620 | [
574117985
] | [] | defmodule PairDance.Infrastructure.Insights.Repository do
alias PairDance.Infrastructure.Team.MemberEntity
alias PairDance.Infrastructure.Team.AssignmentEntity
alias PairDance.Infrastructure.Team.TaskEntity
alias PairDance.Infrastructure.User.Entity, as: UserEntity
alias PairDance.Infrastructure.Repo
import... |
00dfd5cc6d647d1ad7aedc10409992b84c2b7c6d | 2,245 | [
82540176
] | [
"phoenix",
"ecto"
] | defmodule HelloWeb.CMS.PageController do
use HelloWeb, :controller
alias Hello.CMS
alias Hello.CMS.Page
plug :require_existing_author
plug :authorize_page when action in [:edit, :update, :delete]
def index(conn, _params) do
pages = CMS.list_pages()
render(conn, "index.html", pages: pages)
end
... |
00e00cd46420435dfcbe8f28e433aec682210357 | 1,503 | [
81700957
] | [] | defmodule TitleIxWaivers.WaiverResponseLetter do
use Arc.Definition
use Arc.Ecto.Definition
# Include ecto support (requires package arc_ecto installed):
# use Arc.Ecto.Definition
@versions [:original]
@acl :public_read
def __storage do
if Mix.env == :dev or Mix.env == :test do
Arc.Storage.L... |
00e0233cec186e1ab7e5c9c0a522e878c623629f | 1,971 | [
143184715
] | [
"test"
] | defmodule AdminFunTest do
use ExUnit.Case
doctest Snapex7
setup do
{:ok, pid} = Snapex7.Client.start_link()
Snapex7.Client.connect_to(pid, ip: "<IP_ADDRESS>", rack: 0, slot: 1)
{:ok, state} = :sys.get_state(pid) |> Map.fetch(:state)
%{pid: pid, status: state}
end
test "set_connection_type fu... |
00e05da280bf47328e8c90f3686a606ed727743b | 1,531 | [
715546817
] | [
"phoenix"
] | defmodule ApiElixirWeb.UserController do
use ApiElixirWeb, :controller
alias ApiElixir.Admin
alias ApiElixir.Admin.User
action_fallback ApiElixirWeb.FallbackController
def index(conn, _params) do
users = Admin.list_users()
render(conn, :index, users: users)
end
def by_email(conn, _params) do
... |
00e080a06b81f9e9af64944e0e09adfa6dc67105 | 4,475 | [
53504176,
157252814
] | [
"phoenix",
"ecto"
] | require IEx
defmodule IphodWeb.CalendarController do
use IphodWeb, :controller
use Timex
def index(conn, params) do
select_language(params)
render_calendar(conn, get_month(Timex.today()), nil)
end
def mindex(conn, params) do
select_language(params)
render_calendar(conn, get_month(Timex.toda... |
00e0ac854049a705021f60ff384395f055b65c4a | 3,966 | [
402304399
] | [
"test",
"phoenix"
] | defmodule IndiePaperWeb.AuthorConfirmationControllerTest do
use IndiePaperWeb.ConnCase, async: true
alias IndiePaper.Authors
alias IndiePaper.Repo
import IndiePaper.AuthorsFixtures
setup do
%{author: author_fixture()}
end
describe "GET /authors/confirm" do
test "renders the resend confirmation ... |
00e0b4e7fabd3ac42af81daf56f2b2dd5888275a | 1,779 | [
967154552
] | [
"genserver"
] | defmodule ChatAppBackendWeb.RoomChannel do
use ChatAppBackendWeb, :channel
@impl true
def join("room:lobby", payload, socket) do
if authorized?(payload) do
send(self(), :after_join)
{:ok, socket}
else
{:error, %{reason: "unauthorized"}}
end
end
defp format_message(message) do
... |
00e0d776fbe1d573127d3af91d084f26cf48fc41 | 1,972 | [
153572337
] | [
"genserver",
"phoenix"
] | defmodule AgileFlowWeb.MainChannel do
use Phoenix.Channel
alias AgileFlowWeb.Presence
alias AgileFlow.Director
def join("main::start", _payload, socket) do
send(self(), :after_join)
{:ok, socket.assigns.user, socket}
end
def handle_info(:after_join, socket) do
user = socket.assigns.user
{:... |
00e144c19807f9d042070004ae642735a9892615 | 1,720 | [
381372899
] | [
"test"
] | defmodule Storex.Clients.GetTest do
use Storex.DataCase, async: true
import Storex.Factory
alias Storex.Client
alias Storex.Clients.Get
describe "by_id/1" do
test "when the client exists, returns the client" do
%Client{id: id} = insert(:client)
response = Get.by_id(id)
assert {:ok,
... |
00e185f754680cd4286b8d745fa07c312d2c83b7 | 6,165 | [
139333927
] | [] | %{
"amqp": {:hex, :amqp, "1.0.3", "06a6d909abc71d82b7c3133ca491899ca18fce857d0697dd060c29de1ef498d8", [:mix], [{:amqp_client, "~> 3.7.3", [hex: :amqp_client, repo: "hexpm", optional: false]}, {:goldrush, "~> 0.1.0", [hex: :goldrush, repo: "hexpm", optional: false]}, {:jsx, "~> 2.8", [hex: :jsx, repo: "hexpm", optiona... |
00e1b269c1706c23a3211c524c0b585e7fe0bb13 | 2,035 | [
105621848
] | [
"phoenix",
"ecto"
] | defmodule ElixirpostsWeb.ConferencesController do
use ElixirpostsWeb, :controller
alias Elixirposts.Events
alias Elixirposts.Events.Conferences
def index(conn, _params) do
conference = Events.list_conference()
render(conn, "index.html", conference: conference)
end
def new(conn, _params) do
ch... |
00e2b921a928602f9e9a43da2d86ef1fc0dfd240 | 1,500 | [
28269669
] | [
"genserver",
"supervisor"
] |
defmodule Parser do
use GenServer
def start_link(filename) do
:gen_server.start_link({:global, :wc_parser}, __MODULE__, filename, [])
end
def request_page(pid) do
:gen_server.cast({:global, :wc_parser}, {:request_page, pid})
end
def processed(ref) do
:gen_server.cast({:global, :wc_parser}, {... |
00e30219a69f60bd5f232135733749047f9eb3c5 | 2,913 | [
257787813
] | [] | defmodule Domain.Release do
require Logger
@otp_app :domain
@repos Application.compile_env!(@otp_app, :ecto_repos)
def migrate(opts \\ []) do
IO.puts("Starting sentry app..")
{:ok, _} = Application.ensure_all_started(:sentry)
manual =
Keyword.get(
opts,
:manual,
Appl... |
00e38e493abb82e97b72d3bce014a435b26cf0d5 | 2,293 | [
987147168
] | [
"test"
] | defmodule SsrRobustLiveSvg.RandomReboundTest do
use ExUnit.Case
# switch to this module to show the bug
# @random_rebound_module SsrRobustLiveSvg.RandomRebound
@random_rebound_module SsrRobustLiveSvg.RandomReboundV2NonSticky
defp move_ball(opts) do
# Provide defaults and allow overrides
state =
... |
00e41d8321425592b00bd9042e34ee5ff6eead75 | 2,264 | [
744083739
] | [
"typespec",
"documented"
] | defmodule Exceed.Util.Guards do
@moduledoc false
defguard is_valid_year?(year) when year >= 1900
end
defmodule Exceed.Util do
# @related [tests](test/exceed/util_test.exs)
@moduledoc "Helpers for converting Elixir data formats to Excel."
import Exceed.Util.Guards
@type erl_datetime_t() :: {
{p... |
00e43a089d8fd7e1ddf02fc05950bd7f30001091 | 4,255 | [
945111032
] | [
"macro",
"liveview",
"documented"
] | defmodule ElixirDesktopLvnNative do
@moduledoc """
The entrypoint for defining your native interfaces, such
as components, render components, layouts, and live views.
This can be used in your application as:
use ElixirDesktopLvnNative, :live_view
The definitions below will be executed for every
com... |
00e4439c476fe117636be36834470cd1d07e3636 | 4,337 | [
357365146
] | [] | %{
"bakeware": {:hex, :bakeware, "0.1.5", "84acc08d85875cbb97ea9cda2fc767baa2f7157ba985e12d4a1e91c68fead5cb", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "7b3587aee3a1d974a790bebad3c7abe569f8b33d6b34487285a07397d87b63e4"},
"certifi": {:hex, :certifi, "2.5... |
00e49f02a7a4ccd4f69be696d5247ac377967f06 | 4,334 | [
130528783
] | [
"phoenix",
"ecto"
] | defmodule LanguageWeb.WordListController do
use LanguageWeb, :controller
alias Language.Vocab
alias Language.Vocab.WordList
require Logger
plug(:authorise_wordlist when action in [:show, :edit, :update, :delete, :share])
defp authorise_wordlist(conn, _) do
list = Vocab.get_word_list(conn.params["id"... |
00e4b6453ba147d89451ca13f79abdde380109be | 1,779 | [
98858102,
94881643
] | [
"ecto"
] | defmodule Healthlocker.Goal do
use Healthlocker.Web, :model
schema "goals" do
field :content, :string
field :completed, :boolean
field :notes, :string
field :important, :boolean
field :achieved_at, :date
has_many :steps, Healthlocker.Step, on_delete: :delete_all,
... |
00e4dd5fdeed67d4ad8cf02770e1a0c4c72bad67 | 2,077 | [
283360637
] | [
"test"
] | defmodule RecipebookWeb.Schema.Subscriptions.RecipeTest do
use Recipebook.DataCase
use RecipebookWeb.SubcriptionCase
alias RecipebookWeb.Schema
alias Recipebook.Support.UserSupport
alias Recipebook.Support.RecipeSupport
@create_recipe_doc """
mutation CreateRecipe($name: String!, $steps: [InputStep!]!,... |
00e4faf44f2325f381ad7a9fb327576479600946 | 1,730 | [
299711271
] | [
"liveview",
"phoenix"
] | defmodule ChainBusinessManagementWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :chain_business_management
# 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 [
st... |
00e53cc80c61b7d7e5ae63f03ced91f858c146ab | 4,049 | [
725808994
] | [] | defmodule Techschool.Helpers.ReSeed do
alias Techschool.{
Languages,
Frameworks,
Channels,
Courses,
Platforms,
Fundamentals,
Tools,
Bootcamps,
Lessons,
YouTube
}
def call(data_folder_path \\ "priv/repo/data") do
Techschool.Helpers.ResetDb.call(reset_courses: false)
... |
00e590a9b3a175b61569bc1f18caee7abbf37a30 | 1,928 | [
274112313
] | [
"macro",
"documented",
"phoenix"
] | defmodule HelloreactWeb 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 HelloreactWeb, :controller
use HelloreactWeb, :view
The definitions below will be executed for every view,
con... |
00e5e34b585847e32f4ebf7afcae7aaf00d1c8b3 | 3,945 | [
244230354
] | [
"documented"
] | defmodule WeatherDaysNerves do
@moduledoc """
Documentation for WeatherDays.
"""
alias WeatherDaysNerves.Light
@days_count 5
@doc """
Lights up LEDs based on 5 day forecast
## Examples
iex> WeatherDays.lights_from_forecast()
:ok
"""
def lights_from_forecast() do
with {:ok, fore... |
00e5f69ebbd89ddfaa03508244002692d3b7d83f | 2,635 | [
338131945
] | [
"liveview",
"documented"
] | defmodule NoozoWeb.Admin.Page.EditView do
@moduledoc """
Admin pages edit live view
"""
use NoozoWeb, :surface_view
alias Noozo.Core
alias NoozoWeb.Admin.Page.IndexView
data info, :string
data error, :string
@impl true
def render(assigns) do
~F"""
<LivePatch to={Routes.live_path(@socket, ... |
00e6daca54ba100127f327a86cb284cc620329d5 | 21,281 | [
320248068
] | [] | defmodule D21 do
def to_candidate_sets(labels) do
Enum.reduce(labels, %{}, fn {ingredients, allergens}, acc ->
ingredients = MapSet.new(ingredients)
Enum.reduce(allergens, acc, fn allergen, acc ->
case Map.get(acc, allergen) do
nil -> Map.put(acc, allergen, [ingredients])
... |
00e6f74e38b69f106a9391501bb11af4c355219b | 3,724 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Docs.V1.Model.EmbeddedObject do
@moduledoc """
An embedded object in the document.
## Attributes
* `description` (*type:* `String.t`, *default:* `nil`) - The description of the embedded object. The `title` and `description` are both combined to display alt text.
* `embeddedDrawingPro... |
00e70129165235f84e31389021913551640a9473 | 2,036 | [
103058960
] | [
"macro",
"test",
"documented"
] | Code.require_file("../support/mocks/we_work_remotely_mock.exs", __DIR__)
Code.require_file("../support/factories/job_details_factory.exs", __DIR__)
defmodule RagnarCoreTest.Client.WeWorkRemotelyTest do
@moduledoc false
use ExUnit.Case
import Mock
import PathHelpers
alias RagnarCore.WeWorkRemotely
alias ... |
00e8c7fff474a46c47eeee53b6bc9aa454afce97 | 2,914 | [
121406441
] | [] | # Matthew Brookes (mb5715) and Abhinav Mishra (am8315)
defmodule ReplicaState do
@enforce_keys [:config, :db, :leaders, :monitor]
defstruct(
config: Map.new,
db: nil,
decisions: Map.new,
leaders: [],
monitor: nil,
proposals: Map.new,
requests: [],
s_in: 1,
s_... |
00e90ea0c378c479549f439d0a0e1de1daefab1f | 15,048 | [
902804057
] | [
"genserver",
"typespec",
"documented",
"ecto"
] | defmodule K8sBroadcaster.Forwarder do
@moduledoc false
use GenServer
require Logger
alias Phoenix.PubSub
alias ExWebRTC.PeerConnection
alias ExWebRTC.RTP.H264
alias ExWebRTC.RTP.Munger
alias K8sBroadcaster.PeerSupervisor
alias K8sBroadcasterWeb.Channel
@pubsub K8sBroadcaster.PubSub
# Timeout... |
00e923cb2a0aa359cbeefa85b39f1ca321b0ca99 | 2,614 | [
946224249
] | [
"documented",
"ecto"
] | defmodule BlogPost.Blog do
@moduledoc """
The Blog context.
"""
import Ecto.Query, warn: false
alias BlogPost.Blog.Query
alias BlogPost.Repo
alias BlogPost.Blog.Article
alias BlogPost.Accounts.User
@doc """
Returns the list of articles.
## Examples
iex> list_articles()
[%Article{}... |
00e95fdc34e82c905fc8b3205d02024acf5e45cc | 12,534 | [
948652737
] | [
"macro",
"liveview",
"documented"
] | defmodule OctantisWeb.Core do
@moduledoc """
Core Functionality for Polaris Components.
"""
use Phoenix.Component
defmacro __using__(_opts) do
quote do
use Phoenix.Component
# HTML escaping functionality
import Phoenix.HTML
# Shortcut for generating JS commands
alias Phoe... |
00e98b5724868a69faafc17b4f95b3075a2ccf8d | 3,056 | [
797275467
] | [
"liveview",
"test"
] | defmodule ShellyWeb.DashboardLive.BaseComponentsTest do
use ShellyWeb.ConnCase, async: true
import Phoenix.Component
import Shelly.StatsFixtures
alias Shelly.Schemas.{Device, Price, Report}
alias ShellyWeb.DashboardLive.BaseComponents
describe "filters_drawer_trigger" do
test "renders component" do
... |
00e9aea1ca88f7fe3d16eb1782f0c9e780aced66 | 2,314 | [
192265045
] | [] | defmodule BankingApp.MixProject do
use Mix.Project
def project do
[
app: :banking_app,
version: "0.1.0",
elixir: "~> 1.5",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases... |
00e9c04039ff33a631a1d42a2de0167d93905026 | 3,509 | [
911324714
] | [
"phoenix"
] | defmodule ContactlyWeb.ContactsController do
alias Contactly.Contact
alias Contactly.Contacts
use ContactlyWeb, :controller
@default_page_size 5
def index(conn, %{"search_query" => ""}) do
redirect(conn, to: "/mvc/contacts")
end
def index(conn, params) do
user_id = conn.assigns.current_user.id
... |
00ea361ba78b6cbc45923d63ebd4225dcc53e1a9 | 18,379 | [
1013927511
] | [
"liveview",
"documented"
] | defmodule MatchMakerWeb.Components.Modal do
@moduledoc """
The `MatchMakerWeb.Components.Modal` module provides a versatile and customizable modal component for
Phoenix LiveView applications. It supports various configurations for size, style, color,
padding, and border radius to match different design requirem... |
00ea70794898cb968e201d85c0679c0799f55aee | 4,645 | [
933352820
] | [
"liveview"
] | defmodule FlagguesserappWeb.QuizLive.Index do
alias FlagguesserappWeb.QuizLive.ModeParser
use FlagguesserappWeb, :live_view
alias FlagguesserappWeb.QuizLive.JSQuiz
import FlagguesserappWeb.CustomComponents
def render(assigns) do
~H"""
<.quizcard>
<:content>
<%= if @current_flag do %>
... |
00eb4774b028dbf4f1f2b74fafc9b7cd9daf4b38 | 8,198 | [
810146441
] | [
"documented"
] | defmodule ChinaAdminDivisions.Gen.Lv4xg.M4301 do
@moduledoc false
def name("430182218000"), do: "沩山乡"
def name("430182213000"), do: "沙田乡"
def name("430182209000"), do: "喻家坳乡"
def name("430182203000"), do: "菁华铺乡"
def name("430182123000"), do: "资福镇"
def name("430182122000"), do: "大屯营镇"
def name("43018212... |
00eb4f34b0aaef14d7ae0acd299567d5e652f85e | 1,667 | [
425144044
] | [
"typespec",
"documented"
] | defmodule Minesweeper do
@mine "*"
@neighbors [
{-1, 0},
{1, 0},
{0, -1},
{0, 1},
{-1, -1},
{1, 1},
{-1, 1},
{1, -1}
]
@doc """
Annotate empty spots next to mines with the number of mines next to them.
"""
@spec annotate([String.t()]) :: [String.t()]
def annotate(board) ... |
00ebf4292aededb6b802c274f6ac795e74a90c69 | 9,702 | [
127342941
] | [] | %{"algae": {:hex, :algae, "1.1.0", "6d152fd62efb86385bded7421b635d7194d8a15f4e0ef841438740f9db41f48a", [], [{:quark, "~> 2.3", [hex: :quark, repo: "hexpm", optional: false]}, {:type_class, "~> 1.2", [hex: :type_class, repo: "hexpm", optional: false]}, {:witchcraft, "~> 1.0", [hex: :witchcraft, repo: "hexpm", optional: ... |
00ec1841ee982a898f2f3b9f079abf3b9e1b0f3c | 3,539 | [
274214639
] | [
"typespec",
"macro",
"documented"
] | defmodule TypeCheck.Defstruct do
@moduledoc """
Implements the `defstruct!` macro.
To use this macro:
- Ensure you `use TypeCheck` in your module
- Also `use TypeCheck.Defstruct`
And now call `defstruct!/1` when you want to define a struct.
"""
defmacro __using__(_opts) do
# if Module.get_attribu... |
00ec9a24b7988821b370c36eff92071e7def7cd8 | 1,753 | [
723491169
] | [] | defmodule AdventOfCode2023.SearchRange do
def range_of_true(first..last = range, is_true?) do
new_first = Enum.find(range, is_true?)
new_last = Enum.find(last..first, is_true?)
new_first..new_last
end
end
defmodule AdventOfCode2023.Day06 do
alias AdventOfCode2023.{Helpers, SearchRange}
def part_a... |
00ed28757a5b29aa5ab9c9bbd8996ae5a246a296 | 2,265 | [
80773122
] | [
"test"
] | defmodule Device.InstrumentControllerTest do
use Device.ConnCase
alias Device.Instrument
@valid_attrs %{name: "some content", value: "120.5"}
@invalid_attrs %{}
setup %{conn: conn} do
{:ok, conn: put_req_header(conn, "accept", "application/json")}
end
test "lists all entries on index", %{conn: conn... |
00ed3d6a92dee2b62a7c1ea0f0ebbe8bac0f1d23 | 3,637 | [
211695644
] | [
"test",
"ecto"
] | defmodule Parenthese.ProjectsTest do
use Parenthese.DataCase
alias Parenthese.Projects
describe "projects" do
alias Parenthese.Projects.Project
@valid_attrs %{
category: "archi",
cover_url: "https://example.org/1",
date: "2010-04-17",
description: "some description",
flick... |
00ed953071b1768114545b143675e610c8184a5d | 2,168 | [
350887529
] | [
"documented"
] | defmodule MinimalTodo do
@moduledoc """
Documentation for `MinimalTodo`.
"""
def start do
IO.gets("Hi there! Please, inform your .csv file to be loaded: ")
|> String.trim()
|> read()
|> parse()
|> get_command()
end
def get_command(data) do
menu = """
Choose an option:
[R]ead... |
00edce9aeca3f1380ccd895b6213049fb398b04e | 2,287 | [
359585397
] | [
"phoenix",
"ecto"
] | defmodule DiscussWeb.TopicController do
use DiscussWeb, :controller
alias Discuss.Discussion
alias Discuss.Discussion.Topic
plug DiscussWeb.Plugs.RequireAuth when action in [:new, :create, :edit, :update, :delete]
plug :check_topic_owner when action in [:update, :edit, :delete]
def index(conn, _params) d... |
00edda3c26f0fd442430b6ebd867392d186d80c0 | 2,463 | [
559744925,
657799110,
679652486,
725959680,
541841921
] | [
"documented"
] | defmodule Credo.Check.Readability.SinglePipe do
use Credo.Check,
id: "EX3023",
base_priority: :high,
tags: [:controversial],
param_defaults: [allow_0_arity_functions: false],
explanations: [
check: """
Pipes (`|>`) should only be used when piping data through multiple calls.
So ... |
00ede54a0c5820d1d25ba287e75dd4ebba149d84 | 8,197 | [
221940752
] | [
"test"
] | defmodule Arrow.Disruptions.ReplacementServiceTest do
use Arrow.DataCase
alias Arrow.Disruptions.ReplacementService
alias Arrow.ShuttlesFixtures
describe "get_replacement_services_with_timetables/2" do
test "returns replacement services that overlap with the given date range" do
disruption = insert(... |
00ee653fe2b9da9b0e5aeb0cd97fa08dcb021bb6 | 1,919 | [
669665659,
672764442
] | [
"documented",
"ecto"
] | defmodule Teacher.Recordings do
@moduledoc """
The Recordings context.
"""
import Ecto.Query, warn: false
alias Teacher.Repo
alias Teacher.Recordings.Album
@doc """
Returns the list of albums.
## Examples
iex> list_albums()
[%Album{}, ...]
"""
def list_albums(params) do
case ... |
00ee94178c8f2523bb30e508dc4a75918925e2fd | 2,211 | [
583151066
] | [] | defmodule RuckSack do
def get_mapping do
# Get all characters between 'a' and 'z'
a_to_z = ?a..?z
# Map them to strings
|> Enum.map(&List.to_string([&1]))
# Zip them with numbers 1 to 26
|> Enum.zip(1..26)
# Convert into a map
|> Enum.into(%{})
# Similar to above but for capi... |
00eece32fe8da7b43e7ffb4d82f27ec064bf2192 | 1,652 | [
942811655,
920024200
] | [] | defmodule Secrethub.PublicGrpcApi.ListSecrets do
import Ecto.Query
alias Secrethub.Repo
@default_page_size 100
@page_size_limit 100
#
# Helpers for listing secrets in the Public Grpc API
def query(org_id, project_id, page_size, order, page_token, ignore_contents?) do
page_token = if page_token == ... |
00eed7e5200ea6dbd53788deea13a824728186d2 | 1,547 | [
90782234
] | [
"ecto"
] | defmodule UcxChat.Config.FileUpload do
use UcxChat.Web, :model
embedded_schema do
field :file_uploads_enabled, :boolean, default: true
field :maximum_file_upload_size_kb, :integer, default: 2000
field :accepted_media_types, :string, default: "image/*,audio/*,video/*,application/zip,application/x-rar-co... |
00ef1192b603876d197ee260e341ae4d44049785 | 2,054 | [
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.ServiceUsage.V1.Model.JavaSettings do
@moduledoc """
Settings for Java client libraries.
## Attributes
* `common` (*type:* `GoogleApi.ServiceUsage.V1.Model.CommonLanguageSettings.t`, *default:* `nil`) - Some settings.
* `libraryPackage` (*type:* `String.t`, *default:* `nil`) - The pa... |
00ef4207c4764393ff1b10a2375c7b988f322d99 | 4,578 | [
744309102
] | [] | defmodule ContaBot.Action.Graph do
use ContaBot.Action
require Logger
@impl ContaBot.Action
def handle({:init, _command}, context) do
options = [
{"Patrimony", "graph patrimony"},
{"Income", "graph income"},
{"Outcome", "graph outcome"},
{"Profits & Losses", "graph pnl"}
]
... |
00f069f5566576d9d3c4b814536b36274d3b5d8d | 3,740 | [
973907049
] | [
"typespec",
"documented",
"ecto"
] | defmodule Pair.Recordings do
@moduledoc """
The Recordings context.
"""
import Ecto.Query, warn: false
alias Pair.Repo
alias Pair.Recordings.Recording
alias Phoenix.PubSub
@doc """
Returns the list of recordings.
## Examples
iex> list_recordings()
[%Recording{}, ...]
"""
def li... |
00f0cc671a83edb6b631a2bd4fdefc4c565809b8 | 1,515 | [
98139164
] | [
"macro",
"documented",
"phoenix"
] | defmodule Succor.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Succor.Web, :controller
use Succor.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them short ... |
00f1068ac78b43ffa2e4227268054cdd8d7b80e3 | 2,977 | [
814869922
] | [
"typespec",
"documented",
"ecto"
] | defmodule Fhir.StructureMapParameter do
@moduledoc """
A Map of relationships between 2 structures that can be used to transform data.
"""
use Ecto.Schema
import Ecto.Changeset
@derive Jason.Encoder
@primary_key false
embedded_schema do
field(:id, :string)
field(:valueBoolean, :boolean)
fie... |
00f127d120efa8663f4bb737083164309f00e2f8 | 1,516 | [
163351635
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config
# General application configuration
config :wallet_web,
namespace: WalletWeb,
ect... |
00f1696322ca873702fc8f8317a1ae9808085c8b | 2,281 | [
630677170
] | [
"documented",
"ecto"
] | defmodule Homework.Merchants do
@moduledoc """
The Merchants context.
"""
import Ecto.Query, warn: false
alias Homework.Repo
alias Homework.Merchants.Merchant
@doc """
Returns the list of merchants.
## Examples
iex> list_merchants([])
[%Merchant{}, ...]
"""
def list_merchants(_ar... |
00f1776bd490e321e006e221ef4fb641f79ae001 | 1,967 | [
814869922
] | [
"typespec",
"documented",
"ecto"
] | defmodule Fhir.ImplementationGuidePage1 do
@moduledoc """
A set of rules of how a particular interoperability or standards problem is solved - typically through the use of FHIR resources. This resource is used to gather all the parts of an implementation guide into a logical whole and to publish a computable defini... |
00f1eb0e4c0c5f5c86564b2560a9e78d037808ff | 1,815 | [
497092103
] | [
"documented",
"ecto"
] | defmodule Contacts.CRM do
@moduledoc """
The CRM context.
"""
import Ecto.Query, warn: false
alias Contacts.Repo
alias Contacts.CRM.Contact
@doc """
Returns the list of contacts.
## Examples
iex> list_contacts()
[%Contact{}, ...]
"""
def list_contacts do
Repo.all(Contact)
e... |
00f25aac67fce09c25cceb51ca1d31bb5dd3db81 | 1,566 | [
579464913
] | [] | # 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 :remote_backend_exercise,
ecto_repos: [Remot... |
00f34f55c5c0754c05ec08d08f9c000ec83a9f54 | 1,981 | [
843180468
] | [
"test"
] | defmodule EtsSelect.IntegrationTest do
use ExUnit.Case
use Mneme
setup do
:ets.new(:my_table, [:set, :public, :named_table])
:ets.insert(:my_table, {:key1, %{status: :new, age: 30, name: "1"}})
:ets.insert(:my_table, {:key2, %{status: :old, age: 25, name: "2"}})
:ets.insert(:my_table, {:key3, %{... |
00f418bba39a026a57fda834c97cfcf5b1a0c3bb | 2,846 | [
867166333
] | [] | defmodule FIFOReliableBroadcast do
def start(name, processes) do
pid = spawn(FIFOReliableBroadcast, :init, [name, processes])
case :global.re_register_name(name, pid) do
:yes -> pid
:no -> :error
end
IO.puts "registered #{name}"
pid
end
def i... |
00f44356a1959ba47d16a9a8d5858608ff199783 | 4,008 | [
562821467
] | [] | %{
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
"db_connection": {:hex, :db_connection, "2.4.2", "f92e79aff2375299a16bcb069a14ee8615c3414863a6fef93156aee8e86c2f... |
00f4b50a4a4c9837c522c67d5b24e8873dc6d5d5 | 2,031 | [
756853525
] | [
"typespec",
"documented",
"ecto"
] | defmodule Angen.Telemetry.EventTypeQueries do
@moduledoc false
use TeiserverMacros, :queries
alias Angen.Telemetry.EventType
require Logger
@spec event_type_query(Teiserver.query_args()) :: Ecto.Query.t()
def event_type_query(args) do
query = from(event_types in EventType)
query
|> do_where(id... |
00f4cb4965122ebbae30ac8bbc6920f083ca31d8 | 18,211 | [
789802355,
771989527,
773846987,
800967832,
803459398,
805634608,
771499012,
806822991,
776597093,
813782028
] | [
"macro",
"typespec",
"liveview",
"documented"
] | defmodule Phoenix.LiveViewTest.DOM do
@moduledoc false
@phx_static "data-phx-static"
@phx_component "data-phx-component"
@static :s
@components :c
@stream_id :stream
def ensure_loaded! do
unless Code.ensure_loaded?(Floki) do
raise """
Phoenix LiveView requires Floki as a test dependency.... |
00f61e2fdb9a7550492522a3bf285869f103eea8 | 7,422 | [
367278931
] | [
"documented"
] | defmodule Google.Ads.Googleads.V18.Enums.ResourceLimitTypeEnum.ResourceLimitType do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :UNSPECIFIED, 0
field :UNKNOWN, 1
field :CAMPAIGNS_PER_CUSTOMER, 2
field :BASE_CAMPAIGNS_PER_CUSTOMER, 3
field :EXPERI... |
00f67267f4d768fba9a25ce6b11a1ac988754fc3 | 5,051 | [
202972181
] | [] | %{
"bear": {:hex, :bear, "0.8.7", "16264309ae5d005d03718a5c82641fcc259c9e8f09adeb6fd79ca4271168656f", [:rebar3], [], "hexpm"},
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a2... |
00f689434cecaee34507095c2a716ecf3b3ae3a7 | 1,630 | [
232098270
] | [
"macro",
"documented",
"phoenix"
] | defmodule CareersWeb 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 CareersWeb, :controller
use CareersWeb, :view
The definitions below will be executed for every view,
controller, ... |
00f70f4a68b45f7822a5c8abbcb9d9c2eabde869 | 15,602 | [
211260397
] | [] | # AUTORES: Pedro Tamargo Allué y Juan José Tambo Tambo
# NIAs: 758267 y 755742
# FICHERO: escenario.exs
# FECHA: fecha de realizacion
# TIEMPO: tiempo en horas de codificación
# DESCRIPCION: breve descripcion del contenido del fichero
import Fib
defmodule Servidor do
def server(dir_pool, proxy_machine) do
Proce... |
00f7225bf2b40851e3f4635a8d78d8061a323b6b | 4,168 | [
860027769
] | [] | defmodule Tykar.Game.DicePoker do
use Tykar.Game
alias Tykar.Game.DicePoker
alias Tykar.Game.Seat
@derive {Jason.Encoder, except: [:room_id, :channel_name]}
defstruct [
:room_id,
channel_name: "dice_poker",
players: List.duplicate(%Seat{}, 2),
status: :setup,
turn: -1,
roll: 0,
s... |
00f797cb59d6d646c59e21979707718cb44aa228 | 2,125 | [
216034234
] | [
"genserver",
"phoenix"
] | # Game at the end of Chapter 3
defmodule Snake.Scene.Game3 do
use Scenic.Scene
import Scenic.Primitives, only: [rounded_rectangle: 3]
alias Scenic.ViewPort
alias Scenic.Graph
@graph Graph.build(clear_color: :dark_sea_green)
@tile_size 32
@tile_radius 8
@frame_ms 192
def init(_arg, opts) do
vie... |
00f7bfc6d9d723ff57ca1e4309cae4f44086b150 | 1,512 | [
129702597
] | [
"macro",
"documented",
"phoenix"
] | defmodule MixExqWeb 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 MixExqWeb, :controller
use MixExqWeb, :view
The definitions below will be executed for every view,
controller, etc... |
00f845f36fb0a57a6456e0962ab3beda5176a6c5 | 1,810 | [
933514757
] | [
"genserver",
"documented"
] | defmodule ExESDB.EventProjector do
@moduledoc """
This module contains the event projector functionality
"""
use GenServer
alias ExESDB.Themes, as: Themes
alias Phoenix.PubSub, as: PubSub
alias ExESDB.StoreNaming
require Logger
@impl true
def handle_info({:event, event}, state) do
Logger.in... |
00f8609d50dae62d47e23795ea8e5da2ff133323 | 2,388 | [
843505444
] | [
"typespec",
"documented"
] | defmodule LiqPayAPI.InternetAcquiring.Invoice.Issue.Response do
@moduledoc """
Provides struct and type for a InternetAcquiring.Invoice.Issue.Response
"""
@behaviour OpenAPIClient.Schema
@type t :: %__MODULE__{
action:
:auth
| :hold
| :pay
| :paydona... |
00f8b3aab17f5cb63aaeb898d04120029b1bf3d7 | 4,089 | [
158013615
] | [
"documented"
] | defmodule Asteroid.ObjectStore.AuthorizationCode.Mnesia do
@moduledoc """
Mnesia implementation of the `Asteroid.ObjectStore.AuthorizationCode` behaviour
## Options
The options (`Asteroid.ObjectStore.AuthorizationCode.opts()`) are:
- `:table_name`: an `atom()` for the table name. Defaults to `:asteroid_autho... |
00f8cb63661b40f9854b29378846d740b1c44957 | 1,660 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.SecretManager.V1beta1.Model.Location do
@moduledoc """
A resource that represents a Google Cloud location.
## Attributes
* `displayName` (*type:* `String.t`, *default:* `nil`) - The friendly name for this location, typically a nearby city name. For example, "Tokyo".
* `labels` (*type... |
00f8cb8325fb8dda220f5cb2c7b7ef26ab39c882 | 5,891 | [
607729034
] | [
"test",
"ecto"
] | defmodule OperatelyWeb.Api.Queries.GetActivityTest do
use OperatelyWeb.TurboCase
import Ecto.Query, only: [from: 2]
import Operately.GroupsFixtures
import Operately.PeopleFixtures
import Operately.GoalsFixtures
alias Operately.{Repo, Groups}
alias Operately.Access.Binding
alias Operately.Support.RichT... |
00f9565c6f7e0924f57afb8dc64b671a6f9d6717 | 2,337 | [
573490081
] | [] | defmodule Day07.PartOne do
def run([["$", "cd", "/"] | tail], dir_tree, _curr_path) do
run(tail, dir_tree, [:root])
end
def run([["$", "cd", ".."] | tail], dir_tree, curr_path) do
new_curr_path = Enum.reverse(curr_path) |> tl() |> Enum.reverse()
run(tail, dir_tree, new_curr_path)
end
def run([["... |
00f9bb0f0dc64c6afcd390f700458998128feaea | 3,398 | [
296745590
] | [] | %{
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"},
"db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd36893... |
00f9ff85c36e658af6bc032f6015c7aec8b6c37d | 1,983 | [
225373582
] | [] | defmodule Moon do
def parse(string) do
position =
~r/<x=(?<x>[^,]+), y=(?<y>[^,]+), z=(?<z>[^>]+)>/
|> Regex.named_captures(string)
|> (fn captures -> [captures["x"], captures["y"], captures["z"]] end).()
|> Enum.map(&String.to_integer/1)
|> List.to_tuple()
%{position: position,... |
00fa5e02b84eff67a7c07e0da204a1339fcaf228 | 3,032 | [
202200115
] | [] | defmodule MeetupBot.Meetup do
@meetup_names [
"ember-montevideo",
"ReactJS-Uruguay",
"Angular-MVD",
"montevideojs",
"Front-end-MVD",
"Elixir-Montevideo",
"Montevideo-Web-Developers",
"Rust-Uruguay",
"py-mvd",
"Loop-Talks",
"Laravel-UY",
"Montevideo-Vue-JS-Meetup",
"... |
00fabb4071888695e0bfc7697560640967ae4c0a | 7,927 | [
166092965
] | [
"test",
"documented",
"phoenix"
] | defmodule ApiWeb.EventStreamTest do
@moduledoc false
use ApiWeb.ConnCase
alias ApiWeb.Canary
alias ApiWeb.Plugs.CheckForShutdown
import ApiWeb.EventStream
import Plug.Conn
import ApiWeb.Test.ProcessHelper
@module ApiWeb.PredictionController
@moduletag timeout: 5_000
setup %{conn: conn} do
Che... |
00fb40e766f96d3a8affafd16198270d7ded702b | 3,850 | [
101124397
] | [
"typespec",
"documented"
] | defmodule CloudsightElixir do
@moduledoc """
Core functions for interfacing with the API
Additional References:
https://cloudsight.readme.io/reference
"""
alias CloudsightElixir.{Images, Videos}
@deprecated "Use send_image or send_video instead"
@spec send(map, Client.t) :: {atom, [key: binary]}
de... |
00fb4548e3ffa23931f23d2fa719b1899fb4dd1d | 2,364 | [
791099453
] | [
"typespec"
] | defmodule Fastrepl.FS.Mutation do
defstruct [:type, :target_path, :target_section, :data]
import Kernel, except: [apply: 2]
alias __MODULE__
alias Fastrepl.FS
alias Fastrepl.Retrieval.CodeBlock
@type t :: %Mutation{
type: :add | :modify | :remove,
target_path: String.t(),
tar... |
00fbb4131ef63ef34ebcc3bd031701ada8be4f6e | 2,381 | [
757093509
] | [] | defmodule App.DB do
alias App.Clientes.Cliente
alias App.Repo
alias App.Transacoes.Transacao
alias Ecto.Multi
def persistir_transacao(%Transacao{} = transacao) do
novo_saldo = calcula_variacao(transacao.tipo, transacao.valor)
executa_transacao(transacao, novo_saldo)
end
# Ver se é possível otim... |
00fc8675fb872ae21be1b59946a581ddd04d1d77 | 2,697 | [
328272011
] | [
"typespec",
"documented"
] | defmodule MixTestInteractive.Config do
@moduledoc """
Configuration for the task.
"""
use TypedStruct
@application :mix_test_interactive
typedstruct do
field :ansi_enabled?, boolean()
field :clear?, boolean(), default: false
field :command, {String.t(), [String.t()]}, default: {"mix", []}
... |
00fd53eb4f0490f84ffa00a4102e7855055b3833 | 3,286 | [
51436279
] | [
"test"
] | defmodule Fyler.TasksControllerTest do
use Fyler.ConnCase
use ExUnit.Case
import Fyler.ExUnit.AuthHelpers
setup do
{:ok, [auth_conn: auth_conn(conn(), create(:user))]}
end
test "GET #index with pagination", %{auth_conn: auth_conn} do
Fyler.Repo.insert! Fyler.Task.create_changeset(%Fyler.Task{}, %{... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.