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 |
|---|---|---|---|---|
092a29313b74186cb614335a16817ee29f866626 | 2,500 | [
193244709,
101434552,
198908023,
383340007
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Compute.V1.Model.InstanceAggregatedList do
@moduledoc """
## Attributes
* `id` (*type:* `String.t`, *default:* `nil`) - [Output Only] Unique identifier for the resource; defined by the server.
* `items` (*type:* `%{optional(String.t) => GoogleApi.Compute.V1.Model.InstancesScopedList.t... |
092a4d5f63a2891a092fd4921ab1af084b68c1db | 1,765 | [
200198590,
51651927
] | [
"genserver"
] | defmodule Proxy.Cache do
use GenServer
require Logger
# Public API
def lookup(url) when is_binary(url) do
case :ets.lookup(:http_cache, url) do
[{^url, data}] -> {:ok, data}
[] -> :cache_miss
end
end
def save(url, data) when is_binary(url) do
GenServer.cast(__MODULE__, {:save, url... |
092ac20b9ea17ff451a064369c0624fd992017d5 | 1,954 | [
259097080
] | [
"test"
] | defmodule UltimateTttTest.Game.InnerBoard do
use ExUnit.Case
doctest UltimateTtt.Game.InnerBoard, except: [{:place_tile, 3}]
alias UltimateTtt.Game.InnerBoard
def mid_game_board do
InnerBoard.with_tiles({:empty, :x, :o, :empty, :o, :x, :x, :o, :empty})
end
def tie_board do
InnerBoard.with_tiles({... |
092b0703fc1c7522a48ae0a43f248ddd7b65685f | 3,075 | [
311031929
] | [
"test"
] | defmodule LgtvSaver.SaverTest do
use ExUnit.Case, async: true
alias LSTest.{MockGenServer, WakeServer}
alias LgtvSaver.Saver
describe "without waker" do
setup :start_saver
test "switches to saver input when current input becomes inactive", %{saver: saver, tv: tv} do
Saver.input_changed(saver, n... |
092b2ca5456544eb63732ab481636e3f9afb7108 | 2,070 | [
743486347
] | [] | defmodule MorseCode do
# The codes that you should decode:
def name, do: '-. . --- ..-- -. --. ..- -.-- . -.'
def base, do: '.- .-.. .-.. ..-- -.-- --- ..- .-. ..-- -... .- ... . ..-- .- .-. . ..-- -... . .-.. --- -. --. ..-- - --- ..-- ..- ...'
def rolled, do: '.... - - .--. ... ---... .----- .----- .-- .--... |
092b37d9ec117957393c8699af74216a4ad56430 | 2,160 | [
164084093
] | [
"documented",
"ecto"
] | defmodule Eds.Core.Course do
use Ecto.Schema
import Ecto.Changeset
alias Eds.Core.{Course, Chapter, CourseCategory, Section}
alias Eds.Content.{Node, Text, Image, QuizQuestion}
alias Eds.Accounts.{UserCourse}
alias Eds.{Repo}
schema "courses" do
field(:description, :string)
field(:subtitle, :stri... |
092b76c9ab43b4d41835cbe621eddb5123ad351a | 2,484 | [
748354157
] | [
"test",
"ecto"
] | defmodule FoodTruckTracker.FoodTrucksTest do
use FoodTruckTracker.DataCase
alias FoodTruckTracker.FoodTrucks
describe "food_trucks" do
alias FoodTruckTracker.FoodTrucks.FoodTruck
import FoodTruckTracker.FoodTrucksFixtures
@invalid_attrs %{"longitude" => 1111}
test "list_food_trucks/0 returns ... |
092bf2bb69d95aa078a6fb677dbf2366ed4a3cb6 | 4,028 | [
276901189
] | [
"test"
] | defmodule Battleship.Core.ConsoleRendererTest do
use ExUnit.Case
import ExUnit.CaptureIO
alias Battleship.Core.{Board, ConsoleRenderer, GuessBoard, Notation, Ship}
describe "render/1" do
setup do
%{board: Board.new()}
end
test "renders an empty board", %{board: board} do
board_io =
... |
092c0a36c53fb0ef32cb3eb2f034a7daf676d884 | 3,951 | [
992629081
] | [
"genserver",
"typespec",
"documented"
] | defmodule MCPAgent.AgentServer do
@moduledoc """
Clean API for agent server functionality.
This module provides the public interface for creating and interacting with agent servers.
It delegates all implementation to MCPAgent.AgentServer.Server (GenServer layer) and
MCPAgent.AgentServer.Impl (business logi... |
092c14c55dca7691bc6dff70ea446bf8068dae5c | 3,121 | [
470453569
] | [
"typespec",
"documented"
] | defmodule MindfulWeb.Helpers.Utils do
@moduledoc """
This module contain helper functions.
"""
@type states_list() :: [tuple()]
@states %{
"AL" => "Alabama",
"AK" => "Alaska",
"AS" => "American Samoa",
"AZ" => "Arizona",
"AR" => "Arkansas",
"CA" => "California",
"CO" => "Colorado... |
092d3951416e393d90a6d4e007246e39c8235f55 | 6,440 | [
131453463
] | [
"documented",
"ecto"
] | defmodule Rpgr.CampaignContext do
@moduledoc """
The CampaignContext context.
"""
import Ecto.Query, warn: false
alias Rpgr.Repo
alias Rpgr.CampaignContext.Campaign
alias Rpgr.CampaignContext.Member
# AUTHORIZATION
def can_user_edit_campaign(user_id, campaign_id) do
with %Campaign{} = campaign <... |
092d625bc83d24ac9cf9926944dbbc202860afeb | 2,617 | [
176796565
] | [
"test",
"phoenix"
] | defmodule ShopWeb.OrderControllerTest do
use ShopWeb.ConnCase
alias Shop.Store.Order
alias Shop.Repo
alias Shop.Store.Product
describe "show/2" do
setup [:create_order]
test "show/2 renders show view when order is found", %{conn: conn, order: order} do
conn = get(conn, Routes.order_path(conn,... |
092d6bf6ceeb99c8ba2bd538fdd1ff34fe25788e | 5,972 | [
409417669
] | [] | defmodule Mrgr.Factory do
alias Mrgr.Repo
# Factories
def build(:desmond) do
%Mrgr.Schema.User{
first_name: "Desmond",
last_name: "Bowe",
name: "Desmond Bowe",
email: "<EMAIL>",
nickname: "desmondmonster",
refresh_token: Ecto.UUID.generate(),
token: Ecto.UUID.genera... |
092dd4440467c226084dd97d12b8f3198dc92bf0 | 2,987 | [
424169751
] | [
"test"
] | defmodule Astarte.Client.RealmManagement.RealmConfigTest do
use ExUnit.Case
doctest Astarte.Client.RealmManagement.RealmConfig
alias Astarte.Client.{APIError, RealmManagement}
alias Astarte.Client.RealmManagement.RealmConfig
@base_url "https://base-url.com"
@realm_name "realm_name"
@jwt "notarealjwt"
... |
092e02b9026dfc7e266c9381fc7116c96b76cd5a | 2,271 | [
63497734
] | [] | defmodule CodeCorps.StripeTesting.Card do
def create(%{customer: stripe_id, source: _stripe_token}, _opts \\ []) do
{:ok, do_create(stripe_id)}
end
defp do_create(stripe_id) do
%Stripe.Card{
id: stripe_id,
address_city: nil,
address_country: nil,
address_line1: nil,
address_... |
092e3108ec49551cfaa4c543573f0fd73e3602fa | 1,605 | [
448478956
] | [
"liveview"
] | defmodule QuillEx.Metrics.Instrumenter do
require Logger
# alias QuillEx.Metrics.Stash
@stash :stash
@render_start [:render, :start]
@render_finish [:render, :finish]
def setup do
# {:ok, _pid} = Agent.start_link(fn -> %{start: nil} end, name: @datastore)
{:ok, _pid} = Agent.... |
092ed39b52aca6418f0f63b795ba4ea1ea4761f8 | 1,910 | [
611470369
] | [
"macro",
"documented",
"phoenix"
] | defmodule RegistrocolegioWeb 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 RegistrocolegioWeb, :controller
use RegistrocolegioWeb, :view
The definitions below will be executed for ev... |
092ef43cfdcf3058097697ad5ead66ab45f03ccf | 2,612 | [
611192458
] | [
"typespec",
"documented"
] | defmodule SmeeView.Utils do
@moduledoc false
@spec normalize(value :: any()) :: binary()
def normalize(value) when is_nil(value) or value == "" do
nil
end
def normalize(value) when is_atom(value) or is_binary(value) or is_integer(value) do
"#{value}"
end
@spec normalize_email(email :: binary()... |
092fbf02ad546d837d32e52a0141414b3bd86859 | 6,137 | [
70062327
] | [] | %{
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "he... |
092fc8cfb7fc559cbd965dad3fdc9a2f3befe0a7 | 2,053 | [
192407200
] | [
"test"
] | defmodule Reaper.DecoderTest do
use ExUnit.Case
use Placebo
alias Reaper.Decoder
import SmartCity.TestHelper, only: [eventually: 1]
alias SmartCity.TestDataGenerator, as: TDG
@filename "#{__MODULE__}_temp_file"
setup do
on_exit(fn ->
File.rm(@filename)
end)
:ok
end
describe "fai... |
0930495b0190f58a1334708f69f3a838a75d46ef | 1,549 | [
896259126
] | [] | defmodule AdventOfCode.Solution.Year2024.Day23 do
use AdventOfCode.Solution.SharedParse
def build_groups(set, connections, map) do
connections
|> Enum.reduce(set, fn n, acc ->
new_connections = Map.fetch!(map, n)
if Enum.all?(acc, fn x -> Enum.member?(new_connections, x) end) do
build_... |
0930a0ad9292edd4e6a85b9585b89c4705986901 | 2,623 | [
665039743
] | [
"test"
] | defmodule Mlc90640.Frame.ReadTest do
use I2cCase
alias Mlc90640.Frame.Read
import Mox
describe "data_ready?" do
test "returns false if the data is not ready", %{ref: ref} do
expect(MockI2c, :write_read, fn ^ref, 0x33, <<128, 0>>, 2 ->
{:ok, <<0::16>>}
end)
assert {:ok, false} = R... |
0930beea66e158b2a04945409e80d252fee6533e | 1,581 | [
340726076
] | [
"test"
] | defmodule CaminoChallenge.ContratosTest do
use CaminoChallenge.DataCase
alias CaminoChallenge.Contratos.Repositories.ContratoRepository
alias CaminoChallenge.Pessoas.Entities.Pessoa
require Logger
@pessoa_valid %{
nome: "some nome",
type: "fisica"
}
describe "contratos" do
@valid_attrs %{... |
0930c1f7e6d050d76c94250b86a3060e4afe6621 | 4,483 | [
937730255
] | [] | %{
"decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"},
"ecto": {:hex, :ecto, "3.12.5", "4a312960ce612e17337e7cefcf9be45b95a3be6b36b6f94dfb3d8c361d631866", [:mix], [{:decimal... |
093141371f1fedd8c87598c3a93a8c4492625ba1 | 2,158 | [
116114515
] | [
"phoenix"
] | defmodule SearchServer.PageController do
use SearchServer.Web, :controller
def index(conn, _params) do
render conn, "index.html"
end
def search(conn, _params) do
phrase = conn.params["phrase"]
resc = conn.params["resc"]
use_noise_reduction? = conn.params["noise_reduction"] |> String.to_existin... |
093170376fb19943470f79dfe574c171922f31d7 | 5,327 | [
239822890,
459291087
] | [
"liveview"
] | defmodule OliWeb.Components.Header do
use OliWeb, :html
import Phoenix.HTML.Link
import OliWeb.ViewHelpers, only: [brand_logo: 1]
import OliWeb.Components.Delivery.Utils
alias OliWeb.Components.Delivery.UserAccount
alias OliWeb.Breadcrumb.BreadcrumbTrailLive
alias OliWeb.Common.SessionContext
attr(:... |
0932238c375017e423de5d921d65aa804a892b6d | 2,229 | [
31036415
] | [
"test"
] | defmodule CanvasTest do
use ExUnit.Case
# test ".size when passed an empty canvas returns a canvas of that size" do
# expected = [[%Color{ }, %Color{ }, %Color{ }, %Color{ }],
# [%Color{ }, %Color{ }, %Color{ }, %Color{ }],
# [%Color{ }, %Color{ }, %Color{ }, %Color{ }],
# ... |
09323471289734e926afc405b674f854fcb0b815 | 2,080 | [
193865093
] | [
"supervisor",
"documented"
] | defmodule KV.Bucket do
@moduledoc """
This option tells the DynamicSupervisor watching these buckets that these
Agent processes are intended to be temporary, so when one crashes it won't
be restarted. If they were, we'd end up with buckets that are not included
in the registry (so useless).
"""
use Agent,... |
0932616c6877625b6af5c6d65d5f5ae04ab9812a | 1,830 | [
396147041
] | [
"documented",
"ecto"
] | defmodule Tailwindgen.Test5 do
@moduledoc """
The Test5 context.
"""
import Ecto.Query, warn: false
alias Tailwindgen.Repo
alias Tailwindgen.Test5.Postfem
@doc """
Returns the list of postfems.
## Examples
iex> list_postfems()
[%Postfem{}, ...]
"""
def list_postfems do
Repo.a... |
0932a82edba4d35335ed701ce52cbfadf0f5443c | 3,108 | [
958366002
] | [] | # 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 :ash,
allow_forbidden_field_for_relationship... |
0932e3598f9c2a4f96ebf71ee787819d1b723701 | 1,606 | [
220700734
] | [
"macro",
"documented",
"phoenix"
] | defmodule IndexWeb 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 IndexWeb, :controller
use IndexWeb, :view
The definitions below will be executed for every view,
controller, etc, s... |
09330a8ce73c09cb43589bcd5b4456e478d4174b | 1,757 | [
537401866
] | [
"documented",
"ecto"
] | defmodule GuildHall.Users.User do
use GuildHall.Schema
import Ecto.Changeset
alias GuildHall.Projects.Project
alias GuildHall.Attributes.Attribute
alias GuildHall.PTODays.PTO
alias GuildHall.BestOfQuotes.Quote
alias GuildHall.Articles.Article
schema "users" do
field :avatar, :string
field :bio,... |
093331794fb428399be311a9871ca56c43cef17d | 1,541 | [
478698200
] | [
"genserver"
] | defmodule Chat.AMQP.Connection do
use GenServer
use AMQP
require Logger
def start_link(_args) do
GenServer.start_link(__MODULE__, :ok, name: __MODULE__)
end
@impl true
def init(:ok) do
establish_new_connection()
end
def request_channel(consumer) do
GenServer.cast(__MODULE__, {:chan_requ... |
09337848431a19f5054be4361c08a92ef3fc69ee | 2,493 | [
104914512
] | [
"typespec",
"documented"
] | defmodule RobotSimulator do
defstruct direction: :north, position: {0, 0}
@compass [:north, :east, :south, :west]
@doc """
Create a Robot Simulator given an initial direction and position.
Valid directions are: `:north`, `:east`, `:south`, `:west`
"""
@spec create(direction :: atom, position :: { intege... |
0933ac5ce733027e4bf751a12a682616411d964c | 3,007 | [
184930913
] | [
"phoenix",
"ecto"
] | defmodule ShopixWeb.Front.CheckoutController do
use ShopixWeb, :controller
alias Shopix.Schema.Order
alias Ecto.Changeset
alias Shopix.{Front, Mailer}
alias ShopixWeb.Email
plug ShopixWeb.Plug.Translations
def address(conn, _params) do
render(conn, "address.html",
changeset: Front.change_order... |
0933c89e7b131f98ff55830bd1b5a847576e4bc5 | 3,638 | [
983773546
] | [
"liveview",
"ecto"
] | defmodule MainAppWeb.ApplicationLive.Form do
use MainAppWeb, :live_view
alias MainApp.Accounts
alias MainApp.Accounts.Application
@impl true
def render(assigns) do
~H"""
<Layouts.app flash={@flash} current_scope={@current_scope}>
<.header>
{@page_title}
<:subtitle>Use this form... |
093430682a15163a256c3873ffcad03101544c15 | 22,936 | [
1014306393
] | [
"documented"
] | defmodule AdvisorAi.Integrations.HubSpot do
@moduledoc """
HubSpot integration for managing contacts and notes
"""
alias AdvisorAi.AI.{VectorEmbedding, GroqClient}
alias AdvisorAi.Repo
@hubspot_api_url "https://api.hubapi.com"
# OpenAI client will be configured at runtime
def search_contacts(user, qu... |
0934601faae920447ad417b6389167b4ba449709 | 6,689 | [
504597551,
514687923
] | [
"typespec",
"documented"
] | defmodule Oban.Notifier do
@moduledoc """
The `Notifier` coordinates listening for and publishing notifications for events in predefined
channels.
Every Oban supervision tree contains a notifier process, registered as `Oban.Notifier`, which
can be any implementation of the `Oban.Notifier` behaviour. The defa... |
0934e9f3a8d5e809601bc221200a44f2efcdce9b | 1,961 | [
807546695
] | [
"test"
] | defmodule GeoLocService.ErrorHelpersTest do
use ExUnit.Case, async: true
alias GeoLocService.GeoLocation
alias GeoLocService.ErrorHelpers
describe "translate_errors/1" do
test "translates changeset errors for missing fields" do
changeset = GeoLocation.changeset(%GeoLocation{}, %{})
assert %{
... |
09352b03b137c239d73aca7803eabe484ec36ada | 4,562 | [
758594410
] | [
"liveview"
] | defmodule LiveViewJsDemoWeb.OnBeforeElUpdatedLive do
use LiveViewJsDemoWeb, :live_view
@users [
"johndoe",
"janedoe"
]
def mount(_params, _session, socket) do
{:ok,
assign(
socket,
page_title: "onBeforeElUpdated Callback",
users: @users,
user_form: to_form(%{"name"... |
09356ac8bbf1d19528f604f236cc3e5530d32d79 | 2,012 | [
372499099
] | [] | defmodule Kino.MixProject do
use Mix.Project
@version "0.16.0"
@description "Interactive widgets for Livebook"
def project do
[
app: :kino,
version: @version,
description: @description,
name: "Kino",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
star... |
0935996549cf062dcdb32ba20c8d4046ccb38866 | 4,032 | [
110266079
] | [
"documented"
] | defmodule Protect do
@moduledoc """
Functions that turn into a command line script that takes an owner,
and a json file of protection rules, and applies those rules to the
main branch of all the organization's repos
"""
require Logger
require Poison
alias Protect.Github
@doc """
The functio... |
0936ef6bb7c22ed0e7a51b930b2883bb5b7519cf | 2,939 | [
211946408
] | [
"documented"
] | defmodule HttpApi.Resources.Matches do
@moduledoc """
Plug that defines a unique plug pipeline for /matches requests.
Supports encoding responses as Protocol Buffers when it is speficied
in the request Accept header; otherwise it falls back to JSON.
Since the data is static, succesfull responses are cached so... |
09383e08a0ce9cf66b463d11d6ab61c225403698 | 2,190 | [
34621443
] | [
"typespec",
"macro",
"documented"
] | defmodule Mix.Tasks.EspecPhoenix.Init do
use Mix.Task
import Mix.Generator
@shortdoc "Create espec_phoenix folders and files"
@moduledoc """
Creates `spec/phoenix_helper.exs` and `spec/espec_phoenix_extend.ex`.
This task creates the following files:
* `spec/phoenix_helper.exs`
* `spec/espec_phoe... |
09383e7542a1dbf36ab393e4942815645ba6e8aa | 3,137 | [
86900715
] | [
"test"
] | defmodule Test.Eidetic.Model do
use ExUnit.Case
@user_events %{
registered: %Eidetic.Event{
type: "UserRegistered",
version: 1,
serial_number: 1,
payload: %{
forename: "Darrell",
surname: "Abbott"
}
},
renamed: %Eidetic.Event{
type: "UserRenamed",
... |
093862b7e7ff5f712b7463ff033cf0bc2c4f1853 | 3,940 | [
619280940
] | [
"liveview",
"phoenix",
"ecto",
"supervisor",
"documented"
] | Application.put_env(:sample, Example.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 5001],
server: true,
live_view: [signing_salt: "aaaaaaaa"],
secret_key_base: String.duplicate("a", 64)
)
Mix.install([
{:plug_cowboy, "~> 2.5"},
{:jason, "~> 1.0"},
{:phoenix, "~> 1.7.2", override: true},
{:phoenix_ecto, "~... |
0938c76b2e84f13c85e9a07798fd0716d32507d8 | 1,608 | [
105815635
] | [
"macro",
"supervisor",
"documented",
"phoenix"
] | defmodule SupervisorEctoWeb 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 SupervisorEctoWeb, :controller
use SupervisorEctoWeb, :view
The definitions below will be executed for every... |
0938df833c63ae65df9c5008a5150bcb5578b921 | 12,303 | [
324642972
] | [
"test"
] | # credo:disable-for-this-file Credo.Check.Readability.SinglePipe
# credo:disable-for-this-file Credo.Check.Refactor.PipeChainStart
defmodule Mazes.GridTest do
use ExUnit.Case, async: true
import AssertValue
alias Mazes.Algorithms.Sidewinder
alias Mazes.Grid
alias Mazes.Solver.Distances
doctest Grid
de... |
0939068f1cf24e3e4a6ee09e84186123db218d96 | 1,556 | [
583304271
] | [] | %{
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.... |
09397f4ccd7e1978dd4215baf8e6f46c145dc1cd | 3,120 | [
217756140
] | [
"genserver",
"documented"
] | defmodule HlsAdmin.AdminUI do
use GenServer
require Logger
@moduledoc """
# Admin File Browser UI Server
This server implements an in-memory file browser which operates
locally on the current node. It is initialized w/ a `parent_path`
which serves to root the browser in the filesystem tree.
Traversi... |
0939847fc10d211645cf7b5b4ef3f4905a747708 | 1,521 | [
439564692
] | [] | defmodule FizzBuzz do
defmodule UnlessIfElse do
def fizzbuzz(min, max) when min <= max do
Enum.each(min..max, &fizzbuzz/1)
end
defp fizzbuzz(x) do
unless rem(x, 3) == 0 or rem(x, 5) == 0 do
IO.puts(x)
end
if rem(x, 15) == 0 do
IO.puts("FizzBuzz")
else
... |
093a79810437fc1cf2b4e0824b9a695cab4dd9be | 2,186 | [
769657771
] | [
"test",
"phoenix"
] | defmodule ApiWeb.TaskControllerTest do
use ApiWeb.ConnCase
import Api.TasksFixtures
alias Api.Tasks.Task
@create_attrs %{
title: "some title"
}
@update_attrs %{
title: "some updated title"
}
@invalid_attrs %{title: nil}
setup %{conn: conn} do
{:ok, conn: put_req_header(conn, "accept", ... |
093a7b3d0a4473761f223162e694c0c9d2c00028 | 9,376 | [
319448136
] | [
"macro",
"test"
] | Code.require_file("../test_helper.exs", __DIR__)
defmodule ExUnit.CaseTest do
use ExUnit.Case, async: true
ExUnit.Case.register_attribute(__MODULE__, :foo)
ExUnit.Case.register_attribute(__MODULE__, :bar, accumulate: true)
ExUnit.Case.register_attribute(__MODULE__, :baz)
ExUnit.Case.register_describe_attrib... |
093ad2716823daa0d055c080856bbceb397ad4d0 | 1,640 | [
246423252
] | [
"typespec",
"documented"
] | defmodule Engine.Ethereum.RootChain.Rpc do
@moduledoc """
Does RPC calls for enriching event functions or bare events polling to plasma contracts.
The reason why these public functions allow opts is that if we
let [url: "asdf"] through to Ethereumex, the request will be sent to that URL.
This will al... |
093bb37659a2c5b86706c96d237b90c199524a40 | 3,131 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1StudySpecParameterSpecConditionalParameterSpec do
@moduledoc """
Represents a parameter spec with condition from its parent parameter.
## Attributes
* `parameterSpec` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1StudySpecParame... |
093bffffe156be63b25bba869cce0c1a4e225c69 | 2,253 | [
120256782
] | [
"documented",
"ecto"
] | defmodule Litelist.Discussions do
@moduledoc """
The Discussions context.
"""
import Ecto.Query, warn: false
alias Litelist.Repo
alias Litelist.Discussions.Discussion
@doc """
Returns the list of discussions.
## Examples
iex> list_discussions()
[%Discussion{}, ...]
"""
def list_d... |
093c59db41a83e03828b914f5debeb7e613fe84a | 1,906 | [
162063736
] | [] | defmodule Workers.Domain do
require DogStatsd
require Logger
alias Web.Repo
alias Web.Domain
def worker do
case Scheduler.pop_domain do
:empty ->
:timer.sleep(1000)
{crawl_id, domain} ->
DogStatsd.time(:dogstatsd, "worker.domain.time") do
Logger.info "[Domains] foun... |
093c904af95aeef97cda8837aebf839efcf27413 | 1,657 | [
960427010
] | [
"phoenix"
] | defmodule GithubIssuesServiceWeb.FallbackController do
use GithubIssuesServiceWeb, :controller
def call(conn, {:error, :not_found}) do
conn
|> put_status(:not_found)
|> json(%{
error: "Repository not found",
details: [
"Please ensure that:",
"1. The repository exists",
... |
093cc4f28560e9d14288eada7c51d20448e2c609 | 4,235 | [
605242810
] | [
"typespec"
] | defmodule Lexical.RemoteControl.Api.Messages do
alias Lexical.Project
import Record
defrecord :project_compile_requested, project: nil, build_number: 0
defrecord :project_compiled,
project: nil,
build_number: 0,
status: :successful,
diagnostics: [],
elapsed_ms: 0
defrecord :filesystem_e... |
093cdcbce321ff283f672f7da4322bc988004e5e | 4,543 | [
291422428,
408726432
] | [
"genserver",
"liveview",
"documented"
] | defmodule Garuda.Monitor.OrwellDashboard do
@moduledoc false
use Phoenix.LiveView
require Logger
alias Garuda.RoomManager.RoomDb
alias Garuda.RoomManager.RoomSheduler
@polling_interval 5_000
def mount(_params, _session, socket) do
Process.send_after(self(), "update", @polling_interval)
stats = Ro... |
093d085ee99d67d21e3a4a0428f9650d7ee53564 | 3,080 | [
747148349
] | [
"documented"
] | defmodule Cosmos.Upgrade.V1beta1.QueryCurrentPlanRequest do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3
end
defmodule Cosmos.Upgrade.V1beta1.QueryCurrentPlanResponse do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3
field :plan, 1,... |
093d0b03e858834ecb86e0ae943b2194616c83bd | 3,360 | [
60983053
] | [
"test"
] | defmodule Poker.Game.EventParserTest do
use ExUnit.Case
alias Poker.Game.{State, Action, EventParser}
test "it tells you if blinds have not been paid yet" do
state =
State.new(id: "game_id", small_blind: 10, big_blind: 20, players: ["p1", "p2", "p3", "p4"])
|> State.handle_action(Action.call("p... |
093d35aa2895f0e77e3600d2af68bb3c47a80504 | 2,910 | [
832149283
] | [] | defmodule Blyver.MixProject do
use Mix.Project
def project do
[
app: :blyver,
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(),
... |
093d3bf39ac152eac7c85ba20973e08bcadcd991 | 2,294 | [
644711025
] | [] | defmodule LifelinePhoenix.MixProject do
use Mix.Project
def project do
[
app: :lifeline_phoenix,
version: "0.1.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliase... |
093d6ea9776c025a86ebd7c6fe7a59ffbd676469 | 1,857 | [
880697473
] | [
"documented"
] | defmodule SportMonks.Resources.Players do
@moduledoc """
Handles player-related API endpoints.
"""
alias SportMonks.Client
@doc """
Gets a list of players.
## Documentation
Please see [Get all players](https://docs.sportmonks.com/football/endpoints-and-entities/endpoints/players/get-all-players)
... |
093e089854d64747f76f1c0bac669431d1b3e7e2 | 1,693 | [
460987243,
199205901,
138187680,
369322717,
525557181
] | [] | use Mix.Config
# Repository specific configuration
platform = "rpi2"
arch = "arm"
app_part_devparth = "/dev/mmcblk0p3"
# Environment specific configuration
# Nerves Project test farm configuration
# NERVES_TEST_SERVER = nerves-test-server.herokuapp.com
# WEBSOCKET_PROTOCOL = wss
test_server = System.get_env("NE... |
093f60e87d428582d69864a15507377ac24b042b | 2,805 | [
820192032
] | [
"documented",
"ecto"
] | defmodule Sequin.Consumers.Function do
@moduledoc false
use Sequin.ConfigSchema
import Ecto.Changeset
import Ecto.Query
import PolymorphicEmbed
alias Sequin.Accounts.Account
alias Sequin.Consumers.EnrichmentFunction
alias Sequin.Consumers.FilterFunction
alias Sequin.Consumers.Function
alias Sequin... |
093fc2e2cfed26d65f8a95c3845a3b3fbabb8d24 | 2,002 | [
177651502
] | [
"macro",
"test",
"documented"
] | defmodule AshServerWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build common data structures and query the data layer.
Finally, if ... |
093fd7c0f837a8da8bf0d1c9d3eef07b36247652 | 1,516 | [
748452578
] | [] | defmodule SimpleMnist.Examples.Heatmap do
# 前5个训练images的数字50419对应的heatmap
def demo() do
<<_::32, n_images::32, n_rows::32, n_cols::32, images::binary>> =
read_and_unzip!("train-images-idx3-ubyte.gz")
all =
images
|> Nx.from_binary({:u, 8})
|> Nx.reshape({n_images, 1, n_rows, n_cols}... |
0940116af823c4e2bde6d795f49490be4ccd28a0 | 12,875 | [
30200797
] | [
"typespec",
"documented"
] | defmodule Tds.Messages do
@moduledoc false
import Record, only: [defrecord: 2]
import Tds.Tokens, only: [decode_tokens: 1]
alias Tds.Encoding.UCS2
alias Tds.Parameter
alias Tds.Protocol.{Login7, Prelogin}
alias Tds.Types
require Bitwise
require Logger
# requests
defrecord :msg_prelogin, [:para... |
094022d07bebb9939ebd814db4901098d74970b3 | 2,756 | [
615745091,
624520297,
639175033,
864298180,
918394797,
652796601,
686968083,
804212925,
735307616,
770097397,
782271603,
580405245,
612692161,
669266273,
790994144,
793738010,
709820681,
712412528,
602806185,
848232536,
816798871,
760034052,
678534075,
798939972,
8336... | [
"documented",
"ecto"
] | defmodule LiveViewStudio.PizzaOrders do
@moduledoc """
The PizzaOrders context.
"""
import Ecto.Query, warn: false
alias LiveViewStudio.Repo
alias LiveViewStudio.PizzaOrders.PizzaOrder
@doc """
Returns the list of pizza_orders.
## Examples
iex> list_pizza_orders()
[%PizzaOrder{}, ...]... |
09404610199ac0a9ed714ff59af82523d45f959e | 1,678 | [
68364228
] | [
"phoenix"
] | defmodule GuessWho.StateController do
use GuessWho.Web, :controller
alias GuessWho.State
alias GuessWho.User
def index(conn, _params) do
states = Repo.all(State)
render(conn, "index.json", states: states)
end
def create(conn, %{"state" => state_params, "user_id" => user_id}) do
changeset =
... |
0940a891976ef2e96b85c5077842a02677d66c8e | 2,076 | [
391772423
] | [
"test",
"documented"
] | defmodule DoAuth.InviteTest do
alias Uptight.Base, as: B
@moduledoc """
Tests of invite logic and that authed endpoints work
"""
use Plug.Test
use ExUnit.Case, async: false
use DoAuth.TestFixtures, [:crypto]
alias DoAuth.{Crypto, Invite}
alias Uptight.Result
test "root invitations can be granted"... |
0940aeeaf1af5173072503e0f007e732f218abf8 | 5,057 | [
835537002
] | [
"documented"
] | defmodule Sutra.Data.MacroHelper do
@moduledoc """
Helper function to define Data Macros
"""
alias Sutra.Data.Option
alias Sutra.Data.Plutus.Constr
alias Sutra.Data.Plutus.PList
alias Sutra.Utils
import Sutra.Data.Cbor, only: [extract_value: 1]
# Add more common support types
@common_types [
... |
0940e0b70bdcdccaae21a2eadf239236e52893b0 | 2,512 | [
168693106
] | [
"test",
"ecto"
] | defmodule DistanceTracker.TrackersTest do
use DistanceTracker.DataCase
alias DistanceTracker.Trackers
describe "trackers" do
alias DistanceTracker.Trackers.Tracker
@valid_attrs %{activity: "some activity", completed_at: "2010-04-17T14:00:00Z", distance: 42}
@update_attrs %{activity: "some updated a... |
09410d97fff68c12c45eeaf6bde49024fc46eb30 | 2,114 | [
872091867,
913995146,
915448704,
934044764,
962529983,
1017248001,
828087786,
1002277727,
1019465249,
882758430,
884344453,
1010134902,
924963573,
1018026088,
875852258,
936927438,
973282597,
994710780,
1008064659,
1011149314,
1013128869,
929037144,
983213709,
982459127... | [
"documented"
] | defmodule Swoosh.Adapters.Logger do
@moduledoc ~S"""
An adapter that only logs email using Logger.
It can be useful in environments where you do not necessarily want to send real
emails (eg. staging environments) or in development.
By default it only prints the recipient of the email but you can print the f... |
0941348ff78bf3dedc722fcfecd0fa52109d30ea | 2,256 | [
562881446
] | [
"liveview",
"documented"
] | defmodule NoncegeekWeb.ProfileLive do
@moduledoc false
use NoncegeekWeb, :live_view
alias Noncegeek.Explorer
@impl true
def mount(_, session, socket) do
{:ok,
socket
|> assign_new(:entries, fn -> [] end)
|> assign_new(:current_user, fn -> Map.get(session, "current_user") end)}
end
@... |
09413c593ff8e2595ccf6b0133066184310bc845 | 2,623 | [
48874454
] | [
"typespec",
"test"
] | Code.require_file "../test_helper.exs", __DIR__
defmodule Kernel.LexicalTrackerTest do
use ExUnit.Case, async: true
alias Kernel.LexicalTracker, as: D
setup do
{:ok, pid} = D.start_link("dest")
{:ok, [pid: pid]}
end
test "gets the destination", config do
assert D.dest(config[:pid]) == "dest"
... |
09414120c627d9fb4ac3571ff5de6f3a454feae4 | 2,956 | [
206297200
] | [
"typespec",
"documented"
] | defmodule Google.Ads.Googleads.V8.Services.GetCustomerClientLinkRequest 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.Googlea... |
0941b39fd73cfa4f92dd5603812296b0e4d3d243 | 4,228 | [
152782466
] | [
"phoenix",
"ecto"
] | defmodule TaskTrackerWeb.TaskController do
use TaskTrackerWeb, :controller
alias TaskTracker.Tasks
alias TaskTracker.Tasks.Task
alias TaskTracker.AssignedTasks
alias TaskTracker.AssignedUsers
alias TaskTracker.Users
alias TaskTracker.TimeBlocks
def index(conn, _params) do
tasks = Tasks.list_tasks(... |
09441f3f80d4b93637ce90646e1021534928194b | 2,851 | [
306868516
] | [
"phoenix"
] | defmodule CyptoBankWeb.Router do
use CyptoBankWeb, :router
pipeline :api do
plug :accepts, ["json"]
plug :fetch_session
end
pipeline :api_auth do
plug :ensure_authenticated
end
scope "/api", CyptoBankWeb do
pipe_through :api
# User authentication endpoints
post "/users/sign_in", ... |
094489a061c2546c375d4b41815f0eb7c00090dc | 3,045 | [
482720652
] | [
"supervisor",
"documented"
] | defmodule Logger.App do
@moduledoc false
require Logger
use Application
@doc false
def start(_type, _args) do
start_options = Application.get_env(:logger, :start_options)
otp_reports? = Application.fetch_env!(:logger, :handle_otp_reports)
counter = :counters.new(1, [:atomics])
children = [... |
0944b7656c708e89aa89b4905d8a9eedca4f8320 | 5,114 | [
195254865
] | [
"genserver",
"documented"
] | defmodule Hanabi.Server do
@moduledoc """
The Server module of the Hanabi's server application.
This module is the middleman for the players and the game logic. It has a GenServer
behaveiour and represents a TCP based server.
The used interface for TCP/IP is Erlang's :gen_tcp module. All the messages are el... |
0944f53f21446b54444ee7c19c5ec168a457feb5 | 2,466 | [
236023121
] | [] | defmodule Palapa.PublicSeeds do
alias Palapa.Messages
def seed(organization, locale) do
Messages.create_system_message(organization, message_data(locale))
end
def message_data("fr") do
%{
title: "Bienvenue dans votre nouvel espace !",
content: """
<h1>Invitez d'autres personnes'</h1>... |
09455972c62adf3ce3e04c99a2277cf5f31f5afc | 2,647 | [
160717169
] | [
"test"
] | defmodule AdventTest do
use ExUnit.Case
doctest Advent
describe "Solution Day 1" do
test "Part 1" do
assert Advent.run(:day_1) == 416
end
test "Part 2" do
assert Advent.run(:day_1, 2) == 56752
end
end
describe "Solution Day 2" do
test "Part 1" do
assert Advent.run(:day... |
094585934e91b6e47d9062074cb1101f2d48ab19 | 6,958 | [
75570607
] | [
"test"
] | defmodule VendingMachineServerTest do
use ExUnit.Case
setup do
server = start_supervised!(VendingMachineServer)
VendingMachineClient.initialize_state(server, %VendingMachine{
inventory: [
%{product: %{name: "Cola", price: 100}, quantity: 1},
%{product: %{name: "Chips", price: 50}, qua... |
0945aba0ee705aa6c1210f6c3a02b3c978beeac3 | 1,659 | [
673538680
] | [
"liveview",
"phoenix"
] | defmodule AusbildungsnachweisdigitalWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :ausbildungsnachweisdigital
# 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 [
... |
0945c41f18211446f8989735fc7da348a6f3b35d | 21,985 | [
917123261
] | [
"documented"
] | defmodule LevelWeb.Schema.Mutations do
@moduledoc false
use Absinthe.Schema.Notation
@desc "Interface for payloads containing validation data."
interface :validatable do
field :success, non_null(:boolean)
field :errors, list_of(:error)
resolve_type fn _, _ -> nil end
end
@desc "A validation e... |
0945d5822242b16fb456d8519c73a52057e02869 | 17,218 | [
461084124
] | [
"documented"
] | defmodule Mix.Tasks.Docs do
use Mix.Task
@shortdoc "Generate documentation for the project"
@requirements ["compile"]
@moduledoc ~S"""
Uses ExDoc to generate a static web page from the project documentation.
## Command line options
* `--canonical`, `-n` - Indicate the preferred URL with
rel="c... |
094614766994239c7be70ac3589073c2ee09e299 | 2,063 | [
660377590
] | [
"liveview",
"documented"
] | defmodule Beacon.LiveAdmin.PageEditorLive.New do
@moduledoc false
use Beacon.LiveAdmin.PageBuilder
alias Beacon.LiveAdmin.Client.Content
@impl true
def menu_link("/pages", :new), do: {:submenu, "Pages"}
def menu_link(_, _), do: :skip
@impl true
def handle_params(params, _url, socket) do
editor = ... |
0946588945207d73b5cf881a874fd22eca2b6c61 | 1,686 | [
999155354
] | [] | defmodule DateParser do
defp bounded regex do
"^(?:#{regex})$"
end
defp identity(regex), do: regex
def day, do: day(&bounded/1)
defp day(wrap) do
wrap.("[012]?\\d|3[01](?!\\d)")
end
def month, do: month(&bounded/1)
defp month(wrap) do
wrap.("0?[1-9]|1[012]")
end
def year, do: year(&... |
0946869823d36e4b25605a4dfeb14e1d48dbda6d | 2,261 | [
286553422
] | [
"ecto"
] | defmodule Doa.Plant do
use Ecto.Schema
import Ecto.Query
alias Doa.Repo
alias Doa.Plant
@required_fields [
:accepted_symbol,
:scientific_name
]
@editable_fields @required_fields ++ [
:synonym_symbol,
:common_name,
:plants_floristic_area,
:state_and_province,
:fact_sheets,
... |
0946cabf9ac440d7626abf0b0291a442bb7bc877 | 2,951 | [
75778607
] | [] | defmodule Solve do
def ex(input) do
input |> ex1()
input |> ex2()
end
defp ex1(input) do
IO.puts("PART 1")
input |> scores(10) |> Enum.join("") |> IO.puts()
end
defp ex2(input) do
to_find = input |> to_string() |> String.codepoints() |> Enum.map(&String.to_integer/1)
IO.puts("PART 2"... |
0946f2ec2c4e0237012982c47c92046b57f1fade | 1,511 | [
557183263
] | [
"documented",
"ecto"
] | defmodule Api.Users.User do
use Ecto.Schema
import Ecto.Changeset
alias Api.AuthTokens.AuthToken
alias Api.Workingtimes.Workingtime
alias Api.Clocks.Clock
alias Api.Parameters.Parameter
alias Api.Teams.Team
@derive {Jason.Encoder, except: [:__meta__, :auth_tokens, :password]}
schema "users" do
... |
09472fc4635e08866288596dbd30c45bc5c61de2 | 2,142 | [
825968265,
778888249,
99433793
] | [
"liveview"
] | # 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
# Duplicate since I don't think I can easily include modules from lib/ here
defmodul... |
09474edafc8ab460faf1babac360a13760c44a3b | 2,716 | [
702755894
] | [] | "
MATCHING BITSTRINGS AND BINARIES
A bitstring is a chunk of bits, and a binary is a special case of a bit-string
that is always aligned to the byte size.
To match a binary, you use a syntax similar to creating one:
iex(1)> binary = <<1, 2, 3>>
<<1, 2, 3>>
iex(2)> <<b1, b2, b3>> = binary # A binary match
<... |
0947541924b796d4ab50470ad9d121025f7a4574 | 8,773 | [
682357176
] | [
"phoenix",
"ecto"
] | defmodule Pleroma.Web.ActivityPub.UserView do
use Pleroma.Web, :view
alias Pleroma.Keys
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ObjectView
alias Pleroma.Web.ActivityPub.Transmogrifier
alias Pleroma.Web.ActivityPub.Utils
require Pleroma.Web.ActivityPub... |
0947d88deb6870c1d54ed39d211723a79bde7b57 | 1,552 | [
94585265
] | [
"test"
] | defmodule ElixirProgrammingGameTest.ActorTest do
use ExUnit.Case, async: false # true
# import ExUnit.CaptureLog
doctest ElixirProgrammingGame.Actor
alias ElixirProgrammingGame.Actor
setup do
{:ok, actor} = Actor.start_link(save_to_pid: self())
{:ok, actor: actor}
end
test "initializes and stop... |
09482afda51d9033f7ee9cc4ad713fc94c47d3f1 | 2,782 | [
968844604
] | [
"typespec",
"documented"
] | defmodule JetLagServer.Games.EventBroadcaster do
@moduledoc """
Handles broadcasting of game events to connected clients.
This module centralizes all event broadcasting logic to avoid duplication
between HTTP controllers and WebSocket channels.
"""
alias JetLagServer.Games.Structs.{
PlayerJoinedEvent,
... |
09482febcf4ce086ae34de8117f33bcf2950e45b | 14,948 | [
327135648
] | [
"documented"
] | defmodule Aoc2021.Day15.Old do
alias AocUtils.Grid2D, as: Grid
@doc """
This is the first and most naive implementation of the algorithm that I wrote. The first performance issues identified were
using `in` to check membership. It is wickedly slow on the 500x500 grid.
"""
def dijkstra_1(grid, start_pos, end... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.