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 |
|---|---|---|---|---|
01f74de1e8aa58c6e326e44c3db78b994611c940 | 4,116 | [
743563485
] | [
"documented"
] | defmodule Fluid.Test.Factory do
alias Fluid.Model
alias Fluid.Model.Tank
alias Fluid.Model.Pool
def tank_params() do
[
%{
location_type: :in_wh,
capacity_type: :uncapped
},
%{
location_type: :in_wh,
capacity_type: :capped
},
%{
location_... |
01f789362608ea50910c546695d9165b7e0d7bfb | 2,619 | [
66548869
] | [] | %{"bear": {:hex, :bear, "0.8.3", "866002127a97932720a0d475d8582c98ec5fb78db3a18dfe7eaf91594d9024b8", [:rebar3], []},
"bson": {:git, "git://github.com/comtihon/bson-erlang", "0a2965e870efe17012aa278529d24bf525da682e", [tag: "v0.2.2"]},
"cluster_info": {:git, "https://github.com/basho/cluster_info.git", "c234bba9d0d8... |
01f794846c56f49bd4d8a691f00d3b4c7634bdaf | 12,185 | [
161703639,
139498406,
146627563,
159884345
] | [
"typespec",
"documented"
] | defmodule Absinthe.Plug.GraphiQL do
@moduledoc """
Provides a GraphiQL interface.
## Examples
The examples here are shown in
Serve the GraphiQL "advanced" interface at `/graphiql`, but only in
development:
if Mix.env == :dev do
forward "/graphiql",
to: Absinthe.Plug.GraphiQL,
... |
01f7b5168ade29f0e27e3cf00a0788db3106e836 | 4,678 | [
651155880
] | [
"liveview",
"ecto"
] | defmodule GradeInatorWeb.SubmissionLive.FormComponent do
use GradeInatorWeb, :live_component
alias GradeInator.SubmissionList
alias GradeInator.Course.Group
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage submission recor... |
01f820f08d4fc7bbf29b88f7dd734b112b0b6caa | 5,200 | [
985263902
] | [] | # Krotki w Elixir
IO.puts("=== Krotki w Elixir ===\n")
# ------ Tworzenie krotek ------
IO.puts("--- Tworzenie krotek ---")
# Pusta krotka
krotka_pusta = {}
IO.puts("Pusta krotka: #{inspect(krotka_pusta)}")
# Krotka z jednym elementem
krotka_jednoelementowa = {42}
IO.puts("Krotka z jednym elementem: #{inspect(krotk... |
01f866f3ecb8666cb34fe7986d59a817ca1b4026 | 3,565 | [
908003969
] | [] | # 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 :automated_agency, :ash_domains, [AutomatedAge... |
01f8bdc54689496269423d539682cfc0726a14c9 | 1,747 | [
491472874,
969632369
] | [
"test"
] | defmodule Goldcrest.ExampleControllerTest do
use ExUnit.Case
use Plug.Test
describe "GET /greet" do
test "when not authorized responds with 401 status" do
conn = conn(:get, "/greet")
conn = Goldcrest.ExampleRouter.call(conn, [])
assert conn.status == 401
assert conn.resp_body == Jas... |
01f8fb458bfc57ac87af2d5119b24d4ef2ed7888 | 2,851 | [
780616699
] | [
"liveview",
"phoenix"
] | defmodule Auth2024Web.GithubAuth do
import Plug.Conn
alias Assent.{Config, Strategy.Github}
alias Auth2024.Accounts.User
# http://localhost:4000/auth/github
def request(conn) do
Application.get_env(:assent, :github)
|> Github.authorize_url()
|> case do
{:ok, %{url: url, session_params: se... |
01f9913a66bff02179d71c081c83853e25a304a0 | 4,980 | [
148733666
] | [
"phoenix"
] | defmodule MachineMonitorWeb.CenterController do
use MachineMonitorWeb, :controller
action_fallback MachineMonitorWeb.ActionFallbackController
alias MachineMonitor.Settings
alias MachineMonitorWeb.Serializers.Center, as: CenterSerializer
alias MachineMonitorWeb.Serializers.Center.Map, as: MapCenter... |
01f9d05fa7cb9368ee42a90273988d91a02ed9c2 | 4,308 | [
109559506
] | [
"test"
] | defmodule Blueprint.Plot.GraphTest do
use ExUnit.Case
doctest Blueprint.Plot.Graph
setup do
Application.stop(:graphvix)
Application.start(:graphvix)
end
test "A circular reference" do
assert String.trim("""
digraph G {
node_1 [label="A",color="black"];
... |
01fa49929372802ece8273d53af84d5ca16207d3 | 1,982 | [
616302651
] | [
"documented",
"ecto",
"phoenix"
] | defmodule AzimuttWeb.FallbackController do
@moduledoc """
Translates controller action results into valid `Plug.Conn` responses.
See `Phoenix.Controller.action_fallback/1` for more details.
"""
use AzimuttWeb, :controller
# This clause handles errors returned by Ecto's insert/update/delete.
def call(conn... |
01fa4c12f25937380aeb01fb5ed97eace5ee8758 | 16,607 | [
63497734
] | [
"test",
"documented",
"ecto",
"phoenix"
] | defmodule CodeCorps.MessagesTest do
@moduledoc false
use CodeCorps.DbAccessCase
use Phoenix.ChannelTest
use Bamboo.Test
import Ecto.Query, only: [where: 2]
alias CodeCorps.{Conversation, ConversationPart, Emails, Message, Messages}
alias Ecto.Changeset
defp get_and_sort_ids(records) do
records |... |
01fa66a366281bda786c721ec6d18ea4d2175d37 | 1,645 | [
266840309,
266894454
] | [
"test"
] | defmodule Antikythera.Router.ImplTest do
use Croma.TestCase
test "Impl.generate_route_function_clauses should reject invalid path" do
invalid_paths = [
"",
"path/starting/with/non_slash",
"/path/with/trailing/slash/",
"//",
"/segment with invalid characters",
"/segment/with/... |
01fa96743c8a587e69b4b9807c6314db011ffee9 | 2,199 | [
804133475
] | [
"liveview",
"ecto"
] | defmodule ClockWeb.UserLive.FormComponent do
use ClockWeb, :live_component
alias Clock.Demo
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage user records in your database.</:subtitle>
</.header>
<.simple_form
... |
01faaa47a14c2c183c03a512a97b815afb988114 | 2,516 | [
695609767
] | [] | defmodule Pier.OpenApi.Tasks.Functions do
alias Pier.OpenApi.Schema.Operation
require Logger
def build(%{contents: contents} = blueprint, _) do
paths = Enum.map(contents["paths"], &build_operations/1) |> Enum.into(%{})
{:ok, %{blueprint | paths: paths}}
end
defp build_operations({path, properties})... |
01fad1a0558b33e1962db0790302ad1e20a61aff | 1,865 | [
259736116
] | [] | defmodule Dispatcher do
use Matcher
define_accept_types [
json: [ "application/json", "application/vnd.api+json" ],
html: [ "text/html", "application/xhtml+html" ],
any: [ "*/*" ]
]
@html %{ accept: %{ html: true } }
@json %{ accept: %{ json: true } }
@any %{ accept: %{ any: true } }
option... |
01fb22f2ea9ff881d2a73ce5f08628a13643163e | 2,239 | [
716101160
] | [
"phoenix"
] | defmodule TIME_MANAGERWeb.ClockController do
use TIME_MANAGERWeb, :controller
alias TIME_MANAGER.ClockRepo
alias TIME_MANAGER.UserRepo
alias TIME_MANAGER.WorkingtimeRepo
alias TIME_MANAGER.Models.Clock
action_fallback TIME_MANAGERWeb.FallbackController
def index(conn, _params) do
clocks = ClockRep... |
01fb7820a7b028b38be98bd3872f4fcf5451bf0e | 1,535 | [
1017722512
] | [] | # 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:
#
# AuthService.Repo.insert!(%AuthService.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as t... |
01fb9fa316e7f7a63a51845caa45d9e531c1e856 | 7,358 | [
932078974
] | [] | %{
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0... |
01fba788796ba8e277d72d417c53b3ebe91ed70a | 2,503 | [
70421226
] | [] | defmodule Fib do
@interval 2000
@name :fib
def start(num_clients, num_calculate) do
pid = spawn(__MODULE__, :generator, [[], num_clients, num_calculate])
:global.register_name(@name, pid)
end
def register(client_pid) do
send :global.whereis_name(@name), { :register, client_pid }
end
def ge... |
01fbb8e29bd8f69c3815b662c80ce95b507057c6 | 2,151 | [
548014039
] | [
"genserver"
] | defmodule Realtime.Social.PostGenerator do
use GenServer
alias Realtime.Social.CoordinateGenerator
alias Realtime.Social.Post
alias Realtime.Social.PostEvents
alias Faker.Internet
alias Faker.Lorem.Shakespeare
@default_rate 3
@wait_times [5000, 4000, 3000, 2000, 1000, 750, 500, 400, 300, 200, 10]
d... |
01fc8e67df1205147bab2d10fc0fa2d756e81db2 | 2,014 | [
250904436,
275480123,
343209812,
345517080,
356964182,
357334716,
379507262,
406732766,
425222664,
433464550,
452045121,
459182862,
475343077,
559744925,
789802355,
872091867,
913995146,
915448704,
934044764,
962529983,
1017248001,
341577165,
343815695,
384108404,
495... | [
"typespec",
"documented"
] | # This file defines the Plug.Exception protocol and
# the exceptions that implement such protocol.
defprotocol Plug.Exception do
@moduledoc """
A protocol that extends exceptions to be status-code aware.
By default, it looks for an implementation of the protocol,
otherwise checks if the exception has the `:pl... |
01fcfffd250a433cccd0511f0a014af3d0ab6675 | 2,392 | [
401423792
] | [] | defmodule Routes.Authentication do
use Routes.Base
alias Models.Account, as: Account
defp check_constraints_auth(required_fields, map) do
fields = [
# [ field, confirmation_field?, confirmation_error? ]
[ "userName", nil, nil ],
[ "password", "confirmPassword", -7 ],
[ "email", "confi... |
01fd1b8102d8758ba0c1d8910a516958b40207c7 | 2,415 | [
929102242
] | [] | import Config
# Determine if we're running in Docker
docker_env = System.get_env("IN_DOCKER") == "true"
database_host = if docker_env, do: "db", else: "localhost"
database_port = if docker_env, do: "5432", else: "5432"
database_url =
System.get_env("DATABASE_URL") ||
"ecto://postgres:postgres@#{database_host}:... |
01fd4fe411e63436d0c37ec77ca4a0e0b7dc1b7e | 5,205 | [
49048102
] | [] | %{"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], []},
"comeonin": {:hex, :comeonin, "3.0.2", "8b213268a6634bd2e31a8035a963e974681d13ccc1f73f2ae664b6ac4e993c96", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, optional: false]}]},
"... |
01fd5f7fdd59fc77d5048a729f5117b8c4e9b883 | 3,157 | [
101862771
] | [] | defmodule Apientry.Mixfile do
use Mix.Project
def project do
[app: :apientry,
version: git_version,
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
... |
01fd6dd702de10c97319941f06110969a532b354 | 2,957 | [
206297200
] | [
"typespec",
"documented"
] | defmodule Google.Ads.Googleads.V8.Services.GetFeedItemSetRequest do
@moduledoc false
use Protobuf, syntax: :proto2
@type t :: %__MODULE__{
resource_name: String.t()
}
defstruct [:resource_name]
field :resource_name, 1, required: true, type: :string
end
defmodule Google.Ads.Googleads.V8.S... |
01fdb9c5c3962217c7fb3177237d6e655b366cde | 8,933 | [
958893321
] | [
"documented"
] | defmodule Deck do
@moduledoc """
Deck
"""
# 1. comment factory
# 2. change the chunk_every function arg
# 3. change the 39 hardcoded into the table-manager
def card_count do
39
end
def chunk_size do
13
end
def heart, do: "❤️"
def diamond, do: "🔷"
# def clubs, do: "🍀"
def clubs, ... |
01fdbfe0d080046270228ecf762e2d78c19d9406 | 2,819 | [
872735479
] | [
"test",
"ecto"
] | defmodule Perquis.ExclusionsTest do
use Perquis.DataCase
alias Perquis.Exclusions
describe "persons" do
alias Perquis.Exclusions.Person
import Perquis.ExclusionsFixtures
@invalid_attrs %{first: nil, last: nil, state: nil, zip: nil, middle: nil, specialty: nil, dob: nil}
test "list_persons/0 r... |
01fddb0aa66486f26130764ad844d51a3f18cfcc | 5,144 | [
95326777
] | [
"test"
] | defmodule RDF.Query.BuilderStarTest do
use RDF.Query.Test.Case
alias RDF.Query.Builder
describe "bgp/1" do
test "variables" do
assert Builder.bgp([{{:as1?, :ap1?, :ao1?}, :p?, {:as2?, :ap2?, :ao2?}}]) ==
ok_bgp_struct([{{:as1, :ap1, :ao1}, :p, {:as2, :ap2, :ao2}}])
end
test "bl... |
01fde7eeb4815a1329b29c4d7c59fd2d1294ba64 | 2,550 | [
115733141
] | [
"documented"
] | defmodule Coxir.API.RateLimiter do
@moduledoc """
Responsible for handling ratelimits.
"""
@behaviour Tesla.Middleware
import Coxir.Limiter.Helper
import Coxir.API.Helper
alias Coxir.{Limiter, Token}
@major_params ["guilds", "channels", "webhooks"]
@regex ~r|/?([\w-]+)/(?:\d+)|i
@header_remainin... |
01fe1cbde878c78e6a7dae29ebc9b2b3b04c05b8 | 1,707 | [
203210177
] | [
"typespec"
] | defmodule CustomSet do
@opaque t :: %__MODULE__{map: map}
defstruct map: %{}
@spec new(Enum.t()) :: t
def new(enumerable) do
%__MODULE__{
map: Enum.reduce(enumerable, %{}, &Map.put(&2, &1, nil))
}
end
@spec empty?(t) :: boolean
def empty?(custom_set) do
Map.keys(custom_set.map) == []
... |
01fe6cfb0ef3367367c65fdb0245d8a27674e41b | 10,994 | [
198546741,
243129821,
275480123,
425222664,
194748074,
217096433,
239182752,
207503388,
231666876,
238344742,
248292846,
305857545,
229153691,
230659468,
234219270,
252028374,
294000469,
336019332,
189624457,
191000630,
206914017,
228552458,
244384132,
319451119,
2066... | [
"typespec",
"documented"
] | defmodule Phoenix.Digester do
@digested_file_regex ~r/(-[a-fA-F\d]{32})/
@manifest_version 1
@empty_manifest %{
"version" => 1,
"digests" => %{},
"latest" => %{}
}
defp now() do
:calendar.datetime_to_gregorian_seconds(:calendar.universal_time())
end
@moduledoc false
@doc """
Digests... |
020093c36145f210c2f917cdda4ea1828c45145d | 1,931 | [
485586448,
337348249,
1019465249,
1013128869,
417664530,
509563030,
444472658,
261934930
] | [
"documented"
] | defmodule Kaffy.Cache.Table do
@moduledoc false
@table_name :kaffy_cache
@expire_suffix "_expires"
@doc """
Prepare keys and add key value to the cache
"""
def add_to_cache(key, suffix, value, expire_after \\ 600) do
string_key = stringify_key([key, suffix])
expiration_key = stringify_key([key, ... |
0200f31f7ed8fea3e4e82548cee7966285f906fb | 1,800 | [
26671399
] | [
"documented"
] | defmodule Gol.Board do
defstruct living_cells: []
alias Gol.Cell, as: Cell
alias Gol.Rules, as: Rules
alias Gol.Coordinates, as: Coordinates
alias __MODULE__, as: Board
@doc "Creates a board. This is the normal way for a board to be created."
def create_board() do
%Board{}
end
@doc "Update a ... |
0201ef57caae96d402d93d8c786e281161104637 | 15,973 | [
714331259
] | [
"genserver",
"liveview",
"documented"
] | defmodule DemoWeb.PageLive do
use DemoWeb, :live_view
alias Demo.Repo
@impl true
def mount(_, _, socket) do
messages = []
model = Replicate.Models.get!("meta/llama-2-7b-chat")
version = Replicate.Models.get_latest_version!(model)
documents = Demo.Document |> Repo.all() |> Repo.preload(:section... |
02020ddb818fa4ccdf4c37087d811be55fdc4d06 | 2,465 | [
367278931
] | [
"documented"
] | defmodule Google.Devtools.Containeranalysis.V1beta1.GeneratePackagesSummaryRequest do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :name, 1, type: :string, deprecated: false
end
defmodule Google.Devtools.Containeranalysis.V1beta1.PackagesSummaryResponse.LicensesSumm... |
02027ad63bc8d0335e815707ecc5f4932ebe583a | 2,555 | [
567820404
] | [
"test",
"phoenix"
] | defmodule ChessWeb.StatusControllerTest do
use ChessWeb.ConnCase
import Chess.StatusesFixtures
alias Chess.Statuses.Status
@create_attrs %{
name: "some name",
slug: "some slug"
}
@update_attrs %{
name: "some updated name",
slug: "some updated slug"
}
@invalid_attrs %{name: nil, slug: ... |
0202806715900d6003df304c7b7339897fd99632 | 4,674 | [
317642221
] | [
"test"
] | defmodule Day4Question2Test do
use ExUnit.Case
setup do
passport = "pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980\nhcl:#623a2f"
{:ok, passport: passport}
end
describe "birth_year?/1" do
test "returns integer value of the birth year", state do
assert Day4Question2.birth_year(state... |
0202dd2b18c90af9fb93baa839674f9a3152084b | 5,657 | [
449817794,
388447097
] | [] | %{
"cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65... |
0202e69f72e90a61a89f0e382c3d27bf24eadc20 | 1,642 | [
610952058,
392225877,
436553571
] | [
"macro",
"documented",
"phoenix"
] | defmodule RealtimeWeb 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 RealtimeWeb, :controller
use RealtimeWeb, :view
The definitions below will be executed for every view,
controlle... |
0202feb1cd3834b32f3dce16de3e9d69ec4360c3 | 6,510 | [
433587628
] | [
"typespec"
] | defmodule Day8 do
defmodule UniqueNumberIdentifier do
@type t() :: %__MODULE__{
digit: char(),
segment_count: non_neg_integer(),
overlap_with_1: non_neg_integer(),
overlap_with_4: non_neg_integer()
}
defstruct [:digit, :segment_count, :overlap_with_1, ... |
0203ede1e7357d40b92b2566a0fcf0a7a26edf9a | 7,377 | [
314441430
] | [] | defmodule CsvEditor.Csv do
alias CsvEditor.Record
alias CsvEditor.Query
alias CsvEditor.Query.Select
alias CsvEditor.Query.Update
alias CsvEditor.Query.Copy
alias CsvEditor.Query.Search
defstruct headers: [],
records: [],
file_path: "",
name: "",
dirty: false
def load(file_path) do
... |
0204119ee327b0e673593fd4ea41ad5117a1c4fe | 2,486 | [
901314799
] | [
"genserver",
"liveview"
] | defmodule PollingAppWeb.PollLive.Show do
use PollingAppWeb, :live_view
alias PollingApp.Polling
@impl true
def mount(_params, _session, socket) do
{:ok, socket}
end
@impl true
def handle_params(%{"id" => id}, _, socket) do
poll_votes = Polling.list_votes(id)
Polling.subscribe_to_poll(%{poll... |
02041fa62d22cc742f1c7562c23b2fd019352684 | 1,676 | [
510809929
] | [
"genserver",
"liveview"
] | defmodule Metrics.Telemetry.CustomReporter do
use GenServer
alias Metrics.Telemetry.ReporterState
alias Telemetry.Metrics
def start_link(metrics: metrics) do
GenServer.start_link(__MODULE__, metrics)
end
@impl true
def init(metrics) do
Process.flag(:trap_exit, true)
groups = Enum.group_by(... |
020461fd84501ce11b9f76444283542ecbee8b18 | 1,630 | [
126905472,
457467670,
123095619,
379427989,
118888813,
223043008
] | [
"macro",
"documented",
"phoenix"
] | defmodule PlateSlateWeb 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 PlateSlateWeb, :controller
use PlateSlateWeb, :view
The definitions below will be executed for every view,
con... |
020488d5e08f8bba4fa200c8fd7c89010679252f | 1,582 | [
382307716
] | [
"macro",
"documented",
"phoenix"
] | defmodule SmsWeb 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 SmsWeb, :controller
use SmsWeb, :view
The definitions below will be executed for every view,
controller, etc, so keep... |
0204a18268482c3a4f0908c6d1905179ac8d1cef | 3,348 | [
1003849894
] | [
"documented"
] | defmodule Mix.Tasks.Portico.Config do
@shortdoc "Generate a configuration file from an OpenAPI spec"
@moduledoc """
Generate a configuration file from an OpenAPI spec.
This task analyzes an OpenAPI specification and generates a JSON configuration
file that can be used with other Portico tasks. The configurat... |
0204d1ef9c1eebb875f1f69278d645317226c02b | 10,053 | [
314315120
] | [
"test"
] | defmodule SmokexClient.Test.Workers.Yaml do
use ExUnit.Case, async: true
#
# There are `error case` scenarios here and the log messages are not being
# asserted at the moment. For this reason, all logs will be captured to avoid
# adding noise to tests.
#
# https://hexdocs.pm/ex_unit/ExUnit.Case.html#modu... |
0205051eaedcf9c651d68b45877f710318ea64ed | 1,781 | [
106046398
] | [
"test"
] | defmodule FritzApiTest do
use FritzApi.Case, async: false
defmodule InspectPoolOptsClient do
@behaviour FritzApi.HTTPClient
@impl true
def child_spec(pool_opts) do
send(:fritz_api_test, {:child_spec, pool_opts})
Finch.child_spec(name: __MODULE__)
end
@impl true
def get(_url, _... |
02050a3703f4657d20d560a78750bc79b94dcf42 | 2,097 | [
379747369
] | [] | defmodule Grapevine.MixProject do
use Mix.Project
def project do
[
app: :grapevine,
version: "0.1.0",
elixir: "~> 1.7",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),... |
020521919a75d7d9c604e34e3a80d2f321eb1f3b | 2,136 | [
76554848
] | [] | defmodule AdventOfCode.Day4 do
alias AdventOfCode.Common, as: Common
defmodule AdventOfCode.Day4.Room do
defstruct [:name, :sector, :csum]
end
alias AdventOfCode.Day4.Room, as: Room
@room_regex ~r/([a-zA-Z\-]+)(\d+)\[([a-zA-Z]+)\]/
def calculate_hash(str) do
String.replace(str, "-", "")
|> S... |
0207e1b5f15207b14f4c255f984aece4a55873b4 | 5,239 | [
1009968181
] | [
"liveview"
] | defmodule PersonalFinanceWeb.LedgersLive.LedgerCardItem do
use PersonalFinanceWeb, :live_component
@impl true
def mount(socket) do
{:ok, assign(socket, show_menu: false)}
end
@impl true
def render(assigns) do
~H"""
<div
class="card bg-base-100 w-96 shadow-sm"
id={@id}
phx-mou... |
020873ce81655c0d44e8b3f6dd16edfa7c1aba6f | 10,558 | [
64464740
] | [
"test",
"phoenix"
] | defmodule ExDoc.Formatter.HTMLTest do
use ExUnit.Case
setup do
File.rm_rf(output_dir())
File.mkdir_p!(output_dir())
end
defp output_dir do
Path.expand("../../tmp/doc", __DIR__)
end
defp beam_dir do
Application.app_dir(:ex_doc, "ebin")
end
defp doc_config do
[project: "Elixir",
... |
02088fa4545ea6fce971b44c8c1f7fdc25a6babf | 1,532 | [
728692619
] | [
"typespec",
"documented"
] | defmodule FwdClient.PathSearchQuery do
@moduledoc """
Provides struct and type for a PathSearchQuery
"""
use FwdClient.Encoder
@type t :: %__MODULE__{
__info__: map,
ack: integer | nil,
appId: String.t() | nil,
dstIp: String.t(),
dstPort: String.t() | nil,
... |
0208b974e2b8506651dc6e8cc7c4b189ec77d440 | 9,661 | [
651728799
] | [
"genserver",
"documented"
] | defmodule CPSolver.Space do
@moduledoc """
Computation space.
The concept is taken from Chapter 12, "Concepts, Techniques, and Models
of Computer Programming" by Peter Van Roy and Seif Haridi.
"""
alias CPSolver.Variable.Interface
alias CPSolver.DefaultDomain, as: Domain
alias CPSolver.Search, as: Sear... |
0208f68c78448ed0c2b7216e041164e3de946dab | 7,369 | [
375923740
] | [
"documented",
"ecto"
] | defmodule SafebodaFullstack.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias SafebodaFullstack.Repo
alias SafebodaFullstack.Accounts.{User, Driver, Passenger}
alias SafebodaFullstack.Ride
alias SafebodaFullstack.Ride.OngoingRides
# @doc """
# Returns the l... |
02091be6b8302ae77926eaaf71f43a4166e5dd50 | 1,931 | [
744421640
] | [
"phoenix"
] | defmodule BlockScoutWeb.VerifiedContractsController do
use BlockScoutWeb, :controller
import BlockScoutWeb.Chain,
only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1, fetch_page_number: 1]
import BlockScoutWeb.PagingHelper, only: [current_filter: 1, search_query: 1]
alias BlockScoutWeb.{... |
020958f94d705aea69ad100efee4771a0297940d | 1,515 | [
900485550
] | [] | defmodule Day11_P02 do
@behaviour Common.Solver
def read(path) do
File.stream!(path)
|> Enum.map(&String.trim/1)
end
def reduce_list(int, acc) do
Map.update(acc, int, 1, &(&1 + 1))
end
def parse([str]) do
str
|> String.split(" ", trim: true)
|> Enum.reduce(%{}, &reduce_list/2)
e... |
02095da8b802ba482e0d0d168f5ffa92ae298a6c | 2,196 | [
705680146
] | [
"typespec",
"macro",
"documented"
] | defmodule IbEx.Client.Types.Order.OrderConditionsParams do
@moduledoc """
Serializes list of OrderCondition structs for Order serialization.
"""
alias IbEx.Client.Types.Order.OrderCondition
import IbEx.Client.Utils, only: [list_to_union_type: 1]
defstruct conditions: [], conditions_cancel_order: false, co... |
020975bed70dcd963d9eec2f6593066d4b48bfa2 | 2,820 | [
181698357
] | [
"test",
"phoenix"
] | defmodule PhxContextLearnWeb.CMS.PageControllerTest do
use PhxContextLearnWeb.ConnCase
alias PhxContextLearn.CMS
@create_attrs %{body: "some body", title: "some title", views: 42}
@update_attrs %{body: "some updated body", title: "some updated title", views: 43}
@invalid_attrs %{body: nil, title: nil, views... |
0209b0c7c09df17164878ab78b70d1ba684d806a | 2,141 | [
116609639
] | [
"test"
] | defmodule BackendWeb.RoleControllerTest do
use BackendWeb.ConnCase
alias Backend.Auth
alias Backend.Auth.Role
@create_attrs %{}
@update_attrs %{}
@invalid_attrs %{}
def fixture(:role) do
{:ok, role} = Auth.create_role(@create_attrs)
role
end
setup %{conn: conn} do
{:ok, conn: put_req_h... |
0209c208680c3ed761c923ecc3507d5b3d6c6841 | 1,761 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.NetworkServices.V1.Model.GrpcRouteFaultInjectionPolicy do
@moduledoc """
The specification for fault injection introduced into traffic to test the resiliency of clients to destination service failure. As part of fault injection, when clients send requests to a destination, delays can be introduc... |
0209c89299505fa3eb65ca63ad0f31282d4da9bc | 1,700 | [
288856620
] | [
"typespec"
] | defmodule Tracer.TraceContext do
require Logger
defstruct trace_header: "",
project_id: "",
span_id: "",
trace_id: "",
should_sample?: false
@type t() :: %__MODULE__{
trace_header: binary(),
project_id: binary(),
span_id: binary(),
... |
0209cc7448001ffed9f9e38203a35d54c6a0ddc3 | 1,946 | [
254384912
] | [
"documented",
"ecto"
] | defmodule Euphoriafx.Feeds do
@moduledoc """
The Feeds context.
"""
import Ecto.Query, warn: false
alias Euphoriafx.Repo
alias Euphoriafx.Feeds.Feed
@doc """
Returns the list of feeds.
## Examples
iex> list_feeds()
[%Feed{}, ...]
"""
def list_feeds do
Repo.all(Feed)
|> Re... |
020a8153d9f11c35f6ebfadd73714ed840fe1396 | 1,734 | [
722630578
] | [
"phoenix"
] | defmodule FrankFerreiraWeb.Router do
use FrankFerreiraWeb, :router
import Phoenix.LiveDashboard.Router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {FrankFerreiraWeb.Layouts, :root}
plug :protect_from_forgery
plug :pu... |
020a9afb2a28d943448d38bf3535d9e20af7cb8d | 13,838 | [
161121883,
162856964,
161718503,
159038989,
162276071
] | [
"test",
"ecto"
] | Code.require_file "../support/types.exs", __DIR__
defmodule Ecto.Integration.TypeTest do
use Ecto.Integration.Case, async: Application.get_env(:ecto, :async_integration_tests, true)
alias Ecto.Integration.{Custom, Item, ItemColor, Order, Post, User, Tag, Usec}
alias Ecto.Integration.TestRepo
import Ecto.Query... |
020b0be05637d10fcd1b155cbe6f70b22536ee03 | 1,765 | [
987171230
] | [] | defmodule Eloom.MixProject do
use Mix.Project
def project do
[
app: :eloom,
version: "0.1.0",
elixir: "~> 1.18",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end
# Configuration for the OTP ap... |
020b536fd3ab2d8657796d60b877a1e33fd0a6d3 | 3,352 | [
52797857
] | [
"documented"
] | defmodule Cloak.MemoryUsage do
@moduledoc "Periodical logging of some memory usage stats."
require Logger
alias Cloak.MemoryReader.ProcMemInfo
@interval :timer.minutes(1)
@large_mem_usage_in_mb 100
@doc false
def stats() do
if total() > 5 * @large_mem_usage_in_mb do
processes()
ets()
... |
020bc730a7b258cef0e7b12577e38128dba829c2 | 2,895 | [
67795024
] | [
"documented"
] | defmodule PushHub.Aliyun do
@behaviour PushHub.ServiceProvider
use HTTPoison.Base
@action "Push"
def process_url(url) do
"https://cloudpush.aliyuncs.com/?" <> url
end
@defaults %{"Target" => "all",
"TargetValue" => ["all"],
"Type" => 1,
"DeviceType" => 1,
"StoreOffline" => true
}... |
020bef53e4e3d860dc0c98fdd04e125c3b50166d | 5,021 | [
451567660
] | [
"test"
] | defmodule Wordual.GameTest do
use ExUnit.Case
import Wordual.Test.Support.Assertions
import Wordual.Test.Support.Factories
alias Wordual.Game
alias Wordual.KeyboardHints
alias Wordual.Row
describe "init/2" do
test "it starts in the :starting state" do
result = Game.init("abc123", "swole")
... |
020c3ac2d0ef92285a8583701711b5bd8e1f07bb | 3,193 | [
381891907
] | [] | use Mix.Config
# For production, don't forget to configure the url host
# to something meaningful, Phoenix uses this information
# when generating URLs.
#
# Note we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the `mix phx.digest` task,
# ... |
020c71e1f2802dacb608ce736ee73fce2087eabc | 3,252 | [
143670899
] | [
"genserver",
"macro"
] | defmodule Actr do
defmacro __using__(_opts) do
quote do
use GenServer
import Actr
end
end
defp explode_fun(fun) do
{:fn, _, clauses} = fun
Enum.map clauses, fn clause ->
{:->, _, [args, body]} = clause
{args, body}
end
end
defp inject_name_into_fun_sig(name, sig... |
020c9260c00369e0673213f9ecc5962dd70626bf | 10,361 | [
67282843
] | [
"typespec",
"macro",
"documented",
"ecto"
] | defmodule Translecto.Query do
@moduledoc """
Provides convenient functionality for querying translatable models.
"""
defmacro __using__(_options) do
quote do
import Translecto.Query
import Ecto.Query, except: [from: 1, from: 2]
end
end
defp get_table({ ... |
020cb1c1fdab7bca28f9b3c4f97d50e084eec36d | 3,346 | [
499150213
] | [
"liveview"
] | defmodule MusicBot.BotConsumer do
use Nostrum.Consumer
alias Nostrum.Api
alias MusicBot.Commands
alias MusicBot.Ideas
alias Nostrum.Struct.Event.MessageReactionAdd
alias Nostrum.Struct.Event.MessageReactionRemove
def start_link do
Consumer.start_link(__MODULE__)
end
def handle_event({:MESSAGE_... |
020d6bbaf05a623f7ce4edad35042ee205ef8c2f | 4,300 | [
160069062
] | [
"documented"
] | defmodule Syntax do
@moduledoc """
Documentation for Syntax.
"""
import Syntax.Parser
import Submarine.CLI
@doc """
Parse arguments and call puzzle part methods.
## Parameters
- argv: Command-line arguments
"""
def main(argv) do
{input_file, opts} = parse_args(argv)
if Enum.member?(opt... |
020de60630be6122d4af9840216a9678e640d793 | 1,691 | [
582461876
] | [] | # Solution to Advent of Code 2021, Day 14
# https://adventofcode.com/2021/day/14
# returns a list of non-blank lines from the input file
read_input = fn ->
filename = "input.txt"
File.read!(filename) |> String.split("\n", trim: true)
end
# The naive approach is to iterate with string substitutions, and
# this wor... |
020e1a78ba9ab97ea5c40a81a64ceb13ae3d6601 | 1,985 | [
171251589
] | [
"documented",
"ecto"
] | defmodule Phx.InnChecks do
@moduledoc """
The InnChecks context.
"""
import Ecto.Query, warn: false
alias Phx.Repo
alias Phx.InnChecks.InnCheck
@doc """
Returns the list of inn_check.
## Examples
iex> list_inn_check()
[%InnCheck{}, ...]
"""
def list_inn_check do
Repo.all(InnC... |
020e3df7d240ce714bb10ec56f720a3fcec844b5 | 2,750 | [
456382864
] | [
"liveview",
"documented",
"ecto"
] | defmodule PurpleWeb.BoardLive.CreateItem do
@moduledoc """
Item form that's only for creation.
"""
alias Purple.Board
alias Purple.Board.{Item, ItemEntry, UserBoard}
import PurpleWeb.BoardLive.Helpers
use PurpleWeb, :live_view
defp assign_changeset(socket, default_entry) do
entries = [%ItemEntry{co... |
020e4fb73ff5eddea96f8f47d05dd20d8d0da879 | 2,695 | [
815629411
] | [
"liveview",
"ecto"
] | defmodule BVSWeb.OcurrenceTypeLive.FormComponent do
use BVSWeb, :live_component
alias BVS.Negativation
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage ocurrence_type records in your database.</:subtitle>
</.header>
... |
020e8787a03288ab37652d1efb4dabf477299579 | 5,583 | [
960321174
] | [
"documented",
"ecto"
] | defmodule MyApp.Upload do
@moduledoc """
The Upload context handles file uploads and their association with forms and responses.
"""
import Ecto.Query, warn: false, only: [from: 2]
alias MyApp.Repo
alias MyApp.Upload.UploadedFile
require Logger
@doc """
Saves uploaded file information and creates a ... |
020f4b19f8ee8fabc7a06a0073859c24b2e5b022 | 2,185 | [
435169705
] | [] | defmodule Year2022.Day20 do
def run1(), do: part1(input())
def test1(), do: part1(test_input())
defp part1(str) do
list =
str
|> String.split("\n")
|> Enum.map(&String.to_integer/1)
|> Enum.with_index(fn e, i -> {e, i} end)
list0 = mixing(list, [], length(list))
{0, i0} = Enu... |
020f4e84cda2e57753d23eff66fb5c4b6dbd88f4 | 4,954 | [
94121008
] | [
"test"
] | defmodule EbayClone.ItemControllerTest do
use EbayClone.ConnCase
import EbayClone.UserCase
alias EbayClone.Item
def attrs_without_user_id do
%{end_date: %{DateTime.utc_now | year: DateTime.utc_now.year + 1},
name: "some content",
start_price: 42}
end
describe "index" do
test "lists al... |
020f7fac22be0e8500f6045702e95d619f86260a | 7,345 | [
124711178
] | [] | defmodule Jivi.Game do
def new do
{p1, p2} = new_players()
%{
player1: p1,
players: [],
player2: p2,
field: [],
killed: [],
challenged: 0
}
end
def client_view(game) do
%{
player1: game.player1,
player2: game.player2,
field: game.field,
... |
020fdc8b324d31baf66af6ee1ec3befa1c143d26 | 4,032 | [
191467663
] | [
"documented",
"ecto"
] | defmodule Hello.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias Hello.Repo
alias Hello.Accounts.{User, Credential}
@doc """
Returns the list of users.
## Examples
iex> list_users()
[%User{}, ...]
"""
def list_users do
User
|> Repo... |
0211ffc5fb0ff65a41451cca74e2b04f11bbd0a4 | 4,236 | [
168752200
] | [
"phoenix",
"ecto"
] | defmodule FumigateWeb.Admin.PerfumeApprovalController do
use FumigateWeb, :controller
alias Fumigate.Approval
alias Fumigate.Fragrance
plug Fumigate.Plug.AccordList when action in [:new, :create, :edit, :update]
plug Fumigate.Plug.NoteList when action in [:new, :create, :edit, :update]
plug Fumigate.Plug.... |
021206d98d3b8ba6373c57fa122646c9e96e2bb4 | 4,435 | [
482555587
] | [
"typespec",
"documented",
"ecto"
] | defmodule ExOAPI.Stripe.Schemas.CustomerBalanceTransaction do
use TypedEctoSchema
import Ecto.Changeset
@type params :: map()
@moduledoc """
**description**: Each customer has a [`balance`](https://stripe.com/docs/api/customers/object#customer_object-balance) value,
which denotes a debit or credit that's ... |
0212bf37aa25b93d12e440590f26390ce7803897 | 1,580 | [
129602106
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule WorkoutDemo.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use WorkoutDemo.Web, :controller
use WorkoutDemo.Web, :view
The definitions below will be executed for every view,
controller, etc, so k... |
02130abdca15f8e7c94be7817d7694ac85621bfb | 11,776 | [
105913697
] | [
"documented",
"ecto"
] | defmodule Skoller.AutoUpdates do
@moduledoc """
The context module for auto updates.
"""
# TODO: Combine auto update logic into one set of functions instead of the current two.
alias Skoller.Mods.Mod
alias Skoller.Repo
alias Skoller.Settings
alias Skoller.ModActions
alias Skoller.ModNotifications
... |
02135159b80fb7e56585e5f1184d4a56d818a7d5 | 3,757 | [
280615158
] | [
"documented",
"ecto"
] | defmodule AlbionTools.Items do
def extract_shopcategory(item) do
Map.get(item.meta, "@shopcategory")
end
@moduledoc """
The Items context.
"""
import Ecto.Query, warn: false
alias AlbionTools.Repo
alias AlbionTools.Items.Item
def import_file(file_name) do
Poison.decode!(File.read!(file_na... |
0214807ad1c1226618fb41abbd77e3f5c7227b73 | 3,175 | [
207051596
] | [
"test"
] | defmodule StlParser.ASTParserTest do
use ExUnit.Case
alias StlParser.ASTParser
alias StlParser.Facet
alias StlParser.Solid
alias StlParser.Vertex
@ast [
{{{:defsolid, 1, 'solid'}, {:keyword, 1, 'ascii'}},
[
{{{:deffacet, 2, 'facet'}, {:keyword, 2, 'normal'},
[
{:float, ... |
0214b523a7480bfc25e5a160edc4936ab4c2cc0d | 1,699 | [
129467430
] | [] | defmodule DynamicServerManager.Mixfile do
use Mix.Project
def project do
[
app: :dynamic_server_manager,
version: "0.0.10",
elixir: "~> 1.7",
start_permanent: Mix.env == :prod,
package: package(),
description: description(),
deps: deps(),
]
end
# Run "mix help... |
02152a5055bcf157d4f028af8d4a7b0b68fbc574 | 9,747 | [
624054242
] | [
"typespec",
"documented"
] | # Code generated by protox. Don't edit.
# credo:disable-for-this-file
defmodule PgQuery.WithCheckOption 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 ve... |
0215cfd6fa77b25f3f307e667aea8272e000414f | 7,751 | [
113770457
] | [] | %{
"approximate_histogram": {:hex, :approximate_histogram, "0.1.1", "198eb36681e763ed4baab6ca0682acec4ef642f60ba272f251d3059052f4f378", [], [], "hexpm"},
"bureaucrat": {:git, "https://github.com/api-hogs/bureaucrat.git", "1e9d355a786ec6147f510ceb3ff3c772121e2be3", [ref: "1e9d355a786ec6147f510ceb3ff3c772121e2be3"]},... |
0216bd8dda22fb0a6837f95e0b8ad86e9d195a24 | 2,113 | [
425958509
] | [
"typespec"
] | defmodule Grapex.Meager.Sampler do
use Grapex.Meager
import Grapex.ExceptionHandling
import Grapex.Patterns.MeagerDecoder
import Grapex.Meager.Placeholder
require Grapex.PersistedStruct
Grapex.PersistedStruct.init [
required_keys: [
pattern: nil,
n_observed_triples_per_pattern_instance: n... |
0216f99b0a381596658d2e81fa0ad60ce8374afd | 3,242 | [
417649934
] | [
"genserver",
"liveview"
] | defmodule UrlShortnrWeb.ShortLinkPublicLive do
use UrlShortnrWeb, :live_view
alias UrlShortnr.ShortLinks
alias UrlShortnr.ShortLinks.PubSub
@impl true
def mount(_params, session, socket) do
if connected?(socket) do
PubSub.subscribe()
end
socket =
socket
|> assign_current_user(... |
0216fdec085f2c1f081862a2ad7e5914f0dae290 | 2,141 | [
85445695
] | [
"test"
] | defmodule HubGateway.ZWave.Devices.DoorLockTest do
use ExUnit.Case
alias HubGateway.ZWave.Devices.DoorLock
test "door locks are handled as expected" do
assert DoorLock.get_core_type == "door_lock"
assert DoorLock.get_value_type("user_code_1") == {:ok, "Code 1:"}
assert DoorLock.get_value_for_type("s... |
0217e5ae1c8c1a89100fdfc74b855fd0c0f573ea | 2,404 | [
472199338
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule StudyWeb 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 StudyWeb, :controller
use StudyWeb, :view
The definitions below will be executed for every view,
controller, etc, s... |
02183d4b29a23eebf123e469ce145d61502d5b05 | 5,838 | [
1009968181
] | [
"genserver",
"liveview",
"ecto"
] | defmodule PersonalFinanceWeb.CategoryLive.Index do
alias PersonalFinance.Finance.Ledger
alias PersonalFinance.Finance.Category
alias PersonalFinance.Finance
use PersonalFinanceWeb, :live_view
@impl true
def mount(params, _session, socket) do
current_scope = socket.assigns.current_scope
ledger = Fi... |
021883b8bfd4aab74dcd72713b11a888f53cdf5e | 8,419 | [
486373676
] | [
"test"
] | defmodule Silhouette.OperationTest do
use ExUnit.Case
doctest Silhouette.Graphql
alias Silhouette.Graphql
alias Silhouette.Operation
alias Fixtures.User
alias Fixtures.PhoneNumber
alias Examples.Film
alias Examples.Launch
alias Silhouette.SelectionSet
def setup_simple_user_set(_) do
selection_s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.