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
0c7998d86a59a700dda12ea2cf20d61d5454a026
2,067
[ 691044038 ]
[ "test", "ecto" ]
defmodule Appphoenix.PersonsTest do use Appphoenix.DataCase alias Appphoenix.Persons describe "persons" do alias Appphoenix.Persons.Person import Appphoenix.PersonsFixtures @invalid_attrs %{name: nil, description: nil} test "list_persons/0 returns all persons" do person = person_fixture...
0c7a1af2034630f4677796c730e7f8e78fa44974
3,149
[ 393183352, 806846912, 873874749 ]
[ "documented" ]
defmodule Wizard.Chap02.String do @moduledoc """ This module contains functions for learning about the String data types. # Variables Variable names can include uppercase or lowercase letters, underscores, or numbers, but they must start with a lowercase letter or an underscore. # Immutability Variables...
0c7ad615b2b1686701036faf5b3099c444c5616e
2,171
[ 375227211 ]
[ "genserver", "liveview" ]
defmodule InstagramCloneWeb.UserLive.Profile do use InstagramCloneWeb, :live_view alias InstagramClone.{Accounts, Posts} alias InstagramCloneWeb.UserLive.FollowComponent @impl true def mount(%{"username" => username}, session, socket) do socket = assign_defaults(session, socket) user = Accounts.profil...
0c7aed92b76626cee834541ca305bb3aa5fea71e
4,892
[ 437906643 ]
[ "test" ]
defmodule Logger.FormatterTest do use Logger.Case, async: true doctest Logger.Formatter import Logger.Formatter test "prune/1" do assert prune(1) == "�" assert prune(<<"hí", 233>>) == "hí�" assert prune(["hi" | 233]) == ["hi" | "�"] assert prune([233 | "hi"]) == [233 | "hi"] assert prune([...
0c7b8196be16cf74d8b1d74a692460251cd90729
4,219
[ 163277988 ]
[ "macro", "documented" ]
defmodule Nebulex.Adapter.Transaction do @moduledoc """ Specifies the adapter transactions API. ## Default implementation This module also provides a default implementation which uses the Erlang library `:global`. This implementation accepts the following options: * `:keys` - The list of the keys th...
0c7cc93eed782dc04609870d8e7e0a892e0df0f8
9,583
[ 739683026 ]
[ "documented", "ecto" ]
defmodule Digga.Campaigns do @moduledoc """ The Campaigns context. """ import Ecto.Query, warn: false alias Digga.Repo alias Digga.Users.User alias Digga.Campaigns.Membership alias Digga.Campaigns.Receipt alias Digga.Campaigns.ExecuteStepWorker def active_campaigns do [ ## Insert campaig...
0c7cdd388fe793d7896e87a5ca0c1a082cef25b2
1,623
[ 287897305 ]
[]
defmodule CS.MixProject do use Mix.Project def project do [ app: :complains_server, version: "0.1.0", elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), dep...
0c7d14aac600a0c9b4741fe5f93c48cadae510da
1,623
[ 571902666 ]
[ "typespec" ]
defmodule AdventOfCode2022.Solution.Day4 do use AdventOfCode2022.Solution @impl true @spec prepare_input(String.t()) :: [{number(), number()}] def prepare_input(filename) do File.read!(filename) |> String.trim_trailing() |> String.split("\n") |> Enum.map(&parse_line!/1) end @impl true @s...
0c7d21a4f3df4dc1d60f152b49d286b51037b9e2
12,700
[ 624054242 ]
[ "typespec", "documented" ]
# Code generated by protox. Don't edit. # credo:disable-for-this-file defmodule PgQuery.A_Const 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 version of...
0c7d441a983a36ac442b60d78ed5d805602fe173
2,592
[ 98185781 ]
[ "phoenix", "ecto" ]
defmodule CodebattleWeb.Api.V1.PlaybookController do use CodebattleWeb, :controller import Ecto.Query, warn: false alias Codebattle.Game alias Codebattle.Game.Helpers alias Codebattle.Game.Server alias Codebattle.Playbook alias Codebattle.Repo alias Codebattle.Task alias Codebattle.User def appro...
0c7d8e7a94e2ab02f774774ef9c7183e07a47634
1,943
[ 269512124 ]
[]
defmodule RecipeBox.MixProject do use Mix.Project def project do [ app: :recipe_box, version: "0.1.0", elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases()...
0c7d98b2a151543f46c16035a4cf4cf8131cd02b
1,512
[ 816289014 ]
[ "phoenix" ]
defmodule SdjoblistWeb.Router do use SdjoblistWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :rootlayout do plug :put_root_layout, html: {SdjoblistWeb.Layouts,...
0c7daacc8c7fe73ba69997d6ac026520058750d0
1,638
[ 580906288 ]
[ "genserver", "documented" ]
defmodule TinyURL do @moduledoc """ ##Example iex(1)> {:ok, pid} = TinyURL.start_link(:foo) {:ok, #PID<0.109.0>} iex(2)> TinyURL.shorten(:foo, "https://google.com") "99999ebcfdb78df077ad2727fd00969f" iex(3)> TinyURL.get(:foo, "99999ebcfdb78df077ad2727fd00969f") ...
0c7ec7d6b2f75bfd1f4dc88889907279c5559710
1,992
[ 98858102 ]
[ "ecto" ]
defmodule Healthlocker.Slam.ConnectCarer do use Ecto.Schema alias Ecto.Multi alias Healthlocker.{User, Carer, Room, UserRoom, ClinicianRooms, Repo} def connect_carer_and_create_rooms(user, params, service_user) do Multi.new |> Multi.update(:user, User.name_changeset(user, %{first_name: params["first_na...
0c7f15b1b0ae7ac7188b64052708d6b9592f13b6
1,710
[ 699707915 ]
[]
# 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 :collector, ecto_repos: [Collector.Repo] # C...
0c7f87b9323ca509a644e15782bb1a46df26130f
9,357
[ 129004779 ]
[ "typespec", "documented" ]
defmodule ExWire.Struct.WarpQueue do @moduledoc """ `WarpQueue` maintains the current state of an active warp, this mean we will track the `block_chunk` hashes and `state_chunk` hashes given to us, so we can request each from our connected peers. This structure is also persisted during a warp sync, so that i...
0c801ce53e796743bd2fbc09c60323e950be555d
4,953
[ 58656783, 60716862, 52610080, 75659168, 54068570, 58332703, 53535974, 57368077, 52439335, 56011329, 51879967, 56457926, 59367090, 51054054, 61923005 ]
[ "typespec", "documented" ]
defmodule Phoenix.Digester do @digested_file_regex ~r/(-[a-fA-F\d]{32})/ @moduledoc """ Digests and compress static files. For each file under the given input path, Phoenix will generate a digest and also compress in `.gz` format. The filename and its digest will be used to generate the manifest file. It ...
0c8028aad5148c73e4b5cb6d501ab88897ec8788
1,987
[ 863121838 ]
[]
# 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 :chat_cat, ecto_repos: [ChatCat.Repo], gen...
0c805d5bfaca5096430af281ddaea5a2de103eb1
16,269
[ 129619089 ]
[ "test", "ecto" ]
defmodule I18NAPI.TranslationsTest do use ExUnit.Case, async: false @moduletag :translations_api use I18NAPI.DataCase use I18NAPI.Fixtures, [:setup] alias I18NAPI.Translations alias I18NAPI.Projects alias I18NAPI.Accounts alias I18NAPI.Accounts.User @user_attrs %{ name: "test name", email: "...
0c806be35bcd65e9304927330e2606b4e6f39f40
4,193
[ 274330796 ]
[ "documented", "ecto", "phoenix" ]
defmodule Hello.CMS do @moduledoc """ The CMS context. """ import Ecto.Query, warn: false alias Hello.Repo alias Hello.CMS.{Page, Author} alias Hello.Accounts @doc """ Returns the list of pages. ## Examples iex> list_pages() [%Page{}, ...] """ def list_pages do Page |> ...
0c80b2745ed0b1188d017da05d299579aafbb118
2,527
[ 1006445605 ]
[ "documented" ]
defmodule Mix.Tasks.Tenant.Migrations do use Mix.Task alias Ecto.Migrator alias Mix.Ecto alias Mix.Tenant, as: MTenant alias Tenant @shortdoc "Displays the repository migration status" @recursive true @moduledoc """ Displays the up / down migration status for the given repository. The reposito...
0c8155978dddc8b7e574a1eccabde715830ab783
2,875
[ 127043537 ]
[ "test" ]
defmodule Beautify.BlindPriceSheetControllerTest do use Beautify.ConnCase alias Beautify.BlindPriceSheet @valid_attrs %{descriptin: "some content"} @invalid_attrs %{} test "lists all entries on index", %{conn: conn} do conn = get conn, blind_price_sheet_path(conn, :index) assert html_response(conn, ...
0c81fda94f67d5589c7b58ba853a736a8349c2fb
5,147
[ 379678050, 372603056, 347043832, 349082708, 346794822, 712606134 ]
[ "typespec", "documented" ]
defmodule Absinthe.Phase.Document.Validation.ArgumentsOfCorrectType do @moduledoc false # Validates document to ensure that all arguments are of the correct type. alias Absinthe.{Blueprint, Phase, Phase.Document.Validation.Utils, Schema, Type} use Absinthe.Phase @doc """ Run this validation. """ @sp...
0c82696bb8aac2e8d2fdaee8098c95a2a1f943ff
3,592
[ 566470123 ]
[ "test" ]
defmodule Tweedle.AccountsTest do use Tweedle.DataCase alias Ecto.{InvalidChangesetError, NoResultsError} alias Tweedle.Accounts alias Tweedle.AccountsFixtures @moduletag :accounts describe "create_user!/1" do test "OK when valid attrs" do assert Accounts.create_user!(AccountsFixtures.valid_use...
0c82d74bb911755b93cfce7256b7d59dc0a84443
10,452
[ 248702688 ]
[ "typespec", "documented" ]
defmodule Stripe.Account do @moduledoc """ Work with Stripe Connect account objects. You can: - Retrieve your own account - Retrieve an account with a specified `id` This module does not yet support managed accounts. Stripe API reference: https://stripe.com/docs/api/accounts """ use Stripe.Entity...
0c82f533de1a3fc1c3ba7e00b8298008029d9dad
2,304
[ 184334301 ]
[ "genserver", "documented" ]
defmodule Detectino.Api.PinWorker do @moduledoc """ Listens for PIN check requests and send back a response """ use GenServer alias Detectino.Api.{AuthWorker, Pin} require Logger defmodule State do @moduledoc false defstruct pin: nil, tref: nil end def start_link(args) do GenServer.sta...
0c82f9db3b29c59dbfc1e216a19ca5ff50b4afce
1,512
[ 575749266 ]
[ "liveview", "phoenix" ]
defmodule MxgrnWeb.Endpoint do use Phoenix.Endpoint, otp_app: :mxgrn # 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: "_mxgrn_key", ...
0c833a17329755455c0e52b9a90af3453862ac68
5,149
[ 415202580, 423134340 ]
[ "documented", "ecto" ]
defmodule Swoosh.Adapters.Gmail do @moduledoc """ An adapter that sends email using Gmail api For reference [Gmail API docs](https://developers.google.com/gmail/api) ## Dependency Gmail adapter requires `Mail` dependency to format message as RFC 2822 message. {:mail, ">= 0.0.0"} Because `Mail` li...
0c8421ecbf5f59ca633eaa34d6e3be2c5767025b
1,787
[ 282098519 ]
[ "phoenix" ]
defmodule TeacherWeb.PasswordResetController do use TeacherWeb, :controller alias Teacher.{Accouts, Email, Mailer} def new(conn, _params) do render(conn, "new.html") end def create(conn, %{"email" => email}) do case Accouts.get_user_by_username(email) do nil -> conn |> put_fla...
0c84505d2ef0513ce80103b3100746e34e622e1f
3,307
[ 79231217 ]
[ "typespec", "documented" ]
defmodule ExCov.Project do @moduledoc """ Gives information about and analyses a Mix Project for code coverage. """ alias ExCov.Project, as: Project alias ExCov.Module, as: Module alias ExCov.Statistics, as: Statistics defstruct [ compile_path: nil, cover_compiled?: false, cover_analy...
0c856811b79180b4f6f8afc21aa9d3c3966c7e78
2,893
[ 601655350 ]
[]
defmodule BlogClient do @client Application.compile_env(:blog_client, [BlogClient, :default_client]) @headers Application.compile_env(:blog_client, [BlogClient, :headers]) def get_all_users(opts \\ []) do "/users" |> get(opts) end def get_user(user_id, opts \\ []) do "/users/#{user_id}" |> g...
0c85724b3769a58c36f8b7fd4700ca52701eeabf
16,049
[ 763575502 ]
[]
%{ "backoff": {:hex, :backoff, "1.1.6", "83b72ed2108ba1ee8f7d1c22e0b4a00cfe3593a67dbc792799e8cce9f42f796b", [:rebar3], [], "hexpm", "cf0cfff8995fb20562f822e5cc47d8ccf664c5ecdc26a684cbe85c225f9d7c39"}, "bandit": {:hex, :bandit, "1.1.3", "0c504f50029381f41203788851df8e43554d79b0a073e993b424b5897ee2fb8d", [:mix], [{:h...
0c85925544145e67b80319b6e996f776e2b823ff
18,701
[ 994404603 ]
[ "genserver", "typespec", "documented" ]
defmodule WandererKills.Ingest.HistoricalFetcher do @moduledoc """ Manages historical killmail data fetching with rate limiting and progressive delivery. This GenServer handles extended preload requests for historical data, fetching killmails from zkillboard with rate limiting and delivering them progressively...
0c859d3ef5d44c81f6d59f8f9b4c14156c09e642
1,700
[ 120312223 ]
[ "phoenix" ]
defmodule WeatherDiffWeb.AuthController do use WeatherDiffWeb, :controller alias WeatherDiff.Auth.Actions action_fallback(WeatherDiffWeb.FallbackController) def create(conn, params) do case Actions.login(params) do {:ok, user} -> {:ok, jwt, _full_claims} = user |> WeatherDiff.Auth...
0c85b2059808d27e6e87e03585a17627694682a4
8,017
[ 245255033 ]
[]
%{ "bcrypt_elixir": {:hex, :bcrypt_elixir, "2.2.0", "3df902b81ce7fa8867a2ae30d20a1da6877a2c056bfb116fd0bc8a5f0190cea4", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "762be3fcb779f082075...
0c85ff37ac1faf0a69e18ec9d7855b1e5e47e509
1,870
[ 84313518 ]
[]
defmodule Jackmarchant.Mixfile do use Mix.Project def project do [ app: :jackmarchant, version: "0.0.1", elixir: "~> 1.5", elixirc_paths: elixirc_paths(Mix.env), compilers: [:phoenix, :gettext] ++ Mix.compilers, start_permanent: Mix.env == :prod, aliases: aliases(), ...
0c86547b399c028087fd648abf380d60d7cf409f
2,056
[ 487015363 ]
[ "documented" ]
# https://hexdocs.pm/elixir/IO.html # ??? IO devices maintain their position, which means subsequent calls to any reading or writing functions will start from the place where the device was last accessed. The position of files can be changed using the :file.position/2 function. defmodule IOlib do def main do end ...
0c8656664ffdd35e784c3f39461c9d1d4fc52e1b
2,764
[ 605063009 ]
[]
defmodule SuperCollider.MixProject do use Mix.Project @version "0.2.0" def project do [ app: :supercollider, name: "SuperCollider", description: "An Elixir library for interacting with SuperCollider, an audio synthesis and composition platform.", version: @version, elixir: "~> ...
0c8662875dc062be3edfb0d645b921c0a498eef4
2,140
[ 518470225 ]
[ "documented" ]
defmodule MimeSniff.Signatures do @moduledoc false alias MimeSniff.Signatures.{ ExactSignature, HTMLSignature, MaskedSignature, MP4Signature, TextPlainSignature } @default_signatures_path Path.join([__DIR__, "default_signatures"]) @comment_marker "#" @signature_type_map %{ "ExactSi...
0c8663be1e338ef86e18121cf5a61e2562b35f40
1,784
[ 658701189 ]
[ "genserver", "liveview", "ecto" ]
defmodule ExampleWeb.ArticlesLive do use ExampleWeb, :live_view require DataTable.Ecto.Query def render(assigns) do ~H""" <DataTable.live_data_table id="table" source={{DataTable.Ecto, {Example.Repo, @source_query}}}> <:col name="Id" fields={[:id]} sort_field={:id} visible={false} :let...
0c86648e9304d1173bd26ddeb053d34f119ae7b6
2,784
[ 739262096, 223255738, 1234714, 742840268, 139261729 ]
[ "macro", "documented" ]
defmodule Mix.Config do @moduledoc false @moduledoc deprecated: "Use the Config module instead" @deprecated "Use the Config module instead" defmacro __using__(_) do quote do import Mix.Config, only: [config: 2, config: 3, import_config: 1] end end @deprecated "Use the Config module instead" ...
0c86ffc57ce4d50ae08173cf7b6a71560090ba2a
8,543
[ 746946000 ]
[ "typespec", "liveview", "ecto" ]
defmodule FanCanWeb.BallotLive.Template do use FanCanWeb, :live_view require Logger alias FanCan.Public.Election alias FanCan.Public.Election.{BallotRace, Ballot} alias FanCan.Accounts.UserHolds alias FanCan.Accounts alias FanCanWeb.Components.{BallotEntry, LegBallotEntry, BallotEntryForm} # @type ballot...
0c884053836f2ff4458c468b1ef050e799ee3103
2,865
[ 837272941 ]
[ "liveview", "phoenix" ]
defmodule IdpWeb.AuthController do use IdpWeb, :controller import Phoenix.Component, only: [to_form: 2] alias Idp.Clients @oauth_login_path "/auth/v1/log_in" @remember_me_cookie "_idp_web_user_remember_me" @required_authorize_params ~w(client_id redirect_uri) def authorize(conn, params) do with {:ok...
0c8931e938cbe144626dbf01910cbaea68e7d0b5
2,029
[ 263872054 ]
[ "test", "ecto" ]
if Code.ensure_loaded?(Uniq.UUID) do defmodule Needle.ULID.ULIDSchemaTest do use ExUnit.Case, async: true alias Needle.ULID alias Uniq.UUID defmodule TestSchema do use Ecto.Schema @primary_key {:id, Needle.ULID, autogenerate: true} @foreign_key_type Needle.ULID schema "test...
0c8969c4a2bea29eba876e0517f8abf02e4fe217
1,888
[ 181103911 ]
[ "macro", "documented", "phoenix" ]
defmodule NervesHubAPIWeb 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 NervesHubAPIWeb, :controller use NervesHubAPIWeb, :view The definitions below will be executed for every view,...
0c89b7c1864c51d5533ee1054a319cdcdafe2a90
4,935
[ 365097610 ]
[ "test" ]
defmodule NASAExplorationRoversControlTerminalInterface.CelestialBodiesMenuTest do use ExUnit.Case import Mock alias NASAExplorationRoversControlTerminalInterface.CelestialBodiesMenu def assert_show_menu_options do assert_called NASAExplorationRoversControlTerminalInterface.IO.typing_effect_print( ...
0c89becaf0c936c07d59a60897929072329609f7
2,247
[ 84471115 ]
[ "test", "ecto" ]
defmodule PhxPingu.ColonyTest do use PhxPingu.DataCase alias PhxPingu.Colony alias PhxPingu.Colony.Penguin @create_attrs %{name: "some name", noot_noot: "some noot_noot", species: "some species"} @update_attrs %{name: "some updated name", noot_noot: "some updated noot_noot", species: "some updated species"}...
0c89beef027efadfd1c24f879e3f967af5fca6ad
4,921
[ 973293656 ]
[ "genserver" ]
defmodule Diploma.Quic.Server do use GenServer require Logger @server_opts %{ certfile: ~c"priv/cert.pem", keyfile: ~c"priv/key.pem", alpn: [~c"http/3"], idle_timeout_ms: 60_000, peer_bidi_stream_count: 10, sslkeylogfile: ~c"priv/ssl_key.log", keep_alive_interval_ms: 30_000 } @p...
0c8a1239d79697da694713c98f95459863018b59
8,249
[ 942811655, 920024200 ]
[ "test" ]
defmodule Front.Decorators.WorkflowTest do use Front.TestCase alias Front.Decorators alias Support.Stubs.DB @moduletag :skip setup do Support.Stubs.init() Support.Stubs.build_shared_factories() project = DB.first(:projects) GrpcMock.stub(PipelineMock, :list, fn _req, _stream -> Inte...
0c8a4c572da1725f015dc9ab58eaf6abedc62fbd
2,223
[ 56376728 ]
[ "test" ]
defmodule UserAgentParserTest do use ExUnit.Case doctest UserAgentParser @ua_mac_chrome "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 " @ua_iphone "Mozilla/5.0 (iPhone; CPU iPhone OS 9_0 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like...
0c8a8e19de9395ef91fc995c2f3d98df843aca71
2,379
[ 208235798 ]
[ "phoenix", "ecto" ]
defmodule RemitWeb.ProfileController do use RemitWeb, :controller alias Remit.{Repo, Profile} def index(conn, params) do page = case params["query"] do nil -> Profile term -> Profile.search_query(term) end |> Repo.paginate(params) render(conn, "ind...
0c8a8f406a3a02175524699e5e8da654ed62f463
4,760
[ 98185781 ]
[ "phoenix", "ecto" ]
defmodule CodebattleWeb.TaskPackController do use CodebattleWeb, :controller alias Codebattle.TaskPack alias Codebattle.User plug(CodebattleWeb.Plugs.RequireAuth) def index(conn, _params) do task_packs = TaskPack.list_visible(conn.assigns.current_user) conn |> put_meta_tags(%{ title: "He...
0c8aa9d06d019a845e454ee167dc5f29f5355d27
2,917
[ 603652313 ]
[]
defmodule Tsl2561.Comm do alias Circuits.I2C alias Tsl2561.Config @cs_package_numbers [0b0000, 0b0001] @t_fn_cl_package_numbers [0b0100, 0b0101] def open(bus_name) do {:ok, bus} = I2C.open(bus_name) bus end def write_timing(config, bus, address) do select_register(bus, address, 0x1) by...
0c8ad1aca0c7d7bffd6adba95cdda1161c219843
1,755
[ 165131198 ]
[ "genserver", "typespec", "documented" ]
defmodule Prac.Server do use GenServer @name :attendees_server defmodule State do @type t :: __MODULE__ @moduledoc """ This module holds our notification's server state field in the struct: * `attendees` - the delegates present """ defstruct [attendees: []] end #Client server @doc """...
0c8b3d3c4b4cf47cfad911208234235ba9aae0be
6,604
[ 368904630 ]
[ "genserver", "liveview" ]
defmodule RecipeShareWeb.PageLive do use RecipeShareWeb, :surface_view alias RecipeShare.Accounts alias RecipeShareWeb.Components.Page alias RecipeShareWeb.RecipeDetail alias Surface.Components.Form alias Surface.Components.Form.Submit alias Surface.Components.LivePatch alias Surface.Components.LiveRed...
0c8c2e50b87e613d752107bc937bed183e0f0c26
1,545
[ 698789499 ]
[ "liveview" ]
defmodule HTTPizzaWeb.UserConfirmationInstructionsLive do use HTTPizzaWeb, :live_view alias HTTPizza.IAM import HTTPizzaWeb.Templates def render(assigns) do ~H""" <.container size="sm"> <.header class="text-center"> No confirmation instructions received? <:subtitle>We'll send a ...
0c8cb784ce10cc0467e75e4759c2248ca7a1b605
1,851
[ 463684541 ]
[]
%{ "brod": {:hex, :brod, "3.16.1", "1c7b03f99c7cc310de5511cadad9879ab0cc5f1a2612211e68c26dad517d31b0", [:rebar3], [{:kafka_protocol, "4.0.1", [hex: :kafka_protocol, repo: "hexpm", optional: false]}, {:snappyer, "1.2.8", [hex: :snappyer, repo: "hexpm", optional: false]}, {:supervisor3, "1.1.11", [hex: :supervisor3, re...
0c8d52fee9cc312b1dc1bc91856425fa1a5ef96e
9,605
[ 313995562 ]
[]
defmodule Ppa.OffersHandler do use Ppa.Web, :handler require Logger import Ppa.Util.Timex import Ppa.Util.Filters import Ppa.Util.Sql # import Math require Tasks def handle_load_data(socket, params) do Logger.info "Ppa.OffersHandler.handle_load_data# params: #{inspect params}" Tasks.async_handl...
0c8d5b8a743c17e3b91f1c5bda30ea5b0f3344ef
3,969
[ 757318513 ]
[ "test", "supervisor" ]
defmodule Connect4.Games.ServerTest do use ExUnit.Case, async: true alias Connect4.Games alias Connect4.Games.Game alias Connect4.Games.Player alias Connect4.Games.Server @moduletag timeout: 4000 setup_all %{} do {:ok, _} = Games.Supervisor.start_link([]) {:ok, _} = Connect4.Utils.PubSub.start_...
0c8d613ce3f4a663930d362886ef5a802944cd43
4,047
[ 1006498494 ]
[ "test" ]
defmodule Ridez.Rides.PersonRideUniquenessTest do use Ridez.DataCase import Ridez.Rides.Generator alias Ridez.Rides require Ash.Query describe "Person-Ride uniqueness validation" do test "allows creating a person-ride relationship" do person = generate(person()) ride = generate(ride(seats: ...
0c8da31e0f46aa27b6a6f7d67015e386cf740aea
2,429
[ 903709661 ]
[ "documented", "ecto" ]
defmodule Gaze.Messages do @moduledoc """ The Messages context. """ import Ecto.Query, warn: false alias Gaze.Repo alias Gaze.Messages.Message @doc """ Returns the list of messages. ## Examples iex> list_messages() [%Message{}, ...] """ def list_messages do Repo.all(Message) ...
0c8e768cf2d9535ddde45a0f82ff2a60e0528a82
3,546
[ 65153243 ]
[]
defmodule KratosApi.Sync.Tally.Producer do use GenStage @remote_queue Application.get_env(:kratos_api, :remote_queue) def init(state) do {:producer, state} end def handle_demand(demand, state) when demand > 0 do @remote_queue.dequeue("congress-votes", state) |> reply(state) end defp reply(...
0c8e90d16a984cb868f0124b0c36d2d8cb845b7d
3,769
[ 901668033 ]
[]
defmodule Problem14 do defmodule Robot do defstruct position: {0, 0}, velocity: {0, 0} end def run1(input, seconds, {board_width, board_height}) do robots = parse_input(input) positions = Enum.map(robots, &position_after_seconds(&1, seconds, {board_width, board_height})) groups = group_by...
0c8ebbe955059a5957210bf8fb68693744c2bb48
3,097
[ 235876563 ]
[ "test" ]
defmodule TrivialTest do use ExUnit.Case, async: true @localhost {127, 0, 0, 1} @moduletag :trivial alias Trivial.Daemon describe "with default settings" do test "we can connect to our trivial server and get back trivial data" do {:ok, srv} = Daemon.start_link(TrivialStub, "test_file", port: 0) ...
0c8ee293ba6b4a6bc78f1d3ba497a70ca38d059a
5,265
[ 327026866 ]
[ "test", "ecto" ]
defmodule DailyLog.Logs.LogTest do use DailyLog.DataCase alias DailyLog.Logs.Log describe "changeset/2" do test "returns invalid changeset with empty params" do assert %Ecto.Changeset{ errors: [ {:mood, {"should have %{count} item(s)", ...
0c8ee49fa3dd1b77c8e45f9c9d9faec6ffbd6ea9
2,415
[ 227215894 ]
[ "test" ]
defmodule Day19Test do use ExUnit.Case @example """ 0: 1 2 1: "a" 2: 1 3 | 3 1 3: "b" """ @example_2 """ 0: 4 1 5 1: 2 3 | 3 2 2: 4 4 | 5 5 3: 4 5 | 5 4 4: "a" 5: "b" """ test "example - part 1" do rules = rules(@example) assert matches?("aba", rules) assert matches?("aba"...
0c8f2caca30c7c3c2bd247b647bef170ab64539b
1,574
[ 400676905, 407933887 ]
[]
# 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 :rockelivery, ecto_repos: [Rockelivery....
0c8f66444253ea57c18c8d0fff7e205eb526e743
2,027
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2beta1HumanAgentAssistantEvent do @moduledoc """ Output only. Represents a notification sent to Pub/Sub subscribers for agent assistant events in a specific conversation. ## Attributes * `conversation` (*type:* `String.t`, *default:* `nil`) - The...
0c8f68ad50136495bd3725858cb61eefec25483c
2,533
[ 118922716 ]
[ "test" ]
defmodule OAuth2.TestHelpers do import Plug.Conn import ExUnit.Assertions def bypass_server(%Bypass{port: port}) do "http://localhost:#{port}" end def bypass(server, method, path, fun) do bypass(server, method, path, [], fun) end def bypass(server, method, path, opts, fun) do {token, opts} ...
0c8fb51ad4c3c182a2cfcf850e3e51f058c6a211
2,038
[ 966256911 ]
[ "phoenix" ]
defmodule ResumeWeb.UserSessionController do use ResumeWeb, :controller alias Resume.Accounts alias ResumeWeb.UserAuth def create(conn, %{"_action" => "confirmed"} = params) do create(conn, params, "User confirmed successfully.") end def create(conn, params) do create(conn, params, "Welcome back!...
0c8fd1108610dd732cb52a92633130c523bbd173
2,301
[ 651977372, 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.YouTube.V3.Model.Activity do @moduledoc """ An *activity* resource contains information about an action that a particular channel, or user, has taken on YouTube.The actions reported in activity feeds include rating a video, sharing a video, marking a video as a favorite, commenting on a video, u...
0c8fd46cbc3288626435c0733023f402d3423480
2,932
[ 57920862 ]
[ "phoenix" ]
defmodule Kastlex.API.V1.MessageController do require Logger use Kastlex.Web, :controller plug Kastlex.Plug.EnsurePermissions # TODO: partitioner def produce(conn, %{"topic" => topic, "partition" => partition} = params) do {partition, _} = Integer.parse(partition) key = Map.get(params, "key", "") ...
0c905b6e4843accf85ed137ad15bc4b2e8bb2438
2,302
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Transcoder.V1beta1.Model.AudioStream do @moduledoc """ Audio stream resource. ## Attributes * `bitrateBps` (*type:* `integer()`, *default:* `nil`) - Required. Audio bitrate in bits per second. Must be between 1 and 10,000,000. * `channelCount` (*type:* `integer()`, *default:* `nil`) ...
0c90790acb66a3ffdbc761c0ba130aab7255e346
2,037
[ 103320068 ]
[ "genserver" ]
defmodule Howlong.Server do use GenServer # API def start_link(server_name) do IO.puts "Starting Howlong server #{server_name}" GenServer.start_link(__MODULE__, server_name, name: via_tuple(server_name)) end def add_activity(howlong_server, activity_name) do new_activity = %{name: activity_name,...
0c9084c1c47030bc1b993ecc86016eb914c70ea3
2,159
[ 394171405 ]
[ "documented", "ecto" ]
defmodule EmployeeRewardApp.Reward.History do @moduledoc """ The Reward.History context. """ import Ecto.Query, warn: false alias EmployeeRewardApp.Repo alias EmployeeRewardApp.Reward.History.RewardUpdate @doc """ Returns the list of reward_updates. ## Examples iex> list_reward_updates() ...
0c90ab850b5251a4d369c2c0ac43cb25894c6b18
1,541
[ 831575057 ]
[ "documented" ]
defmodule DataProcessor do @moduledoc """ Processes and cleans data using Elixir's Enum module. """ @doc """ Cleans data by removing nils, converting types, and standardizing formats. """ def clean(data) when is_list(data) do data |> Enum.reject(&is_nil/1) |> Enum.map(&standardize_...
0c913e3a5e17a7760745ad4cd4c927411f8550cf
2,550
[ 15400465 ]
[ "documented" ]
defmodule Hex.Config do @moduledoc false def read() do case File.read(config_path()) do {:ok, binary} -> case decode_term(binary) do {:ok, term} -> term {:error, _} -> config = decode_elixir(binary) write(config) config ...
0c914f09f908d4753a6e01e67bd68aa66d2926bc
1,610
[ 913644099 ]
[ "phoenix" ]
defmodule HeadsUpWeb.Router do use HeadsUpWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {HeadsUpWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug :snoop end pipeli...
0c9180f20ac7e78f97842c6bfcec8d4ececd1d94
1,844
[ 41651427 ]
[ "documented" ]
defmodule Gald.Display.Standard do @moduledoc """ ## Struct The standard display of a screen shown to the players. These are created by each screen's `get_display/1` function, and sent in `:screen` events by the race's event emitter. It is also retrieved during snapshots. They have a title, body, an option...
0c91dda2e2202d35c0eaa1e825a02ed47549bb5a
2,124
[ 92760556 ]
[ "documented" ]
defmodule Tip.Calculator do require Logger @doc """ Calculates the total amount based on a tip percentage. iex> calculate(100.0, 10.0) {:ok, %{tip: 10.0, total: 110.0}} iex> calculate("bad", "input") {:error, :invalid_input} """ def calculate(bill_amount, tip_rate) when is_float(bill_amount...
0c9211881ff92260371f6b673d8428a77ae33267
2,899
[ 132394406 ]
[ "test" ]
defmodule TesseractOcr.UtilsTest do use ExUnit.Case doctest TesseractOcr.Utils test "command options generate the options to shell command" do assert TesseractOcr.Utils.command_options("test/resources/world.png", "stdout", %{ lang: "por", oem: "1" }) === ["te...
0c92a9aa0d63c7387b204c8e5e6e4761a7582911
3,910
[ 493276338 ]
[ "documented", "ecto" ]
defmodule DA.CognitoTokenProvider do @moduledoc false @base "/priv/templates/adapters/cognito_token_provider/" def actions do %{ create: %{ "lib/infrastructure/driven_adapters/cognito/cognito_token_provider.ex" => @base <> "cognito_token_provider.ex", "lib/infrastructure/drive...
0c9343638cfa9570550f5dbca4679abffcf0bcc3
4,118
[ 165470630 ]
[ "test", "phoenix" ]
defmodule TilWeb.PostControllerTest do use TilWeb.ConnCase use TilWeb.TestHelper @create_attrs %{content: "some content", title: "some title"} @update_attrs %{content: "some updated content", title: "some updated title"} @invalid_attrs %{content: nil, title: nil} describe "as visitor" do test "can vis...
0c939633f9c054ce1243ffeadd8128fbfb3e3b02
1,744
[ 123401408 ]
[ "typespec", "documented" ]
defmodule LinkedList do @opaque t :: tuple() @doc """ Construct a new LinkedList """ @spec new() :: t def new() do {} end @doc """ Push an item onto a LinkedList """ @spec push(t, any()) :: t def push(list, elem) do {elem, list} end @doc """ Calculate the length of a LinkedList ...
0c93a9780b616175005c29e5e772edc473ca389f
5,115
[ 80333265 ]
[ "documented" ]
defmodule AdmiralStatsParser.Summarizer.EventInfoSummarizer do @doc """ 与えられた EventInfo のリストから、現在の周回数を返します。 ## パラメータ - event_info_list: EventInfo のリスト - level: 難易度を表す文字列 ## 返り値 integer """ def current_loop_counts(event_info_list, level) do # 指定されたレベルの情報のみ取り出し event_info_list |> E...
0c93b060e8f87e82f8714855d1d59b10a887cec4
3,524
[ 559744925, 610034669, 599689212, 670103538, 713860590, 734242561, 669649865, 687446493, 837319868, 688332642, 694781452, 718072585, 710549260, 731178722, 869143224, 613567989, 648118486, 651155880, 682630311, 701803795, 718071371, 631076437, 685399586, 574493719, 6576...
[ "genserver", "supervisor", "documented" ]
defmodule Finch.PoolManager do @moduledoc false use GenServer @mint_tls_opts [ :cacertfile, :ciphers, :depth, :partial_chain, :reuse_sessions, :secure_renegotiate, :server_name_indication, :verify, :verify_fun, :versions ] @default_conn_hostname "localhost" def sta...
0c9452bc9cec76b1bcdc364692d66dea29145788
1,604
[ 200430025 ]
[ "typespec", "documented" ]
defmodule Genex.Types.Chromosome do alias __MODULE__, as: Chromosome @moduledoc """ Genex representation of a single solution. A Chromosome represents one solution to the problem you are trying to solve. Solutions are encoded into a collection of genes. The Chromosome is then evaluated based on some criteria ...
0c945e732b4d4ecec6c3e2afb34a7436b15f29ef
3,755
[ 416383998 ]
[]
defmodule BikeBrigadeWeb.CampaignHelpers do alias BikeBrigade.Delivery.Task alias BikeBrigade.Riders.Rider alias BikeBrigade.LocalizedDateTime @novice_campaign_threshold 5 def task_assigned?(task) do task.assigned_rider != nil end def rider_available?(rider) do Enum.count(rider.assigned_tasks)...
0c948035e6d87cecf80d2201d816470dd3c7c3c3
5,404
[ 34771186 ]
[ "documented" ]
defmodule CedaRealty.Plugs.SignedCookie do @moduledoc """ Provides functions for storing signed and optionally encrypted cookies. Most of the code for this module was stolen from the following: * https://github.com/elixir-lang/plug/blob/master/lib/plug/conn.ex * https://github.com/elixir-lang/plug/blob/...
0c94baf11ab53230c29a14c7d9ac89e947f3a909
4,246
[ 351911000 ]
[ "phoenix" ]
defmodule EventsSpaWeb.CommentController do use EventsSpaWeb, :controller alias EventsSpa.Comments alias EventsSpa.Comments.Comment action_fallback EventsSpaWeb.FallbackController plug :inviteOrOwnerRequired when action in [:create] plug :commenterRequired when action in [:update] plug :commenterOrOwne...
0c9507276170153970e1a634a12282964938789c
1,858
[ 416383998 ]
[ "ecto" ]
defmodule BikeBrigade.Tasks.MailchimpAttributesSync do import Ecto.Query, warn: false import BikeBrigade.Utils, only: [get_config: 1] alias BikeBrigade.Repo alias BikeBrigade.Tasks.Importer alias BikeBrigade.Riders.Rider alias BikeBrigade.MailchimpApi @task_name "mailchimp_attributes_sync" # Lets us ...
0c950768e96367f379f4f14b779a3660568bcc77
1,585
[ 211953245 ]
[]
defmodule SpandexPhoenix.MixProject do use Mix.Project @version "0.4.1" def project do [ app: :spandex_phoenix, version: @version, elixir: "~> 1.6", elixirc_paths: elixirc_paths(Mix.env()), compilers: compilers(Mix.env()), start_permanent: Mix.env() == :prod, packag...
0c950bdddef9a3cf34babdbf66a136bd20bca8ec
2,404
[ 101898333 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule ScutiWeb 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 ScutiWeb, :controller use ScutiWeb, :view The definitions below will be executed for every view, controller, etc, s...
0c95418699baa2771aae09492daf5d987f63d61b
2,310
[ 147431903 ]
[ "test" ]
defmodule Totalwar.GameControllerTest do use Totalwar.ConnCase alias Totalwar.Game @valid_attrs %{name: "some name"} @invalid_attrs %{} test "lists all entries on index", %{conn: conn} do conn = get conn, game_path(conn, :index) assert html_response(conn, 200) =~ "Listing games" end test "rende...
0c955dde4d144ab59550cdaaf87a48bf4bc4f1ea
1,739
[ 864172209 ]
[]
defmodule Cmd.Upgrade do @behaviour Cmd @impl Cmd def requires_project?(), do: false @impl Cmd def spec do [ upgrade: [ name: "upgrade", about: "Upgrade fnord to the latest version", flags: [ yes: [ long: "--yes", short: "-y", h...
0c963596bd497deacfc0cd26e28ded76df51c6c1
1,967
[ 454024606, 869398389, 907510353, 408392383, 7202769, 268407747, 401956793 ]
[]
#!/usr/bin/env elixir alias EMQXUmbrella.MixProject {:ok, _} = Application.ensure_all_started(:mix) # note: run from the project root File.cwd!() |> Path.join("mix.exs") |> Code.compile_file() inputs = MixProject.check_profile!() profile = Mix.env() # need to use this information because we might have compiled all ...
0c9645c0891ced94afba1f2481d8de00a0d6ef53
4,363
[ 162346095 ]
[ "typespec", "documented", "ecto" ]
defmodule Infusionsoft.Schemas do @moduledoc false # Provides functions for transforming field names. # The "to" functions take lists of Common names and turn them into REST or XML names. # The "from" functions take lists of REST or XML names and turn them into Common names. alias Infusionsoft.Schemas.XML.C...
0c9655e426606e818390f0055cb4d0da27139285
3,046
[ 423387434 ]
[ "documented" ]
defmodule Recode.Task.Tags do @moduledoc false use Recode.Task, category: :design alias Recode.Issue alias Rewrite.Source alias Sourceror.Zipper @defaults include_docs: true @impl Recode.Task def run(source, opts) do source |> Source.get(:quoted) |> Zipper.zip() |> Zipper.traverse([]...
0c9678246642f41469d3c0e797e3f68576c544b2
5,689
[ 562531501 ]
[ "test", "liveview" ]
defmodule Mix.LiveViewNative.CodeGen.PatchTest do use ExUnit.Case alias Mix.LiveViewNative.CodeGen.Patch describe "patch codegen scenarios" do test "when :live_view_native config exists the :plugins list is updated and duplicates are removed" do source = """ config :live_view_native, plugins: ...
0c96ed24b14e0847efbc251fc55df7864a01c649
1,532
[ 67418487 ]
[ "documented" ]
defmodule Schizo do @moduledoc """ A nice module that lets you uppercase or unvowel every other letter in a sentence """ @doc """ Uppercases every other word in a sentence. Example: iex> Schizo.uppercase("you are silly") "you ARE silly" """ def uppercase(string) do transformed_every_other_...