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 |
|---|---|---|---|---|
0856cabd55a7d1592fab27a95ed42ecb582be5ce | 3,120 | [
185686745
] | [
"typespec",
"documented"
] | defmodule OpenTelemetry.SemConv.Incubating.GraphqlAttributes do
# This is an auto-generated file
@moduledoc """
OpenTelemetry Semantic Conventions for Graphql attributes.
"""
@doc """
The GraphQL document being executed.
### Value type
Value must be of type `atom() | String.t()`.
### Notes
The va... |
08578fda698f58c7afd5c48affd767e7eaef2c32 | 8,262 | [
695000015
] | [] | defmodule StaticData do
defstruct monthly_cash: 10_000,
original_loan: 1_000_000,
interest_rate: 0.05,
investment_rate: 0.07,
years_to_calculate: 5,
tax_deduction_on_interest_payment: 0.3,
months_between_adjusting_interest_payments: 1
end
defmod... |
0857d8ee6abae0b88a55ee8e962c3cb3e23dd2a0 | 2,561 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.ContainerAnalysis.V1.Model.PackageOccurrence do
@moduledoc """
Details on how a particular software package was installed on a system.
## Attributes
* `architecture` (*type:* `String.t`, *default:* `nil`) - Output only. The CPU architecture for which packages in this distribution channel... |
0857deed99df534591cfffc5f8b41eb3676e85fe | 2,609 | [
726654311
] | [] | defmodule Aoc2023.Day3 do
def etl_input(part),
do: Aoc2023.day_from_module(__MODULE__) |> Aoc2023.read_input(part) |> process()
def part1(part \\ :ex1) do
etl_input(part)
|> find_part_numbers()
|> Enum.sum()
end
def part2(part \\ :ex2) do
etl_input(part)
|> find_gears()
|> Enum.sum... |
08580ff7bc237ff97e23004c3c1526d10ce11f0c | 4,086 | [
193244709
] | [
"typespec",
"documented"
] | defmodule GoogleApi.PaymentsResellerSubscription.V1.Model.GoogleCloudPaymentsResellerSubscriptionV1Promotion do
@moduledoc """
A Promotion resource that defines a promotion for a subscription that can be resold.
## Attributes
* `applicableProducts` (*type:* `list(String.t)`, *default:* `nil`) - Output only.... |
0858429f6aff4f715e89b9cfaf6f7d4d6bc3c8e7 | 3,107 | [
559259743
] | [
"genserver",
"liveview"
] | defmodule FilmelixirWeb.FilmsList do
use Phoenix.LiveView
alias Filmelixir.{Film,Repo}
import Ecto.Query
def mount(_params, _session, socket) do
FilmelixirWeb.Endpoint.subscribe("films")
films = Film |> Repo.all
IO.inspect(films)
film_to_watch = %Film{title: nil, genre: nil, id: nil}
socket ... |
0858fbb3f769c6724d1ab710fd0312851eabd88d | 3,574 | [
571372295
] | [
"documented"
] | defmodule NOAATides.CLI do
require Logger
import SweetXml
@moduledoc """
"""
def main(argv), do: argv |> parse_argv |> process
def hl_to_string('H'), do: "high"
def hl_to_string('L'), do: "low"
def process(%Optimus.ParseResult{args: _args, options: options, flags: flags} = cli_args) do
# Setup l... |
085951e870c898a675974037553cb56c0a0ed8f6 | 2,526 | [
177621656
] | [
"test"
] | defmodule SmartCity.TestDataGenerator.SchemaTest do
use ExUnit.Case
doctest SmartCity.TestDataGenerator.Schema
alias SmartCity.TestDataGenerator.Schema
test "basic schema" do
actual = Schema.get(:basic)
assert actual = %{
"schema" => [
%{
name: "id",
type: "integer",
... |
0859ad2a1a597dbb9e5e1a3947bd61c40b42b0a8 | 1,751 | [
191619540
] | [
"ecto"
] | defmodule Core.Repo.Migrations.CreateProgramMedications do
use Ecto.Migration
def change do
create table(:program_medications, primary_key: false) do
add(:id, :uuid, primary_key: true)
add(:reimbursement, :map)
add(:reimbursement_type, :string)
add(:reimbursement_amount, :numeric)
... |
085a12e8e199b4bbe7ed59adf747fe0743d6d9f5 | 7,432 | [
682357176
] | [
"phoenix",
"documented"
] | defmodule Pleroma.Web.StaticFE.StaticFEController do
use Pleroma.Web, :controller
alias Pleroma.Activity
alias Pleroma.Object
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Visibility
alias Pleroma.Web.Metadata
plug(:put_layout, :static_fe)
plug(:assign_id... |
085a35b6c52d4bf6d980760af4212e5297f9198b | 3,889 | [
135832997
] | [
"liveview"
] | defmodule Data.Article.Blog.EisenbahnbrueckeBovestrasse do
use Article.Default
def created_at(), do: ~D[2020-12-08]
def updated_at(), do: ~D[2022-01-10]
def title(), do: "Eisenbahnbrücke Bovestraße (Veloroute 7)"
def summary(), do: "1,85m breite Radfahrstreifen zwischen Bus- und KFZ-Spuren."
def start(),... |
085ac1373e957cf4b521bb14b3cab573adbaf4dd | 1,748 | [
61379459
] | [] | defmodule Cordial.Authorization do
alias Cordial.{
Notification,
CmsContext,
Authorization.Repo,
Utils
}
def confirm(cms_context \\ %CmsContext{}, user_id) do
if is_enabled(cms_context, user_id) do
new_context = cms_context
|> Map.put(:new_user_id, user_id)
|> CmsContext.set... |
085ac5a2b501829d2f47e593702ee90595847972 | 1,540 | [
722353776
] | [
"liveview",
"phoenix"
] | defmodule BarometerWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :barometer
# 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 [
store: :cookie,
key: "_barom... |
085addda8796a5b947332d677d2eac4b54d44c28 | 2,190 | [
196200304,
211097139,
19643959,
180274417
] | [
"documented"
] | defmodule Mix.Tasks.Compile.Leex do
use Mix.Task.Compiler
alias Mix.Compilers.Erlang
@recursive true
@manifest "compile.leex"
@switches [force: :boolean, verbose: :boolean, all_warnings: :boolean]
# These options can't be controlled with :leex_options.
@forced_opts [report: true, return: true]
@modul... |
085ae044d782b28738b486147f1e1de0b865642a | 2,984 | [
930313042
] | [
"phoenix"
] | defmodule TeammorWeb.Router do
use TeammorWeb, :router
use AshAuthentication.Phoenix.Router
import AshAuthentication.Plug.Helpers
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {TeammorWeb.Layouts, :root}
plug :protect_... |
085b68d4dfe699ae558d3f1d223f4175bbcdab7a | 13,019 | [
713786777
] | [
"documented",
"ecto"
] | defmodule Journey.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
require Logger
require Jason
alias Journey.Prospects.Client
alias Journey.Analytics.Visit
alias Journey.Analytics.Browsing
alias Ueberauth.Auth
alias Journey.Repo
alias Journey.Accounts.{User... |
085b6f6727f2b8a058e8f634b775e35b10ba6bdd | 3,702 | [
131585522
] | [
"test"
] | defmodule SnowplowTracker.SubjectTest do
use ExUnit.Case
alias SnowplowTracker.Subject
describe "set_user_id/2" do
test "sets the user_id in the subject object" do
expected_response = %{
"uid" => "UCANTSEEME"
}
response =
%Subject{}
|> Subject.set_user_id("UCANTSEE... |
085bc423c2cad2f7bb1ee5f21741182065e191e2 | 8,909 | [
394467538
] | [
"test"
] | defmodule Stellar.TxBuild.HashIDPreimageTest do
use ExUnit.Case
alias Stellar.TxBuild.SCAddress, as: TxSCAddress
alias Stellar.TxBuild.InvokeContractArgs, as: TxSorobanAuthorizedContractFunction
alias Stellar.TxBuild.SorobanAuthorizedFunction, as: TxSorobanAuthorizedFunction
alias Stellar.TxBuild.SorobanAuth... |
085bf83800c61e35d5e92feed28f4f09f98ab4c0 | 2,298 | [
132972743
] | [
"phoenix",
"documented"
] | defmodule BearingsWeb.AuthController do
use BearingsWeb, :controller
alias Bearings.Account
alias Bearings.OAuth.GitHub
alias OAuth2.Client
@doc """
This action is reached via `/auth/:provider` and redirects to the OAuth2 provider
based on the chosen strategy.
"""
def index(conn, %{"provider" => pro... |
085c091384ae221dcee50b3765116ca1ddaa5f5f | 2,871 | [
45964967
] | [] | defmodule Trueskill.Factors.DiffFactor do
import Trueskill.Factors.SumFactorBase
alias Trueskill.Gaussian.Distribution, as: Gaussian
def diff_teams(performances, is_reverse) do
diffs = Range.new(0, (Enum.count(performances) - 2))
|> Enum.to_list
|> Enum.map(fn(_) ->
%Trueskill.Variable{va... |
085c9f7f68b16ac0b9fefb81e5934752500fb508 | 3,905 | [
333296109
] | [
"test",
"ecto"
] | defmodule Menucard.MenuTest do
use Menucard.DataCase
alias Menucard.Menu
describe "items" do
alias Menucard.Menu.Item
@valid_attrs %{name: "some name", price: 42}
@update_attrs %{name: "some updated name", price: 43}
@invalid_attrs %{name: nil, price: nil}
def item_fixture(attrs \\ %{}) do... |
085cdfeaadbe34596f342e2e453f3200ff57a7d2 | 1,582 | [
425910508
] | [
"liveview",
"ecto"
] | defmodule PortalCmsWeb.AppLive.FormComponent do
use PortalCmsWeb, :live_component
alias PortalCms.Portal
@impl true
def update(%{app: app} = assigns, socket) do
changeset = Portal.change_app(app)
{:ok,
socket
|> assign(assigns)
|> assign(:changeset, changeset)}
end
@impl true
de... |
085d8260a8275cf1dd6b23fabcb56e31eed8c6e3 | 3,476 | [
724827491,
638016246,
99027669,
280606635,
948031587,
200856268,
409779960,
115758627,
176335991,
867834303,
904149057,
164238413,
186722326,
490104465,
514604379,
118121330,
776969847,
855718809,
631030613,
496790662,
718609993,
398417441
] | [
"test"
] | defmodule HandlerTest do
use ExUnit.Case
import Servy.Handler, only: [handle: 1]
test "GET /wildthings" do
request = """
GET /wildthings HTTP/1.1\r
Host: example.com\r
User-Agent: ExampleBrowser/1.0\r
Accept: */*\r
\r
"""
response = handle(request)
assert response == """
... |
085d9049c064bb6b99b32e4d824faefe95f343b4 | 2,170 | [
470382917
] | [
"test",
"ecto"
] | defmodule Demo.BlogpostsTest do
use Demo.DataCase
alias Demo.Blogposts
describe "blogposts" do
alias Demo.Blogposts.Blogpost
import Demo.BlogpostsFixtures
@invalid_attrs %{conteudo: nil, titulo: nil}
test "list_blogposts/0 returns all blogposts" do
blogpost = blogpost_fixture()
as... |
085e401358f6e172c722c5fde09756031be77aa5 | 2,891 | [
52929405
] | [] | # 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
# Configures the endpoint
config :draft_server, DraftServer.Endpoint,
url: [host: "... |
085e63d4cee6da2786e69020807412e1f4098810 | 1,868 | [
659887158
] | [
"documented",
"ecto"
] | defmodule Fresco.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias Fresco.Repo
alias Fresco.Accounts.Account
@doc """
Returns the list of accounts.
## Examples
iex> list_accounts()
[%Account{}, ...]
"""
def list_accounts do
Repo.all(Acc... |
085e8250959888a239360b921ddadd6d62b5b890 | 2,088 | [
814919812
] | [
"documented",
"ecto"
] | defmodule LivePoker.Games do
@moduledoc """
The Games context.
"""
import Ecto.Query, warn: false
alias LivePoker.Repo
alias LivePoker.Games.Game
@doc """
Returns the list of games.
## Examples
iex> list_games()
[%Game{}, ...]
"""
def list_games do
Repo.all(Game)
end
@do... |
085e852cb6d4a98799bc218e684c235a107d3876 | 2,356 | [
1006790683
] | [
"phoenix"
] | defmodule ProofieWeb.Router do
use ProofieWeb, :router
import ProofieWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {ProofieWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browse... |
085ed0c91ea899ddcf69ab35624f1acb36fee539 | 10,268 | [
433484844
] | [
"typespec",
"documented"
] | defmodule MockExAws do
@moduledoc """
Allow for controlling what is returned for a ExAws request.
"""
@spec request(ExAws.Operation.t(), keyword) :: term
def request(op, config_overrides \\ [])
def request(%{service: :s3, http_method: :delete, path: path}, _config_overrides) do
incoming_prefix = Appli... |
085ef10ef7bca64df10b372095908c7108320a48 | 12,191 | [
896441160
] | [] | defmodule Safari.Virtual.CesiumAsset do
use Ash.Resource,
domain: Safari.Virtual,
data_layer: AshPostgres.DataLayer,
extensions: [AshStateMachine, AshOban, AshGraphql.Resource]
# authorizers: [Ash.Policy.Authorizer]
alias Safari.Virtual.{
CesiumAssetArchiveZipDownload,
CesiumAssetBucketCrede... |
085efb9847153e52ab0fedc541a3b5ea328ea5b2 | 3,974 | [
174074244
] | [
"test",
"ecto"
] | defmodule Graphql.ProfileTest do
use Graphql.DataCase
alias Graphql.Profile
describe "users" do
alias Graphql.Profile.User
@valid_attrs %{job_title: "some job_title", username: "some username"}
@update_attrs %{job_title: "some updated job_title", username: "some updated username"}
@invalid_attr... |
085f20c08bbee016798d329f52ae5379e090afe8 | 2,596 | [
228270460
] | [
"test"
] | defmodule Challenges.One.Test do
use ExUnit.Case
alias Challenges.One
describe "poker_full_house/1" do
test "all tests" do
assert One.is_poker_full_house?(["A", "A", "A", "K", "K"]) == true
assert One.is_poker_full_house?(["3", "J", "J", "3", "3"]) == true
assert One.is_poker_full_house?... |
085fad1a484109b0875529ad112ef11d1fa6d043 | 3,320 | [
647244808
] | [
"phoenix"
] | defmodule RedixDemoWeb.PageController do
use RedixDemoWeb, :controller
defmodule Payload do
defstruct text: nil, weather: nil, location: nil
end
def status(conn, _params) do
case Redix.command(:redix, ["PING"]) do
{:ok, response} ->
render_home(conn, %Payload{text: "Redis Connection Stat... |
085fb239962609cf164a4e9e38815e588d93f735 | 1,514 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.PaymentsResellerSubscription.V1.Model.GoogleCloudPaymentsResellerSubscriptionV1YoutubePayload do
@moduledoc """
Payload specific to Youtube products.
## Attributes
* `accessEndTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The access expiration time for this line item.
*... |
085fcba12a65f8c7379bbf6f5e0e066b036e6a7a | 1,877 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Slides.V1.Model.Outline do
@moduledoc """
The outline of a PageElement. If these fields are unset, they may be inherited from a parent placeholder if it exists. If there is no parent, the fields will default to the value used for new page elements created in the Slides editor, which may depend o... |
08609d53f6ed0fb8c0e59ade254a045c12d0b96c | 2,895 | [
967739576
] | [
"test"
] | defmodule Day02.CubeTest do
use ExUnit.Case, async: true
import Day02.Cube
test "parse games" do
games =
Stream.uniq([
"Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green",
"Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue",
"Game 3: 8 green, 6 blue, 20 red;... |
0860ba207aa69a3b24524acea8a6bed862dc7a4e | 5,050 | [
366388694
] | [
"genserver",
"documented"
] | defmodule MessageContext do
@moduledoc """
This module maintain the required settings to achieve communication with the message broker, it also provides default semantic settings
"""
use GenServer
require Logger
@default_values %{
reply_exchange: "globalReply",
direct_exchange: "directMessages",
... |
0860d0e42c3267f30f899aacd1b511904eb833b6 | 2,019 | [
223679941,
248957590
] | [] | defmodule Welcome2Game.GameScorer do
alias Welcome2Game.{EstateMaker, State, Tableau}
def score(%State{player: tableau}) do
%Tableau{
plan1: plan1,
plan2: plan2,
plan3: plan3,
parka: parka,
parkb: parkb,
parkc: parkc,
pools: pools,
temps: temps,
estate1: es... |
0860ee7b3cb0421036eebe219c1994581097de39 | 1,525 | [
192407200
] | [
"documented"
] | defmodule Providers.Provider do
@moduledoc """
This behavior defines a Provider. Used as the value of a key/value pair (such as in a map) it can be executed to dynamically generate the value for that key.
A map like:
```
%{
id: "bob",
title: %{
provider: "Echo",
opts: %{value: "... |
086203585fb75dd53faa2abf3c7abd2a2ac9df61 | 2,160 | [
513431967
] | [
"genserver"
] | defmodule Dash.Scene.ColorTest do
use Scenic.Scene
alias Scenic.Graph
import Scenic.Primitives
require Logger
defp initial_graph(%Scenic.ViewPort{size: {width, height}}) do
spacing = div(height, 7)
text_spacer = -46
Graph.build(fill: :black, font: :roboto)
|> rectangle({width, spacing}, t: ... |
086210e558ec2510ba9f443d64c140591547cb3d | 11,287 | [
289124495
] | [
"documented",
"ecto"
] | defmodule BankingApi.Bank do
@moduledoc """
The Bank context.
"""
import Ecto.Query, warn: false
alias BankingApi.Repo
alias BankingApi.Accounts.User
alias BankingApi.Bank.{Account, Posting, Transaction}
@doc """
Gets an user account by name and lock it.
## Examples
iex> get_and_lock_acco... |
08623fa686e1971f506417cda4ed03a9ea771049 | 5,063 | [
713982780
] | [
"test"
] | defmodule Lista2Test do
use ExUnit.Case
doctest Lista2
test "maxi" do
assert Helper.maxi(1, 9) == 9
assert Helper.maxi(313, 9) == 313
assert Helper.maxi(0, 0) == 0
assert Helper.maxi(-1, -5) == -1
end
test "maior_venda" do
assert Lista2.maior_venda(0) == 33
assert Lista2... |
08625198006ff131e2724e082da11f4b6d81b351 | 4,372 | [
723859089
] | [
"documented"
] | defmodule AdventOfCode.Year2021.Day20 do
@moduledoc """
https://adventofcode.com/2021/day/20
"""
use AdventOfCode, year: 2021, day: 20
import Bitwise
# ===============================================================================================
# Input
# ============================================... |
08629de1b4ef3dc0689b5957a9985edc355bee98 | 1,592 | [
872600220
] | [
"supervisor",
"documented"
] | defmodule CreditEngine.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
topology = [
mnesia_multi_nodes: [
strategy: Cluster.Strategy.Epmd,
config: [ho... |
0862bb98b4a23e3ac30012e00a6994b01fb9b206 | 17,016 | [
895957273
] | [
"test",
"ecto"
] | defmodule Vmemo.AccountTest do
use Vmemo.DataCase
alias Vmemo.Account
import Vmemo.AccountFixtures
alias Vmemo.Account.{User, UserToken}
describe "get_user_by_email/1" do
test "does not return the user if the email does not exist" do
refute Account.get_user_by_email("<EMAIL>")
end
test "... |
0862f61852bc87d6de22ad7895c7dbf725b4e563 | 2,276 | [
104223581
] | [] | defmodule IcdCode.ICDCode.Codes_G45 do
alias IcdCode.ICDCode
def _G450 do
%ICDCode{full_code: "G450",
category_code: "G45",
short_code: "0",
full_name: "Vertebro-basilar artery syndrome",
short_name: "Vertebro-basilar artery syndrome",
category_name: "Vertebro-ba... |
0863200600e3ec36a02f99c9937f5fdb59d3765a | 1,882 | [
263684724
] | [] | defmodule Wacko.MixProject do
use Mix.Project
def project do
[
app: :wacko,
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(),
d... |
0863353674f83c78aa4fa99004cddf6c640901e5 | 2,457 | [
786751531
] | [
"test",
"ecto"
] | defmodule Syncapp.SyncedTablesTest do
use Syncapp.DataCase
alias Syncapp.SyncedTables
describe "synced_tables" do
alias Syncapp.SyncedTables.SyncTable
import Syncapp.SyncedTablesFixtures
@invalid_attrs %{table_name: nil, last_synced_datetime: nil}
test "list_synced_tables/0 returns all synced... |
0863470c70b6384b076b06e8e78831991b817e2f | 1,817 | [
282207368
] | [
"documented"
] | defmodule Islamic do
@moduledoc """
The `Islamic` calendar module.
"""
use Calendars, [
fields: [
year: integer,
month: 1..12,
day: 29..30
],
months: [
muharram: [1, "Muharram", 30],
safar: [2, "Safar", 29],
rabi_i: [3, "Rabi I (Rabi al-Awwal", 30],
rabi_i... |
08640f6c30f7ae526c9a762ae4b017ea7ef020d7 | 5,424 | [
117238872
] | [
"test"
] | defmodule AutoApi.UnitTypeStateTest do
use ExUnit.Case, async: true
doctest AutoApi.UnitType
alias AutoApi.UnitType
setup_all do
specs = Jason.decode!(File.read!("specs/misc/unit_types.json"), keys: :atoms)
{:ok, types: specs.measurement_types}
end
test "all/0" do
assert UnitType.all() == [
... |
08645bebc070f1c9ecbde5fe126389a993c5a5be | 1,587 | [
415463387
] | [
"liveview",
"ecto"
] | defmodule TaskyWeb.CategoryLive.FormComponent do
use TaskyWeb, :live_component
alias Tasky.Todos
@impl true
def update(%{category: category} = assigns, socket) do
changeset = Todos.change_category(category)
{:ok,
socket
|> assign(assigns)
|> assign(:changeset, changeset)}
end
@imp... |
08647421ba4c50e0f7777b26460e656049cd7fc6 | 2,121 | [
301112663
] | [
"test",
"phoenix"
] | defmodule EventPlatformWeb.InviteControllerTest do
use EventPlatformWeb.ConnCase
describe "index" do
setup [:create_event, :admin_user, :add_authentication_token]
test "lists all invites", %{conn: conn, event: %{id: event_id}} do
conn = get(conn, Routes.invite_path(conn, :index, event_id))
ass... |
08647eb0ac80916101880086133edc713e7d48f5 | 2,339 | [
96478554
] | [] | defmodule CenatusLtd.Mixfile do
use Mix.Project
def project do
[
app: :cenatus_ltd,
version: "0.0.1",
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
build_embedded: Mix.env() == :prod,
start_permanent: Mix... |
086491dcef44a1787b81e975cfe1018795dad1b2 | 1,785 | [
296043180
] | [
"test",
"phoenix"
] | defmodule CaseCsContactManagerWeb.UserControllerTest do
use CaseCsContactManagerWeb.ConnCase
alias CaseCsContactManager.Accounts
alias TestHelper.Jwt
@create_attrs %{token: Jwt.correct_token()}
@wrong_attrs %{token: Jwt.wrong_token()}
@invalid_attrs %{token: "bad value"}
@missing_attrs %{token: nil}
d... |
0864ef936aadb8ec6db832812e7fb56afb845c54 | 4,413 | [
186616380
] | [
"test"
] | defmodule OnesignalElixir.FilterTest do
use ExUnit.Case
alias OnesignalElixir.{Filter}
test "include last session filter" do
filters =
Filter.new()
|> Filter.last_session(">", "5.2")
refute Enum.empty?(filters)
assert Enum.all?(
filters,
&(&1 in [%{field: "last... |
086531e74b16c338eecd5f9c17caef977b3e2d9d | 2,880 | [
124292875
] | [
"test"
] | defmodule AstroquizWeb.StarControllerTest do
use AstroquizWeb.ConnCase
alias Astroquiz.Quizzes
@create_attrs %{constellation: "some constellation", description: "some description", formal_name: "some formal_name", popular_name: "some popular_name"}
@update_attrs %{constellation: "some updated constellation", ... |
08659f76fbdd313b189acb27905d8946ad3384bf | 7,230 | [
567653956
] | [
"test"
] | Code.require_file("../test_helper.exs", __DIR__)
defmodule IEx.InteractionTest do
use IEx.Case
test "whole output" do
assert capture_io("IO.puts \"Hello world\"", fn ->
IEx.Server.run(dot_iex_path: "")
end) =~
"Interactive Elixir (#{System.version()}) - press Ctrl+C to exi... |
0865a8950d7b8cd09762fb90458565ae7ee02c12 | 2,437 | [
107487861
] | [
"phoenix"
] | defmodule Limpet.PostController do
use Limpet.Web, :controller
alias Limpet.Post
alias Limpet.FormPost
def index(conn, _params) do
posts = Repo.all(Post)
render(conn, "index.html", posts: posts)
end
def new(conn, _params) do
changeset = FormPost.changeset(%FormPost{})
render(conn, "new.ht... |
0865c94c09a4d59b8f42d0ebbe41f64fa4c27c30 | 2,106 | [
1004272420
] | [
"documented",
"ecto"
] | defmodule Pollutiondb.Station do
@moduledoc false
use Ecto.Schema
require Ecto.Query
schema "stations" do
field :name, :string
field :lon, :float
field :lat, :float
has_many :readings, Pollutiondb.Reading
end
def insert_mock_data() do
[
%Pollutiondb.Station{
name: "Park... |
086686e8c903c84f3d29a87a7cd7c2a6950b3108 | 2,572 | [
994622434
] | [
"liveview"
] | defmodule SoljarWeb.HelpLive do
use SoljarWeb, :live_view
def render(assigns) do
~H"""
<div class="relative w-full px-6 py-12 mt-16 md:max-w-3xl md:mx-auto lg:max-w-4xl lg:pt-16 lg:pb-28">
<article class="px-2 prose prose-invert lg:px-12 lg:prose-xl">
<h2 phx-click={JS.toggle(to: "#wall... |
0866d75fe795ee6fb16243a51060b7c8662b4c0f | 2,107 | [
737254561
] | [
"test",
"ecto"
] | defmodule Rewards.AccountTest do
use Rewards.DataCase
alias Rewards.Account
describe "customers" do
alias Rewards.Account.Customer
import Rewards.AccountFixtures
@invalid_attrs %{email: nil, phone: nil}
test "get_customer_by_identifier!/1 returns the customer with given identifier" do
c... |
08674974722974c627d0f36cf1e62d6480bcf444 | 12,949 | [
113269269
] | [
"genserver"
] | defmodule SupervisorNode do
use GenServer
def counter(pid, node_id) do
GenServer.cast(pid, {:increase_counter, node_id})
end
def track(pid) do
GenServer.call(pid, :track)
end
def handle_call(:track, _from, messages) do
avg_hops = Enum.at(messages, 0) / Enum.at(messages, 1)
IO.puts avg_hop... |
08677dadd466d864b2ba0c319aad848fb4c56da3 | 4,164 | [
139148503
] | [
"liveview"
] | defmodule SafiraWeb.App.LeaderboardLive.Index do
use SafiraWeb, :app_view
alias Safira.{Contest, Event}
import SafiraWeb.App.LeaderboardLive.Components.{Leaderboard, DaySelector, Prizes}
@limit 10
@impl true
def mount(_params, _session, socket) do
daily_prizes = Contest.list_daily_prizes()
days... |
0867a778294dccc54722c06cf0cc2111912e0e8b | 1,707 | [
367912567
] | [
"phoenix"
] | defmodule NewphxWeb.Router do
use NewphxWeb, :router
pipeline :browser do
plug(:accepts, ["html"])
plug(:fetch_session)
plug(:fetch_flash)
plug(:protect_from_forgery)
plug(:put_secure_browser_headers)
end
pipeline :authorized do
plug :browser
plug NewphxWeb.AuthorizedPlug
end
... |
0867ade2ef2b5c6370a22748fb8bb3df6f63bd6f | 2,379 | [
457807167
] | [
"genserver",
"supervisor"
] | defmodule DynamicSupervisorTerminate.GenServer do
use GenServer
alias DynamicSupervisorTerminate.DynamicSupervisor, as: DSstate
require Logger
def start_link(args) do
{id, type} = {Map.get(args, :name), Map.get(args, :family)}
GenServer.start_link(__MODULE__, default(id, type), name: via(id, type))
e... |
0867c92dff751f66140d5b93f1e0c517f8994ba4 | 1,507 | [
244637741
] | [] | defmodule ElixirKeeb.UIWeb.Keyboard do
alias ElixirKeeb.UIWeb.Endpoint
@mix_env Mix.env()
@topic "keyboard"
def broadcast_log_message(log_message) do
Endpoint.broadcast(
@topic, "log", %{logMessage: log_message})
end
def broadcast_keypress(key) do
Endpoint.broadcast(
@topic, "keypres... |
086846cee35f9a9f8cd736f762e7995a9d62162a | 1,674 | [
293380959
] | [
"macro",
"documented",
"phoenix"
] | defmodule PlaymaMeSignalingWeb 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 PlaymaMeSignalingWeb, :controller
use PlaymaMeSignalingWeb, :view
The definitions below will be executed ... |
0868689f452c1639d8de47400306b619e1f05608 | 4,703 | [
999872074
] | [
"test",
"phoenix"
] | defmodule BywaterWeb.UserSessionControllerTest do
use BywaterWeb.ConnCase
import Bywater.AccountsFixtures
alias Bywater.Accounts
setup do
%{unconfirmed_user: unconfirmed_user_fixture(), user: user_fixture()}
end
describe "POST /users/log-in - email and password" do
test "logs the user in", %{conn... |
0868f58b43fd9a24c8c545faaf99a4be6b4b36c4 | 11,734 | [
808443482
] | [
"typespec",
"documented"
] | defmodule Teiserver.Account.RelationshipLib do
@moduledoc false
alias Teiserver.{Account, Config}
alias Teiserver.Account.AuthLib
alias Teiserver.Data.Types, as: T
alias Phoenix.PubSub
@spec colour :: atom
def colour(), do: :success
@spec icon :: String.t()
def icon(), do: "fa-users"
@spec icon_f... |
0868faf99feaa0a8f01a3a6accc22b58ab86ada3 | 3,292 | [
78321249
] | [
"documented",
"phoenix"
] | #run task with 'mix distill.html'
defmodule Mix.Tasks.Distill.Html do
use Mix.Task
import Plug.Test, only: [conn: 2]
alias Distill.PageRoute
@shortdoc "Generates static html files from pages and saves in given directory"
def run(_args) do
dest_dir = Distill.Directory.default_dest_directory
#create ro... |
08699ad3bb9ce6c9f49b438ae739ee961bebbd8a | 2,426 | [
648122236
] | [
"test",
"documented"
] | defmodule TelemetryTest do
@moduledoc """
For example usage please refer to [test/examples](https://github.com/highmobility/telemetry_test/tree/main/test/examples) directory
"""
use ExUnit.Case
alias TelemetryTest.Server
defguardp is_event(value) when is_list(value) and is_atom(hd(value))
@doc """
E... |
0869a1144b95c82fa2a47c5cc93863f16266d94a | 1,779 | [
63579504
] | [] | defmodule TokyoexHandsonMy.Crawler.Storage do
require Logger
def start_link do
Agent.start_link(fn -> Map.new end, name: __MODULE__)
end
def has_page?(url) do
Agent.get __MODULE__, fn map ->
Map.has_key?(map, url)
end
end
def put_page(url, pages) do
... |
086a264345cdeaf4c0b77b16a19d4631b45e3b5a | 1,588 | [
64495006
] | [
"macro",
"documented"
] | defmodule ExPing.Test.HTTPClient do
@moduledoc """
Mock HTTP client provides interface similar to `:httpc`.
"""
def request(url), do: request(:get, {url, []}, [], [])
def request(:head, {url, _}, _, _) do
cond do
String.contains?(to_string(url), "/200") ->
{:ok, {status_line(200), [], []}}
... |
086a759f4d985a8ddb2425329333d9470b42e394 | 2,491 | [
813902703
] | [
"documented",
"ecto"
] | defmodule LiveViewStudio.Volunteers do
@moduledoc """
The Volunteers context.
"""
import Ecto.Query, warn: false
alias LiveViewStudio.Repo
alias LiveViewStudio.Volunteers.Volunteer
def subscribe do
Phoenix.PubSub.subscribe(LiveViewStudio.PubSub, "volunteers")
end
def broadcast({:ok, volunteer}... |
086a9b6e926230b11ace5bb6c2fd6f6b0324d8b5 | 2,142 | [
221142834
] | [] | %{
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"},
"db_connection": {:hex, :db_connection, "2.1.1", "a51e8a2ee54ef2ae6ec41a668c85787ed40cb8944928c191280fe34c15b76ae5", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "he... |
086aa0903a3709060ec3bad874ca39f6b673916a | 1,527 | [
807634097,
59708985
] | [
"documented"
] | defmodule Nex.Opcodes.O6 do
@moduledoc """
ASL ASL Shift Left One Bit (Memory or Accumulator) ASL
+-+-+-+-+-+-+-+-+
Operation: C <- |7|6|5|4|3|2|1|0| <- 0
+-+-+-+-+-+-+-+-+ N Z C I D V
... |
086b4ccd539c528b4ee447a8da3cf21871f6ef9b | 9,138 | [
578029237
] | [
"phoenix"
] | defmodule Web.DashboardView do
use Web, :view
alias ChallengeGov.CertificationLogs
alias ChallengeGov.Accounts
alias ChallengeGov.MessageContextStatuses
alias Web.Endpoint
def recertification_warning(conn, user) do
case CertificationLogs.get_current_certification(user) do
{:ok, certification} ->... |
086bed4754c92b31bd9a9f1909e130cf526f684e | 1,689 | [
152257872,
144846781
] | [
"documented"
] | defmodule HolidayApp.Auth do
alias HolidayApp.Users
require Logger
@doc """
Performs user authentication depending on `auth` provider and credentials.
## Return values
* {:ok, %User{} = user}
* {:error, reason}
"""
def authenticate(auth)
def authenticate(%Ueberauth.Auth{provider: :identit... |
086bf6c6906a63413ea170b464ff170eff326b44 | 3,779 | [
285782233
] | [
"typespec",
"documented"
] | # credo:disable-for-this-file
defmodule ExAliyunOts.TableStoreTunnel.ShutdownResponse do
@moduledoc false
defstruct []
(
(
@spec encode(struct) :: {:ok, iodata}
def encode(msg) do
{:ok, encode!(msg)}
end
@spec encode!(struct) :: iodata
def encode!(_msg) do
[]
... |
086c02bacde9d1b22b1a39bacc45a89fd54ddd55 | 3,145 | [
209397546
] | [] | defmodule DungeonGenerator do
def new_dungeon(
repetitions \\ 10,
area_size \\ {100, 100},
max_room_size \\ {14, 14},
min_room_size \\ {4, 4}
) do
rooms =
Enum.reduce(0..repetitions, [], fn _x, acc ->
new_room = rectangle(area_size, min_room_size, max_room_size)... |
086c1d75ec99176202cbd9036cb86be4613e2bfe | 17,715 | [
121880823
] | [
"genserver",
"documented"
] | defmodule Peers.Coordinator do
@moduledoc """
Coordinates all peer-related activity for a single metafile download.
It is the main synchronization point for different modules.
Responsibilities:
1. handling announced peer information
2. initiating new PWP conversations
3. accepting incoming PWP con... |
086c21719a381da7f431ed7c1a1c240c40d357eb | 2,922 | [
942811655,
920024200
] | [
"macro",
"documented"
] | defmodule PublicAPI.Schemas.Common do
@moduledoc """
Schema to use for timestamps in the API.
"""
defmacro timestamp(title \\ "Timestamp", description \\ "Timestamp in ISO 8601 format") do
alias OpenApiSpex.Schema
quote do
%Schema{
title: unquote(title),
description: unquote(descr... |
086d16884027485c0743a56cdcd30331db6ef466 | 2,953 | [
340681999
] | [
"genserver"
] | defmodule LicServer do
use GenServer
require Logger
@active_lic_count 10
# Client
def start_link(_) do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
end
def get_license() do
GenServer.call(__MODULE__, :get_license, 60_000)
end
def return_license(lic) do
GenServer.cast(__MODULE... |
086d3dd2c8159052f67f8955eac00ef43b47b24f | 3,199 | [
310810277
] | [
"genserver"
] | defmodule :m_nteventlog do
use Bitwise
@behaviour :gen_server
require Record
Record.defrecord(:r_state, :state,
port: :undefined,
mfa: :undefined
)
def start_link(ident, mFA) do
:gen_server.start_link({:local, :nteventlog}, :nteventlog, [ident, mFA], [])
end
def start(ident, mFA) do
:... |
086d8f19123252f29e34c65427bce590b7ee616f | 2,888 | [
471568532
] | [
"test",
"phoenix"
] | defmodule SolfacilWeb.DevControllerTest do
use SolfacilWeb.ConnCase
import Solfacil.GithubFixtures
@create_attrs %{avatar_url: "some avatar_url", bio: "some bio", location: "some location", name: "some name", repos_url: "some repos_url", username: "some username"}
@update_attrs %{avatar_url: "some updated ava... |
086da7d0001c0ca939ee6f6b11462e9e925e5501 | 1,705 | [
48216982
] | [] | defmodule RecruitxBackend.SignUpEvaluatorSpec do
use ESpec.Phoenix, model: RecruitxBackend.SignUpEvaluator
alias Decimal
alias RecruitxBackend.InterviewRelativeEvaluator
alias RecruitxBackend.InterviewTypeRelativeEvaluator
alias RecruitxBackend.ExperienceMatrixRelativeEvaluator
alias RecruitxBackend.Role
... |
086e5b7ab71e4261e26d3f9ae385a998caa8e4b3 | 3,352 | [
838907457
] | [
"genserver",
"documented"
] | defmodule Electric.Postgres.Proxy.SASL.SCRAMLockedCache do
@moduledoc false
# Ripped almost entirely, without shame, [from
# Postgrex](https://github.com/elixir-ecto/postgrex/blob/cd684e7eb25201602c931fab98c9d64e5ae44b2a/lib/postgrex/scram.ex)
# SCRAM authentication requires expensive calculations
# that may... |
086f59ee4d70c50a8827dd950ba1e08c4238e0b3 | 2,450 | [
495780874
] | [] | import Config
# Configure your database
config :danubian_trade, DanubianTrade.Repo,
adapter: Ecto.Adapters.MyXQL,
username: "root",
password: "root",
database: "danubian_trade",
hostname: "localhost",
show_sensitive_data_on_connection_error: true,
pool_size: 10
# For development, we disable any cache an... |
087008d02a342e89780d63d86f7ea6f89a8136ef | 2,784 | [
858389646
] | [
"ecto"
] | defmodule Klepsidra.Repo.Migrations.CreateKnowledgeManagementNoteRelations do
use Ecto.Migration
def change do
create table(:knowledge_management_note_relations,
primary_key: false,
comment:
"Record of relations (edges) between note entities (nodes), with a specified re... |
0870b16791edd1b1babb3cb702ed7732a3acca2c | 1,756 | [
223773230
] | [
"documented"
] | defmodule AOC.Y2015.Day14 do
@moduledoc """
@see https://adventofcode.com/2015/day/14
"""
@format ~r'(\w+) .+ (\d+) km/s for (\d+) seconds, .+ (\d+) seconds.$'
@stats "priv/data/2015/day14.txt"
|> File.stream!()
|> Stream.map(fn line ->
case Regex.run(@format, line) do
... |
08716e11f6c296453a95fd41ce3292479ba4d501 | 2,099 | [
281158280
] | [] | defmodule Linear.Auth.GithubApp do
use OAuth2.Strategy
@api_url "https://api.github.com"
@apps_url "https://github.com/apps"
def client() do
OAuth2.Client.new(
strategy: __MODULE__,
client_id: fetch_env!(:client_id),
client_secret: fetch_env!(:client_secret),
redirect_uri: fetch_en... |
0871dd7a34a73723c81c2be9c848c39449df21b4 | 1,591 | [
306634903
] | [] | defmodule Plan.MissingParts do
### API ###
def evaluate(data), do: missing_parts_cost(data)
### RULES ###
def missing_parts_cost(data) do
c = completeness_cost(data.order.distributionchannelcode)
x = missing_part_tolerance(data.order.distributionchannelcode)
nb_items_in_order = get_items_qty(da... |
0872acf79e5071c8f7141f4245d0de626eccf57d | 2,591 | [
57448875,
55734142
] | [
"test"
] | defmodule Pxblog.CommentControllerTest do
use Pxblog.ConnCase
alias Pxblog.Comment
alias Pxblog.Factory
@valid_attrs %{author: "Some Person", body: "This is a sample comment"}
@invalid_attrs %{}
setup do
user = Factory.create(:user)
post = Factory.create(:post, user: user)
comment = Fac... |
0872b81b8d70b2af02d69a4e651fba9cb5389f94 | 2,117 | [
741087618
] | [
"documented"
] | defmodule ArchethicFAS.Route.V1.QuotesHistorical do
@moduledoc """
Return the latest quotes for given currencies
"""
alias ArchethicFAS.QuotesHistorical.Interval
alias ArchethicFAS.Quotes
alias ArchethicFAS.UCID
require Logger
import Plug.Conn
def init(opts), do: opts
def call(conn, _opts) do
... |
0872e210a9c62b2aab7f70faa648c862e6dab18b | 1,984 | [
114573182
] | [] | defmodule Hades.Mixfile do
use Mix.Project
def project do
[
app: :hades,
version: "0.0.1",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
start_permanent: Mix.env == :prod,
aliases: aliases(),
deps: deps... |
08734b794c8398097804309bc3595610cd56785f | 4,338 | [
833227405
] | [
"typespec",
"documented"
] | defmodule WandererApp.Map.Operations.Structures do
@moduledoc """
CRUD for map structures.
"""
alias WandererApp.Map.Operations
alias WandererApp.Api.MapSystem
alias WandererApp.Api.MapSystemStructure
alias WandererApp.Structure
require Logger
@spec list_structures(String.t()) :: [map()]
def list_... |
0873afb47cd44ee983cdecd130a9b30daa418c4a | 1,648 | [
360139006
] | [
"documented"
] | defmodule Day10 do
@moduledoc """
Documentation for `Day10`.
"""
def part1(grid) do
path_to_zero(grid)
|> Enum.reduce(MapSet.new(), fn trail, acc ->
MapSet.put(acc, {List.first(trail), List.last(trail)})
end)
|> Enum.count()
end
def part2(grid) do
path_to_zero(grid)
|> Enum.c... |
0873d58e2160cc3a33dd2c1614d5cc32abd230e9 | 3,707 | [
98356798,
177734036
] | [
"test"
] | Code.require_file "../../../installer/test/mix_helper.exs", __DIR__
defmodule PhoenixWeb.DupChannel do
end
defmodule Mix.Tasks.Phx.Gen.ChannelTest do
use ExUnit.Case
import MixHelper
alias Mix.Tasks.Phx.Gen
setup do
Mix.Task.clear()
:ok
end
test "generates channel" do
in_tmp_project "generat... |
0873f9338346a79b8c0f25e8c1591ac1f8aacfe5 | 3,140 | [
192407200
] | [
"test"
] | defmodule DiscoveryApi.RecommendationEngineTest do
use ExUnit.Case
use Placebo
alias SmartCity.TestDataGenerator, as: TDG
alias DiscoveryApi.RecommendationEngine
alias DiscoveryApi.Test.Helper
use DiscoveryApi.DataCase
import SmartCity.Event, only: [dataset_update: 0]
@instance_name DiscoveryApi.inst... |
0874061cf6e1aa4cc3f716e5fc2da1ab46841a59 | 2,038 | [
725864094
] | [
"documented",
"ecto"
] | defmodule MoviePlaylist.MoviePlaylists do
@moduledoc """
The MoviePlaylists context.
"""
import Ecto.Query, warn: false
alias MoviePlaylist.Repo
alias MoviePlaylist.MoviePlaylists.Movie
@doc """
Returns the list of movies.
## Examples
iex> list_movies()
[%Movie{}, ...]
"""
def li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.