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 |
|---|---|---|---|---|
014344526664841e69584784dcba0ec8de149d47 | 6,654 | [
46763801
] | [
"typespec",
"documented"
] | defmodule Elixlsx.Sheet do
alias __MODULE__
alias Elixlsx.Sheet
alias Elixlsx.Util
@moduledoc ~S"""
Describes a single sheet with a given name. The name can be up to 31
characters long.
The rows property is a list, each corresponding to a
row (from the top), of lists, each corresponding to
a column ... |
01434d088eaf99df8b6f0ea4de7e0a89d19b4c47 | 2,102 | [
47978942
] | [] | defmodule Opencast.Mixfile do
use Mix.Project
def project do
[
app: :opencast,
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(),
... |
01446550a4bf4938cf52034653d0c2ca02512092 | 2,132 | [
650138283
] | [
"documented"
] | defmodule SellSetGoApi.UpdateSaleQty do
@moduledoc """
The UpdateSaleQty context.
"""
alias SellSetGoApi.Offers.Offer
alias SellSetGoApi.Inventory.Product
alias SellSetGoApi.Repo
alias SellSetGoApi.Accounts.User
import Ecto.Query, warn: false
@doc """
This function takes a username as input and ret... |
014472e1a4e273a600a43798f748c7b23b9946be | 5,596 | [
804424291
] | [
"typespec",
"liveview",
"documented"
] | defmodule ErrorTracker.Web.CoreComponents do
@moduledoc false
use Phoenix.Component
@doc """
Renders a button.
## Examples
<.button>Send!</.button>
<.button phx-click="go" class="ml-2">Send!</.button>
"""
attr :type, :string, default: nil
attr :class, :string, default: nil
attr :rest, :... |
0144a5c29a60bb6ce29dc23ab782495663b2c64a | 1,518 | [
61719845
] | [
"test"
] | defmodule Tackle.DeliveryHandlerTest do
use ExUnit.Case, async: false
# This is needed for delivery_handler to be generated.
defmodule TestConsumer do
require Logger
use Tackle.Consumer,
url: "amqp://rabbitmq:5672",
exchange: "test-exchange",
routing_key: "test-messages",
service... |
0144b0e8971b7fbe284fff42ed63d4e5afbee72a | 1,618 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1EvaluationMetrics do
@moduledoc """
## Attributes
* `classificationMetrics` (*type:* `GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1ClassificationMetrics.t`, *default:* `nil`) -
* `objectDetectionMetrics` (... |
0144cdc7c6e65e069474694ddfaac29ae25a1079 | 3,927 | [
552557718
] | [
"liveview",
"documented"
] | defmodule SelectoComponents.Views.Detail.Component do
@doc """
Display results of a detail view
"""
import SelectoComponents.Components.Common
use Phoenix.LiveComponent
def render(assigns) do
### Todo Deal with page changes without executing again.......
# |> IO.inspect()
{results, _fields, ... |
0144e68afcc9f680297d3630c3487fd12c7f5d36 | 1,835 | [
31273693
] | [
"phoenix"
] | defmodule Peopleware.Router do
use Phoenix.Router
# Use the default browser stack
pipeline :browser do
plug :accepts, ~w(html)
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
end
pipeline :auth do
# plug Peopleware.Plug.Authentication
plug :authenticate
end
pipe... |
0145b6b5bd0a27314e80379984f051e47e3a685e | 2,869 | [
360635200
] | [
"genserver",
"liveview",
"documented"
] | defmodule PlasmaUiWeb.Content.Edit do
@moduledoc """
A liveview page provides a content editing interface for individual entries of any entity type.
"""
use Surface.LiveView
alias PlasmaUiWeb.Components.Alerts
alias PlasmaUiWeb.Components.DynamicField
alias PlasmaUiWeb.Components.Nav
alias PlasmaUiWeb.... |
0145e0a14c16a0cdc7c9a5277bf2de261c5f8aa1 | 11,139 | [
960531512
] | [
"documented"
] | defmodule PiiGuard.DataUpdateHandler do
@moduledoc """
Handles data updates from external services.
When data is updated, this module checks for PII in the changes,
deletes any content containing PII, and notifies the user via Slack.
"""
require Logger
@doc """
Handles a data update request.
## Par... |
01468b621a4c6327c8924ca279215c709cfcdcc9 | 3,319 | [
582622623
] | [
"typespec"
] | defmodule JllyBot.Role do
require JllyBot.Gettext
alias JllyBot.Repo
alias JllyBot.Repo.Role
alias Nostrum.Api
alias Nostrum.Struct
@spec create_role(atom() | nil, non_neg_integer | Nostrum.Struct.Guild.t(), String, keyword) ::
{:error, any} | {:ok, JllyBot.Repo.Role.t()}
def create_role(modul... |
0146baa65b3b8057fbfd43540b02ce04d778da71 | 2,329 | [
172386964
] | [
"phoenix"
] | defmodule GitGraphedApiWeb.AuthController do
use GitGraphedApiWeb, :controller
plug(Ueberauth)
alias Ueberauth.Strategy.Helpers
alias GitGraphedApi.{Accounts, Accounts.User}
def signout(conn, _params) do
conn
|> delete_resp_cookie("userId")
|> redirect(external: "http://localhost:3000")
end
... |
01475ff86072537759c408657e5d979b89e57c41 | 2,126 | [
371100451
] | [
"test"
] | defmodule ElxValidation.BooleanTest do
use ExUnit.Case
doctest ElxValidation.Boolean
test "validate_boolean" do
assert ElxValidation.Boolean.validate_boolean("true") == true
assert ElxValidation.Boolean.validate_boolean("false") == true
assert ElxValidation.Boolean.validate_boolean("0") == true
... |
01479c2da08e405ce4f69067502052b45689ae31 | 1,681 | [
48145757
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Summon.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Summon.Web, :controller
use Summon.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them short ... |
0147b4801a0240354d1e11580f551f954fdb8120 | 1,863 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Compute.V1.Model.AutoscalingPolicyCpuUtilization do
@moduledoc """
CPU utilization policy.
## Attributes
* `predictiveMethod` (*type:* `String.t`, *default:* `nil`) - Indicates whether predictive autoscaling based on CPU metric is enabled. Valid values are: * NONE (default). No predictiv... |
0148222266bb0e8ba341743d05bfb88ce771c2a5 | 1,728 | [
407720350
] | [] | defmodule Rockelivery.Orders.Create do
import Ecto.Query
alias Rockelivery.{Error, Item, Order, Repo}
def call(params) do
params
|> fetch_items()
|> handle_items(params)
end
defp handle_items({:error, result}, _params), do: {:error, Error.build(:bad_request, result)}
defp handle_items({:ok, ... |
0148247a77ee9a372a273de9beea0b6e9d064883 | 1,960 | [
831565693
] | [
"liveview",
"documented"
] | defmodule KioskExampleWeb.GPIOLive do
@moduledoc """
This implementation is very lazy.
Idiomatically the HW logic should be located in `KioskExample` side and
for local development, we should use like [mox](https://github.com/dashbitco/mox) things.
"""
use KioskExampleWeb, :live_view
def render(assigns)... |
014861db84aed765d24e9986849eeb8d80b115d0 | 2,009 | [
36134727
] | [
"test"
] | defmodule ExJsonSchema.Test.Support.TestSuiteTemplate do
use ExUnit.CaseTemplate
using opts do
quote bind_quoted: [opts: opts] do
alias ExJsonSchema.Test.Support.TestHelpers
@schema_tests_path opts[:schema_tests_path]
@schema_url opts[:schema_url]
@ignored_suites Keyword.get(opts, :ig... |
0148808e2db8c129115dd8ceb752edea0b37c101 | 2,154 | [
225481325
] | [] | input = [
1,
0,
0,
3,
1,
1,
2,
3,
1,
3,
4,
3,
1,
5,
0,
3,
2,
6,
1,
19,
1,
5,
19,
23,
2,
6,
23,
27,
1,
27,
5,
31,
2,
9,
31,
35,
1,
5,
35,
39,
2,
6,
39,
43,
2,
6,
43,
47,
1,
5,
47,
51,
2,
9,
51,
55,
1,
5,
... |
0148c7041d06fba10c7e1ab512584207c511bdf6 | 3,008 | [
197065426
] | [
"test"
] | if !System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("robot_simulator.exs", __DIR__)
end
ExUnit.start()
ExUnit.configure(exclude: :pending, trace: true)
defmodule RobotSimulatorTest do
use ExUnit.Case
test "create has sensible defaults" do
robot = RobotSimulator.create()
assert RobotSimulator... |
014924d6c3f218fa61c96c1a90d2ce5f05386eed | 1,757 | [
78053330
] | [
"test",
"liveview"
] | defmodule NektoBot.ForwarderTest do
use ExUnit.Case, async: false
import Mock
alias NektoBot.Forwarder
alias NektoClient.Model.Message
setup do
chat_id = 1000
client = :a
{:ok, gen_event} = GenEvent.start_link
:ok = GenEvent.add_handler(gen_event, Forwarder,
%... |
014924f3842cf71931690aeb8a326f334b86299d | 3,880 | [
94818958
] | [
"genserver",
"documented"
] |
defmodule Rooms.Match do
use GenServer
@doc ~S"""
Rooms.Match:
user_0 :: App.User
user_1 :: App.User
serializer :: pid
simulation :: pid
ready :: MapSet
connection :: pid
rules :: Map
"""
defstruct user_0: nil,
user_1: nil,
serializer: nil,
simulation: nil,
... |
01492ba9a9ddee6020b4053f42bdb4c65005e03d | 3,953 | [
739136679
] | [
"liveview",
"test"
] | defmodule ClerkDemoWeb.LiveSprocketLiveTest do
use ClerkDemoWeb.ConnCase
import Phoenix.LiveViewTest
import ClerkDemo.SprocketsFixtures
@create_attrs %{name: "some name", user_id: "some user_id"}
@update_attrs %{name: "some updated name", user_id: "some updated user_id"}
@invalid_attrs %{name: nil, user_i... |
0149e4c42b2f8e78fd912aafee41f1c1258dceae | 1,794 | [
167428601
] | [] | defmodule Chippy.MixProject do
use Mix.Project
def project do
[
app: :chippy,
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(),
... |
014a61e619cf60dbce2d4b001e2616f684ff0c1a | 1,769 | [
47763923
] | [
"typespec",
"documented"
] | defmodule Meetup do
@moduledoc """
Calculate meetup dates.
"""
@type weekday ::
:monday | :tuesday | :wednesday
| :thursday | :friday | :saturday | :sunday
@weekdays [:monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday]
@type schedule :: :first | :second | :third | :fourth | :... |
014a628b146ddac9d039e331e25e9775fa17f42f | 4,722 | [
877538596
] | [
"phoenix"
] | defmodule PrimePobreWeb.MovieController do
use PrimePobreWeb, :controller
alias PrimePobre.Movies
alias PrimePobre.Movies.Movie
action_fallback PrimePobreWeb.FallbackController
def index(conn, _params) do
movies = Movies.list_movies()
render(conn, :index, movies: movies)
end
def stream(conn, %... |
014b46da120fd9214884d8a8060eb795a4075b64 | 2,548 | [
179035580
] | [
"documented"
] | defmodule Chapters.Parsers.Normalplaytime.Parser do
import NimbleParsec
@moduledoc ~S"""
Parses Normal Play Time strings.
See https://www.w3.org/TR/media-frags/#npttimedef.
## Examples
iex> {:ok, r, "", _, _, _} = parse("1")
iex> r
[{:seconds, 1}]
iex> {:ok, r, "", _, _, _} = pars... |
014c3545a22e577492b42b36d6181e6f1dd0dcea | 9,342 | [
179247377
] | [
"genserver",
"macro",
"documented"
] | defmodule SignalServerProxy do
@moduledoc """
Proxy interface to reach the intended `SignalBase`.
Reads the configuration file to get the pids of all available brokers
(`SignalBase`).
Several methods in this module accept a namespace argument. Use this argument
to specify which signal broker(s) to access.... |
014c3f3de11ba22c85103942c3fd6f2bccd9c203 | 2,265 | [
289745484
] | [
"liveview"
] | defmodule TobaccosClubWeb.FilterComponent do
use TobaccosClubWeb, :live_component
alias TobaccosClub.Pipes.Filter
def render(assigns) do
~L"""
<div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
<div x-on:click.away="<%= @input_name %> = false" class="relative border-2 border-gray-300 rounded-lg">
... |
014c651875e413efa5a20cee18172f80d058c134 | 3,019 | [
688641955
] | [
"test"
] | defmodule BugsChannel.Events.Database.RedisPushProducerTest do
use ExUnit.Case
import Mock
import ExUnit.CaptureLog
import BugsChannel.Test.Support.FixtureHelper
alias BugsChannel.Repo.Schemas, as: RepoSchemas
alias BugsChannel.Events.Database.RedisPushProducer
alias BugsChannel.Utils.Maps
describe "... |
014c7b8a473bc35109794f5eb582168632212e05 | 5,076 | [
408064277
] | [
"documented"
] | defmodule Dune.Eval.Process do
@moduledoc false
alias Dune.Failure
alias Dune.Helpers.Diagnostics
def run(fun, opts = %Dune.Opts{}) when is_function(fun, 0) do
with_string_io(fn string_io ->
do_run(fun, opts, string_io)
end)
end
defp do_run(fun, opts, string_io) do
task =
Task.asy... |
014cab2383d5caa153178645710eb491baea9cfc | 9,481 | [
204106782
] | [] | defmodule GpsReader.NmeaParser do
require Bitwise
# https://www.gpsinformation.org/dale/nmea.htm
# https://gpsd.gitlab.io/gpsd/NMEA.html
def parse("$GP" <> remainder) do
[ data | [ checksum | _ ] ] = String.split(remainder, "*")
case checksum("GP"<>data, checksum) do
{ true, _ } ->
# IO... |
014cb68aa035f591a64f503fed08b38873835ed2 | 6,529 | [
335161774
] | [
"phoenix",
"documented"
] | defmodule GlassWeb.UserAuth do
import Plug.Conn
import Phoenix.Controller
alias Glass.Accounts
alias GlassWeb.Router.Helpers, as: Routes
# Make the remember me cookie valid for 60 days.
# If you want bump or reduce this value, also change
# the token expiry itself in UserToken.
@max_age 60 * 60 * 24 *... |
014d1b7f1f4a9aa8a584293c8c093f3459fb678c | 3,241 | [
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.WorkloadManager.V1.Model.WorkloadProfile do
@moduledoc """
workload resource
## Attributes
* `application` (*type:* `GoogleApi.WorkloadManager.V1.Model.Layer.t`, *default:* `nil`) - Optional. The application layer
* `ascs` (*type:* `GoogleApi.WorkloadManager.V1.Model.Layer.t`, *defau... |
014d5b62f2f3a7769ed94031dff8c24f096c0dca | 2,766 | [
573641851
] | [] | defmodule FS do
defstruct cwd: [], tree: %{}
def new do
%FS{}
end
def chdir(fs, dir) do
case dir do
"/" -> %FS{cwd: [], tree: fs.tree}
"/" <> _ -> %FS{cwd: String.split(dir, "/", trim: true), tree: fs.tree}
".." -> %FS{cwd: Enum.drop(fs.cwd, -1), tree: fs.tree}
_ -> %FS{cwd: fs... |
014d682327c8bc11a898cffde083ae59433b3abf | 11,927 | [
58656783,
60716862,
63931406,
75659168,
63643631,
58332703,
57368077,
63885140,
67626331,
61923005,
63335915
] | [
"macro",
"documented"
] | defmodule Plug.Router do
@moduledoc ~S"""
A DSL to define a routing algorithm that works with Plug.
It provides a set of macros to generate routes. For example:
defmodule AppRouter do
use Plug.Router
plug :match
plug :dispatch
get "/hello" do
send_resp(conn, 200... |
014d854561e272c4e90f90dde262882c14780782 | 3,314 | [
160272993
] | [
"documented"
] | defmodule AOC.Day4 do
@moduledoc """
https://adventofcode.com/2018/day/4
"""
@doc """
iex> AOC.Day4.part_1([
...> %{
...> action: ["Guard", "#10", "begins", "shift"],
...> time: ~N[1518-11-01 00:00:00.000]
...> },
...> %{action: ["falls", "asleep"], time: ~N[1518-11-01 00:05:00.000]},
..... |
014dfc00791b125485862e43597f60e7e9d56011 | 3,291 | [
258617533
] | [
"test",
"ecto"
] | #defmodule AnalysisHistory.ResultsTest do
# use AnalysisHistory.DataCase
#
# alias AnalysisHistory.Results
#
# describe "analysis_results" do
# alias AnalysisHistory.Results.AnalysisResult
#
# @valid_attrs %{average_length: 42, length: 42, query: "some query", score: 42, url: "some url", user_id: 42}
# @upd... |
014dfdac6ecfe1d7f5a9af92d18758012b2aae14 | 2,364 | [
166092965
] | [
"typespec",
"supervisor",
"documented"
] | defmodule ApiWeb.EventStream.Supervisor do
@moduledoc """
Supervisor for the infrastructure needed for event streaming.
- ServerRegistry - mapping controller/params pairs to a DiffServer
- ServerSupervisor - DynamicSupervisor for managing the children
"""
use Supervisor
alias ApiWeb.EventStream.{DiffSer... |
014e14b55a59d19e2c19bce397f4c5b400800945 | 3,251 | [
986043105
] | [
"liveview",
"test"
] | defmodule ElixirTodoWeb.ItemLiveTest do
use ElixirTodoWeb.ConnCase
import Phoenix.LiveViewTest
import ElixirTodo.TodosFixtures
@create_attrs %{text: "some text", completed: true}
@update_attrs %{text: "some updated text", completed: false}
@invalid_attrs %{text: nil, completed: false}
defp create_item(... |
014e40c95e7bb9de930e3df40999afa09a4386b6 | 2,696 | [
786846015
] | [
"phoenix",
"documented"
] | defmodule ViolacorpWeb.Comman.DocumenttypeController do
use ViolacorpWeb, :controller
import Ecto.Query
alias Violacorp.Repo
alias Violacorp.Schemas.Documenttype
alias ViolacorpWeb.Comman.DocumenttypeView
@doc "inserts a documentType to documentType table"
def insertDocumenttype(conn, params) do
unl... |
014fdf79d00f399cbf4b77db144043dbc6724af7 | 5,641 | [
716436554
] | [
"genserver",
"typespec",
"test",
"documented"
] | defmodule BencheeAsync.Reporter do
@moduledoc """
The GenServer responsible for tracking units of work done.
To allow for more flexibility, this GenServer must be started manually before beginning the benchmarking as part of the benchmark suite setup.
```elixir
# in an .exs script
#{__MODULE__}.start_link... |
0150246847138f1764eb1fbbd4569d64b70be4a6 | 10,370 | [
192407200
] | [
"genserver",
"liveview"
] | defmodule AndiWeb.SubmitLiveView do
use AndiWeb, :live_view
use AndiWeb.HeaderLiveView
use AndiWeb.FooterLiveView
alias Andi.InputSchemas.Datasets
alias Andi.InputSchemas.InputConverter
require Logger
def render(assigns) do
~L"""
<%= header_render(@is_curator, AndiWeb.HeaderLiveView.header_data... |
01502787645d8d9ca66801528c5973eb1f3b2802 | 2,705 | [
584906499
] | [
"genserver"
] | defmodule Protohackers.PrimeTime.Session do
use GenServer, restart: :transient
require Logger
def start_link(opts) do
GenServer.start_link(__MODULE__, [], opts)
end
@impl true
def init([]) do
{:ok, :no_state}
end
@impl true
def handle_info({:tcp, client_socket, data}, state) do
peername... |
01503ce7d352be9103398503f9dddbcd8fba4a65 | 7,551 | [
504260575
] | [] | %{
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mi... |
01506b0561449989ec7cfdeb169b102aaca85fce | 1,863 | [
384725338
] | [] | File.rm_rf!("images/")
File.mkdir_p!("images/")
socket = Libvirt.Backends.Direct.connect!("colosseum.sudov.im")
Libvirt.Volume.download(socket, %{"key" => "/home/main/libvirt/test/user-data.yaml", "name" => "user-data.yaml", "pool" => "test"}, file: "images/user-data.yaml")
name = Libvirt.UUID.gen_string()
{:ok, sta... |
015178fa2c1e21f1522565affee47f2dc73fc226 | 6,615 | [
289522129
] | [
"test"
] | defmodule MazesWeb.MazeHelperTest do
use MazesWeb.ConnCase, async: true
alias MazesWeb.MazeHelper
alias Mazes.RectangularMaze
describe "vertex_color" do
test "white vertex by default" do
maze = RectangularMaze.new(height: 5, width: 5)
maze = Map.merge(maze, %{from: {1, 1}, to: {5, 5}})
... |
01519a9a8c0f2a182c2579f117b00ccbc70fcd58 | 1,697 | [
317616027
] | [
"test"
] | defmodule Advent2020.Days.Day8Test do
use ExUnit.Case, async: true
import Advent2020.Days.Day8
alias Advent2020.VM.ExecutionContext
@sample """
nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
jmp -4
acc +6
"""
describe "parse/1" do
test "can parse sample input" do
assert par... |
0151f8db7b9108a212f8060ce3bbf1988d4e3c49 | 3,738 | [
160602588
] | [
"test"
] | defmodule HypeWeb.UserControllerTest do
use HypeWeb.ConnCase
alias Hype.{Accounts, Auth.Guardian}
alias Hype.CommonTestData, as: TestData
@user_params %{
first_name: "test",
last_name: "user",
email: "<EMAIL>",
password: "test_password"
}
@camel_case_user_params %{
"firstName" => "tes... |
01522e9c66e0503c14cfd0dc7cca0fe4b0222512 | 1,979 | [
127679817
] | [
"documented",
"ecto"
] | defmodule SampleApp.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
import Bcrypt
alias SampleApp.Articles.Micropost
alias SampleApp.Accounts.User
@valid_email_regex ~r/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
schema "users" do
field :email, :string
field :name, :string
field :password_di... |
0152b926bede84f781e6130a01a2a7f3882b3834 | 2,151 | [
732125740
] | [
"typespec"
] | defmodule Equinox.Codec.StreamId do
defmodule Fragment do
defmodule Error do
defexception [:message]
@type t :: %__MODULE__{message: String.t()}
end
@separator "_"
def separator, do: @separator
def validate!(raw) when is_bitstring(raw) do
if String.trim(raw) == "" do
ra... |
0152ce557a4e3d80f2d9b5f07729d0ddf73b5165 | 1,894 | [
705946874
] | [
"documented",
"ecto"
] | defmodule Dadabase.Dada do
@moduledoc """
The Dada context.
"""
import Ecto.Query, warn: false
alias Dadabase.Repo
alias Dadabase.Dada.Joke
@doc """
Fetches the jokes for the main screen -- filtering out nsfk if needed.
"""
def fetch_jokes(show_nsfk) do
query = from j in Joke,
whe... |
0152f32b886e59505fc670db7f9f3418a5e1dc28 | 2,039 | [
94697426
] | [
"documented"
] | defmodule KrakenEx.OHLC do
@moduledoc """
This module gets OHLC data from Kraken's public API.
"""
@doc """
Gets OHLC data based on:
pair: asset pair
interval: Interval time frame interval in minutes (optional):
1 (default), 5, 15, 30, 60, 240, 1440, 10080, 21600
since: return commit... |
015363158eaa6f52ca584ed6eb3c93afcd4d7b81 | 1,911 | [
118918364
] | [
"test"
] | defmodule TriePopulatorFourTest do
use ExUnit.Case, async: true
@subject TriePopulatorFour
test "populate with nothing" do
assert @subject.populate() === %{}
end
test "populate with empty string" do
assert @subject.populate("") === %{}
end
# we are skipping this for now as this model is a proto... |
01537961927f40afbcb889b60ff8c54da2e8c3f6 | 1,693 | [
433605300
] | [
"typespec",
"documented"
] | defmodule Day06 do
# Directed Cyclic Graph
@fish_links %{
"8" => "7",
"7" => "6",
"6" => "5",
"5" => "4",
"4" => "3",
"3" => "2",
"2" => "1",
"1" => "0",
"0" => "-1" # holding state so 7 -> 6 can be merged with -1 -> 6
# "-1" => "6" # the cyclic edge, which is executed manual... |
01539771c2fe7ed03ecfd1b9897dbf448a5bbe89 | 1,811 | [
116519551
] | [
"macro",
"typespec",
"test"
] | defmodule Notation.TypespecTest do
use ExUnit.Case
defmodule ExposeTypeSpec do
defmacro __before_compile__(_) do
if Version.match?(System.version(), ">= 1.7.0") do
quote do
{_set, bag} = :elixir_module.data_tables(__MODULE__)
@typespecs :ets.lookup_element(bag, :type, 2)
... |
0153d3e423f607f9e9ef5cbeb19016ac07bf476d | 4,345 | [
778631757
] | [
"macro",
"ecto"
] | defmodule ProductAnalytics.Repo do
use Ecto.Repo,
otp_app: :product_analytics,
adapter: Ecto.Adapters.Postgres
import Ecto.Changeset
import Ecto.Query
alias ProductAnalytics.Event
def create_event(nil), do: {:error, "Body cannot be null"}
def create_event(events_body) do
events_body = set_eve... |
01540ee1aaf8ddb6f36b671ae00838eb0ca7d066 | 5,557 | [
307391082
] | [
"typespec",
"documented"
] | defmodule Catena.Core.Repeats.Yearly do
@moduledoc false
alias Catena.Core.{Event, Utils}
alias Catena.Core.Repeats.{Monthly, Validators}
alias Catena.Core.Repeats.Utils, as: RepeatUtils
# FREQ=YEARLY;INTERVAL=1;BYMONTH=1;BYDAY=1SU,1TU;COUNT=5 - year by day
# FREQ=YEARLY;INTERVAL=1;BYMONTH=1;BYMONTHDAY=1,... |
015415f257b821e60d3729ea3d12c9289c4edb34 | 9,000 | [
814281648
] | [
"typespec",
"test",
"ecto",
"macro",
"documented"
] | defmodule GameApp.ModelCase do
@moduledoc """
Provides shared functionality and setup for schema-related tests within the GameApp.
This module includes helper functions to facilitate the creation of valid and invalid parameters based on schema definitions, assertion of changeset properties, and more comprehensiv... |
0154366f3084bd7df10e304b7cefaae9e23ba13f | 7,577 | [
84788828
] | [
"test"
] | defmodule Legacy.Feature.Store.StoreTest do
use Legacy.RedisCase, async: true
import Legacy.ExtraAsserts
describe "Legacy.Feature.Store.update/2" do
test "sets the given values on a new feature", %{redis: redis} do
Legacy.Feature.Store.update "feat-store-1", description: "something-else", expire_period... |
0154496762b546bbb361e94444d826cb40b05631 | 1,531 | [
573252914
] | [] | defmodule AdventOfCode.Day02 do
@rules %{
"A" => %{"X" => :draw, "Y" => :win, "Z" => :lost},
"B" => %{"X" => :lost, "Y" => :draw, "Z" => :win},
"C" => %{"X" => :win, "Y" => :lost, "Z" => :draw}
}
@shapes_scores %{
"X" => 1,
"Y" => 2,
"Z" => 3,
"A" => 1,
"B" => 2,
"C" => 3
}
... |
015469e8c75f08b81f0312278deed8ca4308afeb | 1,506 | [
988634206
] | [
"test"
] | defmodule NBA.Stats.PlayerCareerByCollegeRollupTest do
use ExUnit.Case
alias NBA.Stats.PlayerCareerByCollegeRollup
@valid_params [
LeagueID: "00",
PerMode: "Totals",
SeasonType: "Regular Season",
Season: "2024-25"
]
@invalid_params [
# LeagueID should be string from valueset
LeagueID... |
0154a390fe0de81861883158194f0839a44fddee | 2,649 | [
118933166
] | [] | defmodule Plug.Mixfile do
use Mix.Project
@version "1.5.0-rc.0"
def project do
[app: :plug,
version: @version,
elixir: "~> 1.3",
deps: deps(),
package: package(),
lockfile: lockfile(),
description: "A specification and conveniences for composable " <>
"modules... |
0154db4e5c7901a9cc04549a077f27b23e544513 | 1,565 | [
205137761
] | [
"macro",
"documented",
"phoenix"
] | defmodule RetryApiWeb 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 RetryApiWeb, :controller
use RetryApiWeb, :view
The definitions below will be executed for every view,
controlle... |
01555555846e506b0d87cfcc3a7570394034cf8b | 2,413 | [
125706113
] | [] | %{
"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062... |
0155905f11db5b9c36bad2fb8b819f7624589fc6 | 2,214 | [
88574371
] | [
"test",
"ecto"
] | defmodule Api.EmailsTest do
use Api.DataCase
alias Api.Emails
describe "emails" do
alias Api.Emails.Email
@valid_attrs %{content: "some content", name: "some name", slug: "some slug"}
@update_attrs %{content: "some updated content", name: "some updated name", slug: "some updated slug"}
@invalid... |
01561fab2da01ae68888dc8b2b33a52e856836c7 | 3,801 | [
99049723
] | [] | defmodule PhotoManagementApi.Web.Schema.Types do
require Logger
use Absinthe.Schema.Notation
alias PhotoManagementApi.Web.Resolver
alias ImagesResource.Storage.{File, Directory}
alias PhotoManagementApi.Image, as: DBImage
alias PhotoManagementApi.User
union :descendants do
description("A child of ... |
01564c05f82adf16694cc8f7d08769f230f981ac | 2,527 | [
127330179
] | [
"phoenix",
"ecto"
] | defmodule EverlearnWeb.LanguageController do
use EverlearnWeb, :controller
alias Everlearn.Members
alias Everlearn.Members.Language
plug Everlearn.Plug.DisplayFlashes
plug :fetch_navtitle_index when action in [:index]
plug :fetch_navtitle_other when action in [:new, :show, :edit, :create, :update]
plug :... |
0156731e5ff989ce31415f4d0b944ce24584fd19 | 3,723 | [
857210129
] | [
"typespec",
"documented"
] | defmodule ExPass.Structs.NFC do
@moduledoc """
Represents the near-field communication (NFC) payload the device passes to an Apple Pay terminal.
## Fields
* `:encryption_public_key` - (Required) The public encryption key the Value Added Services protocol uses.
Use a Base64-encoded X.509 SubjectPublicKeyIn... |
015691bb3b67315f7fdada263dab58c95b9c970f | 2,199 | [
680294344
] | [
"liveview"
] | defmodule FlashtonesWeb.LokalityUKurtuLive do
use FlashtonesWeb, :live_view
def mount(_params, _session, socket) do
socket =
assign(socket,
favicon: "https://zsprodeti.cz/images/favicon/deti/icon.png",
canonical: "https://zsprodeti.cz/lokality/u-kurtu",
page_title: "ZŠ PRO DĚTI",
... |
0156e5f2fa097d105e49642c2090d2d73b405c4d | 23,919 | [
501193718
] | [] | %{
"arke": {:hex, :arke, "0.3.17", "ad672df673546853cfd47be132e8c9aafdc867466cdac58a2e9b37e4099956c4", [:mix], [{:calendar, "~> 1.0.0", [hex: :calendar, repo: "hexpm", optional: false]}, {:google_api_storage, "~> 0.34.0", [hex: :google_api_storage, repo: "hexpm", optional: false]}, {:goth, "~> 1.3.0", [hex: :goth, re... |
015719b47904e0dd049c83639c24e75f223ea557 | 3,736 | [
190238917
] | [
"test"
] | defmodule OPQTest do
use OPQ.TestCase, async: true
doctest OPQ
test "enqueue items" do
{:ok, opq} = OPQ.init
OPQ.enqueue(opq, :a)
OPQ.enqueue(opq, :b)
wait fn ->
{_status, queue, _demand} = OPQ.info(opq)
assert :queue.len(queue) == 0
end
end
test "enqueue functions" do
... |
0157eb30aaca3cf662e0accea89908c26ac0516c | 3,768 | [
838960203
] | [
"typespec",
"documented"
] | defmodule AbsintheErrorMessage.TopLevelMessage do
@moduledoc """
GraphQL Top-Level Message
"""
alias AbsintheErrorMessage.Serializer
@type t :: %__MODULE__{
message: binary() | nil,
extensions: map() | nil
}
@type t_map :: %{
message: binary() | nil,
extensions: map() | nil
}
@type ... |
01580bf00ecc574d66d9d128f97f0cb4f6b99663 | 4,942 | [
111608919,
152971678,
144133827,
160035005,
160895185,
155782883,
144511632
] | [
"genserver",
"test"
] | defmodule GenServers do
use Koans
@intro "GenServers"
defmodule Laptop do
use GenServer
#####
# External API
def start_link(init_password) do
# The __MODULE__ macro returns the current module name as an atom
GenServer.start_link(__MODULE__, init_password, name: __MODULE__)
end
... |
015917b7d2a9908980efcdd90636312e8600d022 | 4,737 | [
346114697
] | [
"documented",
"ecto"
] | defmodule Ozfarium.Gallery do
@moduledoc """
The Gallery context.
"""
import Ecto.Query, warn: false
alias Ozfarium.Repo
alias Ozfarium.Gallery.Queries
alias Ozfarium.Gallery.Ozfa
alias Ozfarium.Users.UserOzfa
alias Ozfarium.Users.User
@doc """
Returns the list of ozfa ids.
## Examples
... |
015b1035ec57e33037ffd16f2ed6aeb51b763cbb | 2,746 | [
56356676
] | [
"documented"
] | defmodule AirApi.ReleaseTasks do
@moduledoc ~S"""
Mix is not available in a built release. Instead we define the tasks here,
and invoke it using the application script generated in the release:
bin/wolf command Elixir.AirApi.ReleaseTasks create
bin/wolf command Elixir.AirApi.ReleaseTasks migrate
... |
015bbd1f947858ef29469510c5ac38f8493b345a | 3,427 | [
128714359
] | [] | use Mix.Config
# For production, we often load configuration from external
# sources, such as your system environment. For this reason,
# you won't find the :http configuration below, but set inside
# RapcorWeb.Endpoint.init/2 when load_from_system_env is
# true. Any dynamic configuration should be done there.
#
# Don... |
015c9b4293c0c57629aaed535ea076cdb075835b | 1,545 | [
822255248
] | [
"documented"
] | defmodule MusicListings.Parsing.VenueParsers.BaseParsers.MhRthTdmhParser do
@moduledoc """
Base parser for Massey Hall, Roy Thomson Hall and
TD Music Hall, as they are on a single site
"""
alias MusicListings.HttpClient
alias MusicListings.Parsing.ParseHelpers
alias MusicListings.Parsing.Performers
alia... |
015cbb4c1eda1204f47c984ab02877ef36906083 | 1,520 | [
52686006
] | [
"test"
] | defmodule Bingo.GameTest do
use ExUnit.Case
test "a new game has no numbers" do
game = Bingo.Game.new("The name", "the-id")
assert game.played_numbers == []
end
test "a new game has no numbers" do
game = Bingo.Game.new("The name", "the-id")
assert game.played_numbers == []
end
test "a g... |
015d069eda774fe4ab5d2c475e6e496b55d9017d | 3,628 | [
329790458
] | [
"liveview",
"test"
] | defmodule WaldonWeb.LeaseLiveTest do
use WaldonWeb.ConnCase
import Phoenix.LiveViewTest
alias Waldon.Leases
@create_attrs %{balance: "120.5", deposit: "120.5", end_time: "2010-04-17T14:00:00Z", rent: "120.5", start_time: "2010-04-17T14:00:00Z"}
@update_attrs %{balance: "456.7", deposit: "456.7", end_time: ... |
015d0e741d104fc5b561628c9e959951ab7e050b | 1,647 | [
141769220
] | [] | # 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 :excourtbot,
ecto_repos: [ExCourtbot.Rep... |
015d86e3919e62db7bb50a65d48acb1fe2242777 | 2,332 | [
948973699,
520217048
] | [] | defmodule Ockam.CloudNode.MixProject do
use Mix.Project
@version "0.10.1"
@elixir_requirement "~> 1.10"
@ockam_github_repo "https://github.com/build-trust/ockam"
@ockam_github_repo_path "implementations/elixir/ockam/ockam_cloud_node"
def project do
[
app: :ockam_cloud_node,
version: @ver... |
015df6b5b9a792a148e45a0e00638006893672ca | 2,539 | [
492431252
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule BulmaAuthWeb 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 BulmaAuthWeb, :controller
use BulmaAuthWeb, :view
The definitions below will be executed for every view,
contro... |
015df83b2a36149bf305de6783bf1cb75a2e5c01 | 13,122 | [
125843928
] | [
"macro",
"test"
] | Code.require_file("test_helper.exs", __DIR__)
require EEx
defmodule EExTest.Compiled do
def before_compile do
{__ENV__.line, hd(tl(get_stacktrace()))}
end
EEx.function_from_string(:def, :string_sample, "<%= a + b %>", [:a, :b])
filename = Path.join(__DIR__, "fixtures/eex_template_with_bindings.eex")
E... |
015e5937b82c4b5e77d01cb19d1528d3beea3d3a | 2,193 | [
482555587
] | [
"typespec",
"documented",
"ecto"
] | defmodule ExOAPI.Stripe.Schemas.Item do
use TypedEctoSchema
import Ecto.Changeset
@type params :: map()
@moduledoc """
**description**: A line item.
**:amount_subtotal** :: *:integer*
Total before any discounts or taxes are applied.
**:amount_total** :: *:integer*
Total after discounts and taxe... |
015eca45a35923ecae822b7391febba8a9ee876f | 9,880 | [
610034669,
599689212,
651155880,
701803795,
631076437,
657606827,
801567260,
635280241,
647000319,
657598765
] | [
"typespec",
"liveview",
"documented",
"phoenix"
] | defmodule Phoenix.Token do
@moduledoc """
Tokens provide a way to generate and verify bearer
tokens for use in Channels or API authentication.
The data stored in the token is signed to prevent tampering
but not encrypted. This means it is safe to store identification
information (such as user IDs) but shou... |
015edf5fefb1585d5fd2343635c85ea66cbe4779 | 2,400 | [
558575089
] | [
"typespec",
"test",
"documented"
] | defmodule Bouncer.Client.WoodyTest do
@moduledoc """
Tests for Woody implementation of Bouncer.Client behaviour.
"""
# Can't run async mode when relying on app env
use ExUnit.Case, async: false
alias Bouncer.Client.Woody, as: Client
alias Woody.Generated.Bouncer.Decisions.Arbiter, as: Service
alias Woo... |
015f08f321487547c3fe13d427806f33c9b459d4 | 5,079 | [
1010011901
] | [
"documented"
] | defmodule Sui.Rpc.V2alpha.FunctionDescriptor do
@moduledoc """
Descriptor of a Move function
"""
use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
def descriptor do
# credo:disable-for-next-line
%Google.Protobuf.DescriptorProto{
name: "FunctionDescriptor",
field: [
... |
015f2e63991f3324838cce75ec81011dd2d596da | 2,268 | [
776960390
] | [
"test",
"ecto"
] | defmodule SmtpAnn.DnsblServersTest do
use SmtpAnn.DataCase
alias SmtpAnn.DnsblServers
describe "dnsblserver" do
alias SmtpAnn.DnsblServers.DnsblServer
import SmtpAnn.DnsblServersFixtures
@invalid_attrs %{dns_name: nil}
test "list_dnsblserver/0 returns all dnsblserver" do
dnsbl_server = ... |
015fccd2ce34c3760df8f3038445c7bdb3cc5b62 | 2,593 | [
138639074
] | [
"documented",
"ecto"
] | defmodule Retrospectivex.Accounts.Managers.User do
import Ecto.Query, warn: false
alias Retrospectivex.Accounts.Schemas.User
alias Retrospectivex.Repo
@doc """
Returns the list of users.
## Examples
iex> list_users()
[%User{}, ...]
"""
def list_users do
Repo.all(User)
end
@doc ... |
01600bd8045ebc10961370d2b0d76f98e40a9d5c | 8,311 | [
871608373
] | [
"phoenix",
"ecto"
] | defmodule TimeManagerWeb.WorkingTimeController do
use TimeManagerWeb, :controller
use PhoenixSwagger
import Ecto.Query
alias TimeManager.WorkingTimes
alias TimeManager.WorkingTimes.WorkingTime
alias TimeManager.Repo
alias TimeManagerWeb.WorkingTimeJSON
action_fallback TimeManagerWeb.FallbackController... |
0160834fdbe62ff238ea7288f6c9520d8e1c0fc5 | 7,899 | [
47582444
] | [
"documented"
] | defmodule Santa.Day24.Input do
@doc false
def input() do
"#####################################################################################################################################################################################
#...........#...#.....#.....#.....#....7#.................#.............#...... |
0160c22dfd005bf691f3ec974dd360a8809ff669 | 3,562 | [
508333850
] | [] | defmodule Servy.Config.Routes do
alias Servy.Conv
alias Servy.Services.VideoCam
alias Servy.Services.GenServers.FourOhFourCounterServer
alias Servy.Controllers.Html.BearsController, as: HtmlBearsController
alias Servy.Controllers.Html.PledgesController, as: HtmlPledgesController
alias Servy.Controllers.Api... |
0160cef5564509e3a0cfafec0e09ec3aa80c4369 | 2,097 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.VMMigration.V1.Model.OperationMetadata do
@moduledoc """
Represents the metadata of the long-running operation.
## Attributes
* `apiVersion` (*type:* `String.t`, *default:* `nil`) - Output only. API version used to start the operation.
* `createTime` (*type:* `DateTime.t`, *default:*... |
0161068259c06b3b1db5af35d2ccd61a1a0b819d | 1,787 | [
109419208
] | [
"test"
] | defmodule MessageCodecTest do
use ExUnit.Case
doctest Utils.Message.MessageCodec
alias Utils.Message, as: Message
alias Utils.Message.MessageCodec, as: MessageCodec
test "decode(encode(msg)) for mw keeps payload" do
payload = "Functional programming is fun"
recipient = "Anakin"
topic = "... |
016184c59a2153a2d334ee6e63afd98c3bdb252e | 2,526 | [
258013430
] | [
"genserver"
] | defimpl FarmbotCore.AssetWorker, for: FarmbotCore.Asset.Device do
alias FarmbotCore.{Asset, Asset.Device}
alias FarmbotCeleryScript.AST
use GenServer
require FarmbotCore.Logger
def tracks_changes?(%Device{}), do: true
def preload(%Device{}), do: []
def start_link(%Device{} = device, _args) do
GenSe... |
0161c214273203f3c274dfd334f0e4eb77257b78 | 2,406 | [
97245035,
11283069,
96117673,
96421836,
95967693,
95074642,
97330784,
45867028
] | [] | %{"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c... |
0161c9b5d32f97cfe2f433dba8dd1b612b061ff7 | 1,604 | [
53538839
] | [
"test"
] | defmodule PauperedisTest.MessageTest do
use ExUnit.Case
doctest Pauperedis
alias Pauperedis.Message
setup do
# Set key "foo" to "barr"
raw_bytes = <<0x00, 0x00, 0x00, 0x0C, 0x01, 0x00, 0x03, 0x66, 0x6F, 0x6F, 0x00, 0x04, 0x62, 0x61, 0x72, 0x72>>
{:ok, raw: raw_bytes, message: %Message{raw: raw_byt... |
0161de7ff30ef11cd97493fd029538bec2631e0a | 9,371 | [
997214727
] | [
"genserver",
"documented"
] | defmodule Aiex.NATS.ServerManager do
@moduledoc """
Manages an embedded NATS server process lifecycle.
This GenServer downloads (if needed) and manages a NATS server binary,
allowing the OTP application to run with an embedded NATS instance
instead of requiring an external server.
"""
use GenServer
re... |
0163392acb45095183cd062bd6361a56393ba98b | 2,584 | [
274201957
] | [
"typespec",
"documented"
] | defmodule Goth.Token do
defstruct [:expires_at, :token, :type, :scope]
@type t() :: %__MODULE__{
expires_at: non_neg_integer(),
scope: String.t(),
token: String.t(),
type: String.t()
}
@doc """
Fetches the token.
WARNING: This function serves as compatibility... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.