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 |
|---|---|---|---|---|
08aead61203afe5334aa79a63974b2ee627dc0ad | 1,736 | [
49848741
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule BlogDelTaco.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use BlogDelTaco.Web, :controller
use BlogDelTaco.Web, :view
The definitions below will be executed for every view,
controller, etc, so k... |
08aeba8a536bd38a62756d073d0c528344eb3236 | 1,772 | [
755853718
] | [
"documented"
] | defmodule Ibex.Tws.Protocol do
@moduledoc """
Encodes and decodes the TWS API message protocol in binary.
"""
@sep <<0>>
@default_encoding :utf8
@max_int Integer.MAX_VALUE
@max_double 1.7976931348623157e308
@true_value 1
@false_value 0
@invalid_symbol_error "Invalid symbol"
@padding_size 4
@mes... |
08af02b743131672d4d8955427cd06529c6c5bd2 | 2,861 | [
712036559
] | [
"genserver",
"typespec",
"documented"
] | defmodule MBTAV3API.Store.Alerts do
use GenServer
use MBTAV3API.Store, implementation_module: MBTAV3API.Store.Alerts.Impl
require Logger
alias MBTAV3API.Alert
end
defmodule MBTAV3API.Store.Alerts.Impl do
@moduledoc """
Store of alerts. Store is written to by a single `MBTAV3API.Stream.ConsumerToStore`
an... |
08af2499153d6fd26ad3b477a9bf55b6f9cd972e | 8,597 | [
192407200
] | [
"test"
] | defmodule Valkyrie.BroadwayTest do
use ExUnit.Case
use Placebo
alias SmartCity.TestDataGenerator, as: TDG
alias SmartCity.Data
import SmartCity.Data, only: [end_of_data: 0]
import SmartCity.Event, only: [event_log_published: 0]
import SmartCity.TestHelper, only: [eventually: 1]
@dataset_id "ds1"
@d... |
08af74209a0365588842f1a630a98db8219bd83f | 2,120 | [
151178717
] | [
"supervisor"
] | defmodule JobWebserver.Cache do
def start_link() do
DynamicSupervisor.start_link(name: __MODULE__, strategy: :one_for_one)
end
# must define child_spec when you want this to be a supervised process and you don't use
# Genserver
def child_spec(_) do
%{
id: __MODULE__,
start: {__MODULE__, :... |
08afcf99273cd533651bc8088ffdf1a613b1e30a | 1,801 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.CloudSearch.V1.Model.SuggestRequest do
@moduledoc """
Request of suggest API.
## Attributes
* `dataSourceRestrictions` (*type:* `list(GoogleApi.CloudSearch.V1.Model.DataSourceRestriction.t)`, *default:* `nil`) - The sources to use for suggestions. If not specified, the data sources are t... |
08b046c39bd7910fa7b96c2f056b8486b7d9bc6a | 1,630 | [
119340470
] | [
"macro",
"documented",
"phoenix"
] | defmodule ShortUrlWeb 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 ShortUrlWeb, :controller
use ShortUrlWeb, :view
The definitions below will be executed for every view,
controlle... |
08b0e328bd0746757de54aa2c29d5c03e145f368 | 2,266 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaAnswerReference do
@moduledoc """
Reference.
## Attributes
* `chunkInfo` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaAnswerReferenceChunkInfo.t`, *default:* `nil`) - Chunk information.
* `stru... |
08b0f08c32b8291d68c5fcf93abd2c95ca6995bf | 3,043 | [
718958131
] | [
"documented"
] | defmodule LinkedLists do
@moduledoc """
This module provides functions for working with linked lists.
"""
@doc """
Returns the `essentials_setup_work_from_home_list`.
Returns `list` of `strings`
## Examples
iex> LinkedLists.get_essentials_setup_work_from_home_list()
... |
08b13372c37a0310989a5d98d782875d5d2a5be8 | 11,057 | [
942468823
] | [
"test",
"documented"
] | defmodule GameBot.Domain.Events.ValidatorTest do
@moduledoc """
Tests for the EventValidator protocol implementations.
"""
use ExUnit.Case, async: true
alias GameBot.Domain.Events.{EventValidator, EventValidatorHelpers}
alias GameBot.Domain.Events.GameEvents.{GameStarted, GuessProcessed}
describe "Event... |
08b193e114e4996509ba74cbbbd02467714538a1 | 2,627 | [
24574800
] | [] | defmodule Issues.Reporter do
@vertical_border " | "
@horizontal_border "---"
@intersect_border "-+-"
def response({ :error, body }) do
{ :error, "Repository does not exist" }
end
def response({ :ok, issues }) do
{ :ok, format_okay_response(issues) }
end
def format_okay_response( issues ) do
... |
08b1e1d14caa32fc7d838992e6ff2bc9fc72aee1 | 2,411 | [
162523000
] | [] | defmodule MockChain do
alias BITCOIN.Wallet.{Wallet}
alias BITCOIN.BlockChain.{Transaction, TransactionQueue, Chain, TxOutput, TxInput}
alias BITCOIN.UserNode
def mockLedger do
# Start a new GenServer
Chain.start_link()
# Start a new Transaction queue to store transaction in buffer untill... |
08b20213d96184caae8f714e5ed48267ac16a724 | 9,781 | [
828087786
] | [
"liveview"
] | defmodule ExampleWeb.Project1Live.FormComponent do
use ExampleWeb, :live_component
require Ash.Query
alias Example.ProjectGeneral
alias Example.Accounts
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage project one reco... |
08b241e7696d5a042707e8936816a038cf38ad4a | 3,887 | [
345176968
] | [
"test",
"phoenix"
] | defmodule NervesHubWWWWeb.OrgControllerTest do
use NervesHubWWWWeb.ConnCase.Browser, async: true
alias NervesHubWebCore.Fixtures
describe "new org" do
test "renders form", %{conn: conn} do
conn = get(conn, Routes.org_path(conn, :new))
assert html_response(conn, 200) =~ "Create New Organization"
... |
08b24ba750632d2d0d2b84084b39c60aa81cea82 | 1,693 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.People.V1.Model.UpdateContactGroupRequest do
@moduledoc """
A request to update an existing user contact group. All updated fields will be replaced.
## Attributes
* `contactGroup` (*type:* `GoogleApi.People.V1.Model.ContactGroup.t`, *default:* `nil`) - Required. The contact group to upda... |
08b25c30ca9e9b55ae63638e33e689baca9f9c97 | 1,630 | [
81555570
] | [
"supervisor"
] | defmodule MmApi.RedixPool do
use Supervisor
#redis_connection_params host: "localhost"
#@redis_connection_params host: "<IP_ADDRESS>"
def start_link do
Supervisor.start_link(__MODULE__, [])
end
def init([]) do
# Get poolboy setting
read_opts = Application.get_env(:mm_api, MmApi.Red... |
08b25e3de72fc6c893a4bc5155ceffc30ec35e70 | 2,831 | [
762759308
] | [
"test",
"phoenix"
] | defmodule Moonwalk.Web.ErroHandlingTest do
use Moonwalk.ConnCase, async: true
describe "html errors can be disabled" do
# The controller is using `html_errors: false` for the validation plug so we
# should have only json errors despite the HTTP request accepting HTML.
@describetag req_accept: "text/htm... |
08b2a0907266ca94ee319c02fca6a7ec8323ed8d | 1,646 | [
285339854
] | [
"macro"
] | defmodule Tour do
defmodule Unless do
def fun_unless(clause, do: expression) do
if(!clause, do: expression)
end
# require Tour.Unless 后才能用 macros
defmacro macro_unless(clause, do: expression) do
quote do
if(!unquote(clause), do: unquote(expression))
end
end
end
defm... |
08b39d505b476132c4c4bf3cc86a05ad13077461 | 1,928 | [
401440711
] | [
"macro",
"documented",
"phoenix"
] | defmodule FmessengerWeb 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 FmessengerWeb, :controller
use FmessengerWeb, :view
The definitions below will be executed for every view,
con... |
08b49cd9f0d58c1fadfeb896fd12bc58a42dbba8 | 1,584 | [
761508960
] | [
"phoenix",
"ecto"
] | defmodule AipimWeb.LinkController do
use AipimWeb, :controller
alias Aipim.Links
alias Aipim.Links.Link
def index(conn, _params) do
links = Links.list_links()
render(conn, :index, links: links)
end
def new(conn, _params) do
changeset = Links.change_link(%Link{})
render(conn, :new, changes... |
08b4e58bf32b8fb35e7fa7548392fe7224e9e722 | 3,375 | [
433034488
] | [] | defmodule Y2017.Day22 do
use Advent.Day, no: 22
def part1(data, iterations) do
data
|> parse_input()
|> do_parts(default_state(iterations))
end
def part2(data, iterations) do
data
|> parse_input()
|> do_parts(%{default_state(iterations) | level: :evolved})
end
defp default_state(i... |
08b56713b6199f9279f385abbe8fc668ec78f525 | 3,796 | [
622369877
] | [
"typespec",
"documented"
] | defmodule Integrator do
@moduledoc """
A library for solving non-stiff ordinary differential equations (ODEs).
`Integrator` uses either the Dormand-Prince 4/5 Runge Kutta algorithm, or the Bogacki-Shampine 2/3
Runge Kutta algorithm. It is intended that the user only needs to call `Integrator.integrate/4`, and... |
08b5747b33aa641b548d6dfed743a2c4613d9660 | 1,748 | [
75839945
] | [
"test"
] | defmodule MyApp.ArticleControllerSpec do
use ESpec.Phoenix, controller: true, async: true
alias MyApp.Repo
alias MyApp.Article
# alias MyApp.ArticleController
let :attrs, do: %{title: "国木田花丸", body: "未来ずら"}
let :assigns, do: conn.assigns
describe "show" do
context "when id is existent" do
let!... |
08b61f1dbf3638ccc917578f4b5cd4b9c05ec977 | 7,523 | [
885126122
] | [
"test"
] | defmodule ServerSentEventsTest do
use ExUnit.Case, async: true
doctest ServerSentEvents
test "parse basic server sent events" do
data = """
id: 1
event: starting
data: {"status":"starting","progress":0}
id: 2
event: updating
data:{"status":"processing","progress":45}
retry: 1500... |
08b69de45af9d1844154e4b62029a03f052af367 | 3,919 | [
866004583
] | [
"test",
"documented"
] | defmodule Mix.Tasks.Advent.Generate.Day do
use Igniter.Mix.Task
@example "mix advent.generate.day --example arg"
@shortdoc "A short description of your task"
@moduledoc """
#{@shortdoc}
Longer explanation of your task
## Example
```bash
#{@example}
```
## Options
* [day] The day of the mo... |
08b69e86dc59195e03ab000e83481b69d098d13c | 3,573 | [
65417589
] | [
"test"
] | defmodule GenStagePlaygroundTest do
use ExUnit.Case, async: false
doctest GenStagePlayground
alias GenStagePlayground.{Build, Repo}
alias Experimental.GenStage
import Ecto.Query
setup do
# Explicitly get a connection before each test
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo)
Ecto.Adapters... |
08b6d0a549ea95e07a9081edaf430f50b2ab517f | 7,220 | [
605242810
] | [
"typespec",
"macro",
"documented"
] | defmodule Lexical.RemoteControl.Search.Store.Backends.Ets.Schema do
@moduledoc """
A use-able module that allows ETS schemas to be created and migrated.
This module allows users to define ETS key-based schemas for our search backends. These modules
are versioned, and are all stored in their own ETS tables. Thi... |
08b6ecf3ca0f7aa2f063db64d9ea817abd0bc89b | 1,745 | [
99649331
] | [
"documented"
] | defmodule Essence.Router do
@moduledoc """
Our main server file. Here we configure our routes and call the main logic of our application.
"""
use Plug.Router
use Essence.View
alias Essence.Url
require Logger
plug Plug.Logger
plug Plug.Parsers, parsers: [:urlencoded, :multipart]
plug :match
plug :d... |
08b76a3e63dec01936831e7d5d8b6669ba468a57 | 2,820 | [
52660704
] | [
"test",
"phoenix"
] | defmodule BlogWeb.ClientControllerTest do
use BlogWeb.ConnCase
alias Blog.SiteContent
alias Blog.SiteContent.Client
@create_attrs %{bio: "some bio", name: "some name", url: "some url", active: true}
@update_attrs %{
bio: "some updated bio",
name: "some updated name",
url: "some updated url",
... |
08b77ea9f45a0f6aa32b30c2c3afc11226c4ea93 | 2,249 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2ImageTransformation do
@moduledoc """
Configuration for determining how redaction of images should occur.
## Attributes
* `allInfoTypes` (*type:* `GoogleApi.DLP.V2.Model.GooglePrivacyDlpV2AllInfoTypes.t`, *default:* `nil`) - Apply transformation to all find... |
08b7859a14929f4059c753ac802a6a303be3300d | 2,109 | [
501325238
] | [] | # 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 :mellifera,
ecto_repos: [Mellifera.Repo],
... |
08b7b123b52c55912a69cfe7c3af80cb314b950b | 3,081 | [
959927846
] | [
"documented",
"ecto"
] | defmodule Xiam.Rbac do
@moduledoc """
The RBAC context.
"""
import Ecto.Query, warn: false
alias XIAM.Repo
alias Xiam.Rbac.Role
alias Xiam.Rbac.Capability
alias Xiam.Rbac.Product
@doc """
Returns the list of roles.
"""
def list_roles do
Role
|> preload(:capabilities)
|> Repo.all()
... |
08b7ccffe5664a194d60a4008522a85938d13657 | 4,850 | [
678424363
] | [
"typespec",
"documented"
] | defmodule Fortune do
@moduledoc """
Get a fortune!
Fortune reads a string, usually a random one, from one or more fortune files.
Fortune files contain a list of strings and an associated index for for quick
retrieval of a randomly chosen string. This implementation provides an Elixir
take on the ubiquitous... |
08b7eeaf129578332f7c020e0c24c188ac3df6df | 1,786 | [
136371739
] | [
"documented"
] | defmodule Board do
@moduledoc false
def init() do
:empty
|> List.duplicate(3)
|> List.duplicate(3)
end
def move(board, player, x, y) do
new_row_x =
board
|> row(x)
|> List.replace_at(y, player)
List.replace_at(board, x, new_row_x)
end
def winner(board) do
rows_w... |
08b878758224ce9f9be1eb209d205db819ab88c5 | 2,346 | [
47292091
] | [
"test"
] | defmodule JsonapiOverhaul.UserControllerTest do
use JsonapiOverhaul.ConnCase
alias JsonapiOverhaul.User
alias JsonapiOverhaul.Company
@valid_attrs %{ type: "user", attributes: %{name: "TestUser"}}
@create_valid_attrs %{ type: "users", attributes: %{name: "TestUser"}}
@invalid_attrs %{}
setup do
conn... |
08b9512d8ee16b55e32ed38444cd1bacd044f689 | 2,685 | [
231127705
] | [
"test",
"documented"
] | defmodule Delta.ApplicationTest do
@moduledoc false
use ExUnit.Case, async: true
alias Delta.Application
describe "config/1" do
test "can get the default configuration" do
assert %{"producers" => %{}, "sinks" => %{}} =
Application.config([
{:system, "DOES_NOT_EXIST"},
... |
08b970d35c5a0a460d639b4e3fc7820f84d524dc | 2,221 | [
991942273
] | [
"typespec",
"documented"
] | defmodule Polarex.BenefitGrant do
@moduledoc """
Provides struct and type for a BenefitGrant
"""
@type t :: %__MODULE__{
benefit_id: String.t(),
created_at: DateTime.t(),
customer: Polarex.Customer.t(),
customer_id: String.t(),
error: Polarex.BenefitGrantError.... |
08b99aecc3e4c9f706bcac8a546a6f9ac9ebf51f | 1,548 | [
82663977
] | [
"typespec"
] | defmodule Dnevnik.Config do
@content_directory "./_workspace"
@public_directory "./_public"
@config_file "config.json"
@spec content_directory() :: String.t
def content_directory, do: @content_directory
@spec public_directory() :: String.t
def public_directory, do: @public_directory
@spec i... |
08b9a631fe3d426c1ec418bc2d778ec6b775f5dd | 1,937 | [
539853437
] | [
"test",
"documented"
] | defmodule MessengerBot.MessageTest do
@moduledoc false
use ExUnit.Case, async: true
alias MessengerBot.Message
import MessengerBot.Support.Factory
describe "Message.parse/1" do
test "successfully parse message event" do
%{
id: id,
mid: mid,
text: text,
recipient_id... |
08ba167d64833c87d6f3570ddcfe9c25854c8110 | 1,917 | [
389241607
] | [
"typespec",
"macro",
"documented"
] | defmodule Boxicon do
@moduledoc """
Boxicon is surface component library that wraps the amazing boxicons library.
Usage:
defmodule MyComponent do
use Surface.Component
@impl true
def render(assigns) do
~F"\""
<Boxicon
name="cal... |
08ba917dc7b9c9510e772a75c4f0b747c2962991 | 1,778 | [
573096859
] | [
"test"
] | defmodule SurrealExTest.QueryFiltersTest do
use ExUnit.Case
defmodule Conn do
use SurrealEx.Conn
end
defmodule ExampleFlow do
use SurrealEx.Query,
conn: SurrealExTest.QueryFiltersTest.Conn
def filters(_args) do
[
ArgsChecker.required(:price_max),
ArgsChecker.should_be(... |
08bb0c78187abe4bfae8f8fa7ef529e61a5ff7f2 | 2,167 | [
453802704
] | [
"documented"
] | defmodule Day04 do
@moduledoc false
def input do
{:ok, input} = File.read('./lib/04/input.txt')
[numbers | boards] = input |> String.split("\n", trim: true)
{
numbers |> String.split(",", trim: true) |> Enum.map(&String.to_integer/1),
boards |> parse_boards()
}
end
defp parse_boar... |
08bb2169d5b2383d4ebc08c49c4f9f87f043a571 | 3,101 | [
576109811
] | [] | defmodule Monkey do
defstruct id: nil, items: [], testNumber: nil, operation: nil, trueMonkey: nil, falseMonkey: nil, number_of_inspections: 0
end
defmodule Main do
def parse_monkey(monkey) do
monkeyParts = String.split(monkey, "\n")
id =
String.to_integer(
Enum.at(monkeyParts, 0)
|>... |
08bb274be7e7c8b15a6a7e99dc7e3bec1fab0ec1 | 1,739 | [
1018582674
] | [
"test"
] | defmodule LedgerBankApi.Banking.UserPaymentsPerformanceTest do
use ExUnit.Case, async: false
alias LedgerBankApi.Banking.UserPayments
alias LedgerBankApi.Banking.Schemas.UserPayment
alias LedgerBankApi.Banking.Schemas.UserBankAccount
alias LedgerBankApi.Banking.Schemas.UserBankLogin
alias LedgerBankApi.Bank... |
08bb2e5871f549be4bafaef266df64a260d0fb95 | 3,189 | [
930200020
] | [
"liveview",
"test"
] | defmodule BettingWeb.TeamLiveTest do
use BettingWeb.ConnCase
import Phoenix.LiveViewTest
import Betting.TeamsFixtures
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
defp create_team(_) do
team = team_fixture()
%{team: team}
end
des... |
08bb8686a9e96348279fc62ce61948b4f9fd4da1 | 1,595 | [
776638611
] | [
"genserver",
"supervisor",
"documented"
] | defmodule Region.System do
use GenServer
@moduledoc """
Region.System is the topmost supervisor for a Region.
"""
require Logger
alias Scape.Emitter, as: ScapeEmitter
alias Region.Init, as: RegionInit
############## API ###################
############## CALLBACKS #############
@impl GenServer... |
08bc0f4de2866090795194dae1b407e69f6ac0c4 | 3,716 | [
471931971
] | [] | %{
"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... |
08bc6a8cb438253cb161f546bb94e30bf82ebd84 | 1,780 | [
115409939
] | [] | %{"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [], [], "hexpm"},
"db_connection": {:hex, :db_connection, "1.1.2", "2865c2a4bae0714e2213a0ce60a1b12d76a6efba0c51fbda59c9ab8d1accc7a8", [], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optio... |
08bdfea5c14927c40734442c107737c1837762b4 | 2,639 | [
209305387
] | [
"macro",
"supervisor",
"test"
] | defmodule Test.Unit.CredoModuleFunctionOrdering.Rule do
use CredoModuleFunctionOrdering.TestHelper
@described_check CredoModuleFunctionOrdering.Rule
setup_all do
import Supervisor.Spec, warn: false
children = [
worker(Credo.CLI.Output.Shell, []),
worker(Credo.Service.SourceFileScopes, []),
... |
08be0f195ed3b377af877da51e453288b5bc6193 | 2,123 | [
321991338
] | [
"genserver",
"typespec",
"documented"
] | defmodule Esl.HackerNews.Worker do
use GenServer
@moduledoc false
@spec start_link(any) :: :ignore | {:error, any} | {:ok, pid}
def start_link(opts) do
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
end
@spec fetch :: {:error, String.t} | {:ok, list(map)}
def fetch(... |
08be29d361777e3e213a24ae950036896b84ba7a | 2,514 | [
296205115
] | [
"genserver"
] | defmodule SketchNov28a do
use GenServer
require Logger
@socket Chromoid.Socket
@topic "ble"
alias PhoenixClient.{Channel, Message}
def start_link(device) do
GenServer.start_link(__MODULE__, device, name: __MODULE__)
end
def set_color(color) do
GenServer.call(__MODULE__, {:set_color, color})
... |
08be300ab35764f4255ab9eb97e1b1194f117ebe | 1,505 | [
597318051
] | [
"documented",
"ecto"
] | defmodule Butike.Order.OrderItem do
use Ecto.Schema
import Ecto.Changeset
@derive {Jason.Encoder,
only: [
:description,
:item_id,
:meta_data,
:name,
:note,
:order_id,
:quantity,
:shop_msisdn,
... |
08be83b96817d9d4dd4190527a54bcb94b1c83c3 | 2,004 | [
53053877
] | [
"test"
] | if !System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("anagram.exs", __DIR__)
end
ExUnit.start
ExUnit.configure trace: true
defmodule AnagramTest do
use ExUnit.Case
# @tag :skip
test "no matches" do
matches = Anagram.match "diaper", ["hello", "world", "zombies", "pants"]
assert matches == []... |
08bec4b4162a8e38f045cc0b9341fd4b8d2eb661 | 19,892 | [
762131773,
682357176,
675225385,
739033590
] | [] | defmodule Pleroma.Factory do
use ExMachina.Ecto, repo: Pleroma.Repo
require Pleroma.Constants
alias Pleroma.Object
alias Pleroma.User
@rsa_keys [
"test/fixtures/rsa_keys/key_1.pem",
"test/fixtures/rsa_keys/key_2.pem",
"test/fixtures/rsa_keys/key_3.pem",
... |
08c067862c0b5d987063c79a1bd55211392aecab | 4,099 | [
75415779
] | [
"documented"
] | defmodule Day02 do
# 1 2 3
# 4 5 6
# 7 8 9
def digit("1", "U"), do: "1"
def digit("1", "D"), do: "4"
def digit("1", "R"), do: "2"
def digit("1", "L"), do: "1"
def digit("2", "U"), do: "2"
def digit("2", "D"), do: "5"
def digit("2", "R"), do: "3"
def digit("2", "L"), do: "1"
def digit("3", "U"),... |
08c14cbbdf51101b31fd0ccdaba133c4b06c1aee | 2,901 | [
228414339
] | [
"test"
] | defmodule Profile.Feed.FlowTest do
use ExUnit.Case
require Temp.Env
import Definition, only: [identifier: 1]
@instance Profile.Application.instance()
Temp.Env.modify([
%{
app: :service_profile,
key: Profile.Feed.Flow,
set: [
window_limit: 2,
window_unit: :second
... |
08c18fd587815dd52ecbaa8c86cc51df772297a3 | 5,349 | [
932408700
] | [
"typespec",
"documented"
] | defmodule Peridio.NetMon.InterfacesMonitor.Info do
@moduledoc false
alias Peridio.NetMon.IP
@link_if_properties [:lower_up, :mac_address]
@address_if_properties [:addresses]
@all_if_properties [:present, :hw_path] ++ @link_if_properties ++ @address_if_properties
defstruct ifname: nil,
hw_pat... |
08c19ce8defc47c43b8517c2715e1d3cab27411e | 1,725 | [
53514988
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule WebrtcTest.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use WebrtcTest.Web, :controller
use WebrtcTest.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep... |
08c1f9db880a5fe8dd71f299faf67c248bd379c0 | 9,058 | [
211097139,
180274417
] | [
"typespec",
"macro",
"documented"
] | defmodule Integer do
@moduledoc """
Functions for working with integers.
Some functions that work on integers are found in `Kernel`:
* `abs/1`
* `div/2`
* `max/2`
* `min/2`
* `rem/2`
"""
import Bitwise
@doc """
Determines if `integer` is odd.
Returns `true` if the given `intege... |
08c2b54dd0aea3713a99c608991c983728706ba0 | 2,733 | [
533537020,
180672647,
294427908,
121001913
] | [
"test"
] | defmodule Snitch.Data.Model.GeneralConfigurationTest do
use ExUnit.Case, async: true
use Snitch.DataCase
import Snitch.Factory
alias Snitch.Data.Schema.{Image, GeneralConfiguration}
alias Snitch.Data.Model.GeneralConfiguration, as: GCModel
alias Snitch.Data.Model.Image, as: ImageModel
alias Snitch.Core.... |
08c2cde79328551914f4b0644ddc860faafe5bcd | 3,416 | [
980133098
] | [] | # This file is responsible for configuring your umbrella
# and **all applications** and their dependencies with the
# help of the Config module.
#
# Note that all applications in your umbrella share the
# same configuration and dependencies, which is why they
# all use the same configuration file. If you want different... |
08c31f21a68998784168aada4e746e8c2af477e6 | 2,546 | [
736990952
] | [
"liveview",
"ecto"
] | defmodule CajuWeb.OrganizationLive.FormComponent do
use CajuWeb, :live_component
alias Caju.Membership
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage organization records in your database.</:subtitle>
</.header>
... |
08c3414622118654769129f20298789b9e350432 | 1,855 | [
605242810
] | [] | defmodule Lexical.Server.Provider.Handlers.WorkspaceSymbol do
alias Lexical.Protocol.Requests.WorkspaceSymbol
alias Lexical.Protocol.Responses
alias Lexical.Protocol.Types.Location
alias Lexical.Protocol.Types.Symbol.Kind, as: SymbolKind
alias Lexical.Protocol.Types.Workspace.Symbol
alias Lexical.RemoteCont... |
08c3c367f8ff900a622f23ca9f2cb2f34ed37471 | 3,343 | [
358724772
] | [
"test",
"phoenix"
] | defmodule RobbyWeb.AuthTest do
use RobbyWeb.ConnCase
alias RobbyWeb.Auth
alias RobbyWeb.User
alias RobbyWeb.Repo
@valid_user %User{
dn: "uid=tom,ou=users,dc=example,dc=com",
salt: "VWBjGIv1DCA2u15kaJ38w+sl4pNeH1minZz6D3ivT/0XzST2+9E0RZFoBX0iqnOF",
username: "tom",
email: "<EMAIL>"
}
setu... |
08c48702b277c566242defd2b91f4d207e1b4c85 | 1,958 | [
669117211
] | [
"liveview"
] | defmodule EmployeeManagementSystemWeb.TaskLive.Index do
use EmployeeManagementSystemWeb, :live_view
alias EmployeeManagementSystem.Tasks
alias EmployeeManagementSystem.Tasks.Task
alias EmployeeManagementSystem.Users
alias EmployeeManagementSystem.Messages
alias EmployeeManagementSystem.Messages.Message
... |
08c4d5ba0f1991240a3f6d21e992d207ee734c84 | 2,119 | [
90767762
] | [
"test"
] | defmodule Teamwork.Feature.ParentTest do
use Teamwork.FeatureCase
use Bamboo.Test, shared: :true
test "a parent can register" do
navigate_to "/"
fill_in "parent", "name", with: "Joe Blow"
fill_in "parent", "email", with: "<EMAIL>"
fill_in "parent", "phone", with: "5555555555"
fill_in "parent"... |
08c538c106ba3bff2b112f4cfcf5d5c86cff8975 | 18,748 | [
997921940
] | [
"phoenix",
"ecto",
"documented"
] | defmodule WhatsappCloneWeb.ConversationController do
use WhatsappCloneWeb, :controller
alias WhatsappClone.{Repo, Conversations, ConversationMember, Conversation, Message}
import Ecto.Query
require Logger
action_fallback WhatsappCloneWeb.FallbackController
@doc """
GET /api/users/:id/conversations
Li... |
08c5d151a2d558d1a5fc742f5432d6f95507e0dd | 15,312 | [
285782233
] | [
"typespec",
"documented"
] | # credo:disable-for-this-file
defmodule ExAliyunOts.TableStore.DeleteRowRequest do
@moduledoc false
defstruct table_name: nil,
primary_key: nil,
condition: nil,
return_content: nil,
transaction_id: nil
(
(
@spec encode(struct) :: {:ok, iodata} | {:error, ... |
08c5edcb02b8a89272d4061d1531da94655b0367 | 1,911 | [
98556704
] | [
"test",
"ecto"
] | defmodule Mithril.RoleAPITest do
use Mithril.DataCase
alias Mithril.RoleAPI
alias Mithril.RoleAPI.Role
@create_attrs %{name: "some name", scope: "some scope"}
@update_attrs %{name: "some updated name", scope: "some updated scope"}
@invalid_attrs %{name: nil, scope: nil}
def fixture(:role, attrs \\ @cre... |
08c6136b0e7f73355bd686aa761871bcb504d0b2 | 10,542 | [
64593313
] | [] | %{
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "he... |
08c62cb5052f361ccabaf115ca2e747ef7546e22 | 3,658 | [
143077854
] | [
"typespec",
"documented"
] | defmodule ExLimiter.Plug do
@moduledoc """
Plug for enforcing rate limits. The usage should be something like
```
plug ExLimiter.Plug, scale: 1000, limit: 5
```
Additionally, you can pass the following options:
- `:bucket`, a 1-arity function of a `Plug.Conn.t` which determines
the bucket for the ... |
08c6a61ec5d99029c319ea1e263f37bf540d956a | 1,595 | [
812674621
] | [
"supervisor",
"documented"
] | defmodule Lightwarrior.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl true
def start(_type, args) do
children = [
LightwarriorWeb.Telemetry,
{DNSCluster, query: Application.get_env(:lightwarr... |
08c6a84c9f46310c6c8f770dc441b5c126ee708f | 9,509 | [
350026487
] | [] | %{
"certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hexpm", "524c97b4991b3849dd5c17a631223896272c6b0af446778ba4675a1dff53bb7e"},
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mi... |
08c6b37ca63ca46eef0850141d09f015693125ad | 1,757 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2HumanAgentHandoffConfigSalesforceLiveAgentConfig do
@moduledoc """
Configuration specific to Salesforce Live Agent.
## Attributes
* `buttonId` (*type:* `String.t`, *default:* `nil`) - Required. Live Agent chat button ID.
* `deploymentId` (*t... |
08c6bf98e12b4d0045c2fc5ccc2c1f5aa49e06ab | 11,156 | [
529451757,
463405209,
563730500
] | [
"test"
] | defmodule Explorer.Token.InstanceMetadataRetrieverTest do
use EthereumJSONRPC.Case
alias Explorer.Token.InstanceMetadataRetriever
alias Plug.Conn
import Mox
setup :verify_on_exit!
setup :set_mox_global
@abi [
%{
"type" => "function",
"stateMutability" => "view",
"payable" => fals... |
08c6f62f006f3ccd378988e281e5d1e8e2862127 | 2,254 | [
92439386
] | [
"phoenix"
] | defmodule Ewms.ComponentController do
use Ewms.Web, :controller
alias Ewms.Component
alias Ewms.Border
plug :load_borders when action in [:new, :create, :edit, :update]
def load_borders(conn, _) do
query =
Border
|> Border.alphabetical
|> Border.names_and_ids
borders = Repo.all qu... |
08c6fd6ec2fe25599a8b48192b7e2c37ad5e865a | 9,790 | [
180210180
] | [
"test"
] | defmodule Mongo.BulkWritesTest do
use CollectionCase
require Logger
alias Mongo.BulkOps
alias Mongo.BulkWrite
alias Mongo.BulkWriteResult
alias Mongo.OrderedBulk
alias Mongo.UnorderedBulk
test "check unordered bulk", top do
coll = unique_collection()
bulk =
coll
|> UnorderedBulk.... |
08c709e5e54fc6dff7e7b0f6913e81b97aa62255 | 1,722 | [
117745207
] | [
"typespec"
] | defmodule Derivative do
@type literal() :: {:const, number()}
| {:const, atom()}
| {:var, atom()}
@type expr() :: {:add, expr(), expr()}
| {:mul, expr(), expr()}
| literal()
def test() do
expression = {:mul, {:mul, {:const, 5}, {:var, :x}}, {... |
08c7370f527b904849dd51792f716d01b91ae822 | 2,272 | [
380253561
] | [
"test"
] | defmodule WabanexWeb.SchemaTest do
use WabanexWeb.ConnCase, async: true
alias Wabanex.{User, Users.Create}
describe "users queries" do
test "when a valid id is given, returns user", %{conn: conn} do
params = %{email: "<EMAIL>", name: "Ariane", password: "123456"}
{:ok, %User{id: user_id}} = Cre... |
08c781f28e0b97e5889949b48d4d867b784b007f | 1,598 | [
36053943
] | [
"macro",
"documented",
"phoenix"
] | defmodule Acquainted.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Acquainted.Web, :controller
use Acquainted.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep... |
08c7a66245139196404e5bd38dd3f2a29aa5db35 | 2,537 | [
328472385
] | [
"ecto"
] | # Functional Core
# A Notify libary that is developed as a functional core.
#
# Design
# The Notify library uses sendgrid and slack
# If a notification for sendgrid or slack is enabled (stored in Settings) then the notification method is used
# There is a fail safe in monitor.scheduler.ex to turn off all notification... |
08c7b216e6ecd3771407351212224ceec6ca862e | 7,397 | [
96140037
] | [] | %{"benchee": {:hex, :benchee, "0.9.0", "433d946b0e4755e186fe564568ead4f593b0d15337fcffa95ed7d5b8a6612670", [:mix], [{:deep_merge, "~> 0.1", [hex: :deep_merge, repo: "hexpm", optional: false]}], "hexpm"},
"benchee_html": {:hex, :benchee_html, "0.3.1", "4f784a567f2999e28d36c13356495f455fad4fb88c66a9c2db60ab2b60d11479",... |
08c7bdc34441ca032cd87ff70e48f6ca6cbcdd1c | 4,239 | [
618745367
] | [
"documented",
"ecto"
] | defmodule Kuukuu.Forum do
@moduledoc """
The Forum context.
"""
import Ecto.Query, warn: false
alias Kuukuu.Repo
alias Kuukuu.Forum.Thread
alias Kuukuu.Forum.Post
@doc """
Returns the list of threads.
## Examples
iex> list_threads()
[%Thread{}, ...]
"""
def list_threads do
... |
08c82370f7ac54bf73d2979a2d4299984355e155 | 8,593 | [
829059969
] | [
"test"
] | defmodule BACnet.Test.Protocol.Services.AtomicReadFile do
alias BACnet.Protocol.APDU.ConfirmedServiceRequest
alias BACnet.Protocol.Constants
alias BACnet.Protocol.ObjectIdentifier
alias BACnet.Protocol.Services.AtomicReadFile
alias BACnet.Protocol.Services.Protocol, as: ServicesProtocol
require Constants
... |
08c87fbfc845d4e1abaeafe5b20e8d744364bae3 | 1,548 | [
123640390
] | [
"macro",
"test"
] | defmodule MixUnderTest do
use ExUnit.Case
defmacro mix_under(args, out, [do: code]) do
quote do
cwd = File.cwd!
try do
File.cd!(Path.expand("../example", __DIR__))
unquote(out) = System.cmd("mix", ["under"] ++ unquote(args))
unquote(code)
after
File.cd!(cwd)
... |
08c8b668adca059a2c521c5698a62cc87848fc85 | 3,700 | [
511978455
] | [
"typespec"
] | defmodule API.Webhooks do
alias API.Utils
@type webhook :: %{
name: String.t(),
uri: String.t(),
hook: String.t(),
format: String.t(),
enabled: boolean(),
http_verb: String.t(),
retries: integer(),
include_subaccounts: map(),
... |
08c9a24e5f61aed7cb5918d95c35bab1b791bd96 | 4,526 | [
944774752
] | [
"test"
] | defmodule ChessApp.Games.GameServerTest do
use ExUnit.Case
alias ChessApp.Games.GameServer
setup do
# Start a new game for each test
{:ok, game_id} = GameServer.create_game()
%{game_id: game_id}
end
describe "create_game/0" do
test "creates a new game with unique ID" do
{:ok, game_id1}... |
08c9aa90d5334647b6e2fc4ffe4cd1a6690feaef | 2,428 | [
75139810
] | [] | defmodule Point.MovementSearcherSpec do
use ESpec
import ServiceSpecHelper
alias Point.{AccountFactory, TransferService}
describe "search account movements before timestamp" do
let movements: described_module().search(for: account(), after: time())
let time: Timex.shift(Timex.now, minutes: -1)
let ... |
08ca11dc37ff944e7eb1ed362a38b6d6a047fcf1 | 12,684 | [
105913697
] | [
"ecto"
] | defmodule Skoller.Students.StudentAnalytics do
alias Skoller.Repo
alias Skoller.Users.User
alias Skoller.Students.Student
alias Skoller.Schools.School
alias Skoller.Sessions.Session
alias Skoller.CustomSignups.Signup
alias Skoller.CustomSignups.Link
alias Skoller.Periods.ClassPeriod
alias Skoller.Stud... |
08ca6f11298fe3a4cc30fac583b0be94a94aeb22 | 2,430 | [
500346992
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule IserverWeb 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 IserverWeb, :controller
use IserverWeb, :view
The definitions below will be executed for every view,
controller, ... |
08cab992606017964a28ad5772281d77470eacce | 1,634 | [
207896355
] | [
"documented"
] | defmodule CampfireWeb.YoutubeApi do
@moduledoc """
Handles Youtube API requests.
"""
@doc """
Takes a Youtube Video ID and obtains the video title, description and thumbnail url.
"""
def get_video_info(videoid) do
# The quota-limited Api Key used for all api queries. TODO: Provide this via deploymen... |
08cac7a2182f1a26dc222fafb9c012830833c15d | 2,001 | [
640293267
] | [
"phoenix",
"ecto"
] | defmodule SchoolApp.StudentsDomains do
import Ecto.Query, warn: false
alias SchoolApp.Repo
alias SchoolApp.Database.StudentDomain
use SchoolAppWeb, :verified_routes
def app_item_config do
%{
id: :students_domains,
# link: ~p"/students_domains",
icon: ["hero-user", "hero-square-3-stack-3... |
08cb665d6190d6d243eb425a0ceeb13e01623615 | 3,007 | [
435412495
] | [] | defmodule Naboo.Mixfile do
use Mix.Project
def project do
[
app: :naboo,
version: "0.4.1",
elixir: "~> 1.14",
erlang: "~> 24.1",
elixirc_paths: elixirc_paths(Mix.env()),
test_paths: ["test"],
test_pattern: "**/*_tests.exs",
test_coverage: [tool: ExCoveralls],
... |
08cb7bf1d58c179a63b6516d2fa464b636e15b2c | 1,891 | [
568124125
] | [
"test"
] | defmodule AdventOfCode.Day10Test do
use ExUnit.Case
import AdventOfCode.Day10
@input """
addx 15
addx -11
addx 6
addx -3
addx 5
addx -1
addx -8
addx 13
addx 4
noop
addx -1
addx 5
addx -1
addx 5
addx -1
addx 5
addx -1
addx 5
addx -1
addx -35
addx 1
addx 24
addx -19
... |
08cc4a1ccd565ced2d3d8dedb6a1a49f709c254c | 2,061 | [
185558207,
213229236,
1000104078,
982054619,
882572863,
217320195,
174991383,
807904878,
540729553,
771023416,
887377354
] | [
"phoenix",
"documented"
] | defmodule Pleroma.Web.MastodonAPI.DirectoryController do
use Pleroma.Web, :controller
import Ecto.Query
alias Pleroma.Pagination
alias Pleroma.User
alias Pleroma.UserRelationship
alias Pleroma.Web.MastodonAPI.AccountView
require Logger
plug(Pleroma.Web.ApiSpec.CastAndValidate)
plug(:skip_auth when... |
08cc83089c9d46d0b32f04866e95ca166d5a093f | 2,241 | [
603632154
] | [
"test"
] | defmodule MacrowExTest do
use ExUnit.Case
doctest MacrowEx
defmodule MyMacrowEx do
use MacrowEx
rules "hoge", fn ->
"ほげ"
end
rules "len", fn array ->
length(array) |> Integer.to_string()
end
rules "len_return_integer", fn array ->
length(array)
end
end
defmod... |
08cd007658d24f19ff9f58f80c631e6ae3326ed0 | 2,503 | [
405954616
] | [
"ecto"
] | defmodule ExDoubleEntry.AccountBalance do
use Ecto.Schema
import Ecto.{Changeset, Query}
alias ExDoubleEntry.{Account, AccountBalance}
schema "#{ExDoubleEntry.db_table_prefix()}account_balances" do
field(:identifier, ExDoubleEntry.EctoType.Identifier)
field(:currency, ExDoubleEntry.EctoType.Currency)
... |
08cda0bfd0504528681fa905cd5e6c0175708eb5 | 1,928 | [
433065520
] | [] | defmodule MembraneExample.LiveStream do
use Membrane.Pipeline
require Logger
alias Membrane.Element.Tee
alias Membrane.Audiometer.Peakmeter
alias Membrane.Element.Fake
@port 5000
@impl true
def handle_init(name) do
path = Path.join("priv/static/livestream", name)
File.mkdir_p!(path)
Proc... |
08ce17825120cd25d0d2734fb39ec928119db7d0 | 1,794 | [
92987871
] | [
"phoenix"
] | defmodule LawApi.DefendantController do
use LawApi.Web, :controller
alias LawApi.Defendant
#GET /api/v1/defendants
def index(conn, _params) do
defendants = Repo.all(Defendant)
render(conn, "index.json", defendants: defendants)
end
#POST /api/v1/defendants
def create(conn, %{"defendant" => defen... |
08ce414d38746de79a13f0944ebab932ae08cd0c | 6,048 | [
145966873
] | [
"documented"
] | defmodule CsGuide.Fixtures do
@moduledoc """
A module for defining drinks fixtures that can be used in tests.
This module can be used with a list of fixtures to apply as parameter:
use CsGuide.Fixtures
Fixtures.create_drinks()
"""
@spirits_premixed "Spirits & Premixed"
def create_venues do
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.