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
098940ae7b4f9f40163f2f32466a979c917acf21
2,955
[ 508767032 ]
[]
defmodule Huffman do def sample do 'the quick brown fox jumps over the lazy dog this is a sample text that we will use when we build up a table we will only handle lower case letters and no punctuation symbols the frequency will of course not represent english but it is probably not that far off'...
09897a52927d00c909e604c2f11ed7c8896bb161
1,526
[ 573138084 ]
[ "documented" ]
defmodule PeckEngineeringAssessment.FoodTrucksFixtures do @moduledoc """ This module defines test helpers for creating entities via the `PeckEngineeringAssessment.FoodTrucks` context. """ @doc """ Generate a food_truck. """ def food_truck_fixture(attrs \\ %{}) do {:ok, food_truck} = attrs ...
098ad833fdf9fda23ef6819bf892f951c06c57f1
4,091
[ 180090514 ]
[ "test", "liveview" ]
defmodule Cizen.Effects.MapTest do use Cizen.SagaCase alias Cizen.EffectTestHelper.{TestEffect, TestEvent} alias Cizen.Automaton alias Cizen.Dispatcher alias Cizen.Effect alias Cizen.Event alias Cizen.Filter alias Cizen.Saga alias Cizen.SagaID alias Cizen.StartSaga require Filter use Cizen.Ef...
098adae44c4229d1956c76f4ef02e09b9ff86ce7
2,187
[ 885412428 ]
[]
# 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 :phoenix_nested_form_validation, generators:...
098b298449c37c767a6c94465bf7ce0e36912202
13,251
[ 230360546 ]
[ "typespec", "documented" ]
defmodule DNS do def int_bool(<< bit :: 1 >>) do int_bool(bit) end def int_bool(n) do if n != 0, do: true, else: false end def bool_int(bool) do if (bool), do: 1, else: 0 end def bin_slice(binary, start) do binary_part(binary, start, byte_size(binary) - start) end def bin_slice(bina...
098b36709cb97da55bc898116488c1eb1afe1787
3,152
[ 536150270 ]
[ "typespec", "documented" ]
defmodule Core.Ai.Anthropic.Models do @moduledoc """ Structs for representing Anthropic API requests and responses. """ defmodule AskAIRequest do @derive Jason.Encoder @moduledoc """ Represents a request to ask a question to Claude. """ @type model :: :claude_haiku | :claude_sonnet @t...
098b6d5dfa41fc42c637049953013e9dfc6e8d99
2,680
[ 136825794 ]
[]
defmodule Fixtures do def run() do IO.puts("#{DateTime.utc_now}") DB.create_tables() populate_experiments() populate_assignments() IO.puts("#{DateTime.utc_now}") # {:ok, "Done"} end def populate_experiments() do variant_0 = %DB.Variant{name: "variant_0", allocation: 20, is_control: t...
098b9c507a3e620745d6a21687a5089ebbe74f63
1,944
[ 969999971 ]
[ "documented" ]
defmodule DeeperHub.Core.Data.Migrations.BxCnlViewsTrack do @moduledoc """ Migration para criar e remover a tabela bx_cnl_views_track. """ alias DeeperHub.Core.Data.Repo alias DeeperHub.Core.Logger require DeeperHub.Core.Logger @doc """ Cria a tabela de bx_cnl_views_track. """ def up do Logger...
098c488e742dabb08fad157ecd0d525281202b44
11,186
[ 290041107 ]
[]
%{ "abi": {:hex, :abi, "0.1.17", "55f7538eb036c3d3c338d4c51c2d72102f1d70cd2f2fccb2ccdad031fd85c2b2", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:keccakf1600, "~> 2.0.0", [hex: :keccakf1600_orig, repo: "hexpm", optional: false]}], "hexpm", "655b87d5d04d9ca93c3495c18359ba3eb504e398eac...
098c7e140fdc33258e2e11e48dc298c0c9b2c377
1,661
[ 200430025 ]
[ "documented" ]
defmodule Genex.Tools.Evaluation.Penalty do alias Genex.Types.Chromosome @moduledoc """ Penalty functions for use with constraint satisfaction problems. Returns the chromosome so you can easily cascade constraints. ## Example ``` def fitness_function(c) do c |> Penalty.delta(...) |> Penalty...
098ca84258a94cade2ef31982372ae9fe3b4cec5
2,142
[ 711349229 ]
[]
defmodule Main do def main() do "input-large.txt" #"input-small.txt" |> parse_input() |> walk() |> Enum.map(fn {point, _dir} -> point end) |> Enum.uniq() |> length() end def walk(graph) do walk(graph, [{{0, 0}, :e}], MapSet.new()) end def walk(_graph, [], visited), do: visit...
098caab05f8a7f7f2b513cd52ac9dc3ce4ee425a
1,929
[ 874360764 ]
[]
defmodule BackendWeb.EnergyUsageJSON do def data(%{ prefecture_code: prefecture_code, prefecture_name: prefecture_name, year: year, month: month, special_high_voltage_consumption: special_high_voltage_consumption, special_high_voltage_retailers_count: special_high_volta...
098d688e3870eb68c57f03fbd1223e5c89d1076b
1,888
[ 207422517 ]
[ "phoenix" ]
defmodule FocalApiWeb.WorkflowController do use FocalApiWeb, :controller alias FocalApi.Clients alias FocalApi.Clients.Workflow action_fallback FocalApiWeb.FallbackController plug FocalApiWeb.Plugs.AuthenticateSession when action in [:create, :update, :delete, :index_by_client, :show] plug FocalApiWeb.Pl...
098d696e145f3cae996d816a546597b91d6f5862
2,332
[ 475991571 ]
[ "documented" ]
defmodule Dagger.Core.Client do @moduledoc """ GraphQL client for Dagger. """ alias Dagger.Core.GraphQLClient alias Dagger.Core.QueryBuilder, as: QB alias Dagger.Core.EngineConn alias Dagger.Core.QueryError defstruct [:url, :conn, :connect_opts] @doc false def connect(opts \\ []) do with {:ok...
098df1f883503c3170fc2e402aa7e19efab84571
1,571
[ 401794420 ]
[]
defmodule Scrivener.List.Mixfile do use Mix.Project @version "2.0.1" @name "Scrivener.List" @source_url "https://github.com/stephenmoloney/scrivener_list" @homepage_url "https://hexdocs.pm/scrivener_list" def project do [ app: :scrivener_list, name: @name, version: @version, sou...
098e0a92480ab4b0a055dd196fe6153503e76251
3,456
[ 114391883 ]
[ "test", "documented" ]
defmodule Concentrate.Producer.MqttTest do @moduledoc false use ExUnit.Case alias Concentrate.Producer.Mqtt setup do old_level = Logger.level() on_exit(fn -> Logger.configure(level: old_level) end) Logger.configure(level: :warning) {:ok, emqtt_writer} = :emqtt.start_link(%{ host...
098e410ca3b88d926bd637f1b113eec728308859
3,852
[ 236852798, 497769481, 366872029, 575873463, 482720652, 478522297 ]
[ "test" ]
Code.require_file("../test_helper.exs", __DIR__) defmodule Kernel.FnTest do use ExUnit.Case, async: true test "arithmetic constants on match" do assert (fn -1 -> true end).(-1) assert (fn +1 -> true end).(1) end defp fun_match(x) do fn ^x -> true _ -> false end end test "pin ...
098e7157bc2deae2866a67537db11c3c50fd5127
1,923
[ 818737306 ]
[ "ecto" ]
defmodule Pollutiondb.Station do use Ecto.Schema import Ecto.Changeset require Ecto.Query schema "stations" do field(:name, :string) field(:lon, :float) field(:lat, :float) has_many(:readings, Pollutiondb.Reading) end defp changeset(station, data) do station |> Ecto.Changeset.cast(...
098eac4f823402344d5bcdaa0da5f483f8deb88b
6,072
[ 838669031 ]
[ "typespec", "documented" ]
defmodule PipeLine.Commands.Registration do @moduledoc """ Handles registration of channels. """ require Logger alias Nostrum.Api alias Nostrum.Cache.GuildCache alias Nostrum.Cache.MemberCache alias Nostrum.Struct.Guild.Member alias PipeLine.Commands.Info alias PipeLine.Database.Registration alias...
098f66b4960c5e4a89c285c2eb874d88ad68e005
4,551
[ 93765520, 99250164 ]
[ "typespec", "documented" ]
defmodule Mix.Tasks.App.Start do use Mix.Task # Do not mark this task as recursive as it is # responsible for loading consolidated protocols. @shortdoc "Starts all registered apps" @moduledoc """ Starts all registered apps. The application is started by default as temporary. In case `:start_permanent...
098ffa6406887b36864d6621966d1cc9828b9d99
5,362
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.AdExchangeBuyer.V14.Model.PerformanceReport do @moduledoc """ The configuration data for an Ad Exchange performance report list. ## Attributes * `bidRate` (*type:* `float()`, *default:* `nil`) - The number of bid responses with an ad. * `bidRequestRate` (*type:* `float()`, *default:*...
099005959d982a1cbe147f781a4ce4bc01dace83
5,185
[ 1010291862 ]
[ "test" ]
defmodule CircuitBreakerSupervisorTest do use ExUnit.Case import TelemetryTest setup [:telemetry_listen] setup do start_supervised!(DummyFeatureFlagService) :ok end @tag telemetry_listen: [:circuit_breaker_supervisor, :child, :start] test "starts supervised children" do children = [sleepy_...
09902dfd110af5af93483fa9d9454b35d0007567
2,332
[ 501037941 ]
[ "phoenix", "ecto" ]
defmodule PortfolioManagementWeb.BookController do use PortfolioManagementWeb, :controller alias PortfolioManagement.TradeModel alias PortfolioManagement.TradeModel.Book plug(:put_root_layout, {PortfolioManagementWeb.LayoutView, "torch.html"}) plug(:put_layout, false) def index(conn, params) do cas...
099049472981ab376344fd06c20549daaf7ebd23
2,198
[ 726201850 ]
[]
defmodule Day4 do def solve1(input) do input |> String.split("\n", trim: true) |> parse() |> Enum.map(&Map.get(&1, :points)) |> Enum.sum() end def solve2(input) do input |> String.split("\n", trim: true) |> parse() |> countCards() end defp parse([]), do: [] defp parse([...
09909b06b5ac53485a45126d42d6cce189a31b77
2,028
[ 570108287 ]
[ "ecto" ]
defmodule AoC22.Day8.B do alias AoC22.Utils alias AoC22.Day8.Matrix def solve(input) do input |> Utils.input() |> Matrix.to_matrix() |> count_visible_trees() |> Enum.max() end defp count_visible_trees(trees) do Enum.reduce(1..(Enum.count(trees) - 2), [], fn y, scores -> Enum.re...
09909bc14b68578685178ddbdeb78c9c575d9e88
3,328
[ 288751731 ]
[ "documented" ]
defmodule SmartRecord do @moduledoc """ Documentation for SmartRecord. """ def new(top_mod, rec_name, field_defaults) do {fields, defaults} = Enum.unzip(field_defaults) size = Enum.count(fields) + 1 name = String.to_atom(Macro.camelize(to_string(rec_name))) rmod = Module.concat(top_mod, name) ...
0990b868808d17f3b14def96a088856e18ba88c6
1,619
[ 208416681 ]
[ "macro", "documented", "phoenix" ]
defmodule MaMenuWeb 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 MaMenuWeb, :controller use MaMenuWeb, :view The definitions below will be executed for every view, controller, etc...
0990fb377c6f35cc00c7397a270571e5ed1b9c8a
1,716
[ 69692002 ]
[ "test", "documented" ]
defmodule Cluster.Strategy.EpmdTest do @moduledoc false use ExUnit.Case alias Cluster.Strategy.Epmd require Cluster.Nodes describe "start_link/1" do @tag capture_log: true test "starts GenServer and connects nodes" do {:ok, pid} = Epmd.start_link([ %Cluster.Strategy.State{ ...
09911cbe327cb73a5d5895c4dd3ff8c180ab5483
1,754
[ 274426021 ]
[ "genserver", "liveview", "ecto" ]
defmodule TwitterWeb.SearchLive do use TwitterWeb, :live_view alias Twitter.Repo alias Twitter.User alias Twitter.Friendship alias TwitterWeb.Live.Component.Friend alias TwitterWeb.Live.Component.Input alias TwitterWeb.Live.Component.Header import Ecto.Query, warn: false @impl true def render(ass...
099144566e69805eabacd377e04b171644b5d090
5,319
[ 422190395 ]
[]
defmodule Dispatcher do use Matcher define_accept_types [ any: ["*/*"], turtle: ["text/turtle", "application/n-triples"], html: [ "text/html", "application/xhtml+html" ], json: [ "application/json", "application/vnd.api+json" ] ] @any %{ accept: %{ any: true } } @turtle %{ accept: %{ turtle:...
099223018c75fb1e3293dd74a09ea069ef5baf62
1,826
[ 182314088 ]
[ "genserver", "documented" ]
defmodule MagicHome.Lights.GpioLamp do use GenServer use MagicHome.Lights.LampProcessGeneric require Logger def start_link(opts = %{lamp: %Lamp{id: lamp_id}}) do GenServer.start_link( __MODULE__, opts, name: process_name(lamp_id) ) end @doc false def init(opts = %{lamp: %Lamp{...
099236b01f5b8f8d8617dd28c53f584b71367ac5
16,849
[ 109027767 ]
[ "typespec", "documented" ]
defmodule Elasticsearch do @moduledoc """ Entry-point for interacting with your Elasticsearch cluster(s). You should configure at least one `Elasticsearch.Cluster` in order to use the functions in this module, or else you'll need to pass all the configuration for the cluster into each function call. ### T...
09926a92c6271f1f585572b44490878d9f3dd8cb
3,209
[ 337078215 ]
[ "liveview" ]
defmodule FireWatchWeb.FireLive.Index do use FireWatchWeb, :live_view alias FireWatch.Fires alias FireWatch.Fires.Fire alias FireWatchWeb.FireLive.TableComponent @impl true def mount(_params, _session, socket) do paginate_options = %{page: 1, per_page: 10} fires = Fires.list_fires(paginate: pagina...
09926da6555ab77e52f58ca92a9b4ab7c5359928
4,358
[ 495987261 ]
[ "test", "documented" ]
defmodule RevStemmingTest do use CouchTestCase @moduletag :revs @moduletag kind: :single_node @moduledoc """ This is a port of the rev_stemming.js suite """ @new_limit 5 @tag :with_db test "revs limit update", context do db_name = context[:db_name] resp = Couch.get("/#{db_name}/_revs_limi...
09929d24dc596d4aa1ab6c8fcfd73be68d2660c8
3,518
[ 372337510 ]
[ "typespec", "documented", "ecto" ]
use Vtc.Ecto.Postgres.Utils defpgmodule Vtc.Ecto.Postgres.PgRational do @moduledoc """ Defines a composite type for storing rational values as dual int64s. These values are cast to `%Ratio{}` structs for use in application code, provided by the `Ratio` library. The composite type is defined as follows: `...
0992ecedc8c58aaa4bc483a2614cfe83c4701966
1,837
[ 151649574 ]
[ "phoenix" ]
defmodule CollabReactorWeb.SessionController do use CollabReactorWeb, :controller alias CollabReactor.Repo def create(conn, params) do case authenticate(params) do {:ok, user} -> new_conn = Guardian.Plug.api_sign_in(conn, user, :access) jwt = Guardian.Plug.current_token(new_conn) ...
0994c49363212314a12271a7200f245067229de8
6,566
[ 410121215 ]
[ "test", "ecto" ]
defmodule Sig.Finance.FinancialTransactionsTest do use Sig.DataCase alias Sig.Accounts.User alias Sig.Finance.Banks.Accounts.Account alias Sig.Finance.FinancialTransactions alias Sig.Finance.FinancialTransactions.FinancialTransaction describe "update_change/1" do test "returns a changeset" do as...
0994e72c158d75a9f4be861d6975ecf378489ffa
1,743
[ 117589708 ]
[]
#!/usr/bin/env elixir defmodule Day18 do def add([], ys), do: ys def add(xs, ys) do reduce([xs, ys]) end def reduce(t) do case explode(t, 0) do {true, t, _, _} -> reduce(t) {false, t} -> case split(t) do {true, t} -> reduce(t) {false, t} ->...
0995204802235a1e5acf3fbf5517b00d2ca84c7a
2,133
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Content.V2.Model.Warehouse do @moduledoc """ A fulfillment warehouse, which stores and handles inventory. ## Attributes * `businessDayConfig` (*type:* `GoogleApi.Content.V2.Model.BusinessDayConfig.t`, *default:* `nil`) - Business days of the warehouse. If not set, will be Monday to Frida...
0995b828b31bd4caeb89dfaf730902c4dbfa89c5
1,720
[ 1010011901 ]
[ "documented" ]
defmodule Sui.Rpc.V2beta.MergeCoins do @moduledoc """ Command to merge multiple coins of the same type into a single coin. """ use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 def descriptor do # credo:disable-for-next-line %Google.Protobuf.DescriptorProto{ name: "MergeCoins"...
099648a49f453a8cebdad244324e3e7ba0c39101
1,548
[ 48701042, 565421534 ]
[]
defmodule Changelog.Slack.Client do use HTTPoison.Base def process_url(url), do: "https://changelog.slack.com/api#{url}" def process_response_body(body) do try do Jason.decode!(body) rescue _ -> body end end def process_request_headers(headers) do [{"content-type", "application/...
099651aa3fb1239828989bf136ed134f3cbeb526
1,914
[ 323975400 ]
[ "typespec", "macro", "documented" ]
defmodule LP2.Scanner.Token do defmacro __using__(_opts) do quote do import unquote(__MODULE__), only: [token: 1, token: 2] end end defmacro token(token_name, opts \\ []) defmacro token(token_name, do: block)do _token(token_name, block) end defmacro token(token_name, _) do _token(toke...
09965dbb289a13dee2f236ab7aa00776d1b12bc7
2,063
[ 703143319 ]
[ "typespec" ]
defmodule Core.Content.UseCases.Updating do alias Core.User.UseCases.Authorization alias Core.Shared.Types.Success alias Core.Shared.Types.Error alias Core.Shared.Types.Exception alias Core.Shared.Validators.Identifier @spec update( Core.User.Ports.Getter.t(), Core.Playlist.Ports.Getter.t(), ...
09967f72b77ef0d62b5d4258ec77da09920a86ce
2,677
[ 445377160 ]
[ "genserver", "liveview" ]
defmodule HowmanycanplayWeb.GameLive do use HowmanycanplayWeb, :live_view def mount(%{"id" => id}, _session, socket) do game = case Igdb.fetch_game(id) do {:ok, game} -> game other -> other end socket = socket |> assign(:game, game) {:ok, s...
099763c6e7fdbd465b2ef773f61903e826eb0190
2,379
[ 387670185 ]
[ "phoenix", "ecto" ]
defmodule FelixirWeb.AuthController do use FelixirWeb, :controller import Plug.Conn alias Felixir.Auth alias FelixirWeb.Utils alias FelixirWeb.Constants alias Felixir.Auth.User plug :dont_exploit_me when action in [:login, :register] plug :protect_me when action in [:logout, :getme] def login(conn,...
099887d79dffd3e79675056e8659e2aa7f67ff3c
1,668
[ 683777182 ]
[ "typespec", "macro", "documented" ]
defmodule UrFUSwissKnife.CharEscape do @moduledoc false @chars_need_escape [?_, ?*, ?[, ?], ?(, ?), ?~, ?`, ?>, ?#, ?+, ?-, ?=, ?|, ?{, ?}, ?., ?!] @spec sigil_t(String.t(), any()) :: String.t() def sigil_t(data, _params) do escape_telegram_markdown(data) end @spec sigil_i(Macro.t(), any()) :: Macro.t...
0998ae9a79fb02864f15bdbc9e2122c1c3c36bf2
1,939
[ 149341770 ]
[]
defmodule Ibento.Web.MixProject do use Mix.Project def project() do [ app: :ibento_web, version: "0.1.0", build_path: "../../_build", config_path: "../../config/config.exs", deps_path: "../../deps", lockfile: "../../mix.lock", elixir: "~> 1.5", elixirc_paths: eli...
0999647c3bcbd518cf04b759cb5e2b8f547d5b91
3,649
[ 66563929 ]
[ "test" ]
defmodule Peepy.RoomControllerTest do use Peepy.ConnCase alias Peepy.Room @valid_attrs %{name: "some content"} @invalid_attrs %{} setup %{conn: conn} do user = Repo.insert! %Peepy.User{} {:ok, jwt, _ } = Guardian.encode_and_sign(user, :token) conn = conn |> put_req_header("content-t...
099a2c2f3703296ea191aa73c2a74b6aa17605b1
1,752
[ 203268660 ]
[ "phoenix", "ecto" ]
defmodule PhellowWeb.BoardController do use PhellowWeb, :controller alias Phellow.Content alias Phellow.Content.Board def index(conn, _params) do boards = Content.list_boards() render(conn, "index.html", boards: boards) end def new(conn, _params) do changeset = Content.change_board(%Board{}) ...
099a83195a1e3b901ee75b8a0c7f596beb78729e
1,553
[ 107552604 ]
[ "macro", "documented", "phoenix" ]
defmodule CiCWeb 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 CiCWeb, :controller use CiCWeb, :view The definitions below will be executed for every view, controller, etc, so keep...
099a879e9f45fff1809f21c8adbd3419c6b7a1d6
5,379
[ 398198092 ]
[ "genserver", "liveview", "documented", "ecto" ]
# coveralls-ignore-start defmodule CodewarWeb.Home.IndexLive do use CodewarWeb, :live_view import CodewarWeb.ErrorHelpers alias Codewar.Competition.Competitions alias Codewar.Competition.Schemas.Answer alias CodewarWeb.Channels.CompetitionChannel @impl true def mount(_params, _session, socket) do if...
099ac3d4d7fc9eb788849381b8d0a33aea233d15
7,963
[ 624054242 ]
[ "typespec", "documented" ]
# Code generated by protox. Don't edit. # credo:disable-for-this-file defmodule PgQuery.JsonArrayAgg do @moduledoc false if function_exported?(Protox, :check_generator_version, 1) do Protox.check_generator_version(1) else raise "This code was generated with protox 2 but the runtime is using an older versi...
099aca7dda0470083a3f5883be6df899ed16cbaa
1,513
[ 976808468 ]
[ "documented" ]
defmodule Basenji.Reader.CBTReader do @moduledoc false import Basenji.Reader def format, do: :cbt def close(_any), do: :ok def file_extensions, do: ["cbt"] def get_magic_numbers, do: [%{offset: 257, magic: ~c"ustar"}] def get_entries(cbz_file_path, _opts \\ []) do with {:ok, file_names} <- :erl_t...
099b47fec9a11d3bc55ddaa9ea2d1063a9f3b672
2,049
[ 647499532 ]
[ "test" ]
defmodule OrbitTest.Test do use ExUnit.Case require OrbitTest test "build_client_cert/2" do # WHEN cert = OrbitTest.build_client_cert("schrockwell") # THEN assert %Orbit.ClientCertificate{common_name: "schrockwell", self_signed?: true} = cert assert DateTime.diff(cert.not_valid_after, DateT...
099b6f8c6207b1e5aee29010fa5dbcfc06a34a11
1,925
[ 353805581 ]
[ "test", "ecto" ]
defmodule Api.ReviewsTest do use Api.DataCase alias Api.Reviews describe "reviews" do alias Api.Reviews.Review @valid_attrs %{rating: 120.5} @update_attrs %{rating: 456.7} @invalid_attrs %{rating: nil} def review_fixture(attrs \\ %{}) do {:ok, review} = attrs |> Enum....
099bc1e688e3a6586727d26bb751072bef4ceb71
4,541
[ 661274771 ]
[ "test" ]
defmodule HangmanImplGameTest do use ExUnit.Case doctest Hangman alias Hangman.Impl.Game test "new game returns structure" do game = Game.new_game assert game.turns_left == 7 assert game.game_state == :initializing assert length(game.letters) > 0 end test "new game returns correct word" ...
099bcd0925df6e780e43575ae40ec690d427ef04
1,758
[ 746982029 ]
[ "phoenix", "ecto" ]
defmodule Elixir03Web.ProductController do use Elixir03Web, :controller alias Elixir03.Catalog alias Elixir03.Catalog.Product def index(conn, _params) do products = Catalog.list_products() render(conn, :index, products: products) end def new(conn, _params) do changeset = Catalog.change_produc...
099c04f557986d85964de09312e22a0567669c43
5,375
[ 750496720 ]
[ "test" ]
defmodule EWalletServiceWeb.AccountControllerTest do use EWalletServiceWeb.ConnCase alias EWalletService.Users.Create, as: CreateUser alias EWalletServiceWeb.Token import Mox setup do params = %{ "name" => "John", "email" => "<EMAIL>", "password" => "password123" } {:ok, user...
099c16d06c8e11efd6c81a0784fcc5b73838d0af
17,110
[ 806822991 ]
[ "typespec", "macro", "documented" ]
defmodule Cldr.DateAndTime.Backend do @moduledoc false def define_backend_modules(config) do backend = config.backend config = Macro.escape(config) quote location: :keep, bind_quoted: [config: config, backend: backend] do defmodule DateTime do @doc """ Formats a DateTime accordin...
099c9c3538aca30fdfbf3e1be6dcd0834d2475be
2,678
[ 392199891 ]
[ "test" ]
defmodule Blog.Core.PostTest do use ExUnit.Case, async: true alias Blog.Core.Post describe "parse_metadata/1" do test "it works" do raw_content = """ -- date: 2021-08-01 -- title: Hello, world! test """ parsed = raw_content |> Post.parse_metadata() ...
099cf0b8b48e46fcd887ceb1bd6ec062e85fea03
1,929
[ 178806693 ]
[ "test" ]
defmodule AuthServer.UserTest do use ExUnit.Case import Ecto import Ecto.Query alias AuthServer.Repo alias AuthServer.Model.User setup do :ok = Ecto.Adapters.SQL.Sandbox.checkout(AuthServer.Repo) %User{} |> User.changeset(%{user_id: "test_id", password: "password", name: "testman"}) |> R...
099d23f14cc7b15f3471b8897be6c66b987e7dcd
1,713
[ 322274139 ]
[]
# 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 config :kickstart, ecto_repos: [Kickstart.Repo...
099d904ad68417c7ef50939fb25aad5ac15ae296
6,356
[ 935778085 ]
[ "typespec", "documented" ]
defmodule WandererNotifier.Domains.CharacterTracking.Character do @moduledoc """ Struct for standardizing character data from the map API (current flat format). Expects API payloads like: ```json { "data": [ { "characters": [ { "name": "Shiv Black", "corpo...
099d995f93e967706ad442dcf3c789dc5f3f16b9
2,322
[ 624054242 ]
[ "typespec", "documented" ]
# Code generated by protox. Don't edit. # credo:disable-for-this-file defmodule PgQuery.JsonConstructorType do @moduledoc false @type t :: %__MODULE__{} defstruct [] ( @spec default() :: :JSON_CONSTRUCTOR_TYPE_UNDEFINED def default() do :JSON_CONSTRUCTOR_TYPE_UNDEFINED end ) @spec encode...
099dc77a81b58c96d6cd5480005c7e066ec2e6c6
8,583
[ 579561205 ]
[]
defmodule CoreIdentityElixir.CoreIdentity.Mock do def request(:get, "localhost/api/v1/oauth/certs", "", _headers, _params) do {:ok, %HTTPoison.Response{status_code: 200, body: Jason.encode!(certs())}} end def request(:get, "localhost/api/v1/providers", "", _headers, _params) do {:ok, %HTTPoison.Response{...
099eb4400e31c152b41ac8a8822db5b1eab13717
18,146
[ 818847023 ]
[ "documented", "ecto" ]
defmodule Hello.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias Hello.Repo alias Hello.Accounts.{Users, UsersToken, UsersNotifier} ## Database getters @doc """ Gets a users by email. ## Examples iex> get_users_by_email("<EMAIL>") %Users{} ...
099ecffa0c4366bd2c404a3edc5475d5ff9080a1
1,708
[ 348846695 ]
[]
defmodule HomeApp.DeviceControl do alias HomeApp.{Configuration, ConfigurationAgent} def dispatch(devices, action, parameters \\ %{}) def dispatch(devices, action, parameters) when is_list(devices) do Enum.each(devices, fn device -> dispatch(device, action, parameters) end) end def dispatch(%...
099f03d309ccfd3a4cf2dcfa8fee58ef7efc22c4
3,063
[ 528431347 ]
[ "phoenix" ]
defmodule ShuttertopWeb.Api.PhotoView do use ShuttertopWeb, :view def render("index.json", %{photos: photos, total_entries: total_entries}) do %{ photos: render_many(photos, ShuttertopWeb.Api.PhotoView, "photo_basic.json"), total_entries: total_entries } end def render("show.json", %{photo...
099f8df49fa2616a9dd673966fb7d731645fafdd
4,405
[ 153828913 ]
[]
%{ "certifi": {:hex, :certifi, "2.4.2", "75424ff0f3baaccfd34b1214184b6ef616d89e420b258bb0a5ea7d7bc628f7f0", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, "cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:re...
099fb76393c1c62b3afa5a7291cc4ff6e1eb285a
12,695
[ 737574059 ]
[ "test", "ecto" ]
defmodule Studio.PortalsTest do use Studio.DataCase alias Studio.Portals describe "users" do alias Studio.Portals.User import Studio.PortalsFixtures @invalid_attrs %{metadata: nil, did: nil} test "list_users/0 returns all users" do user = user_fixture() assert Portals.list_users()...
099feae1db196c9f249698163dac4c694dc5565a
4,405
[ 896649984 ]
[ "liveview", "documented" ]
defmodule MyMoneyWeb.Component.Breadcrumb do @moduledoc false use MyMoneyWeb.Component @doc """ Renders a breadcrumb. ## Examples <.breadcrumb> <.breadcrumb_list> <.breadcrumb_item> <.breadcrumb_link href="/">Home</.breadcrumb_link> </.breadcrumb_item...
09a041f1bdb89e93006ec7f401e9bf5a70675ab2
2,819
[ 87683657, 99106424, 103105109, 109620344, 125414041, 87457687, 207847106, 228937556, 77253880, 86030418, 95605888, 103459096, 77785313, 86063602, 96350285, 72784914, 96857265, 73516692, 80629259, 86415043, 91157211, 133864047, 17908039, 99961699, 80284638, 85355617,...
[ "documented" ]
defmodule Mix.Tasks.Gettext.Extract do use Mix.Task @recursive true @shortdoc "Extracts translations from source code" @moduledoc """ Extracts translations by recompiling the Elixir source code. mix gettext.extract [OPTIONS] Translations are extracted into POT (Portable Object Template) files (wit...
09a051cf9abecf95e7fc0960f0af4ead2a09cc11
2,402
[ 404549451 ]
[ "test" ]
defmodule FlightBooking.FlightBookingTest do use ExUnit.Case alias FlightBooking.Booking.Agent, as: BookingAgent alias FlightBooking.User.Agent, as: UserAgent import FlightBooking.Factory setup_all do BookingAgent.start_link(%{}) UserAgent.start_link(%{}) on_exit(fn -> BookingAgent.clear...
09a0ae205241bec723bea4c5c0347eef7439d73e
4,606
[ 425955021 ]
[ "test", "ecto" ]
defmodule ALF.Examples.DistrTrans.TwoPhaseCommitParallel.TPCPipeline do use ALF.DSL defstruct data: 0, route_to: nil, ready: false, both_ready: false, done: false @components [ composer(:decompose), switch(:route_event, branches: %{ first: [s...
09a14c816debfb8555ba28ca539e1b98361a626b
5,639
[ 491172215 ]
[ "typespec", "documented", "ecto" ]
defmodule Mazaryn.Posts do @moduledoc """ Public Mazaryn.Posts API """ require Logger alias Core.PostClient alias Mazaryn.Schema.Post alias Mazaryn.Schema.Comment def update_comment(%Ecto.Changeset{valid?: false} = changeset), do: changeset def update_comment(%{changes: %{id: comment_id, content: ...
09a18ed76d12d6cb1d80de2a40705a8c4a7c39d2
4,077
[ 580519284 ]
[ "test", "ecto" ]
defmodule Storage.MessageTest do use ExUnit.Case alias Ecto.Adapters.SQL.Sandbox alias Storage.{Helpers, Message} setup do :ok = Sandbox.checkout(Storage) Sandbox.mode(Storage, {:shared, self()}) end def changeset(params \\ %{}) do conversation = Helpers.insert_conversation() first_user_...
09a230cd23df76dec7673bfeba595d6ea037e059
3,354
[ 82238227 ]
[ "test" ]
defmodule Teaminterface.UploadController.CbTest do use Teaminterface.ConnCase import Teaminterface.ConnCase.Fixture alias Teaminterface.ChallengeBinary setup do current_round = build(:round) |> make_current |> insert enablement = insert(:enablement, round: current_round) enabled_cset = enablement...
09a27585b07a6807fe53d4c7a8ad1b95eebb06a0
2,346
[ 682296768 ]
[]
defmodule GithubInfoApi.MixProject do use Mix.Project def project do [ app: :github_info_api, version: "0.1.0", elixir: "~> 1.14", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), test_coverage: [tool...
09a283099fef697d552635cd14dc1607518670b2
2,396
[ 218801995, 333962160 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Storage.V1.Model.Notification do @moduledoc """ A subscription to receive Google PubSub notifications. ## Attributes * `custom_attributes` (*type:* `map()`, *default:* `nil`) - An optional list of additional attributes to attach to each Cloud PubSub message published for this notificatio...
09a2c8f666fcabe114dd6ad7e076b1cd9314ea8b
1,608
[ 528915591 ]
[ "liveview" ]
defmodule LiveViewStudioWeb.LightLive do use LiveViewStudioWeb, :live_view def mount(_params, _session, socket) do socket = assign(socket, :brightness, 10) {:ok, socket} end def render(assigns) do ~L""" <h1>Front Porch Light</h1> <div id="light"> <div class="meter"> <span sty...
09a34bcb4908fdf0d1682eb1936d4696c86daec7
1,560
[ 459130670 ]
[ "phoenix" ]
defmodule Demo.Interface.Router do use Phoenix.Router alias Demo.Interface.User scope "/" do get "/", User.Controller, :welcome # registration get "/start_registration_form", User.Controller, :start_registration_form post "/start_registration", User.Controller, :start_registration get "/fin...
09a3bd756645572e3eacfa11846cb6fc46f10d80
1,843
[ 553824177 ]
[ "test" ]
defmodule HushTest do use ExUnit.Case, async: false doctest Hush import Mox alias Hush.Provider.MockProvider test "release_mode? is false" do assert Hush.release_mode?() == false end test "resolve!()" do expect(MockProvider, :load, fn _ -> :ok end) expect(MockProvider, :fetch, fn _ -> {:ok...
09a3fafd913511ea2d0b9dfc9be1e56bc628edb0
4,813
[ 124031695 ]
[ "genserver", "phoenix" ]
defmodule WebsocketWeb.HallRoomChannel do use Phoenix.Channel require Logger alias Phoenix.Socket alias Websocket.ServerRoom, as: ServerRoom @room_name "lobby" def get_lobby_name(), do: @room_name def get_user_pid(socket), do: socket.assigns.pid def get_user_uid(socket), do: socket.a...
09a4287267d737e2740abed09727291555412106
3,019
[ 154814401 ]
[ "macro", "test" ]
defmodule ETag.PlugTest do use ExUnit.Case, async: true import ETag.Plug, only: [call: 2, handle_etag: 2] describe ".call" do test "sets a before_send callback" do conn = conn() opts = opts() assert %Plug.Conn{before_send: [_handle_etag_function]} = call(conn, opts) end end descr...
09a431e9333477058c69d9b99d943b1655cb5230
3,261
[ 309049499 ]
[ "documented" ]
defmodule Euler.Problem61 do @moduledoc """ https://projecteuler.net/problem=61 """ @doc """ The purpose of the `main` function is to measure the execution time of as function. """ def main() do # start chrono time_start = Time.utc_now() result = solve() # stop chrono time_finish...
09a4491d7092729908c1bd56e89f2c28747dab5f
2,276
[ 509861145 ]
[ "test" ]
defmodule ExMon.GameTest do use ExUnit.Case alias ExMon.{Game, Player} describe "start/2" do test "starts the game state" do player = Player.build("Arthur", :kick, :punch, :heal) computer = Player.build("SkyNet", :kick, :punch, :heal) assert {:ok, _pid} = Game.start(computer, player) ...
09a45e67ffbf334247cd91ead79d757f7f9aa3ec
7,190
[ 163002453 ]
[ "typespec", "documented" ]
defmodule ReverseProxyPlug do @moduledoc """ The main ReverseProxyPlug module. """ alias Plug.Conn @behaviour Plug @http_client HTTPoison @spec init(Keyword.t()) :: Keyword.t() def init(opts) do upstream_parts = opts |> Keyword.get(:upstream, "") |> get_string() |> upstrea...
09a463fd4590c0d5845b99e6e7d98d943489820b
3,604
[ 668251219 ]
[ "liveview", "ecto" ]
defmodule PetalProWeb.UserOnboardingLive do use PetalProWeb, :live_view alias PetalPro.Accounts def mount(params, _session, socket) do socket = socket |> assign(user_return_to: Map.get(params, "user_return_to", nil)) |> assign_form(Accounts.change_profile(socket.assigns.current_user)) ...
09a4ed5802904cd9088a6224cf38935c4036221b
1,577
[ 146480908, 293995086, 286885556 ]
[ "macro", "documented", "phoenix" ]
defmodule Proj5Web 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 Proj5Web, :controller use Proj5Web, :view The definitions below will be executed for every view, controller, etc, s...
09a4f94a1ead50e5b9d2bd79021f19c2534e8c85
2,771
[ 175115999 ]
[ "phoenix", "ecto" ]
defmodule TaskTrackerWeb.TaskController do use TaskTrackerWeb, :controller alias TaskTracker.Tasks alias TaskTracker.Tasks.Task alias TaskTracker.Users alias TaskTracker.Timeblocks def index(conn, _params) do tasks = Tasks.list_tasks() users = Users.get_users() current_user = get_session(conn,...
09a59771d0ea83d56bc94696f2c0918c3bbb372c
1,728
[ 878522784 ]
[]
defmodule Offerings.Live.ProbabilityPipeline do use Broadway require Logger alias Broadway.Message alias ExAws.Kinesis alias Offerings.Live.ProbabilityProducer def start_link(opts) do offerings_stream = Keyword.fetch!(opts, :offerings_stream) Logger.info("Kinesis OFFERINGS STREAM: #{offerings_str...
09a5c03525e5ceca5068b6856420f9a73119ac2d
1,680
[ 240733 ]
[ "test" ]
defmodule MoviePicksTest do use ExUnit.Case import ExUnit.CaptureIO doctest MoviePicks test "displays a movie with a good score" do movie_picks = fn -> MoviePicks.CLI.main([FakeHttpClient]) end assert capture_io([input: "goodmovie\n"], movie_picks) == """ Enter the name of a movie: Title: title...
09a626333ff729db403f990a2b7902e091c68118
2,305
[ 967938120 ]
[ "liveview", "ecto" ]
defmodule TodoWeb.TaskLive.FormComponent do use TodoWeb, :live_component alias Todo.Tasks @impl true def render(assigns) do ~H""" <div> <.header> {@title} <:subtitle>Use this form to manage task records in your database.</:subtitle> </.header> <.simple_form f...
09a644d1f5fd9744179b933aa13b132bb801306d
13,312
[ 439166275 ]
[]
%{ "absinthe": {:hex, :absinthe, "1.7.1", "aca6f64994f0914628429ddbdfbf24212747b51780dae189dd98909da911757b", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3.0", ...
09a6555f75c14b84b7bbbc9f3548557d23401354
2,189
[ 59006384 ]
[ "macro" ]
defmodule TestProject.Repo.Schema do defmacro __using__(_) do quote do import unquote(__MODULE__), only: :macros end end defmacro schema([do: block]) do quote do Module.register_attribute(__MODULE__, :struct_fields, accumulate: true) Module.register_attribute(__MODULE__, :mapping_f...
09a67c8b6693753aeb1e295e7b87b52bec5abffc
1,749
[ 435204539 ]
[ "liveview", "ecto" ]
defmodule TeamThinkWeb.TaskListLive.FormComponent do use TeamThinkWeb, :live_component alias TeamThink.TaskLists alias TeamThink.Conversations @impl true def update(%{task_list: task_list} = assigns, socket) do changeset = TaskLists.change_task_list(task_list) {:ok, socket |> assign(assig...
09a75f32b1a831ebab56e8202352c31b16f32de1
2,953
[ 710789931 ]
[ "test", "phoenix" ]
defmodule ApiWeb.WorkingTimeControllerTest do use ApiWeb.ConnCase alias Api.Accounts alias Api.Accounts.WorkingTime @create_attrs %{ start: "2010-04-17T14:00:00Z", end: "2010-04-17T14:00:00Z" } @update_attrs %{ start: "2011-05-18T15:01:01Z", end: "2011-05-18T15:01:01Z" } @invalid_attrs...
09a7b78dab29d0374ba7cd1eea1b36110d890ade
6,498
[ 829325066 ]
[ "documented" ]
defmodule Sample do @path "popular-names.txt" # ファイル読み込みと\nでスプリットしてリストに変換する関数 defp read_and_split(path \\ @path) do path |> File.read!() |> String.split("\n") end @doc """ # 10. 行数のカウント 行数をカウントせよ.確認にはwcコマンドを用いよ. ## Unix ```bash wc -l popular-names.txt ``` ## Examples ```elix...
09a7ec8d2c52f6b2e570238c9e6cc5593197bfc9
1,563
[ 169122955 ]
[]
defmodule EventClient do def do_post(api, obj) do url = "http://localhost:4000/#{api}" body = Poison.encode!(obj) {:ok, results} = HTTPoison.post url, body, [{"Content-Type", "application/json"}] json = Poison.decode!(results.body) IO.puts(inspect json) end def do_get(api) do url = "htt...
09a861919693c5ee83df4a4507244f688d2a82e1
3,070
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Compute.V1.Model.VmEndpointNatMappingsInterfaceNatMappings do @moduledoc """ Contain information of Nat mapping for an interface of this endpoint. ## Attributes * `drainNatIpPortRanges` (*type:* `list(String.t)`, *default:* `nil`) - List of all drain IP:port-range mappings assigned to th...