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 |
|---|---|---|---|---|
0365ff0892e6bb8da45e654a9c92bcea166a4e49 | 4,972 | [
989917799
] | [
"test"
] | defmodule ExMCP.ClientRetryTest do
use ExUnit.Case, async: true
alias ExMCP.Client
alias ExMCP.Reliability.Retry
describe "retry functionality integration" do
test "client configuration with retry policies" do
# Test that client can be configured with retry policies
retry_policy = [max_attempt... |
03661d630a3fe27f9fb22e51ccd64f5adeeceb6e | 1,841 | [
136292379
] | [
"test"
] | defmodule ArkEcosystem.Client.API.BlocksTest do
use ExUnit.Case
import ArkEcosystem.Client.API.Blocks
import Tesla.Mock
@client ArkEcosystem.Client.new(%{
host: "http://127.0.0.1:4003/api",
nethash: "578e820911f24e039733b45e4882b73e301f813a0d2c31330dafda84534ffa23",
version:... |
03666fca56716944febdf5322d07ffd52888b517 | 11,434 | [
225483206
] | [] | Code.require_file("input_parser.exs", "../helpers")
Code.require_file("timed.exs", "../helpers")
defmodule Day5 do
defmodule Part1 do
def run_brute() do
InputParser.get_input_list_for_day(5, ",", true)
|> prep_for_do
|> do_the_thing(0, 1)
|> after_do
end
defp prep_for_do(input_list... |
0366d254b992e055ea7b9f71f0153de87c2d581f | 2,160 | [
885428538
] | [
"liveview",
"ecto"
] | defmodule MozWeb.ThreadLive.FormComponent do
use MozWeb, :live_component
alias Moz.Mozaic
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage thread records in your database.</:subtitle>
</.header>
<.simple_form
... |
0366ee96f6b13cee496619d3f67e9ee9bf88d697 | 8,213 | [
189251630
] | [
"test"
] | defmodule Dotcom.Utils.ServiceDateTimeTest do
use ExUnit.Case
use ExUnitProperties
import Mox
import Dotcom.Utils.DateTime, only: [coerce_ambiguous_date_time: 1]
import Dotcom.Utils.ServiceDateTime
import Test.Support.Generators.DateTime
import Test.Support.Generators.ServiceDateTime
setup :verify_on_... |
036721b2132b2dc6f7f77f5302805ac9e36043bd | 4,455 | [
501212508
] | [
"phoenix"
] | defmodule BebemayotteWeb.PageController do
use BebemayotteWeb, :controller
alias Bebemayotte.CatRequette
alias Bebemayotte.ProdRequette
alias Bebemayotte.SouscatRequette
alias Bebemayotte.PanierRequette
#----------------------------------------------------------PAGE PRODUITS-------------------------------... |
0367a101ad862e1a1825796e8e68c053d03fb837 | 3,270 | [
494616699
] | [
"documented"
] | defmodule Rarity do
@moduledoc """
Rarity algorithm logic
"""
alias Rarity.Cache
@trait_types ~w(Body Extras Eyes Face Head Items Mouth Sean)
@num_seanies 5_000
@trait_themes [
MapSet.new(["Civil War Beard", "Civil War Rifle", "Civil War Glasses", "Civl War Glasses", "Union Soldier Hat", "Union Sol... |
0367ede97f6b3835710c5250d25abbde236e1295 | 6,292 | [
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Compute.V1.Model.NetworkEndpointGroup do
@moduledoc """
Represents a collection of network endpoints. A network endpoint group (NEG) defines how a set of endpoints should be reached, whether they are reachable, and where they are located. For more information about using NEGs for different use c... |
03680be17730f1db824f8bdc6d561e68b2e1c3b8 | 5,132 | [
890537506
] | [] | defmodule Paxos do
def start(name, participants) do
if Process.whereis(name) do
Process.unregister(name)
end
pid = spawn(Paxos, :init, [name, participants])
case :global.re_register_name(name, pid) do
:yes -> pid
:no -> nil
end
end
def propose(pid, inst, value, timeout) ... |
03681a4b440ba5ddce2d9242e812b3254f56edf9 | 3,522 | [
827985656
] | [
"test"
] | defmodule BitGraphTest.Algorithms do
use ExUnit.Case
alias BitGraph.Common
alias BitGraph.Algorithms
alias BitGraph.V
test "Topsort for DAG" do
edges = [
{"2", "1"},
{"2", "0"},
{"2", "3"},
{"3", "0"},
{"3", "4"},
{"1", "5"},
{"4", "5"},
{"0", "5"}
]
... |
03686cbb8be22466305e2c261983bd86dd487809 | 2,390 | [
878185623
] | [
"test"
] | defmodule ServerTest do
use ExUnit.Case, async: true
setup do
Server.start_link(:test)
:ok
end
test "Create a New Review for a truck" do
assert :ok == Server.add_truck_review(:test, "Off the Grid Services, LLC", 8.5, "Anton Ego")
end
test "Create a New Review for a truck that doesnt exist" do... |
0368bb2281312b70f5c602d3362bb767d774c150 | 1,993 | [
744421640
] | [
"supervisor",
"documented"
] | defmodule EthereumJSONRPC.Application do
@moduledoc """
Starts `:hackney_pool` `:ethereum_jsonrpc`.
"""
use Application
alias EthereumJSONRPC.{IPC, RequestCoordinator, RollingWindow}
alias EthereumJSONRPC.Utility.{EndpointAvailabilityChecker, EndpointAvailabilityObserver}
@impl Application
def start(... |
0368eb1b161fbdcee13c1c1c6af4079f4b049ed8 | 1,704 | [
218722075
] | [
"phoenix",
"ecto"
] | defmodule TimesheetsWeb.UserController do
use TimesheetsWeb, :controller
alias Timesheets.Users
alias Timesheets.Users.User
def index(conn, _params) do
users = Users.list_users()
render(conn, "index.html", users: users)
end
def new(conn, _params) do
changeset = Users.change_user(%User{})
... |
036908330d88b1f0a1aced25fca324fc9f6e8fbb | 2,300 | [
409254740
] | [
"test",
"ecto"
] | defmodule HappyTree.PlantsTest do
use HappyTree.DataCase
alias HappyTree.Plants
describe "plants" do
alias HappyTree.Plants.Plant
@valid_attrs %{casual_name: "some casual_name", image_url: "some image_url", slug: "some slug"}
@update_attrs %{casual_name: "some updated casual_name", image_url: "some... |
0369c520324ade0f51b9e7cf3924c6796b4cb502 | 2,766 | [
746452863
] | [
"test",
"ecto"
] | defmodule ApiApp.AccountTest do
use ApiApp.DataCase
alias ApiApp.Account
describe "users" do
alias ApiApp.Account.User
import ApiApp.AccountFixtures
@valid_attrs %{username: "some_username", is_active: true, password: "some_password"}
@update_attrs %{
username: "some_updated_username",
... |
036aeba31ececc11d04f5e9815246a1d9cd9da81 | 3,795 | [
30761273
] | [] | defmodule DevelopmentSetup.Config.ConfigFiles.ScssLint do
def content do
'
# Default application configuration that all configurations inherit from.
scss_files: "**/*.scss"
linters:
BangFormat:
enabled: true
space_before_bang: true
space_after_bang: false
BorderZero:
enabled: true
conve... |
036b27d0d964642b126eac7bbea95a9f39a26de3 | 1,746 | [
287135377
] | [
"test"
] | defmodule AwsParameterStoreConfigProviderTest do
use ExUnit.Case
import Mock
setup_with_mocks([
{ExAws, [], [request!: fn _ -> %{"Parameter" => %{"Value" => "ok"}} end]}
]) do
:ok
end
describe "resolve secrets" do
test "single string path" do
assert [{:app, [some_key: "ok"]} | _] =
... |
036b57113dcc636efd32d6b3b2f185284ab7d363 | 3,177 | [
190765579
] | [
"typespec",
"macro",
"documented"
] | defmodule ExHttpMicroservice.Client do
@moduledoc """
Use this module to declare an interface to an external service.
Specify the connection options by overriding functions.
## Examples
defmodule MyUserApiClient do
use ExHttpMicroservice.Client
# Determines whether requests are made over... |
036b6f5b9ba65acaf9f3682e22a1baa2de7e7157 | 12,752 | [
41227823,
44181278,
75696014,
41243642
] | [
"supervisor",
"documented",
"ecto"
] | defmodule Ecto do
@moduledoc ~S"""
Ecto is split into 3 main components:
* `Ecto.Repo` - repositories are wrappers around the database.
Via the repository, we can create, update, destroy and query existing entries.
A repository needs an adapter and a URL to communicate to the database
* `Ecto.... |
036b95787093d812f94b617f1b8848c48e11fb48 | 6,055 | [
985853139
] | [
"typespec"
] | # Generated by Mochi compiler v0.10.26 on 2025-07-16T14:09:08Z
defmodule Main do
@testCases [
%{"base" => 10, "begin" => "1", "end" => "100", "kaprekar" => ["1", "9", "45", "55", "99"]},
%{"base" => 17, "begin" => "10", "end" => "gg", "kaprekar" => ["3d", "d4", "gg"]}
]
@spec parseIntBase(String.t(), inte... |
036bc4fefb7ab974bfae95c88c7ab235526c472d | 2,296 | [
220098356
] | [] | defmodule BaseBlog.Posts do
import Ecto.Query, warn: false
alias BaseBlog.Repo
alias BaseBlog.Posts.Post
alias BaseBlog.Posts.Tag
alias BaseBlog.Posts.LinkPostTag
alias Helper.PaginationHelper
# Post
defp post_query() do
from p in Post,
join: a in assoc(p, :author),
left_join: pt in LinkPostTag, on: p.... |
036cf69cc9819684fe6692b56686cd720ffeed5c | 1,680 | [
581007504
] | [
"liveview"
] | defmodule WingManagerWeb.UserForgotPasswordLive do
use WingManagerWeb, :live_view
alias WingManager.Accounts
def render(assigns) do
~H"""
<div class="mx-auto max-w-sm">
<.header class="text-center">
Forgot your password?
<:subtitle>We'll send a password reset link to your inbox</:s... |
036d082c94c4b2baca134c8326cea079652aa55f | 2,273 | [
123491655
] | [
"test"
] | defmodule FixMyLifeWeb.ListControllerTest do
use FixMyLifeWeb.ConnCase
alias FixMyLife.Goals
alias FixMyLife.Goals.List
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
def fixture(:list) do
{:ok, list} = Goals.create_list(@create_attrs)
... |
036d4a4e1858b4e725ed8798244f52f1afe92edc | 1,561 | [
1015807564
] | [
"liveview",
"phoenix"
] | defmodule KDSWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :kds
# 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: "_kds_key",
sig... |
036e0e869436b27b16ae939481033f394e22a725 | 2,656 | [
211781131
] | [
"phoenix"
] | defmodule Menu.DemandController do
use Menu.Web, :controller
alias Menu.Demand
def index(conn, _params) do
user_team = current_team(conn)
query = from u in Demand, order_by: [u.id], where: u.team_id == ^user_team.id
demands = Repo.all(query) |> Repo.preload([:product])
case get_format(conn) do
... |
036ea8b2bcab49167c9213a066fac74a2531f704 | 2,641 | [
681252658
] | [
"test",
"liveview"
] | defmodule NappyWeb.CacheMountedImagesTest do
use ExUnit.Case, async: true
use NappyWeb.ConnCase
alias Nappy.Catalog.Collection
alias Nappy.CatalogFixtures
import Ecto.Query, warn: false
import Phoenix.LiveViewTest
import Nappy.CatalogFixtures
setup do
payload =
Enum.map(1..5, fn num ->
... |
036ebe559c5c14a6c727b2302402966c382578c5 | 2,338 | [
712391766
] | [
"documented"
] | defmodule FoodFromHome.Orders.Services.SetDeliveredStatusAndAddDeliveryTimeToDeliveryAndProduceDeliveryCompletedEvent do
@moduledoc """
When a deliverer delivers an order, the status of the order is changed to :delivered.
Simultaneously the corresponding delivery record is updated with the delivery time.
Then a... |
036f11bd9ed01985f99fc3815f116289f8d17ee8 | 5,848 | [
123528600
] | [
"typespec",
"documented",
"ecto"
] | defmodule OMG.WatcherInfo.DB.Transaction do
@moduledoc """
Ecto Schema representing a transaction
"""
use Ecto.Schema
use Spandex.Decorators
require Logger
alias OMG.Utils.Paginator
alias OMG.Watcher.Utxo
alias OMG.WatcherInfo.DB
require Utxo
import Ecto.Query, only: [from: 2, where: 2, where: ... |
037060ce52ee377156701aac979ab2199f24ea90 | 2,893 | [
797959850
] | [
"typespec",
"documented"
] | defmodule ExSeedify do
@moduledoc """
ExSeedify keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
@names ExSeedify.Services.ListNamesFromFile.call()
alias ExSeed... |
0370c3aefd903b607743452dfa74dacf16ea735e | 2,275 | [
1017722512
] | [] | import Config
# Configure the database for test
config :auth_service, AuthService.Repo,
username: "postgres",
password: "postgres",
database: "auth_service_test#{System.get_env("MIX_TEST_PARTITION")}",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 50,
max_overflow: 100,
show_sensit... |
03713e7efb54471e91a15c6894bf1756fdf628b3 | 1,872 | [
343272451
] | [
"test"
] | defmodule AppWeb.AccountsControllerTest do
use AppWeb.ConnCase, async: true
alias Ecto.UUID
alias App.{Account, User}
describe "deposit/2" do
setup %{conn: conn} do
params = %{
name: "Thales",
password: "123456",
nickname: "tata",
email: "<EMAIL>",
age: 24
... |
03714c3d8516874f013694c3587db288d58e7938 | 4,175 | [
399045494
] | [] | # 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 :azimutt,
business_name: "Azimutt",
seo_ti... |
03716191882d93c76514e03796aa34e208b6bc4b | 1,975 | [
84061404
] | [] | %{"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], []},
"db_connection": {:hex, :db_connection, "1.1.1", "f9d246e8f65b9490945cf7360875eee18fcec9a0115207603215eb1fd94c39ef", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, optional: false]}, {:... |
03718bae38124088a49334f2c4f53d4485cc998d | 8,306 | [
79822986
] | [] | %{"bamboo": {:hex, :bamboo, "0.8.0", "573889a3efcb906bb9d25a1c4caa4ca22f479235e1b8cc3260d8b88dabeb4b14", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: false]}, {:poison, ">= 1.5.0", [hex: :poison, optional: false]}]},
"bamboo_smtp": {:hex, :bamboo_smtp, "1.3... |
03725d7b6eafd9a6a971da741ef92b692f0c1655 | 4,218 | [
573285530
] | [] | defmodule Aoc.Y2022.Day14 do
use Aoc.Day
answers do
part_1 961
part_2 26375
end
input do
handle_input fn input ->
acc =
input
|> String.split("\n")
|> Enum.reduce(%{}, fn path, acc ->
path
|> String.split(" -> ")
|> Enum.map(fn coord ->
... |
03728ef1b466cbf99605a2cb8e8ef416c3879c82 | 14,800 | [
67251634
] | [
"macro",
"test",
"ecto"
] | defmodule Ecto.RepoTest do
use ExUnit.Case, async: true
import Ecto.Query
import Ecto, only: [put_meta: 2]
require Ecto.TestRepo, as: TestRepo
defmodule MySchema do
use Ecto.Schema
schema "my_schema" do
field :x, :string
field :y, :binary
field :z, :string, default: "z"
fiel... |
0372e0a5edd4eed81e172b4402ac2b00115828c1 | 3,035 | [
57978790
] | [
"documented"
] | defmodule Grafana.Dashboard do
use Grafana.API
@path "/api/dashboards"
@doc """
Get the home dashboard
iex> {:ok, dash} = Grafana.Dashboard.home
...> Map.keys(dash)
["dashboard", "meta"]
iex> {:ok, dash} = Grafana.Dashboard.get
...> Map.keys(dash)
["dashboard", "meta"]
"""
def ho... |
03731a8bc49a4f0eebf20290ad61524ad221752e | 3,704 | [
433929203
] | [] | defmodule Day16P2 do
def solve(filename) do
File.read!(filename)
|> String.trim()
|> String.graphemes()
|> Enum.map(
&hex_to_binary(&1)
|> String.graphemes()
)
|> Enum.flat_map(fn x -> x end)
|> parse_input()
end
defp parse_input(input, opts_read \\ 0, ops_to_re... |
03734c918afdbfba98f7493b0c93d821ad0e5024 | 3,606 | [
94881643
] | [
"phoenix"
] | defmodule Healthlocker.OxleasAdhd.Caseload.UserController do
use Healthlocker.Web, :controller
use Timex
alias Healthlocker.SleepTracker
alias Healthlocker.{User, Goal, Post, OxleasAdhd.ServiceUser, Room, Answer}
def show_teacher(conn, %{"su_id" => su_id, "room" => room_id, "teacher" => teacher_id}) do
t... |
03735080778fba4b43ac73917ffcaba6043c380c | 2,056 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1SchemaModelevaluationMetricsBoundingBoxMetrics do
@moduledoc """
Bounding box matching model metrics for a single intersection-over-union threshold and multiple label match confidence thresholds.
## Attributes
* `confidenceMetrics` (*type:* `lis... |
03749909b2d8733346e731c0005ae2f9d36d5678 | 2,567 | [
75433872
] | [
"test"
] | defmodule AdventOfCode2016.BathroomSecurityTest do
use ExUnit.Case
doctest AdventOfCode2016.BathroomSecurity
import AdventOfCode2016.BathroomSecurity
describe "day 2 - part 1" do
test "can move in all directions" do
assert move(:normal, "R", "1") == "2"
assert move(:normal, "D", "3") == "6"
... |
0374b1ff166f815689bc7354aef66471f9419228 | 1,631 | [
318395450
] | [] | defmodule AdventOfCode202004.A do
def read_data() do
File.read!("input.txt")
|> String.trim()
|> String.split(~r/[\n ]/)
end
def read_csv() do
File.read!("input.txt")
|> String.trim()
|> String.split("\n")
end
def test_data() do
[
]
end
# cid (Country ID)
def valid?(... |
037512c82d09be8e3641fc8e3001ce18e7b2feb3 | 3,483 | [
117610516
] | [
"documented"
] | defmodule ExTwitter.Parser do
@moduledoc """
Provides parser logics for API results.
"""
@doc """
Parse tweet record from the API response json.
"""
def parse_tweet(object) do
tweet = struct(ExTwitter.Model.Tweet, object)
user = parse_user(tweet.user)
%{tweet | user: user}
end
@doc """
... |
037526e7f33c1cf9894d16f84875d3a7c7a9a829 | 2,803 | [
833663685
] | [
"phoenix"
] | defmodule AdminSiteDemoWeb.Router do
use AdminSiteDemoWeb, :router
import AdminSiteDemoWeb.UserAuth
import Backpex.Router
alias Live.PostLive
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {AdminSiteDemoWeb.Layouts, :root... |
03756adc6282ae5cac2f5ea8b4b4f840b5a9d481 | 7,643 | [
158683678
] | [
"macro"
] | defmodule StoreHall.DefaultFilter do
import StoreHall.FilterAcceptedOptions
import Ecto.Query, warn: false
alias StoreHall.Users
@accepted_fields [:id, :inserted_at, :updated_at, :name]
def sort_filter(query, nil), do: query |> order_by([{:asc, :inserted_at}])
def sort_filter(query, -1), do: query |> order... |
0375af5f10247df56107220d2a4e6c5ead79c04f | 2,724 | [
226252445
] | [
"documented"
] | defmodule Thirteen.Play do
@moduledoc """
API to play game.
"""
alias Thirteen.{Game, Thirteen}
def new(name), do: {:ok, Thirteen.new(name)}
def new_test_game(name), do: {:ok, Thirteen.new_test_game(name)}
def join(%Game{state: state} = game, name) when state != :join do
case game |> Game.player_exi... |
0375c50ecb6eb48fd10380451341b70e1a31fad7 | 2,061 | [
76979851
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
alias Cerbas.General
# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded... |
0376a82bf8393aea104b6a70955f1894132ce68f | 1,651 | [
128100236
] | [
"documented",
"ecto"
] | defmodule Imdbae.Chats do
@moduledoc """
The Chats context.
"""
import Ecto.Query, warn: false
alias Imdbae.Repo
alias Imdbae.Chats.Room
@doc """
Returns the list of rooms.
## Examples
iex> list_rooms()
[%Room{}, ...]
"""
def list_rooms do
Repo.all(Room)
end
@doc """
G... |
0376edee7578b24373d80f508fde8456f0e28615 | 1,545 | [
597235199
] | [] | defmodule ExVisa.MixProject do
use Mix.Project
@version "0.2.1"
@repo "https://github.com/OAsat/visa_elixir"
def project do
[
app: :ex_visa,
version: @version,
elixir: "~> 1.14",
description: "Use VISA(Virtual Instrument Software Architecture) in Elixir",
start_permanent: Mix... |
03774c5b6af6ee2897204831d8cea1817f8d94b1 | 4,160 | [
108863412
] | [
"typespec",
"documented"
] | defmodule Ark_Elixir.Transaction do
@moduledoc """
Operations for Transactions.
"""
@doc """
Get a single transaction.
## Examples
iex> Ark_Elixir.Transaction.get_transaction("a38dc6b9e6679be706d5b39eef7dd0a7a10011e63da7623082106d90834e23e1")
%{"success" => true,
"tran... |
0377d6fbbec05495376d04dc60fd4e469f2e2da1 | 2,387 | [
854557312
] | [
"liveview",
"ecto"
] | defmodule FithubWeb.TargetAreaLive.FormComponent do
use FithubWeb, :live_component
alias Fithub.Track
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage target_area records in your database.</:subtitle>
</.header>
... |
0377dd5774ec0198e561fd852070387c3d4e725e | 3,160 | [
100904346
] | [
"documented"
] | defmodule Tracer.Event do
@moduledoc """
Defines a generic event
"""
defstruct event: nil
# def to_string(event) do
# "#{inspect event}"
# end
defimpl String.Chars, for: Tracer.Event do
def to_string(event) do
"#{inspect event}"
end
end
def format_ts(ts) do
{{year, month, day... |
03783f3078e47a11811790fa976527cdcccaf612 | 1,602 | [
46719141
] | [
"genserver"
] | defmodule TexasHoldem.RoomChannel do
use TexasHoldem.Web, :channel
def join("rooms:lobby", payload, socket) do
if authorized?(payload) do
Process.flag(:trap_exit, true)
# :timer.send_interval(5000, :ping)
send(self, {:after_join, payload})
{:ok, socket}
else
{:error, %{reason:... |
0378e9b74731eeba0a576f7162238f1ca77daca2 | 1,613 | [
158501854
] | [
"typespec",
"documented"
] | defmodule Melog.TestUtils do
@moduledoc """
Test utilities
"""
import Melog.Factory
alias MelogWeb.Schema
alias MelogWeb.UserQueries
alias Melog.ExperienceAPI
alias Melog.FieldApi
# @utc_tz "Etc/UTC"
# @iso_extended "{ISO:Extended:Z}"
@doc """
Convert a Timex utc to local time zone
"""
de... |
0379040a6630f6ea8ea155e9bfc7500f258ffe7b | 2,337 | [
719293862
] | [
"liveview"
] | defmodule AshActivityPlannerWeb.ActivityGroupLive.FormComponent do
use AshActivityPlannerWeb, :live_component
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage activity_group records in your database.</:subtitle>
</.header... |
0379088413c313ee12e5cbe65b577d70ec1282a9 | 16,895 | [
937609519
] | [
"test",
"ecto"
] | defmodule ContextKit.CRUDTest do
use ExUnit.Case, async: false
alias ContextKit.Author
alias ContextKit.Book
alias ContextKit.Books
alias ContextKit.Test.Repo
setup do
Repo.delete_all(Book)
Repo.delete_all(Author)
:ok
end
describe "query_{:resource}/0-1" do
test "simple query" do
... |
03791997c145baf59ae7bf55bb587664acb88ba3 | 2,910 | [
273945317
] | [] | %{
"certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"},
"cowlib": {:hex, :cowlib, "2.6.0", "8aa629f81a0fc189f261dc98a42243fa842625feea3c7ec56c48f4ccdb55490f", [:re... |
03792921d384992f33d59c0565f829f965e6077e | 1,548 | [
161256383
] | [] | defmodule Aoc.Year2021.Day13 do
use Aoc.DayBase
def part_one(input) do
{points, [fold | _rest]} = parse_input(input)
points
|> do_fold(fold)
|> Enum.count()
end
def part_two(input) do
{points, folds} = parse_input(input)
Enum.reduce(folds, points, fn fold, points -> do_fold(points, fo... |
037969b434ececf9133fc389615fe11be4a5d138 | 2,299 | [
1006216534
] | [] | # 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 :blocks_analytics,
ecto_repos: [BlocksAnalyt... |
037abcd77122148fc932fbc76e69e7b14797da48 | 3,713 | [
859249071
] | [
"phoenix",
"ecto"
] | defmodule TaksoWeb.BookingController do
use TaksoWeb, :controller
import Ecto.Query, only: [from: 2]
alias Takso.{Repo}
alias Takso.Sales.{Taxi, Booking, Allocation}
alias Ecto.{Changeset, Multi}
# We added this function to handle the GET query to "/bookings/new" as
# specified by the router. If you run ... |
037ae9df534e845814ddb1e317278f9c6b24eb18 | 1,512 | [
407482156
] | [] | # 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.
# General application configuration
use Mix.Config
import Config
config :quantum,
ecto_repos: [Qu... |
037af8f0e575a3144a701250722c77a933e440ab | 1,949 | [
61420243
] | [] | defmodule PhoenixExample.Mixfile do
use Mix.Project
def project do
[app: :phoenix_example,
version: "0.0.1",
elixir: "~> 1.3",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :pr... |
037bc0bf636491dc672b28066f097a34e78e6b89 | 2,562 | [
51779078
] | [
"typespec",
"macro",
"documented"
] | defmodule ExFabricators.Builder do
@moduledoc """
Defines a fabricators builders.
Builder provides a set of macroses for defining fabricators.
Also provides functional for running fabricators.
The result of building is a one or a bunch of structs.
This builder can be useful in ExUnit tests when you need t... |
037c00ecf0c0634b70be251edc52c946138060dd | 3,176 | [
318945858
] | [
"test"
] | defmodule Pleroma.Web.MastodonAPI.MastodonAPITest do
use Pleroma.Web.ConnCase
alias Pleroma.Notification
alias Pleroma.ScheduledActivity
alias Pleroma.User
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.MastodonAPI.MastodonAPI
import Pleroma.Factory
describe "follow/3" do
test "returns error when ... |
037c42d4104d19feabfe453de43eb263a1185370 | 6,424 | [
680481530
] | [
"documented",
"ecto"
] | defmodule AllThingsSocial.Influencers.InfluencerToken do
use Ecto.Schema
import Ecto.Query
alias AllThingsSocial.Influencers.InfluencerToken
@hash_algorithm :sha256
@rand_size 32
# It is very important to keep the reset password token expiry short,
# since someone with access to the email may take over ... |
037c4a31c06c72abe82afb0f682507e5ba5fd835 | 6,238 | [
118192826
] | [
"typespec",
"documented"
] | defmodule Shoehorn.Handler do
@moduledoc """
A behaviour module for implementing handling of failing applications
A Shoehorn.Handler is a module that knows how to respond to specific
applications going down. There are two types of failing applications.
The first is an application that fails to initialize and... |
037c904419cae2f973e1fc71c7ce9982ab264894 | 2,567 | [
974780375
] | [
"liveview"
] | defmodule CampusXchangeWeb.AuctionLive.Show do
use CampusXchangeWeb, :live_view
@impl true
def mount(%{"id" => id}, _session, socket) do
auction = get_auction(id)
if connected?(socket) do
# Subscribe to auction updates
Phoenix.PubSub.subscribe(CampusXchange.PubSub, "auction:#{id}")
end
... |
037cad35cf414bf992d4729b31b4c3b2fc0248a9 | 1,894 | [
160306538
] | [
"documented"
] | defmodule Mix.Tasks.Farmbot.Firmware.Slack do
@moduledoc "Upload a firmware to slack."
@shortdoc "Upload firmware to slack."
use Mix.Task
import Mix.Tasks.Farmbot.Env
def run(opts) do
token = slack_token()
{keywords, comment, _} =
opts |> OptionParser.parse(switches: [signed: :boolean, channe... |
037cb48e283a071bf6c615490ac5b524daaef858 | 4,915 | [
338724299
] | [
"test",
"phoenix"
] | defmodule MvpApiWeb.WasteMaterialsControllerTest do
use MvpApiWeb.ConnCase
# alias MvpApi.Environment
# alias MvpApi.Environment.WasteMaterials
# @create_attrs %{
# amount: "120.5",
# environmental_burden: "120.5",
# maximum_admitted_standard: "120.5",
# overload_level: "120.5",
# price: "... |
037d2604d0a3b47dd53a977bda95b28f122b49f0 | 15,441 | [
1002196417
] | [
"typespec",
"documented"
] | defmodule SnmpKit.SnmpSim.MIB.BehaviorAnalyzer do
# Suppress warnings for private functions that are only called internally
@dialyzer [
{:nowarn_function, finalize_behavior: 1},
{:nowarn_function, determine_final_behavior: 4},
{:nowarn_function, determine_behavior_by_type: 2},
{:nowarn_function, gen... |
037d3c48a2f6bae13a4fd07057fb113a331aca62 | 1,788 | [
98587100
] | [] | defmodule MyList do
def len([]), do: 0
def len([_head | tail]), do: 1 + len(tail)
def square([]), do: []
def square([head | tail]), do: [head * head | square(tail)]
def add1([]), do: []
def add1([head | tail]), do: [head + 1 | add1(tail)]
def map([], _func), do: []
def map([head | tail], func), do: [... |
037d7ade84ae7d546b9e421bbaecda615cb0e5dc | 8,602 | [
822149439
] | [
"typespec",
"documented"
] | defmodule OpenAPIClient.Operations do
@moduledoc """
Provides API endpoints related to operations
"""
@base_url "https://example.com"
@doc """
Test endpoint
Test endpoint
## Arguments
* `path_param`: ["path-param"] Path parameter
* `required_header`: ["X-Required-Header"] Required header pa... |
037d86ed7fa846d028c4e3af7c84034018d24186 | 5,254 | [
351091707
] | [] | defmodule KnnNx do
alias NimbleCSV.RFC4180, as: CSV
import Nx.Defn
def main do
filewriter = fn (filename, data) ->
File.open(filename, [:append])
|> elem(1)
|> IO.binwrite(data)
end
{x_train, y_train, x_test, _y_test} = get_parsed_CSV()
x_input = Nx.tensor(Enum.at(x_test, ... |
037dc5ffe9a472b05fe6d07fe44a14adbe9f55af | 6,972 | [
49388648
] | [
"documented"
] | defmodule Euler.Set4 do
alias Euler.ExtAPI.{LispAPI,
JavaAPI,
CAPI}
alias Euler.Sets
@moduledoc """
Set4 houses solutions to problems 31 - 40.
"""
@doc """
31) Coin Sums
In England the currency is made up of pound, £, and pence, p, and there are eight coins ... |
037dd9f1242071afbf047bbcb121fe6f8429fa8a | 2,196 | [
28567849
] | [
"documented"
] | defmodule Issues.CLI do
@moduledoc """
CLI parsing and dispatch to functions that will generate the
issues table for the last _n_ issues of a github project
"""
# try
# mix run -e 'Issues.CLI.run(["elixir-lang", "elixir", "10"])'
# mix run -e 'Issues.CLI.run(["elixir-lang", "elixir"])'
@default_co... |
037e3020088e086cdb381c40d69e90c28a3a1a9a | 1,686 | [
826063302
] | [
"typespec"
] | defmodule GoChampsScoreboard.Events.Definitions.UpdatePlayerInTeamDefinition do
@behaviour GoChampsScoreboard.Events.Definitions.DefinitionBehavior
alias GoChampsScoreboard.Events.Models.Event
alias GoChampsScoreboard.Games.Models.GameState
alias GoChampsScoreboard.Games.Games
alias GoChampsScoreboard.Games.... |
037eda410068e1ef38ec2821c3967eeea3dd6b11 | 5,729 | [
175995267
] | [] | %{
"accept": {:hex, :accept, "0.3.3", "548ebb6fb2e8b0d170e75bb6123aea6ceecb0189bb1231eeadf52eac08384a97", [:rebar3], [], "hexpm"},
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"},
"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88... |
037f02666a8d60cca821052e9b5095f080721094 | 2,062 | [
149292201
] | [] | defmodule KoobaServer.Mixfile do
use Mix.Project
def project do
[
app: :kooba_server,
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(... |
037f3ff3b344433172b19a70c2eb7a60c7a72200 | 1,603 | [
960436116
] | [
"documented",
"ecto"
] | defmodule HaloElixirApp.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
alias HaloElixirApp.Repo
alias HaloElixirApp.Accounts.User
@doc """
Returns the list of users.
"""
def list_users do
Repo.all(User)
end
@doc """
Gets a single user.
"""
def ge... |
037fb76dcee13299f73586fe531a3c1e89fde12f | 2,322 | [
437779616
] | [] | defmodule Day9.M2 do
def get_at(_data, x, _y) when x < 0, do: 10
def get_at(_data, _x, y) when y < 0, do: 10
def get_at(data, x, _y) when x >= length(data), do: 10
def get_at(data, x, y) do
size = length(Enum.at(data, 0))
case y do
^size -> 10
_ -> data |> Enum.at(x) |> Enum.at(y)
end
... |
037fc2a955a607d123ed3fafde9c9ff5461bb3e7 | 1,601 | [
58332703,
56457926
] | [
"documented"
] | defmodule Inflex do
@doc """
Camelizes or pascalizes strings and atoms.
## Examples
iex> Inflex.camelize(:upper_camel_case)
"UpperCamelCase"
iex> Inflex.camelize("pascal-case", :lower)
"pascalCase"
"""
defdelegate [camelize(word), camelize(word, option)], to: Inflex.Camelize
@doc... |
03805db2a71362dfa13753c6f1ab320a2bb23335 | 1,710 | [
279185217
] | [] | defmodule Realbook.MixProject do
use Mix.Project
def project do
[
app: :realbook,
version: "0.3.1",
elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
test_coverage: [tool: ExCoveralls],
preferred_cli_env:
[coveralls: :test,
"coveralls.detail": :test,
... |
0380ff3cd04ab81f55b2ef23e7474273c42fdc89 | 2,595 | [
386041866
] | [
"test",
"phoenix"
] | defmodule CoverflexApiWeb.UserControllerTest do
use CoverflexApiWeb.ConnCase
alias CoverflexApi.Benefits
alias CoverflexApi.Benefits.User
@create_attrs %{
balance: 120.5,
username: "some username"
}
@update_attrs %{
balance: 456.7,
username: "some updated username"
}
@invalid_attrs %{b... |
038126255e540f8da2e515fe6cd7eb22e73ba61e | 3,041 | [
84469281
] | [
"macro"
] | # File: Wok.Request.ex
# This file was generated from wok_request.beam
# Using rebar3_elixir (https://github.com/botsunit/rebar3_elixir)
# MODIFY IT AT YOUR OWN RISK AND ONLY IF YOU KNOW WHAT YOU ARE DOING!
defmodule Wok.Request do
def unquote(:"custom_data")(arg1) do
:erlang.apply(:"wok_request", :"custom_data",... |
03813665448e0f38a4249fb6fa2e156b0d411791 | 3,621 | [
725971743
] | [] | defmodule AdventOfCode.Day11 do
@universe_expansion 999_999
def input(test? \\ false) do
if test? do
"""
...#......
.......#..
#.........
..........
......#...
.#........
.........#
..........
.......#..
#...#.....
"""
else
Adve... |
03817e52a903a87f44e8221f17a92b37c09a89a5 | 2,716 | [
257719992
] | [
"genserver",
"typespec",
"documented"
] | defmodule FirebaseAuthVerifier.CertificateManager do
@moduledoc """
A SourceSigner that caches the [`Joken.Signer(s)`](`Joken.Signer`) according to
the max-age of the cache header of the response.
Done according to:
https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_a_third-p... |
038282c947d9b663c8120dc4ebc0a79ef22181d2 | 1,638 | [
168148853
] | [] | # Daniel Yung (lty16) Tim Green (tpg16)
defmodule Broadcast4 do
def main do
args = for arg <- System.argv, do: String.to_integer(arg)
reliability = Enum.at(args, 0)
num_peers = Enum.at(args, 1)
# spawn peers
peers = Enum.map(0..num_peers - 1, fn x ->
spawn(Peer, :start, [x, num_peers, sel... |
0382ebdbafefa5d8696c42d5173a97bd7251e9a7 | 2,814 | [
732592134
] | [
"phoenix",
"ecto"
] | defmodule TsObanWeb.SuperheroDailyStatisticsController do
use TsObanWeb, :controller
alias TsOban.SuperheroDailyStatistic
alias TsOban.SuperheroDailyStatistic.SuperheroDailyStatistics
def index(conn, _params) do
superhero_daily_statistics = SuperheroDailyStatistic.list_superhero_daily_statistics()
ren... |
0383758b30eeab14b2639d2996ad68f20e59f039 | 14,267 | [
308172757
] | [
"documented"
] | defmodule EXLA do
@moduledoc """
[Google's XLA](https://www.tensorflow.org/xla/) (Accelerated Linear Algebra) compiler/backend for Nx.
It supports just-in-time (JIT) compilation to GPU (both CUDA and ROCm) and TPUs.
## XLA binaries
EXLA relies on the `XLA` package to provide the necessary XLA binaries.
W... |
0383796385c2e6ded56fccecdf0743029995aa70 | 3,178 | [
837319868
] | [
"macro",
"documented"
] | defmodule Gnat.Server do
require Logger
@moduledoc """
A behavior for acting as a server for nats messages.
You can use this behavior in your own module and then use the `Gnat.ConsumerSupervisor` to listen for and respond to nats messages.
## Example
defmodule MyApp.RpcServer do
use Gnat.Ser... |
03837e728e113f9519b0bb1ecfaf48290d775a51 | 10,475 | [
46594870
] | [] | %{
"blinkchain": {:hex, :blinkchain, "1.0.0", "0bef4296c0fc3e36c153d717eefcaf5fa6681b4c81f3f5b98030e8044d3d3fe1", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"},
"dns": {:hex, :dns, "2.1.2", "81c46d39f7934f0e73368355126e4266762cf227ba61d5889635d83b2d64a493",... |
0384ff0a17ba029ff85c61c5550effaec920a5dd | 3,305 | [
708400545
] | [] | defmodule NervesContainersBananapiM1.MixProject do
use Mix.Project
@github_organization "nerves-containers"
@app :nerves_containers_bananapi_m1
@source_url "https://github.com/#{@github_organization}/#{@app}"
@version Path.join(__DIR__, "VERSION")
|> File.read!()
|> String.trim()
def... |
038559c93c3d6fe6c4aba9e691aec68ef2c4b4de | 5,670 | [
287626345
] | [
"typespec",
"documented"
] | defmodule Mobius.Validations.ActionValidations do
@moduledoc """
Validation utilities for actions
## Validator types
### :any
Any value.
### :string
Any string.
### {:string, keyword()}
A string with options. The supported options are:
- min: The minimum length of the string. Defaults to 0.
... |
038585b7819322529fccaa87e43f74ceedcd6cba | 1,818 | [
239822890,
419435907,
459291087
] | [
"liveview"
] | defmodule OliWeb.Grades.UpdatesTableModel do
alias OliWeb.Common.Table.{ColumnSpec, SortableTableModel}
use Phoenix.Component
def new(updates, ctx) do
inserted_at_spec = %ColumnSpec{
name: :inserted_at,
label: "Date/Time",
render_fn: &OliWeb.Common.Table.Common.render_date/3,
sort_fn:... |
03858715396790cd353ec30a44cce7b9d58269ae | 17,688 | [
564335846
] | [] | %{
"bcrypt_elixir": {:hex, :bcrypt_elixir, "3.3.1", "9f2e7e00f661a6acfae1431f1bc590e28698aaecc962c2a7b33150dfe9289c3d", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "9f539e9d3828fad4ffc... |
038700ce6b5f76868abe80f7c8551d789b0cd9ae | 1,768 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.StorageTransfer.V1.Model.EventStream do
@moduledoc """
Specifies the Event-driven transfer options. Event-driven transfers listen to an event stream to transfer updated files.
## Attributes
* `eventStreamExpirationTime` (*type:* `DateTime.t`, *default:* `nil`) - Specifies the data and ti... |
0387493b0cf700f3104aa564279df6ed12d6a4e3 | 12,007 | [
161220340
] | [
"genserver",
"test",
"documented"
] | defmodule ZenMonitor.Proxy.Test do
@moduledoc """
Tests for the ZenMonitor.Proxy module
"""
use ExUnit.Case
alias ZenMonitor.Proxy
alias ZenMonitor.Proxy.{Batcher, Tables}
alias ZenMonitor.Test.Support.Subscriber
# Batchers stop when their subscriber goes DOWN, this tag tells ExUnit to suppress stops ... |
0387676b346728425bb7cc4be196c4e4e2f8530c | 2,538 | [
457126994
] | [
"test",
"phoenix"
] | defmodule ApiWeb.MeowControllerTest do
use ApiWeb.ConnCase
import Api.ContentsFixtures
alias Api.Contents.Meow
@create_attrs %{
content: "some content",
image_url: "some image_url"
}
@update_attrs %{
content: "some updated content",
image_url: "some updated image_url"
}
@invalid_attrs... |
03880b5230179aa9219afa52d5fad0e044dc7598 | 2,266 | [
105072768
] | [
"genserver",
"documented"
] | defmodule RiemannxTest.Servers.UDP do
@moduledoc """
A simple UDP server that forwards messages received back to the test process
"""
alias Riemannx.Proto.Msg
alias Riemannx.Settings
use GenServer
@behaviour RiemannxTest.Server
# =========================================================================... |
03886002877dd2e0d6ba05c04738da01f8cbd51d | 5,799 | [
80143296
] | [
"documented"
] | defmodule JodelClient do
@moduledoc """
This is a basic client implementation of the Jodel API.
"""
@endpoint_v2 "https://api.go-tellm.com/api/v2/"
# JodelApp client version
# Major version has been set to "9", which is not the actual major version
# See current Android version here:
# https://play.g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.