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
02e8bc21a0a47d30d939042c7c757b4cfcfea2b9
6,078
[ 285782233 ]
[ "typespec", "documented" ]
# credo:disable-for-this-file defmodule ExAliyunOts.TableStore.BatchGetRowResponse do @moduledoc false defstruct tables: [] ( ( @spec encode(struct) :: {:ok, iodata} | {:error, any} def encode(msg) do try do {:ok, encode!(msg)} rescue e in [Protox.EncodingError...
02e96849a49da38c10e65fb7643c60dba3e325f0
1,539
[ 191612022 ]
[ "test" ]
defmodule GraphQL.DatabaseIDsMiddlewareTest do use GraphQL.ConnCase, async: true import Core.Factories alias Absinthe.Relay.Node setup context do conn = put_scope(context.conn, "legal_entity:read") {:ok, %{conn: conn}} end describe "database IDs middleware" do test "success on entity lists"...
02ea3a7d19cc340e8fb3932a7431c90e9333f136
1,748
[ 60487004 ]
[ "test" ]
defmodule FFNerd.WeeklyRankingTest do use ExUnit.Case # import FFNerd.WeeklyRanking doctest FFNerd.WeeklyRanking @client FFNerd.Client.new("test") setup_all do HTTPoison.start end # NOTE: Tests are disabled due to missing test data from FFNerd. # test "Return a list of all weekly ranking record...
02ea6b969afd06468280e58b63c64cb93385b1be
4,244
[ 471617373 ]
[ "macro", "test" ]
defmodule Mix.Tasks.Trogon.TypeProvider.ListTest do use ExUnit.Case import ExUnit.CaptureIO alias Mix.Tasks.Trogon.TypeProvider.List, as: ListTask test "lists type mappings for a valid TypeProvider" do output = capture_io(fn -> ListTask.run(["Trogon.TypeProvider.TestSupport.AccountTypeProvi...
02ea6d7a1f9f16376608e9418d0cbc3a118d03f1
2,167
[ 30997399 ]
[ "test" ]
defmodule Phoenixskeleton.AssetsControllerTest do use Phoenixskeleton.ConnCase alias Phoenixskeleton.Assets @valid_attrs %{gfsid: "some content", name: "some content"} @invalid_attrs %{} setup %{conn: conn} do {:ok, conn: put_req_header(conn, "accept", "application/json")} end test "lists all entri...
02eaaf464834ad300114eaaae3a08f002d4ca003
4,406
[ 909515614 ]
[ "liveview" ]
defmodule CivicsWeb.TransitLive.SearchComponent do use CivicsWeb, :live_component alias Civics.Properties @impl true def mount(socket) do socket = assign_new(socket, :assessments, fn -> [] end) |> assign_new(:routes, fn -> [] end) |> assign_new(:assessment, fn -> nil end) |> assign_...
02ebd8391956978324b54d68f2de72aaa9cf11a4
1,526
[ 271156947 ]
[ "test" ]
defmodule NimbleTemplate.Addons.MimicTest do use NimbleTemplate.AddonCase, async: false describe "#apply!/2" do @describetag mock_latest_package_versions: [{:mimic, "1.3.1"}] test "injects mimic to mix dependency", %{ project: project, test_project_path: test_project_path } do in_tes...
02ebea88ad4712c66aa39e28e1afe87b68deceb6
3,197
[ 238230407 ]
[ "typespec", "documented" ]
# To an agent, an object is the set of perceptions it imparts. defmodule Activation do defstruct percept: nil, confidence: nil, # e.g. data: MovingAverageRecord data: nil end defmodule Automata.Perceptory.Activation do @moduledoc """ Activation represents the dynamic activatio...
02ec4507c646b873e288f9c08d91bf62abe45794
1,856
[ 407445749 ]
[]
defmodule Elrondex.Transaction.TransactionOnBlock do alias Elrondex.Transaction.{TransactionOnBlock} alias Elrondex.{Struct} defstruct data: nil, destinationShard: nil, epoch: nil, # gasLimit: nil, gasPrice: nil, hash: nil, miniblockHash: ni...
02ec4698872c23493fa0352c3e67b711deb9de3d
8,493
[ 286127393 ]
[ "test" ]
defmodule ShapeshifterTest do use ExUnit.Case describe "new/1" do test "handles valid rawtx in hex format" do assert {:ok, %Shapeshifter{format: :tx} = shifter} = Shapeshifter.new(TestTx.rawtx) assert %BSV.Tx{} = shifter.src end test "handles valid rawtx in binary format" do rawtx =...
02ec95778e4103cc91d4e6388807604a08d6e7fe
2,355
[ 825443197 ]
[]
import Config # Configure your database config :product_app, ProductApp.Repo, username: "postgres", password: "pass", hostname: "localhost", database: "product_app_dev", show_sensitive_data_on_connection_error: true, pool_size: 10, stacktrace: true # For development, we disable any cache and enable # de...
02ece4f3a74a9779b41f1b43ab18cb62c026d11f
2,188
[ 124121925 ]
[ "typespec", "documented" ]
if Code.ensure_loaded?(Plug) do defmodule BtrzAuth.Plug.VerifyAudiences do @moduledoc """ Looks for and validates that the passed `audiences` are present in the private data under `conn.private.user_aud` saved by `BtrzAuth.Plug.VerifyToken` (the order of the plugs is very important!) If the audience...
02ed466742be25591ccc0549d7676bd6c568a0d3
3,107
[ 319456543 ]
[]
defmodule Day4 do def part1 do File.read!('day4.txt') |> String.split("\n", trim: true) |> Enum.map(&String.replace(&1, "[", "")) |> Enum.map(&String.replace(&1, "]", ":00")) |> Enum.map(&String.split(&1, " ")) |> Enum.map(&parse_time/1) |> Enum.sort_by(fn dt -> {hd(dt).year, hd(dt).month,...
02ed799d57c706abdc8cec213206c6369991e772
4,067
[ 832312910 ]
[ "documented", "ecto" ]
defmodule LivreWeb.SSO do @moduledoc """ Handle every SSO related actions """ require Logger use Livre.Repo.Query, schemas: [Livre.Repo.User] use Phoenix.VerifiedRoutes, endpoint: LivreWeb.Endpoint, router: LivreWeb.Router def valid_provider?(provider) do existing_providers = Appl...
02ed86f8aa9d8cd7540771ae9b6641b862637dbc
3,335
[ 228075441 ]
[ "phoenix" ]
defmodule TurnosWeb.DayController do use TurnosWeb, :controller use PhoenixSwagger alias Turnos.Days alias Turnos.Days.Day action_fallback TurnosWeb.FallbackController def swagger_definitions do %{ Day: swagger_schema do title("Day") description("A day") p...
02edf49325af30106715ad177173d31c4934ab15
3,493
[ 686920461 ]
[ "documented", "ecto" ]
defmodule FinAnalyzer.Transactions do @moduledoc """ The Transactions context. """ import Ecto.Query, warn: false alias FinAnalyzer.Repo alias FinAnalyzer.Transactions.Transaction @doc """ Returns the list of transactions. ## Examples iex> list_transactions(user, filters) [%Transactio...
02ee6ce918bad7bca2ddefa04ddff8e22e98d963
2,036
[ 723732298 ]
[ "documented", "ecto" ]
defmodule Movies.Distributors do @moduledoc """ The Distributors context. """ import Ecto.Query, warn: false alias Movies.Repo alias Movies.Distributors.Distributor @doc """ Returns the list of distributors. ## Examples iex> list_distributors() [%Distributor{}, ...] """ def list_...
02ee84c25b30068fe5bd7ce1678fbfdac04b03af
4,253
[ 225416545 ]
[ "documented", "ecto" ]
defmodule EzCoinsApi.Finances do @moduledoc """ The Finances context. """ alias Ecto.{Changeset, Multi} import Ecto.Query, warn: false alias EzCoinsApi.Repo alias EzCoinsApi.Finances.Donation alias EzCoinsApi.Finances.Wallet @doc """ Returns the list of donations. ## Examples iex> list...
02eeb19ffc973b40217c9aaa2985a35887a2acea
2,485
[ 433939055 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule PhoenixPathWeb 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 PhoenixPathWeb, :controller use PhoenixPathWeb, :view The definitions below will be executed for every view, ...
02eed86506cb57fe95084ad69e86a753757dd85b
1,857
[ 861432872, 601542502 ]
[]
# Modified by Szymon Kubica (sk4520) Feb 2023 defmodule Scout do # ____________________________________________________________________ Setters defp add_pvalues(self, pvalues) do %{self | pvalues: MapSet.union(self.pvalues, pvalues)} end defp remove_acceptor_from_waitfor(self, a) do %{self | waitfor: ...
02ef428024160e3680bee8aee15f465e556ae7e7
1,855
[ 208653737 ]
[ "documented" ]
defmodule Kvstore.Router do @moduledoc """ Реализуем CRUD API через методы POST, GET, PUT, DELETE create, read, update, delete """ use Plug.Router use Plug.Debugger require Logger alias Plug.Conn.Query, as: Qw plug(Plug.Logger, log: :debug) plug(:match) plug(:dispatch) post "/create" do ...
02ef67036a98668becdd811e24999ba4c11a4745
3,450
[ 572912397 ]
[]
defmodule DaySeven do def build_dir_tree do File.read!("input.txt") |> String.split("\r\n") |> Enum.filter(&(&1 != "")) |> Enum.reduce( %{ root: %{ children: %{}, size: 0 }, current_path: [] }, fn line, acc -> case line do ...
02ef894f484d7c94e19cd031accf5ad90469580f
1,576
[ 452455078 ]
[]
# Will be using `ANSI` Application.put_env(:elixir, :ansi_enabled, true) # Letting people know what iex.exs they are using IO.puts( # <> IO.ANSI.blink_slow() IO.ANSI.magenta_background() <> IO.ANSI.bright() <> IO.ANSI.underline() <> "Using global .iex.exs (located in ~/.iex.exs)" <> IO.ANSI.reset() ) ...
02f04bb1d80cd824b824312f5b5d2323dbad1a37
4,967
[ 68940403, 574868280 ]
[ "macro", "documented", "ecto" ]
defmodule Authorize do @moduledoc """ Define authorization rules through a simple DSL """ defmacro __using__(_options) do quote do import unquote(__MODULE__) Module.register_attribute(__MODULE__, :rules, accumulate: true) @before_compile unquote(__MODULE__) end end @doc """ Rule...
02f08f3facbd0ec0fd6c1faa0b449e5d1c934ec6
6,088
[ 164500959 ]
[ "test" ]
defmodule AssertHTMLTest do use ExUnit.Case, async: true doctest AssertHTML, import: true import AssertHTML alias ExUnit.AssertionError describe "assert_html (check css selector)" do setup do [html: ~S{ <div class="container"> <h1>Hello</h1> <p class="description"> ...
02f1041065d1f10ab60ffe5a21f1954b2bfba306
21,851
[ 383340007 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Compute.V1.Api.TargetTcpProxies do @moduledoc """ API calls for all endpoints tagged `TargetTcpProxies`. """ alias GoogleApi.Compute.V1.Connection alias GoogleApi.Gax.{Request, Response} @library_version Mix.Project.config() |> Keyword.get(:version, "") @doc """ Deletes the specif...
02f17d438f8754128f2b1f2c0d948799766e7b3a
13,103
[ 650698680 ]
[ "documented", "ecto" ]
defmodule TudoChat.Messages do @moduledoc """ The Messages context. """ import Ecto.Query, warn: false import TudoChatWeb.Utils.Errors alias TudoChat.Groups.Group alias TudoChat.Messages.ComGroupMessage alias TudoChat.Messages.{JobStatus, MessageMeta} alias TudoChat.Repo alias TudoChatWeb.Utils.Pag...
02f182c5a32f8fa3837fa549442adbab064feaec
2,979
[ 185065059, 53934475 ]
[ "macro", "ecto" ]
defmodule MediaSample.BaseUploader do defmacro __using__(opts) do repo = Module.split(__CALLER__.module) |> List.first |> Module.safe_concat(Repo) quote location: :keep do use Arc.Definition import unquote(__MODULE__) alias Ecto.Changeset alias unquote(repo) unquote(config(opts))...
02f1c4fceaebf5d57bcfcecf0c443c4917cc7d0a
2,882
[ 114328844 ]
[]
# Script for populating the database. You can run it as: # # mix run priv/repo/seeds.exs # # Inside the script, you can read and write to any of your # repositories directly: # # Liveview.Repo.insert!(%Liveview.SomeModel{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they wil...
02f251a373f646b85c505f5a08972856da334407
1,906
[ 96162842 ]
[ "test", "documented" ]
defmodule WireToWireTest do @moduledoc """ This test starts a server and connects a peer to it. It checks that a PING / PONG can be successfully communicated. """ use ExUnit.Case, async: true @moduletag integration: true @localhost {127, 0, 0, 1} @us_port 8888 @them_port 9999 setup do server ...
02f27eb31df80187c5666e56596f8b075920e7dc
2,594
[ 330819813 ]
[ "test", "ecto" ]
defmodule Lightrail.MessageStore.DB.PublishedMessageTest do use ExUnit.Case, async: true alias Lightrail.MessageStore.DB.PublishedMessage setup do uuid = "deadbeef-dead-dead-dead-deaddeafbeef" attrs = %{ correlation_id: uuid, encoded_message: "xyz-gibberish-xyz", exchange: "lightrail:...
02f2b72a67de9c224e226ddaaadaca4032642b27
4,297
[ 578029237, 243317091 ]
[ "phoenix" ]
defmodule Web.SubmissionExportController do use Web, :controller alias ChallengeGov.Challenges alias ChallengeGov.Phases alias ChallengeGov.SubmissionExports plug(Web.Plugs.EnsureRole, [:super_admin, :admin, :challenge_manager]) def index(conn, %{"id" => id}) do %{current_user: user} = conn.assigns ...
02f2c847ef827869c74485bb1d6d46e8c621a2e8
4,170
[ 211390448 ]
[ "test" ]
defmodule Re.NeighborhoodsTest do use Re.ModelCase alias Re.Addresses.Neighborhoods import Re.Factory describe "all" do test "should return only addresses with active listing" do address1 = insert(:address, neighborhood: "Test 1") insert(:listing, address: address1) insert(:listing, add...
02f32dd94c5b8a3ac101ea42928b01952acf6bcc
3,331
[ 888218401 ]
[ "phoenix" ]
defmodule VRHoseWeb.MainController do use VRHoseWeb, :controller # vrcjson does not support unbalanced braces inside strings # this has been reported to vrchat already # # https://feedback.vrchat.com/vrchat-udon-closed-alpha-bugs/p/braces-inside-strings-in-vrcjson-can-fail-to-deserialize # # workaround fo...
02f3af34097c5529c0f1a8e4704d826385557c50
2,784
[ 44487553 ]
[]
require Logger defmodule DistTest do defp counter_loop(outCh, n) do Channel.channel_send(outCh, n, "counter out") counter_loop(outCh, n+1) end def counter(n) do outCh = Channel.channel() spawn fn -> counter_loop(outCh, n) end outCh end defp filter_loop(inCh, outCh, p) do i = Channel....
02f3c32364e22b43f26a3a5efa5ad6c11d626f26
2,021
[ 776926564 ]
[ "liveview" ]
Mix.install([ {:liveview_playground, "~> 0.1.5"} ]) defmodule CoreComponents do use LiveviewPlaygroundWeb, :html attr :field, Phoenix.HTML.FormField, required: true attr :type, :string, default: "text" attr :rest, :global, include: ~w(placeholder type) def input(assigns) do ~H""" <input type="tex...
02f3dc4ae269b45967639ea91bd19d1d2d9d9a14
1,602
[ 266840309, 266894454 ]
[ "documented" ]
use Croma defmodule Antikythera.Tmpdir do alias Antikythera.Context alias Antikythera.ExecutorPool.Id, as: EPoolId alias AntikytheraCore.TmpdirTracker @doc """ Creates a temporary directory which can be used as a working space for the passed function `f`. This function is basically intended for async job...
02f422f314629910d21809b281a7d551ea065553
2,069
[ 942811655, 920024200 ]
[ "documented" ]
defmodule PublicAPI.Handlers.Dashboards.Create do @moduledoc false require Logger alias InternalClients.Dashboards, as: DashboardsClient alias PublicAPI.Schemas import PublicAPI.Util.PlugContextHelper use PublicAPI.SpecHelpers.Operation use Plug.Builder @operation_id "Dashboards.Create" plug(OpenAp...
02f52d60764c974c8654ebf6179f89dd04736d11
3,281
[ 88574371 ]
[]
defmodule Api.Mixfile do use Mix.Project def project do [ app: :api, version: "1.0.0", elixir: "~> 1.5", # Remember to change .exenv-version elixirc_paths: elixirc_paths(Mix.env), compilers: [:phoenix] ++ Mix.compilers, build_embedded: Mix.env == :prod, start_permanen...
02f54c9ed7a0939e7d0006abf49dd32426aa4dba
2,912
[ 594619181, 11888299 ]
[]
defmodule Euler do def prime_factors(n) do prime_factors(n, 2) end defp prime_factors(n, p) when n < (p * p) do [n] end defp prime_factors(n, p) when rem(n, p) == 0 do [p | prime_factors(div(n, p), p)] end defp prime_factors(n, p) do prime_factors(n, p + 1) end def factors(n) do ...
02f5529a3786f9706add424990fe953c4b88ce20
1,630
[ 225895917 ]
[ "macro", "documented", "phoenix" ]
defmodule PhawkesWeb 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 PhawkesWeb, :controller use PhawkesWeb, :view The definitions below will be executed for every view, controller, ...
02f554acd82e6ce484324fc738057cb2e357f2db
4,213
[ 501654880 ]
[ "liveview" ]
defmodule HajWeb.ApplyLive.Complete do use HajWeb, {:live_view, [ layout: {HajWeb.Layouts, :apply}, container: {:div, class: "flex h-full flex-col bg-zinc-50"} ]} alias Haj.Spex alias Haj.Applications on_mount {HajWeb.UserAuth, {:ensure_authenticated, "/sok/edit"}} @im...
02f5c12a675723c92fb4d4552af629d2ba2e926d
1,867
[ 103117158 ]
[]
defmodule Perseids.Pagination do def prepare_params(params) do params = to_keyword_list(params) page = case params[:page] do nil -> 1 _ -> params[:page] end per_page = case params[:per_page] do nil -> 24 _ -> params[:per_page] end params_without_pagination = Keyword....
02f69073545bb96c6d31a2e8107eb5fbced8615e
1,653
[ 335441824 ]
[]
defmodule CourseHub.Queries.FilterBy do import Ecto.Query def filter_by(query, identifier, params \\ nil) def filter_by(query, _identifier, nil), do: query def filter_by(query, identifier, params) do conditions = walk_filter(true, identifier, params) query |> where(^conditions) end defp wal...
02f70b5d75d995c075bb68e06c83dcbf19dd1090
8,181
[ 100113696 ]
[ "documented" ]
defmodule CloudStorage.Azure do @moduledoc """ CloudStorage Azure Documentation. """ @azure_api_version Application.get_env(:cloud_storage, :azure_api_version) @base_login Application.get_env(:cloud_storage, :azure_default_base_login) @base_resource Application.get_env(:cloud_storage, :azure_default_base_r...
02f7e554de4f44a4c070bf5a9e46b074420e6cee
1,727
[ 669615614 ]
[ "ecto" ]
defmodule RentCars.Accounts.User do use Ecto.Schema import Ecto.Changeset import Waffle.Ecto.Schema alias Ecto.Enum alias RentCars.Accounts.Avatar alias RentCars.Rentals.Rental @role_values ~w/ADMIN USER/a @primary_key {:id, :binary_id, autogenerate: true} # @foreign_key :binary_id @fields ~w/rol...
02f84cc2ad8e20140fbcdecd27bb2c91e5ae5357
2,271
[ 779971199 ]
[ "test" ]
defmodule Profitry.Exchanges.Clients.Finnhub.FinnhubClientTest do use ExUnit.Case, async: true alias Profitry.Exchanges.Schema.Quote alias Profitry.Exchanges.Clients.Finnhub.FinnhubClient @mock_response %{ status: 200, body: %{ "c" => 148.97, "h" => 149.77, "l" => 147.85, "o" =...
02f85478601bb8f897b5374484831a4d8150583e
1,777
[ 488335066, 305202387 ]
[ "documented" ]
defmodule Cielo do @moduledoc """ Main module of client. This module wraps other specific modules and they main functions. Be aware that all modules implements parameter's validation for all calls in Cielo API, and these validations was written by Cielo employees, and the documentation can be found in [Cielo...
02f87461b4ed5f87dce623f7c01cdbffc0bdd071
2,586
[ 839445075 ]
[ "liveview", "macro", "phoenix", "documented" ]
defmodule LiveGraphixWeb do use Phoenix.Router @moduledoc """ The entrypoint for defining your web interface, such as controllers, components, channels, and so on. This can be used in your application as: use LiveGraphixWeb, :controller use LiveGraphixWeb, :html use LiveGraphixWeb, :view ...
02f8e5053e5233f0bacb4df092acea1189a71400
3,808
[ 575481771 ]
[ "documented" ]
import AOC # https://adventofcode.com/2022/day/15 aoc 2022, 15 do def p1(input) do sensors_and_beacons = parse_input(input) # Separate into a list of beacons and sensors sensors = Enum.map(sensors_and_beacons, fn {sensor_x, sensor_y, _, _, distance} -> {sensor_x, sensor_y, distance} ...
02f93495038073ec255876ed598a152fa0fe07f9
10,091
[ 525010823 ]
[ "test" ]
defmodule ChromicPDF.PDFGenerationTest do use ExUnit.Case, async: false import ExUnit.CaptureLog import ChromicPDF.Utils, only: [system_cmd!: 2] alias ChromicPDF.TestServer @test_html Path.expand("../fixtures/test.html", __ENV__.file) @test_dynamic_html Path.expand("../fixtures/test_dynamic.html", __ENV__....
02f96dd2ad1815add295d6e5d0eb954eba0cf598
2,753
[ 976179705 ]
[]
defmodule Cloudflare.Mixfile do use Mix.Project def project do [ app: :elixir_cloudflare, version: "1.0.0", elixir: "~> 1.18", build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, package: package(), description: """ Welcome to Cloudflare&#39;...
02f97bfbdac4cce3658e75e79ba136931452bd4b
3,487
[ 120765292 ]
[ "typespec" ]
defmodule Openflow.GetAsync.Reply do defstruct( version: 4, xid: 0, # virtual field datapath_id: nil, # virtual field aux_id: 0, packet_in_mask_master: [], packet_in_mask_slave: [], port_status_mask_master: [], port_status_mask_slave: [], flow_removed_mask_master: [], f...
02f9848a98c7e942678843c14d0c34fb15e1d7f1
2,456
[ 113021157 ]
[ "test" ]
defmodule AssociationsWeb.CommentControllerTest do use AssociationsWeb.ConnCase alias Associations.Blogs #alias Associations.Blogs.Comment @create_attrs %{body: "some body"} #@update_attrs %{body: "some updated body"} #@invalid_attrs %{body: nil} def fixture(:comment) do {:ok, comment} = Blogs.crea...
02f9c0de5f50587238a81082a9653ddbc7303b11
3,700
[ 115803927 ]
[]
%{"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [], [], "hexpm"}, "cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.3.2", [...
02f9f13b000379d9e1020636422f76f7466e46f9
3,031
[ 100374784 ]
[ "test" ]
defmodule InsWeb.ENR.AdmissionControllerTest do use InsWeb.ConnCase alias Ins.ENR @create_attrs %{first_name: "some first_name", last_name: "some last_name", views: 42} @update_attrs %{first_name: "some updated first_name", last_name: "some updated last_name", views: 43} @invalid_attrs %{first_name: nil, la...
02fad066181f82088ede83966038644e0ffa5feb
4,059
[ 79664415 ]
[ "phoenix", "ecto" ]
defmodule Healthlocker.GoalController do use Healthlocker.Web, :controller alias Healthlocker.{Goal, Step} def index(conn, _params) do user_id = conn.assigns.current_user.id important_goals = Goal |> Goal.get_important_goals(user_id) |> Repo.all unimportant_g...
02fae306da1b8794c0192f29febcace18058b208
1,716
[ 55084802 ]
[ "test" ]
defmodule CreditCardChecker.CreateAnExpenseTest do use CreditCardChecker.IntegrationCase, async: false import CreditCardChecker.AuthTestHelper, only: [sign_in_through_app: 0] alias ExpensesPage.Expenses setup do sign_in_through_app :ok end test "can create an expense" do assert ExpensesP...
02faf0189dcdcfbb87cacced52e9d1beca83b67f
8,073
[ 159979201 ]
[]
defmodule Cart do defstruct coordinates: {}, direction: "", next_turn: :left def carts_from_track(track) do track |> Map.to_list() |> Enum.filter(fn({_, type}) -> type in ["<", ">", "^", "v"] end) |> Enum.map(fn({{x, y}, direction}) -> %Cart{coordinates: {x, y}, direction: direction} end) end ...
02faf430f244d7abb15570f125233900c7fa3061
3,981
[ 17058012 ]
[ "typespec" ]
defmodule ElixirTalk.Protocol do require Logger @spec parse(binary) :: {:ok, term, binary} | :more def parse(<<"OUT_OF_MEMORY\r\n", rest :: binary>>), do: {:ok, :out_of_memory, rest} def parse(<<"INTERNAL_ERROR\r\n", rest :: binary>>), do: {:ok, :internal_error, rest} def parse(<<"DRAINING\r\n", rest :: b...
02fb3242296473bacc0f8bdb61f9a4050af22834
2,435
[ 88099827 ]
[]
defmodule Chat.ConvoChannel do use Chat.Web, :channel alias Chat.Convo alias Chat.Message alias Chat.MessageView def join("convos:" <> convo_id, params, socket) do last_seen_id = params["last_seen_id"] || 0 convo_id = String.to_integer(convo_id) convo = Repo.get!(Convo, convo_id) messages =...
02fb84248861592b847eda68d53e513cd4b233a6
1,869
[ 477066904 ]
[ "liveview", "ecto" ]
defmodule SportfestWeb.SchuelerLive.FormComponent do use SportfestWeb, :live_component alias Sportfest.Vorbereitung @impl true def update(%{schueler: schueler} = assigns, socket) do changeset = Vorbereitung.change_schueler(schueler) {:ok, socket |> assign(assigns) |> assign(:changeset,...
02fb8e3f340a704f7891758a771a851afeac3942
6,662
[ 995681669 ]
[ "documented", "ecto" ]
defmodule Schedop.Classes do @moduledoc """ The Classes context. """ import Ecto.Query, warn: false alias Schedop.Repo alias Schedop.Classes.Class @doc """ Returns the list of classes. ## Examples iex> list_classes() [%Class{}, ...] """ def list_classes do Repo.all(Class) e...
02fc0fe4d079c7ebda19cb585f311241c067f54e
2,003
[ 118354548 ]
[ "test", "ecto" ]
defmodule RecordShop.ArtistsTest do use RecordShop.DataCase alias RecordShop.Artists describe "artists" do alias RecordShop.Artists.Artist @valid_attrs %{name: "some name"} @update_attrs %{name: "some updated name"} @invalid_attrs %{name: nil} def artist_fixture(attrs \\ %{}) do {:ok...
02fc31ecc21b849d2b9c941e38c7a227831a59c0
2,789
[ 1010091562 ]
[ "liveview", "ecto" ]
defmodule TrackerWeb.DayLive.SetCountComponent do alias Tracker.Goals alias Tracker.Goals.GoalEntry alias Tracker.Goals use TrackerWeb, :live_component def render(assigns) do ~H""" <div> <.header> Set count </.header> <.simple_form for={@form} id="goal-entry...
02fc38652dd5fa330e7821d92a846b85ee5c2bfd
6,412
[ 263995896 ]
[ "documented" ]
defmodule Coherence.Authentication.Session do @moduledoc """ Implements Session based authentication. By default, it uses an Agent for session state. Additionally, a the session can be stored in a database with an Agent based cache. The plug can be used to force a login for unauthenticated users for routes ...
02fc75c1acbad10c96b70ef98ca9d8539778d241
3,635
[ 54825292 ]
[ "test" ]
defmodule Pushex.Validators.TypeTest do use ExUnit.Case defmodule Dummy do defstruct [:value] end test "simple types" do port = Port.list |> List.first valid_cases = [ {1, :any}, {"a", :any}, {1, :number}, {1, :integer}, {nil, ...
02fceb9b971e5e339c8dfe2bd51c9af39a8aab69
1,991
[ 576527248 ]
[ "typespec", "documented" ]
defmodule OpentelemetryFinch do @moduledoc """ OpentelemetryFinch uses [telemetry](https://hexdocs.pm/telemetry/) handlers to create `OpenTelemetry` spans. ## Usage In your application start: def start(_type, _args) do OpentelemetryFinch.setup() # ... end """ require Open...
02fd707a38ff2e7d37c1c85464672d062c814660
1,509
[ 48193320 ]
[ "test" ]
defmodule Day11Test do use ExUnit.Case test "Passwords must include one increasing straight of at least three letters" do assert Day11.req_1("hijklmmn") all_true = ["abc", "bcd", "cde", "xyz"] |> Enum.map(&Day11.req_1/1) |> Enum.reduce(true, &(&1 && &2)) assert all_true ...
02fdb925ac9d0804772bab64d5b933bc37382304
8,864
[ 775065727 ]
[ "test" ]
defmodule Supavisor.Integration.ProxyTest do require Logger use Supavisor.DataCase, async: true alias Postgrex, as: P @tenant "proxy_tenant1" setup_all do db_conf = Application.get_env(:supavisor, Repo) {:ok, proxy} = Postgrex.start_link( hostname: db_conf[:hostname], port: Ap...
02ff1a49bfd42c3e6fb246bd18f2cf7c652c7e2f
2,513
[ 48741861 ]
[ "test" ]
defmodule EctoOracleAdapter.Integration.DeadlockTest do # We can keep this test async as long as it # is the only one accessing advisory locks use ExUnit.Case, async: true require Logger @timeout 500 alias EctoOracleAdapter.Integration.PoolRepo test "deadlocks reset worker" do tx1 = self() %Tas...
02ff35b55aa6325f453f51cc4a03e2e6b7f48ec5
22,052
[ 998619362 ]
[ "documented" ]
defmodule TransitRealtime.FeedHeader.Incrementality do @moduledoc false use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.0", syntax: :proto2 field :FULL_DATASET, 0 field :DIFFERENTIAL, 1 end defmodule TransitRealtime.TripUpdate.StopTimeUpdate.ScheduleRelationship do @moduledoc false use Protob...
02ff85e4c70308b747eca0406ac73f6ffe36450f
5,021
[ 74609694 ]
[]
%{ "certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"}, "earmark": {:hex, :earmark, "1.2.1", "7ad3f203ab84d31832814483c834e006cf88949f061a4b50d7e783147572280f", [:mix], [...
02ffe4e9eb1b9a45fcf0732438fab9f146193b46
6,948
[ 915766719 ]
[]
defmodule NervesLivebook.MixProject do use Mix.Project @app :nerves_livebook @version "0.14.2" @source_url "https://github.com/nerves-livebook/nerves_livebook" @rpi_targets [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :rpi4, :rpi0_2, :rpi5] @all_targets @rpi_targets ++ [:bbb, :osd32mp1, :x86_64, :...
0300158cca5868ac7c4fde4b2d25d56d93b17fa4
2,068
[ 953587036 ]
[ "test" ]
defmodule FlashSyncE.WebSocket.HandlerTest do use ExUnit.Case alias FlashSyncE.WebSocket.Handler describe "init/2" do test "upgrades connection to WebSocket for valid requests" do req = %{method: "GET", qs: "token=123&device_id=456"} result = Handler.init(req, []) assert {:cowboy_websocke...
03007c4a9778267dbf536e301eb8b8cb4e7e7c1c
2,359
[ 306140891 ]
[ "phoenix" ]
defmodule TimemanagerWeb.WorkingTimeController do use TimemanagerWeb, :controller alias Timemanager.Time alias Timemanager.Time.WorkingTime action_fallback TimemanagerWeb.FallbackController def index(conn, %{"userID" => user_id, "id" => id}) do working_time = Time.list_workingtimes(%{"user_id" => user_...
030082120fa6a6bb518f1f81e0508a6c69ea7867
2,575
[ 131352086 ]
[ "test" ]
defmodule AppWeb.MotoControllerTest do use AppWeb.ConnCase alias App.Placa @create_attrs %{placa_motos: "some placa_motos"} @update_attrs %{placa_motos: "some updated placa_motos"} @invalid_attrs %{placa_motos: nil} def fixture(:moto) do {:ok, moto} = Placa.create_moto(@create_attrs) moto end ...
0300c902a226c5e4b4187a9a1b52fb7b5f92b5a5
2,058
[ 94032441 ]
[]
defmodule DatoCMS.FaviconMetaTags do @apple_touch_icon_sizes [57, 60, 72, 76, 114, 120, 144, 152, 180] @icon_sizes [16, 32, 96, 192] @windows_sizes [{70, 70}, {150, 150}, {310, 310}, {310, 150}] def meta_tags(site, theme_color \\ nil) do favicon = get_in(site, [:data, :attributes, :favicon]) name = get...
0300d8599d4f186158a3ca02c17f927e1b97b9a9
2,322
[ 556161830, 585915775, 589089007, 589866492, 691980346, 807904878, 215544723, 500260157, 691199358, 530308212 ]
[]
defmodule Pleroma.Web.ApiSpec.Schemas.Chat do alias OpenApiSpex.Schema alias Pleroma.Web.ApiSpec.Schemas.ChatMessage require OpenApiSpex OpenApiSpex.schema(%{ title: "Chat", description: "Response schema for a Chat", type: :object, properties: %{ id: %Schema{type: :string}, account...
0301227b44ca3339c8908aa925754e852bbd40f7
14,483
[ 191615560 ]
[ "test", "documented", "ecto" ]
defmodule Core.DeclarationTest do @moduledoc false use Core.DataCase import Mox alias Core.Declarations alias Core.Declarations.Declaration alias EctoTrail.Changelog alias Ecto.UUID alias OPS.Redis alias Scrivener.Page @create_attrs %{ "id" => UUID.generate(), "employee_id" => UUID.genera...
03014c5faeac0aa6b379cf430dc169f46e403900
2,950
[ 128200713 ]
[ "genserver", "supervisor", "documented" ]
defmodule MpesaElixir.AuthServer do @moduledoc """ A GenServer implementation that manages Mpesa API authentication tokens. This server is responsible for: 1. Obtaining an access token from the Mpesa API during initialization 2. Storing the token in an ETS table for quick access 3. Automatically refreshin...
03017f9836f83a8d6fde3683a38dcb79e1dc24db
17,254
[ 867269234 ]
[ "typespec", "documented", "ecto" ]
defmodule DigistabStore.Store do @moduledoc """ The Store context handles all e-commerce functionality for the DigistabStore application. ## Architecture This context is the core business logic layer, sitting between the web interface and the database. It handles with all product-related operations and enfo...
0301d225e4d12d85540e93ac56e72459f584d898
1,819
[ 31450403 ]
[ "documented" ]
defmodule Issues.CLI do @default_count 4 @moduledoc """ Handle the command line parsing and the dispatch to the various functions that end up generating a table of the las _n_ isues in github project """ def main(argv) do argv |> parse_args |> process end @doc """ 'argv' can be -h or -he...
0301f40d7710c3304d639ea776040993443dfbb4
3,053
[ 479228142 ]
[ "test" ]
defmodule Ohlex.HostLinkOmron.Test do use ExUnit.Case alias Ohlex.HostLink.Omron test "compute_fcs/1" do assert Omron.compute_fcs("@04RD02070001") == "56" assert Omron.compute_fcs("@04RD000020") == "50" end describe "is_frame_valid?/1" do test "Validates a correct FCS" do assert Omron.is_f...
03025e1b45452e94c6aa85026324e8bc5b558237
1,655
[ 234062689 ]
[ "test" ]
defmodule WatTest do use ExUnit.Case, async: true test "converting a Wasm text file to a Wasm core module" do wat = """ (module (func (export "add") (param i32) (param i32) (result i32) local.get 0 local.get 1 i32.add return ) ) """ assert {:ok, wasm...
0302bb86476627354e72035ee153a61d6a979165
5,044
[ 571776611 ]
[ "test", "ecto" ]
defmodule Mix.Tasks.Pleroma.DatabaseTest do use Pleroma.DataCase, async: true use Oban.Testing, repo: Pleroma.Repo alias Pleroma.Activity alias Pleroma.Object alias Pleroma.Repo alias Pleroma.User alias Pleroma.Web.CommonAPI import Pleroma.Factory setup_all do Mix.shell(Mix.Shell.P...
0303a274d4c5d30a7981fe7e9d32d265a941be27
2,831
[ 800612629 ]
[ "test" ]
defmodule CoreTest do use ExUnit.Case setup do user_name = "yigit" {:ok, pid} = Core.start_link(user_name) {:ok, pid: pid, user_name: user_name} end test "initial state should be an empty map", state do assert Core.details(state[:user_name]) == %{} end test "it should update state with c...
0303ac0590befbfeda8e953898baf06395bcd4da
2,105
[ 154110347 ]
[]
use Mix.Config # For development, we disable any cache and enable # debugging and code reloading. # # The watchers configuration can be used to run external # watchers to your application. For example, we use it # with brunch.io to recompile .js and .css sources. config :vue_sample, VueSampleWeb.Endpoint, http: [por...
0303add7a22429f2147c5448433d245b66d2d2ec
7,350
[ 399631385, 558629623 ]
[ "documented", "ecto" ]
defmodule Mix.Tasks.Pleroma.Database do alias Pleroma.Conversation alias Pleroma.Maintenance alias Pleroma.Object alias Pleroma.Repo alias Pleroma.User require Logger require Pleroma.Constants import Ecto.Query import Mix.Pleroma use Mix.Task @shortdoc "A collection of database related tasks" ...
0303e1ab91b36356cc8410b40bd09b3166d8494a
3,561
[ 937971646 ]
[ "phoenix" ]
defmodule FriendWeb.Router do use FriendWeb, :router import FriendWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {FriendWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers p...
030440a65295b1931a3a3a4d3586195e17cd772f
4,691
[ 911264133 ]
[ "test" ]
defmodule Lux.Lenses.Etherscan.TxListInternalAddressLensTest do use UnitAPICase, async: false alias Lux.Lenses.Etherscan.TxListInternalAddress setup do # Set up test API key in the configuration Application.put_env(:lux, :api_keys, [ etherscan: "TEST_API_KEY", etherscan_pro: false ]) ...
0304961838240d9df65b0db682e1adb6dabb745e
1,623
[ 84673899, 235196783 ]
[ "test", "phoenix" ]
defmodule RumblWeb.AuthTest do use RumblWeb.ConnCase, async: true alias RumblWeb.Auth setup %{conn: conn} do conn = conn |> bypass_through(RumblWeb.Router, :browser) |> get("/") {:ok, %{conn: conn}} end test "authenticate_user halts when no current_user exists", %{conn: conn} do ...
03061f16b4af40ea9a26e72793b2c47ca6dfa5f0
2,469
[ 449302427 ]
[]
defmodule Task1 do # --------------------------------------------------------------- # Simple Hello World print. def hello do :world end # --------------------------------------------------------------- # Prints if inputted value is odd or even. def is_even(n) do if rem(n, 2) == 0 do IO.w...
0306309c853d6efac0cdffe0405dec3e49369fae
5,996
[ 180650299 ]
[ "typespec", "documented" ]
defmodule Hindsight.Core.QuestionLib do @moduledoc false use HindsightWeb, :library alias Hindsight.Core.Question @doc false @spec get_next_ordering(integer) :: integer def get_next_ordering(template_id) do query = from questions in Question, where: questions.template_id == ^template_id,...
030698fbb6415b0e9691490242708055db1dc8bc
2,851
[ 671824355, 690807478, 690639393, 696931940 ]
[ "test", "ecto" ]
defmodule Fly.BillingTest do use Fly.DataCase alias Fly.Billing describe "invoices" do alias Fly.Billing.Invoice import Fly.BillingFixtures import Fly.OrganizationFixtures @invalid_attrs %{due_date: nil, invoiced_at: nil, stripe_id: nil} setup do org = organization_fixture() ...
03070bb433a5315547531166092961b9dc318c02
3,903
[ 499636562 ]
[ "typespec", "documented" ]
defmodule IsoLang do @moduledoc """ Documentation for `IsoLang`. Provides utilities for dealing with [ISO 639](https://en.wikipedia.org/wiki/ISO_639) languages. ## See Also - https://en.wikipedia.org/wiki/IETF_language_tag - https://tools.ietf.org/search/bcp47 - https://datahub.io/core/language-codes...
030739fbcb4f0c534a684a8a592c0f13d03c413a
2,227
[ 185453293, 326833083, 421230971, 467255673, 413633557, 511389672, 422936433, 630677170, 465522567, 443198115, 590661149, 325422831, 329651309, 511298469, 444568754, 463250017 ]
[ "test", "ecto" ]
defmodule Homework.UsersTest do use Homework.DataCase alias Homework.Users describe "users" do alias Homework.Users.User @valid_attrs %{dob: "some dob", first_name: "some first_name", last_name: "some last_name"} @update_attrs %{ dob: "some updated dob", first_name: "some updated first_...
03073d89794933f584fa10bf2ec2e452235c17a5
5,406
[ 411863018 ]
[ "documented" ]
defmodule AmbryScraping.GoodReads.Books.Editions do @moduledoc false import AmbryScraping.GoodReads.Books.Shared, only: [parse_date: 1] alias AmbryScraping.GoodReads.Browser alias AmbryScraping.GoodReads.Contributor alias AmbryScraping.GoodReads.Edition alias AmbryScraping.GoodReads.Editions def editio...
03074a904ee8b02b3a53bdad56d8a828d344ad74
3,374
[ 185558207, 556161830, 213229236, 1000104078, 585915775, 589089007, 982054619, 589866492, 691980346, 882572863, 217320195, 174991383, 807904878, 215544723, 540729553, 500260157, 691199358, 771023416, 887377354, 530308212 ]
[]
defmodule Pleroma.Web.ApiSpec.Admin.MediaProxyCacheOperation do alias OpenApiSpex.Operation alias OpenApiSpex.Schema alias Pleroma.Web.ApiSpec.Schemas.ApiError import Pleroma.Web.ApiSpec.Helpers def open_api_operation(action) do operation = String.to_existing_atom("#{action}_operation") apply(__MODU...
0307a0569795b2f9b3b6ad096bdab46dc4c2c85b
1,829
[ 188481559 ]
[ "documented" ]
defmodule Rabbit.Connection.Pool do @moduledoc false alias Rabbit.Connection.Server @opts_schema KeywordValidator.schema!( pool_size: [is: :integer, default: 1, required: true], max_overflow: [is: :integer, default: 0, required: true], strategy: [is: :atom, def...