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
047886c89c2bbc73343ddb6662d942dd7dc92a00
1,591
[ 846793042 ]
[ "supervisor", "documented" ]
defmodule Lessthanseventy.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false use Application @impl true def start(_type, _args) do :logger.add_handler(:my_sentry_handler, Sentry.LoggerHandler, %{ config: %{metadata: [:file,...
0478bc3529695095524594ec50479e6243d2e1d9
2,597
[ 305647453 ]
[ "test", "phoenix" ]
defmodule ProjetApiWeb.ClockControllerTest do use ProjetApiWeb.ConnCase alias ProjetApi.API alias ProjetApi.API.Clock @create_attrs %{ status: true, time: ~N[2010-04-17 14:00:00] } @update_attrs %{ status: false, time: ~N[2011-05-18 15:01:01] } @invalid_attrs %{status: nil, time: nil} ...
04794f03a2dd92ac6550f59d883aa56d40f637e5
1,952
[ 657799110, 679652486, 725959680, 541841921 ]
[ "documented" ]
defmodule Credo.Check.Refactor.UnlessWithElse do use Credo.Check, id: "EX4027", base_priority: :high, explanations: [ check: """ An `unless` block should not contain an else block. So while this is fine: unless allowed? do raise "Not allowed!" end ...
047a1c0607ea8ec142d0daa1e0006ad30fd7d64b
2,532
[ 938343838, 597899270, 937868689 ]
[ "phoenix" ]
defmodule RealworldWeb.Router do use RealworldWeb, :router use AshAuthentication.Phoenix.Router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {RealworldWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_brows...
047a97bc085cce580f9794e8530c743829aa6621
1,621
[ 509252504 ]
[ "liveview", "ecto" ]
defmodule SmeInterviewsWeb.QuestionTemplateLive.FormComponent do use SmeInterviewsWeb, :live_component import SmeInterviewsWeb.QuestionTemplateLive.FormHandlers alias SmeInterviews.QuestionTemplates @impl true def update(assigns, socket) do update_socket(assigns, socket) end @impl true def handle...
047b3150d1c7292a5b246ef85e221dab51a15999
4,155
[ 48341971 ]
[ "genserver", "macro", "documented" ]
defmodule Exfile.Config do @default_backends %{ "store" => {Exfile.Backend.FileSystem, directory: Path.expand("./tmp/store"), max_size: nil, hasher: Exfile.Hasher.Random }, "cache" => {Exfile.Backend.FileSystem, directory: Path.expand("./tmp/cache"), max_size: nil, hash...
047bd7ffe87e0ec8e6f0246846bd848a0669646d
1,967
[ 129608111 ]
[ "test", "ecto" ]
defmodule MotorRepairBackend.RoleServiceTest do use MotorRepairBackend.DataCase alias MotorRepairBackend.RoleService describe "role" do alias MotorRepairBackend.RoleService.Role @valid_attrs %{name: "some name"} @update_attrs %{name: "some updated name"} @invalid_attrs %{name: nil} def rol...
047c2324a01f6181896740bae96f91505403449a
3,141
[ 958190762 ]
[ "phoenix" ]
defmodule RemcalWeb.Router do use RemcalWeb, :router import RemcalWeb.UserAuth import Oban.Web.Router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {RemcalWeb.Layouts, :root} plug :protect_from_forgery plug :put_sec...
047c85d47a02b5882b247558df4c8e1a56294dcb
4,125
[ 329212434 ]
[ "test" ]
defmodule LinkedListTest do use ExUnit.Case test "length/1 of new list" do list = LinkedList.new() assert LinkedList.length(list) == 0 end # @tag :pending test "empty?/1 of new list" do list = LinkedList.new() assert LinkedList.empty?(list) end # @tag :pending test "length/1 of list of ...
047c948aaad8a3e134ed6d8f72aedfe0122a62b7
1,733
[ 177871154, 157476350, 612062134 ]
[]
defmodule Distillery.Mixfile do use Mix.Project def project do [app: :distillery, version: "1.5.5", elixir: "~> 1.3", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, deps: deps(), description: description(), package: package(), docs: docs(), ali...
047ca3435eb8113c7f3381941f857027ab14bfc7
3,064
[ 105194269 ]
[ "documented" ]
defmodule CardsProject do @moduledoc """ Provides methods for creating and handling a deck of cards """ @doc """ Return list of strings representing a deck of playing cards """ def create_deck do values = ["Ace", "Two", "Three", "Four", "Five"] suits = ["Spades", "Clubs", "Hearts", "Diamonds"] ...
047d23c5495c78a2fbe28512b1d16bf505f52eec
1,566
[ 370385025 ]
[]
# In this file, we load production configuration and secrets # from environment variables. You can also hardcode secrets, # although such is generally not recommended and you have to # remember to add this file to your .gitignore. use Mix.Config secret_key = System.get_env("SECRET_KEY") || raise(""" environm...
047db280d5f35cc84fd17351977622807df32264
1,621
[ 933942248 ]
[ "liveview" ]
defmodule SpendlyWeb.UserForgotPasswordLive do use SpendlyWeb, :live_view alias Spendly.Accounts def render(assigns) do ~H""" <div class="auth-container"> <div class="auth-card"> <.header class="text-center"> <h3>Forgot your password?</h3> <:subtitle>We'll send a passwo...
047dd9c8a7ddee4e5b9c244d533724930291054a
4,188
[ 106712767 ]
[ "test" ]
defmodule SanbaseWeb.Graphql.ProjectApiFundsRaisedTest do use SanbaseWeb.ConnCase, async: false import Sanbase.Factory import SanbaseWeb.Graphql.TestHelpers setup do # Add the Projects to the Postgres insert(:project, %{name: "Test project", slug: "test", ticker: "TEST"}) insert(:project, %{name: ...
047e54f98bf7135332970c6bd492f68409b0b31f
2,537
[ 832082385 ]
[]
defmodule OctoconDiscord.Components.HelpHandler.Pages.CommandList.Alter do use OctoconDiscord.Components.HelpHandler.Pages @commands [ %{ name: "create", description: "Creates a new alter", nav_page: "alter_create" }, %{ name: "view", description: "Views an alter's profile...
0480b01f5273c57b73eeb1606c760dcb4d34139b
12,390
[ 66522657 ]
[ "test" ]
defmodule Solid.Tags.CaseTagTest do use ExUnit.Case, async: true alias Solid.Tags.CaseTag alias Solid.{Lexer, ParserContext, Renderable} alias Solid.Parser.Loc defp parse(template) do context = %ParserContext{rest: template, line: 1, column: 1, mode: :normal} with {:ok, tag_name, context} <- Lexer.t...
0480c89e09ad416d9bf7eb368a38afb10e5e1a3b
3,831
[ 779050500 ]
[ "test" ]
defmodule SchoolTest do use ExUnit.Case def make_school_with_students(students) do {results, school} = Enum.reduce(students, {[], School.new()}, fn {student, grade}, {results, school} -> {result, school} = School.add(school, student, grade) {[result | results], school} end) {En...
048157fb8f059553a9675706a3bfafb3634a94b0
7,497
[ 180242735 ]
[ "test" ]
defmodule ExchangeInHost do use ExUnit.Case doctest Exchange.Exchange alias Exchange.Start alias Exchange.Protocol, as: Prot setup_all do Start.start_init_mnesia() # Sign in socket = sign_in("koln", "pass") # Create guest guest_socket = sign_in("dortmund", "pass") {:ok, socket: sock...
04815b68de71ddcf3b653fbd6a29b0a7508b65e1
1,609
[ 324639607 ]
[ "typespec", "documented" ]
defmodule Cartographers.GameEngine.ScoringRules.LostBarony do @moduledoc """ # Lost barony Earn three reputation stars for each space along one edge of the largest square of filled spaces. """ alias Cartographers.GameEngine.MapSheet alias Cartographers.GameEngine.MapSheet.Position @behaviour Cartographer...
04818e9d3862ae189fccd2f86e93c4237f5dedcf
3,790
[ 948834783 ]
[ "typespec", "documented" ]
defmodule GanDengYan.Game.Player do @moduledoc """ Represents a player in the GanDengYan card game. Each player has a name, a hand of cards, and a flag indicating whether they are the banker (dealer). """ alias GanDengYan.Game.Card @type t :: %__MODULE__{ name: String.t(), hand: [Ca...
0481bbeb82f1409b07f79ca4fc8f8f91711fb183
1,650
[ 821781255 ]
[ "liveview" ]
defmodule LynxWeb.InputWithButton do use Phoenix.Component import Tails, only: [classes: 1] import LynxWeb.Button import LynxWeb.CoreComponents, only: [translate_error: 1, error: 1] attr :id, :any, default: nil attr :class, :string, default: nil attr :field, Phoenix.HTML.FormField, doc: "a form fiel...
0481bcd4e727ca10f09872866792b66b9a489c16
1,907
[ 537406155, 457849495 ]
[]
# 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 :nuca_backend, ecto_repos: [NucaBackend.Repo...
0481cd6a46f2456d0e5230e5a05dc9bd8f3093fb
6,796
[ 323599864 ]
[]
defmodule Puzzleday24 do defp debug(msg, opts) do log_level = System.get_env("LOG_LEVEL") if log_level == "debug" do default_opts = [pretty: true, charlists: :as_lists] combined_opts = Keyword.merge(default_opts, opts) IO.inspect(msg, combined_opts) else msg end end defp ...
0481e78fb38b3a6f4be728ca5e7ecd1225286b89
2,164
[ 333161331 ]
[ "documented" ]
defmodule ExcessiveExuberanceDetector.SiteScraper.ReviewRequestServiceMock do @moduledoc """ Mock for `ReviewRequestService`. Used for testing. Set in `config/test.exs`. """ def get_reviews_page(url) do cond do is_url_page_number?(1, url) -> most_overly_positive_review() |> fake_revie...
0482049f95c3095d56d0c424fdd2df2137ea7543
15,926
[ 413865861 ]
[ "liveview" ]
defmodule Luvbot.Consumer do use Nostrum.Consumer alias Nostrum.Api def start_link do Consumer.start_link(__MODULE__) end def handle_event({:MESSAGE_CREATE, msg, _ws_state}) do # Algumas funções de Teste apenas :) cond do String.starts_with?(msg.content, "!echo") -> # Repete exatam...
0482111c69e7befff01a8c0550febdb7e02435dc
2,710
[ 337279787 ]
[ "test", "ecto" ]
defmodule Pucks.PeopleTest do use Pucks.DataCase alias Pucks.People describe "users" do alias Pucks.People.User @valid_attrs %{email: "some email", password: "some password", password_confirmation: "some password_confirmation", password_hash: "some password_hash", username: "some username"} @update...
0482447a667f7b801585f0fc1cf8a4a915273532
1,873
[ 396994603 ]
[ "supervisor" ]
defmodule BinanceFuturesBot.TradeManager do require Logger use Supervisor alias BinanceFuturesBot.TradeManager alias BinanceFuturesBot.TradeManager.{StateHistory, TradeServer} def start_link(opts \\ []) do if is_nil(opts[:name]), do: raise "must set name in options for BinanceFuturesBot.TradeManager" ...
04824a4d337356d576ab1ee44bb474c3f5762122
1,893
[ 55570611 ]
[]
defmodule Purduedir.ScrapeHtml do def scrape(html_text) do tree = html_text |> Exquery.tree {type,error_text} = check_for_error(tree) if type == :none do list_items = tree |> Exquery.Query.all({:tag,"table",[{"class","more"}]}) people = Enum.map(list_items, &get_person_info/1) %{:type =>...
0482537da4e20862e94fed0f1662e6e6344055bb
1,667
[ 567697300 ]
[]
defmodule Day09 do import Enum def part1 do File.read!("data/day09.txt") |> String.trim |> to_charlist |> decompress |> count end def part2 do File.read!("data/day09.txt") |> String.trim |> decomp_count end def decomp_count(""), do: 0 def decomp_count("(" <> rst) do ...
04825cbc5d1795d82706ed32227126a143555d08
1,737
[ 603527578 ]
[ "liveview", "phoenix" ]
defmodule LynxWeb.Endpoint do use Phoenix.Endpoint, otp_app: :lynx # 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: "_lynx_bag", ...
04825f352be3675dd5c3f99a8b8a9928ff4e7383
3,206
[ 28820154 ]
[]
defmodule Neoxir.TxEndPoint do @headers %{"Accept" => "application/json; charset=UTF-8", "Content-Type" => "application/json"} # Begin and commit a transaction in one request # If there is no need to keep a transaction open across multiple HTTP requests, # you can begin a transaction, execute statements, an...
04832c7d15e25563d4b2eec8fdabc1181b1659a2
2,560
[ 206541249 ]
[ "test" ]
defmodule MyposWeb.Schema.Mutation.ItemCreateTest do use MyposWeb.ConnCase, async: true alias Mypos.{Product} setup do category_items = [ %{ "name" => "lunch box", "description" => "kiddies lunch box" } ] category_items |> Enum.map(&Product.create_category/1) cat...
04834d0adb5b656e24399f8dab7fada4ef72412d
5,171
[ 44110377 ]
[ "documented" ]
defmodule Blackbook.Authentication do @moduledoc """ Handles core authentication "stuff" - verifying who the user is,resetting information etc. """ use Timex @doc """ Each user is granted a single token login at registration. This method uses that unique token to log them in. ## Examples ``` {:ok...
048374ad6abfe4db7e15f553cf6760f78f2582c8
4,193
[ 712319518 ]
[ "genserver", "liveview", "phoenix", "ecto" ]
defmodule ElixirChatWeb.ChatLive do alias Phoenix.Endpoint alias ElixirChat.Repo alias ElixirChat.ChatMessage alias ElixirChat.NewMessage alias Phoenix.Socket.Broadcast alias ElixirChat.Accounts alias ElixirChatWeb.Endpoint import Ecto.Query use ElixirChatWeb, :live_view @topic "chat" def mount(...
04838042448eede1613ee6e6f5b5ac8be3407b2d
1,628
[ 439053677 ]
[ "phoenix", "documented" ]
defmodule OscarWeb.CanvasController do use OscarWeb, :controller alias Oscar.Canvas action_fallback OscarWeb.FallbackController def index(conn, _params) do canvases = Canvas.list() render(conn, "index.json", canvases: canvases) end @doc """ Creates a canvas. See Oscar.Canvas.create for para...
0483c04c596581db2c7b266209338fd975ef3ffb
4,345
[ 612062134 ]
[]
defmodule ThamaniWeb.InputHelpers do use Phoenix.HTML alias Thamani.Dispatches def array_input(form, field, attr \\ []) do default_attr = [ count: 1 ] merged_attr = attr ++ default_attr count = merged_attr[:count] values = Phoenix.HTML.Form.input_value(form, field) || [] values = ...
04846d517004cef4ad1778f32fb433456f47a5ca
2,339
[ 594893960 ]
[ "genserver", "typespec" ]
defmodule TakeANumberDeluxe do use GenServer alias TakeANumberDeluxe.State @spec start_link(keyword()) :: {:ok, pid()} | {:error, atom()} def start_link(init_arg) do GenServer.start_link(__MODULE__, init_arg) end @spec report_state(pid()) :: TakeANumberDeluxe.State.t() def report_state(machine), do:...
0484c240d9bbe957b867d7b2d6076a50538dce06
1,517
[ 440585484 ]
[ "typespec", "documented", "ecto" ]
defmodule Beacon.MediaLibrary.Asset do @moduledoc """ Assets are the images, videos, and any other media type uploaded and served by the Media Library. > #### Do not create or edit assets manually {: .warning} > > Use the public functions in `Beacon.MediaLibrary` instead. > The functions in that module gua...
0484cc51a32dcebd650dae018556ceb9296a6953
5,148
[ 190765579 ]
[ "test" ]
defmodule ExHttpMicroservice.ClientTest do use ExUnit.Case, async: true defmodule DefaultClient do use ExHttpMicroservice.Client end describe "when client doesn't specify secure" do test "process_request_url/1 returns an http url" do uri = DefaultClient.process_request_url("") |> URI.parse() ...
048501f7fc9be2daadd6b757cdf6b8a33f41ff39
2,267
[ 87932026 ]
[ "typespec", "documented" ]
defmodule Imgur.Image do alias Imgur.API @doc """ Get an image. """ @spec get(Imgur.Client.t, String.t) :: {:ok, Imgur.Model.Image.t} | {:error, any} def get(client, id) do API.get(client, "/3/image/#{id}", schema: Imgur.Model.Image.schema()) end @doc """ Upload an image from a file path. """ ...
048513ab480b7962438537e8648f295eb46a35a8
1,595
[ 165687186, 22574046 ]
[ "macro", "test", "documented", "ecto" ]
defmodule Fawkes.ConnCase do @moduledoc """ This module defines the test case to be used by tests that require setting up a connection. Such tests rely on `Phoenix.ConnTest` and also imports other functionality to make it easier to build and query models. Finally, if the test case interacts with the dat...
048564c934c168fcdb756de8ef0196551b951c1a
3,167
[ 43452316 ]
[ "test" ]
defmodule Boardex.Board.RectangleBoardTest do use ExUnit.Case alias Boardex.Board alias Boardex.Board.RectangleBoard alias Boardex.Square defp play(board, piece, position) do move = %Boardex.Move.PlacePiece{position: position, piece: piece} Board.make_move(board, move) end test "New board empty...
04859a6c145e99dbf598ad584c0687d49b2b90c1
3,563
[ 71174806 ]
[ "documented" ]
defmodule ExPlay.Request.Auth do use ExPlay.Request.Base @moduledoc """ Wrapper module to handle authentication for Google Play user """ @doc "Attempts to authenticate the user, returning a new instance with auth_token set" def authenticate(account) do response = account |> make_auth_requ...
0485cbbb4d00ea8db4a1c81955c9319cccfeb30c
2,293
[ 909508638 ]
[]
defmodule PhoenixSvelteDeno.MixProject do use Mix.Project def project do [ app: :phoenix_svelte_deno, version: "0.1.0", elixir: "~> 1.14", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps() ] end # Co...
0485d606c84f05df1c7d05f7fcb1e2aa2c0bf468
2,115
[ 89032365 ]
[]
# In Elixir and many functional languages, functions are first class citizens. # We will learn about the types of functions in Elixir, what makes them different, and how to use them. # Anomymous functions sum = fn(x, y) -> x + y end # we invoke anon functions by using the dot notation IO.puts sum.(5, 6) # in elxir an...
0485d79f0148a710b0f813eaf7e45e77e4098a0a
2,368
[ 290643507 ]
[]
%{ "cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71af...
0485ec0d28d4a9602b8ce7be81bafeca9d82ddcd
9,733
[ 970389734, 385691311, 424400274 ]
[ "documented", "ecto" ]
defmodule Pleroma.Instances.Instance do @moduledoc "Instance." @cachex Pleroma.Config.get([:cachex, :provider], Cachex) alias Pleroma.Instances alias Pleroma.Instances.Instance alias Pleroma.Repo alias Pleroma.User alias Pleroma.Workers.BackgroundWorker use Ecto.Schema import Ecto.Query import E...
0486035345a6a2fc98af172bbbb8b88a68455b82
1,625
[ 71075151 ]
[]
defmodule BlockchainParser.Parsers.Block do import BlockchainParser.Utils.Integer defstruct magic_id: <<0xD9B4BEF9>>, # char[32], fix num of four bytes that marks start of a new block length: 0, # uint32_t, Blocks length version: 0, # uint32_t, Expected to be eq to 1, 2, 3 or 4 ...
048606382ce25dea82354778f03498588b4a70b0
7,243
[ 131902244 ]
[ "test" ]
defmodule HeroDigitalWeb.PlateRegistrationDataControllerTest do use HeroDigitalWeb.ConnCase alias HeroDigital.PlateRegistration alias HeroDigital.PlateRegistration.PlateRegistrationType alias HeroDigital.Identity alias HeroDigital.Product.Motorcycle alias Decimal @email "some email" @phone "some phone...
048632842c412e87c78cf60cd4402effea6674a1
6,592
[ 996920193 ]
[ "test" ]
defmodule Foundation.Perimeter.ExternalTest do use ExUnit.Case describe "create_dspex_program/1" do test "validates valid DSPEx program creation" do valid_params = %{ name: "Test Program", description: "Test description", schema_fields: [%{name: :input, type: :string, required: ...
048678dfb97571088566acfcf4af89905a29c261
10,385
[ 967119405 ]
[]
%{ "bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: f...
04869db1f2f3f3fbb93e36619b43ceb867ea4aee
1,523
[ 463017638 ]
[ "documented" ]
defmodule PoorManOtp.GenericServer do @moduledoc """ A Generic implementation for process as Servers """ @callback handle_cast(msg :: tuple(), state :: any()) :: {:noreply, any()} @callback handle_call(msg :: tuple(), parent :: pid(), state :: any()) :: {:reply, any(), any()} @callback handle_info(msg :: t...
0486e56877502307cc6d6107ce4c267dfd94943d
3,620
[ 844733583 ]
[ "typespec", "documented" ]
defmodule LagoClient.InvoicePreviewInputCoupons do @moduledoc """ Provides struct and type for a InvoicePreviewInputCoupons """ use LagoClient.Encoder @type t :: %__MODULE__{ __info__: map, amount_cents: integer | nil, amount_currency: String.t() | nil, code: String.t(...
04871bf121d73219c195f0bb296d2d0ba47510bb
2,538
[ 44213117 ]
[ "documented" ]
defmodule Bouncer.Session do @moduledoc """ A library of functions used to work with session data. """ alias Plug.Conn alias Bouncer.Token alias Bouncer.Utility def adapter, do: Application.get_env(:bouncer, :adapter) @doc """ Generates a session token. The ttl (time-to-live) defaults to 2 weeks. ...
04879583cbf61993c4a4b8139530dd8e8ad32dbc
5,371
[ 226253062 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "cowboy": {:hex, :cowboy, "2.7.0", "91ed100138a764355f43316b1d23d7ff6bdb0de4ea618cb5d8677c93a7a2f115", [:rebar3], [{:cowlib,...
0487b0ac18442b85a34bdabf207350b51e42af93
7,485
[ 92813625 ]
[ "genserver", "documented" ]
defmodule Elber.Zones.Zone do @moduledoc """ Zone Dispatch """ use GenServer require Logger alias Elber.Zones.Utils def start_link(name, zone_struct) do zone_name = via_tuple(name) GenServer.start_link(__MODULE__, [zone_struct, name], name: zone_name) end def stop(z...
048829c4318389f459d9beb18a8da1b8397019ab
3,385
[ 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.AnalyticsAdmin.V1alpha.Model.GoogleAnalyticsAdminV1alphaDataSharingSettings do @moduledoc """ A resource message representing data sharing settings of a Google Analytics account. ## Attributes * `name` (*type:* `String.t`, *default:* `nil`) - Output only. Resource name. Format: accounts/...
048879b5a54c2f90fa1e3dc3bc7c7299e379fd8f
1,550
[ 237197924 ]
[ "documented", "ecto" ]
defmodule Astarte.Flow.Blocks.Block do use Ecto.Schema import Ecto.Changeset alias Astarte.Flow.Blocks.Block alias Astarte.Flow.PipelineBuilder alias ExJsonSchema.Validator alias ExJsonSchema.Schema.Draft4 @block_name_format ~r/^[a-zA-Z][a-zA-Z0-9-_]*$/ @primary_key false @derive {Phoenix.Param, ke...
04895e65738da064007fbdf5a6723fc83a67c59c
7,289
[ 476039832 ]
[ "genserver", "documented" ]
with {:module, _} <- Code.ensure_compiled(Broadway) do defmodule OffBroadway.Polyn.Producer do @moduledoc """ A [Broadway](https://hexdocs.pm/broadway/Broadway.html) Producer for Polyn. The word `Producer` here is confusing because the word is overloaded. In this module `Producer` refers to [GenStage...
04899c002131fff14bacf9836f87df487e88ca57
2,921
[ 363151122 ]
[]
defmodule Painter do import Mogrify @key_size 90 def perform(frequencies, keyboard) do base_image = draw_base_image(keyboard) keyboard |> Enum.with_index() |> draw_keyboard(base_image, frequencies) |> create(path: ".") end defp draw_keyboard([], image, _frequencies), do: image defp ...
0489e73ce4932bccefc5aea6e6e1442fb9f2bfa7
4,489
[ 994446978 ]
[ "typespec", "documented" ]
defmodule Jido.Signal.Bus.RecordedSignal do @moduledoc """ Represents a signal that has been recorded in the bus log. This struct wraps a signal with additional metadata about when it was recorded. """ use TypedStruct @derive {Jason.Encoder, only: [:id, :type, :created_at, :signal]} typedstruct do ...
048a1ef1d5bc051921f6922dcc8d71affb90730c
1,773
[ 160319353 ]
[]
defmodule Aoc.Y2021.D03 do use Aoc.Input def part1(str \\ nil) do gamma_rate = (str || input()) |> parse_input() |> calc_gamma_rate() epsilon_rate = gamma_rate |> Enum.map(fn 0 -> 1 1 -> 0 end) (Integer.undigits(gamma_rate, 2) * Integer.undigits(eps...
048a40be3ebd8cc83e951a27eb5035b29a907b56
3,543
[ 213941143 ]
[ "test" ]
defmodule StepFlow.WorkflowViewTest do use ExUnit.Case use Plug.Test alias Ecto.Adapters.SQL.Sandbox # Bring render/3 and render_to_string/3 for testing custom views import Phoenix.View setup do # Explicitly get a connection before each test :ok = Sandbox.checkout(StepFlow.Repo) # Setting the...
048ac55890ac68b2f836581e2fdcd5786b0135e9
2,509
[ 200268785 ]
[ "typespec", "documented" ]
defmodule(Thrift.Generated.ValidationStamp) do @moduledoc(false) _ = "Auto-generated Thrift struct transaction.ValidationStamp" _ = "1: binary proof_of_work" _ = "2: binary proof_of_integrity" _ = "3: transaction.LedgerOperations ledger_operations" defstruct(proof_of_work: nil, proof_of_integrity: nil, ledg...
048ad485cd8513b37c1d73c5dc23c0a5165e22bb
1,941
[ 934490999 ]
[]
defmodule Realworld.Articles.Comment do use Ash.Resource, data_layer: AshSqlite.DataLayer, authorizers: [Ash.Policy.Authorizer], notifiers: [Ash.Notifier.PubSub], domain: Realworld.Articles sqlite do table "comment" repo Realworld.Repo end attributes do uuid_primary_key :id at...
048b24d7c13df74e643564942ed2d0cb43507068
1,785
[ 657993163 ]
[]
# 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 :customer_csv_upload, ecto_repos: [CustomerC...
048b7977d7a5b94cb719b1a2070b55f3c5597f1d
2,253
[ 55335604 ]
[ "supervisor", "documented" ]
defmodule Portal do use Application # See http://elixir-lang.org/docs/stable/elixir/Application.html # for more information on OTP Applications def start(_type, _args) do import Supervisor.Spec, warn: false children = [ # Define workers and child supervisors to be supervised # worker(Porta...
048bb1435650c6742654340823ae8dcdd3a00667
6,495
[ 987887890 ]
[]
%{ "castore": {:hex, :castore, "1.0.14", "4582dd7d630b48cf5e1ca8d3d42494db51e406b7ba704e81fbd401866366896a", [:mix], [], "hexpm", "7bc1b65249d31701393edaaac18ec8398d8974d52c647b7904d01b964137b9f4"}, "earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c...
048bf5de85b12a6fed877254bc168687a4fab6b2
3,637
[ 249125161 ]
[ "test", "ecto" ]
defmodule BankAccounting.AuthTest do use BankAccounting.DataCase alias BankAccounting.Auth describe "users" do alias BankAccounting.Auth.User @valid_attrs %{email: "some email", password: "some password_hash"} @update_attrs %{email: "some updated email", password: "some updated password_hash"} ...
048c2412e3f5e44a7eb8c83562b1ed1c0e90e33c
6,467
[ 923184347 ]
[ "documented" ]
defmodule BeamBot.Strategies.Domain.Indicators do @moduledoc """ Technical indicators used in trading strategies. This module provides functions for calculating various technical indicators commonly used in trading strategies, such as moving averages, RSI, MACD, etc. """ @doc """ Calculates the Simple Mo...
048c803bb502fad8603085375a0803d523733ad0
1,930
[ 961890557 ]
[ "genserver", "typespec", "documented" ]
defmodule Ethui.Stacks.HttpPorts do @moduledoc """ GenServer that manages a range of HTTP ports """ use GenServer @type t() :: [ range: Range.t(), claimed: MapSet.t(pos_integer()) ] @type opts() :: [ range: Range.t() ] @spec start_link(opts) :: GenServer.o...
048c8903fc6773bff4ccdd7611d87122baaaaff6
6,701
[ 939353141 ]
[ "genserver" ]
defmodule BackendElixir.Messaging.Consumer do use GenServer require Logger alias BackendElixirWeb.Endpoint @queue "notifications.queue" @exchange "notifications.exchange" @routing_key "notifications.key" # Start the Consumer when the app starts def start_link(opts \\ []) do GenServer.start_link(__...
048c8acc6377cb4e964869237817bb5b6e6d8c17
1,882
[ 234071671 ]
[ "typespec", "documented", "ecto" ]
defmodule Weaver.Step.Result do @moduledoc """ Functions to initialize and modify the 5-element tuple returned as the result of `Weaver.Step.process/1`. """ alias Weaver.Ref @type t() :: { list(tuple()), list(tuple()), list(tuple()), list(Absinthe.Blueprint.t()), ...
048c91a9026152375081f106cb00e828b4d1f8f7
1,620
[ 393536144 ]
[ "genserver", "test" ]
defmodule Derive.Ex.GenServerTest do use ExUnit.Case import Derive.Ext.GenServer defmodule Server do use GenServer def start_link(opts \\ []), do: GenServer.start_link(__MODULE__, nil, opts) def init(nil), do: {:ok, nil} def handle_call({reply, sleep}, _from, state) do Proce...
048d25bb1536eab2a270065676daf939d0eff43f
4,448
[ 244870223 ]
[ "typespec", "supervisor", "documented" ]
defmodule AeMdw.Application do @moduledoc """ Before starting the supervision tree, the application runs: - a start phase of database migrations - a start phase of managing the ingestion/synchronization of chain data (with DynamicSupervisor) - initializes some deps apps - imports some Node calls Then it ...
048d340ac84585ec1384ddb8b7e121a66752717a
7,770
[ 899616717 ]
[ "documented" ]
defmodule Elixact.Validator do @moduledoc """ Validates values against type definitions and schemas. """ alias Elixact.Error @doc """ Validates data against a schema module, checking for required fields, field-level validations, and strict mode constraints if enabled. Returns {:ok, validated_data} on...
048f55f820639eb9f31ba25588de5b82efee41f8
2,197
[ 518522354 ]
[ "test", "ecto" ]
defmodule Twitterclone.TwatContextTest do use Twitterclone.DataCase alias Twitterclone.TwatContext describe "twats" do alias Twitterclone.TwatContext.Twat import Twitterclone.TwatContextFixtures import Twitterclone.UserContextFixtures @invalid_attrs %{text: nil} test "list_tw...
04901650d32d5ab85df59ddb5b6a65d0f5997255
2,084
[ 344981584 ]
[ "documented", "ecto" ]
defmodule EventsApp.Comments do @moduledoc """ The Comments context. """ import Ecto.Query, warn: false alias EventsApp.Repo alias EventsApp.Comments.Comment @doc """ Returns the list of comments. ## Examples iex> list_comments() [%Comment{}, ...] """ def list_comments do Rep...
04907d92f6cf44191bfc7b91cf67ef9649502655
10,986
[ 998750050 ]
[ "documented" ]
defmodule AccountingPoc.TigerBeetleBalanceService do @moduledoc """ Service for querying account balances from TigerBeetle. This service uses TigerBeetle as the source of truth for balance calculations, bypassing AshDoubleEntry's problematic ULID casting issues. """ alias AccountingPoc.Ledger.UlidTigerbee...
0490db66edd1b64a6a982227f897a20fa5ef32e6
2,161
[ 260816712 ]
[]
defmodule PhxChat.MixProject do use Mix.Project def project do [ app: :phx_chat, version: "0.1.0", elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: ...
0491621a34dfe2fe720d7a8f97562c8e6f22f2f1
2,534
[ 96067513 ]
[]
%{"calliope": {:hex, :calliope, "0.4.2", "29d8585331f3c04f95d6e2f7c8367d660cfb6c2dc031bd3d22afb7e7201eb5c6", [:mix], [], "hexpm"}, "certifi": {:hex, :certifi, "1.1.0", "c9b71a547016c2528a590ccfc28de786c7edb74aafa17446b84f54e04efc00ee", [:rebar3], [], "hexpm"}, "combine": {:hex, :combine, "0.9.6", "8d1034a127d4cbf69...
0491ae29cf4f8314906d6454c051d98c14d4f4a6
2,793
[ 768785038 ]
[ "genserver" ]
defmodule PaymentServer.ExchangeRate.Monitor do use GenServer require Logger alias PaymentServer.ExchangeRate alias PaymentServer.ExchangeRate.Endpoint alias PaymentServer.ExchangeRate.Cache @currencies Application.compile_env(:payment_server, :supported_currencies) @time_delay_ms Application.compile_e...
0491c93043062ffd97d251c70c15ef9907497ac6
1,586
[ 166059736 ]
[ "test" ]
defmodule RomanNumeralsTest do use ExUnit.Case # @tag :pending test "1" do assert RomanNumerals.numeral(1) == "I" end @tag :pending test "2" do assert RomanNumerals.numeral(2) == "II" end @tag :pending test "3" do assert RomanNumerals.numeral(3) == "III" end # @tag :pending test ...
049258a11c579916cb7d5da2b0bde1b1e9629e36
2,597
[ 1011147301 ]
[ "phoenix" ]
defmodule BankWeb.Router do use BankWeb, :router import BankWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {BankWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug :fet...
0492955f1ebd98a462451209083fe966ceb982c9
2,962
[ 738217772 ]
[]
defmodule Hexplorer.UI do alias Hexplorer.Sys @tick 60 def init(state) do ExNcurses.initscr() ExNcurses.noecho() ExNcurses.start_color() ExNcurses.curs_set(0) ExNcurses.cbreak() ExNcurses.listen() ExNcurses.keypad() ExNcurses.refresh() ExNcurses.init_pair(1, :black, :white) ...
049318f084a4befbc5b153ba4e9f397d7d42cf41
5,514
[ 921493255 ]
[ "documented" ]
use EngineSystem defengine Examples.PingEngine do @moduledoc """ I am a ping engine that demonstrates active message sending and target-based communication patterns within the EngineSystem architecture. ## My Purpose I serve as an active communication engine that can initiate conversations with other eng...
04937163be84f3fbec13f8da958e1b553c3d7f88
2,214
[ 143163129 ]
[ "typespec" ]
defmodule Gnat.Parser do require Logger # states: waiting, reading_message defstruct [ partial: "", state: :waiting, ] @type parsed :: {:msg, String.t, non_neg_integer(), String.t | nil, binary()} | :ping | :pong | {:error, String.t} | {...
04939347535e6b02b8bd816b962572e833aa561a
17,436
[ 575873463, 482720652, 569522840 ]
[ "typespec", "macro", "documented" ]
defmodule Mix.Task do @moduledoc """ Provides conveniences for creating, loading, and manipulating Mix tasks. A Mix task can be defined by using `Mix.Task` in a module whose name begins with `Mix.Tasks.` and which defines the `run/1` function. Typically, task modules live inside the `lib/mix/tasks/` director...
0493fd5f1808ef26c794421bc8495c9155477783
1,680
[ 795936542 ]
[ "supervisor" ]
defmodule Supervise.MaxRestarts.UsingOneForOne do use Supervisor import Supervise.Utils.Process alias Supervise.Workers.SimpleWorker @child_names [ :max_restarts_worker1, :max_restarts_worker2, :max_retarts_worker3, :max_restarts_worker4 ] def start_link(_opts) do Supervisor.start_li...
0494129ad69cf01f63eeb8f7b52d7b0de8ca98cd
1,777
[ 882046315 ]
[ "test" ]
# TODO: # It is based on these issues and we need to fix 12 if we want to support nested list sub fields: # 1. https://github.com/mishka-group/guarded_struct/issues/12 # 2. https://github.com/mishka-group/guarded_struct/issues/7 defmodule GuardedStructTest.NestedSubFieldTest do use ExUnit.Case, async: true defmod...
04943a0ffebb9c52f1d9d185a5a271993e360e3b
3,217
[ 84006914 ]
[ "typespec", "documented" ]
defmodule JS2E.Printer.PrinterError do @moduledoc """ Represents an error generated while printing a JSON schema object as Elm code. """ use TypedStruct alias JsonSchema.Types @type error_type :: :unresolved_reference | :unknown_type | :unexpected_type | :unknown_...
049443b32a07c88e7fcf2b4df3ae2f33d6b0ed67
1,694
[ 1010414021 ]
[]
#!/usr/bin/env elixir # Simple example runner for Pipeline Mix.install([ {:pipeline, path: "."} ]) # Use live adapters (remove test mode) # System.put_env("TEST_MODE", "mock") # Load the workflow config_file = "test_simple_workflow.yaml" {:ok, config} = Pipeline.Config.load_workflow(config_file) IO.puts("🚀 Runni...
0494783ebdf49ae21ed7e54e0220a774d21e9268
2,297
[ 274765346, 359020274, 562988939, 722193981, 484868735 ]
[ "phoenix", "ecto" ]
defmodule NotSkullWeb.UserController do use NotSkullWeb, :controller alias NotSkull.Accounts alias NotSkull.Accounts.User alias NotSkull.ExternalServices.Email def show(conn, %{"id" => user_id}) do with {:ok, session_user_id} <- user_id_from_session(conn), {true, _, _} <- {session_us...
0494f946b22355db5362e28311ec12f1747b3d58
2,029
[ 299824116 ]
[ "test", "ecto" ]
defmodule ExMonAPI.TrainerTest do use ExMonAPI.DataCase alias ExMonAPI.Trainer describe "changeset/1" do test "se os parâmetros forem válidos, retorne um changeset válido" do params = %{name: "Rodrigo", password: "123456"} response = Trainer.changeset(params) assert %Ecto.Chan...
04954500aa996f1fcbb96cadf3e5c884f3d1be92
2,874
[ 105948750 ]
[ "test" ]
defmodule CommunityToolsWeb.PresentationControllerTest do use CommunityToolsWeb.ConnCase alias CommunityTools.Presentations @create_attrs %{slides: "some slides", summary: "some summary", title: "some title"} @update_attrs %{slides: "some updated slides", summary: "some updated summary", title: "some updated ...
04961a813ceb15769902aa1dfd9c84393b4aa6f0
2,836
[ 240012222, 282263329 ]
[ "typespec", "macro", "documented" ]
defmodule Stripe.Util do @moduledoc false @doc """ Performs a root-level conversion of map keys from strings to atoms. This function performs the transformation safely using `String.to_existing_atom/1`, but this has a possibility to raise if there is not a corresponding atom. It is recommended that you p...
04968e1d7481d8a7b598ab5af4a2e5cf81275ff4
1,877
[ 401423631 ]
[ "documented" ]
defmodule PhraseClient do @moduledoc """ Un-official Phrase.com client for elixir, use it to download your phrase app translations. """ defmodule HTTP do @moduledoc """ The HTTP layer of the Phrase client, this module interacts with the endpoints of the service offered by Phrase.com and retur...
0496a6b6c39d6b6325481427b50b4d1555e8391f
3,799
[ 190789950, 442465291 ]
[ "test", "phoenix" ]
defmodule CritWeb.UserManagement.UserControllerTest do use CritWeb.ConnCase alias CritWeb.UserManagement.UserController, as: UnderTest use CritWeb.ConnMacros, controller: UnderTest alias Crit.Sql alias Crit.Users.Schemas.User alias CritWeb.Audit setup :logged_in_as_user_manager describe "index" do ...
049778443499f162c446b35b82a500425e51e28e
3,256
[ 317711726 ]
[]
defmodule Day5 do @input File.stream!("./day5_input.txt") @seat_numbers 0..1021 def part1() do seats = get_seats() highest_number = highest_seat_number(seats) IO.puts("Highest seat number: #{highest_number}") end def part2() do seats = get_seats() mine = find_my_seat(seats) IO.puts(...
04978570321ac4fbfa7adb8c9e312687b41417c9
2,346
[ 369305202 ]
[]
defmodule Grades.Calculator do def percentage_grade(%{homework: homework, labs: labs, midterm: midterm, final: final}) do avg_homework = avg(homework) avg_labs = avg(labs) mark = calculate_grade(avg_labs, avg_homework, midterm, final) round(mark * 100) end def letter_grade(%{homework: homework,...