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
04f4516ec57bd239b31172bc9148adb6ddde30c9
1,819
[ 15625818 ]
[]
[ "cowboy": {:git, "git://github.com/extend/cowboy.git", "0ec713fc4b185c3cd0f6b2e7ec2c5f198361bddd", []}, "cowlib": {:git, "git://github.com/extend/cowlib.git", "63298e8e160031a70efff86a1acde7e7db1fcda6", [{:ref, "0.4.0"}]}, "ex_doc": {:git, "git://github.com/elixir-lang/ex_doc.git", "7a9ad350d2b23dfebc375a1be573c2...
04f4e7c29cd59143d879ef05d2e97ed4cd59eff7
16,798
[ 294446490 ]
[ "phoenix" ]
defmodule EworksWeb.Router do use EworksWeb, :router alias EworksWeb.Authentication.Guardian alias EworksWeb.Plugs pipeline :api do plug :accepts, ["json"] plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json], pass: ["*/*"], json_decoder: Jason end # define an auth pipeli...
04f5592d426fe450ef927c0edf85a46217aff0d6
1,544
[ 369676329 ]
[]
defmodule AstarteNervesLedExample.Handler do use Astarte.Device.Handler alias Nerves.Leds alias Astarte.Device require Logger def init_state(_args) do {:ok, nil} end def handle_message( %Astarte.Device.Handler.Message{ device_id: device_id, interface_name: "org.astarte-...
04f610d64777ec36e74a6416308f3e21f7a3f8cc
4,321
[ 992931758 ]
[ "test", "ecto" ]
defmodule GestaoFinanceira.FinanceTest do use GestaoFinanceira.DataCase alias GestaoFinanceira.Finance describe "transactions" do alias GestaoFinanceira.Finance.Transaction import GestaoFinanceira.FinanceFixtures @invalid_attrs %{data: nil, descricao: nil, valor: nil, tipo: nil} test "list_tr...
04f640e780113880c8fee9288011cd030ef30368
1,980
[ 786564268 ]
[ "ecto" ]
defmodule Bench.Books do import Ecto.Query alias Bench.Repo alias Bench.Books.Book alias Bench.Filter @topic inspect(__MODULE__) def subscribe do Phoenix.PubSub.subscribe(Bench.PubSub, @topic) end def broadcast({:ok, book}, tag) do Phoenix.PubSub.broadcast(Bench.PubSub, @topic, {tag, book}) ...
04f694c9d08d69426bdff351956800a7b3d5145f
1,656
[ 429220654 ]
[ "macro", "test" ]
defmodule AdventOfCode2019Test do use ExUnit.Case import Mock doctest AdventOfCode2019 doctest RocketEquation doctest TwelveOhTwoProgramAlarm doctest CrossedWires doctest SecureContainer doctest UniversalOrbitMap doctest AdventOfCode2019.SpaceImageFormat doctest AdventOfCode2019.SensorBoost @pa...
04f6f92d8c5e76cda9beaf5300bcc68fbf368d76
2,888
[ 326380583, 878006424 ]
[ "genserver", "liveview", "phoenix" ]
defmodule XitterWeb.TweetLive.Index do use XitterWeb, :live_view on_mount {XitterWeb.LiveUserAuth, :live_user_optional} @impl true def render(assigns) do ~H""" <.header> Listing Tweets <:actions> <.link patch={~p"/tweets/new"}> <.button>New Tweet</.button> </.link...
04f765fa478240bbc52d5a6ae5ec28e436209259
5,811
[ 676720643 ]
[ "typespec", "macro", "documented" ]
defmodule Membrane.Core.CallbackHandler do @moduledoc false # Behaviour for module that delegates its job to the other module via callbacks. # It delivers implementation of executing callbacks and results parsing their # results. use Bunch alias Membrane.CallbackError require Membrane.Logger @type ...
04f79891cce43a58ca445f83cfee6cf957d9a501
18,341
[ 588790131 ]
[ "documented" ]
# credo:disable-for-this-file defmodule Explorer.SmartContract.Solidity.Verifier do @moduledoc """ Module responsible to verify the Smart Contract. Given a contract source code the bytecode will be generated and matched against the existing Creation Address Bytecode, if it matches the contract is then Verif...
04f7d2407bf27ff0b5524eaae8feea71a6c5d4c1
2,836
[ 736117700 ]
[ "test", "ecto" ]
defmodule Blog.PostsTest do use Blog.DataCase alias Blog.Posts describe "posts" do alias Blog.Posts.Post import Blog.PostsFixtures @invalid_attrs %{title: nil, content: nil, published_on: nil, visibility: nil, user_id: nil} test "list_posts/0 returns all posts" do post = post_fixture() ...
04f828cca3c25c47dbef6f553254d0d5a0707ab2
1,577
[ 101809418 ]
[ "macro", "documented", "phoenix" ]
defmodule CServWeb 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 CServWeb, :controller use CServWeb, :view The definitions below will be executed for every view, controller, etc, s...
04f8303d314b1e02694169198ccf01ff4855e488
1,818
[ 641210530 ]
[ "phoenix" ]
defmodule EmulsionWeb.Router do use EmulsionWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {EmulsionWeb.Layouts, :root} plug :protect_from_forgery # plug :put_secure_browser_headers end pipeline :api do pl...
04f8681dbeb40bb53d0f5138181f2962ed4b9f70
3,009
[ 252507258 ]
[]
defmodule CurbsideConcerts.Factory do alias CurbsideConcerts.Repo alias CurbsideConcerts.Accounts.User alias CurbsideConcerts.Musicians.Genre alias CurbsideConcerts.Musicians.Musician alias CurbsideConcerts.Musicians.Session alias CurbsideConcerts.Requests.Request def attrs(:musician) do %{ na...
04f8b6c46b9fa1327f5a2a39d2de927a1c6f7b40
2,580
[ 761948266 ]
[ "test", "phoenix" ]
defmodule ElixirAppWeb.UserControllerTest do use ElixirAppWeb.ConnCase import ElixirApp.UsersFixtures alias ElixirApp.Users.User @create_attrs %{ username: "some username", password: "some password", email: "some email" } @update_attrs %{ username: "some updated username", password: "...
04f8f3f029119b3b56e123076397d29a853bee6d
2,490
[ 89221471 ]
[]
defmodule Gobstopper.Service.Mixfile do use Mix.Project def project do [ app: :gobstopper_service, version: "0.1.0", build_path: "../../_build", config_path: "../../config/config.exs", deps_path: "../../deps", lockfile: "../../mix....
04f9ed0ec924e83e4a65914c812180b492bb205c
2,197
[ 930771334 ]
[ "liveview" ]
defmodule GlobaltideWeb.JobLive.Show do use GlobaltideWeb, :live_view alias Globaltide.Accounts import GlobaltideWeb.Job.JobDetailTile import GlobaltideWeb.Common.NavbarComponent def mount(%{"id" => id}, session, socket) do job = Globaltide.Repo.get(Globaltide.JobListing, String.to_integer(id)) # Fe...
04fa0e7703203d52f0189e62f55a4c36bb0d9cdc
2,025
[ 292387152 ]
[ "macro", "documented", "phoenix" ]
defmodule DigitalCollectionsWeb 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 DigitalCollectionsWeb, :controller use DigitalCollectionsWeb, :view The definitions below will be execut...
04fa7f2cb6f66ad8e37b1b4fa2004e253d153944
1,654
[ 476424195 ]
[ "test" ]
defmodule Structs do use Koans @intro "Structs" defmodule Person do defstruct [:name, :age] end koan "Structs are defined and named after a module" do person = %Person{} assert person == %Structs.Person{age: nil, name: nil} end koan "Unless previously defined, fields begin as nil" do n...
04facbcc18cf64af089ff5164f3321b9f82e859f
4,056
[ 403439198 ]
[ "typespec", "liveview" ]
defmodule LivebookWeb.SessionLive.RuntimeComponent do use LivebookWeb, :live_component alias Livebook.{Session, Runtime} @impl true def mount(socket) do {:ok, assign(socket, type: nil)} end @impl true def update(assigns, socket) do assigns = if socket.assigns.type == nil do type =...
04fafaf4975d78c75180a22d0adaf18377e26f03
2,273
[ 289953917 ]
[]
defmodule HarnessDotfiles.MixProject do use Mix.Project @version_file Path.join(__DIR__, ".version") @external_resource @version_file @version (case Regex.run(~r/^v([\d\.]+)/, File.read!(@version_file), capture: :all_but_first ) do [version] -> version ...
04fb06aeb350df4b76678d8b9619ece2e19bd02d
10,962
[ 338818608 ]
[]
%{ "certifi": {:hex, :certifi, "2.5.3", "70bdd7e7188c804f3a30ee0e7c99655bc35d8ac41c23e12325f36ab449b70651", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "ed516acb3929b101208a9d700062d520f3953da3b6b918d866106ffa980e1c10"}, "connection": {:hex, :connection, "1.1....
04fb793c8f17b3a87274118c3ad4ca3351a74b4d
4,586
[ 555225235 ]
[ "liveview", "test" ]
defmodule ApartmanWeb.DailyInvoiceLiveTest do use ApartmanWeb.ConnCase import Phoenix.LiveViewTest alias Apartman.Invoice @create_attrs %{advancePayment: "some advancePayment", deposit: "some deposit", keycardFees: "some keycardFees", otherFees: "some otherFees", otherLabels: "some otherLabels"} @update_at...
04fb8234847327b6e4014115fe760a51392f1f5f
2,203
[ 170695325 ]
[ "documented" ]
defmodule TwitterIntegration do @moduledoc """ Documentation for TwitterIntegration. """ @url Application.get_env(:twitter_integration, :url) @auth Application.get_env(:twitter_integration, :auth) @url_twitter ~s(https://twitter.com/) def run(route \\ :most_relevants) do headers = [Username: @auth, ...
04fba6f0fde350a115bb800afe35ef088d8b9b1f
2,380
[ 244650692 ]
[ "typespec", "documented" ]
defmodule ProjectIdent do @moduledoc """ ProjectIdent module """ @doc """ find_files: Traverses paths according to the given repository and project type and returns a list of matches """ @spec find_files(atom | %{path: any}, atom | %{files: any, path: any}) :: [binary] def find_files(repo, project_t...
04fbea9ea59b323565b7680e2bd3d4526edc450e
3,938
[ 1008065584 ]
[ "genserver", "documented" ]
defmodule App.Dashboard.Orchestrator do @moduledoc """ Orchestrador principal que coordena todos os módulos do dashboard. Implementa o padrão Facade e coordena: - DataFetcher: busca dados da API - DataStore: armazena e gerencia estado - CacheManager: gerencia cache - EventBroadcaster: faz broadcasts de ev...
04fc224d0ea91ee56411ab64a11c14a5749d7657
1,933
[ 112599024 ]
[ "test" ]
if !System.get_env("EXERCISM_TEST_EXAMPLES") do Code.load_file("anagram.exs", __DIR__) end ExUnit.start ExUnit.configure exclude: :pending, trace: true defmodule AnagramTest do use ExUnit.Case test "no matches" do matches = Anagram.match "diaper", ["hello", "world", "zombies", "pants"] asse...
04fd49bfd2bcb93d1b91599520edd7e0915065b8
4,062
[ 59958515 ]
[ "genserver", "documented" ]
defmodule Murnau.Adapter.Telegram.Chat.Labor do @moduledoc """ Provides all logic to handle Labor specific actions. """ use Murnau.Adapter.Telegram.Chat.Base alias Murnau.Adapter.Labor.Api, as: Api alias Murnau.Adapter.Telegram require Logger @vsn "0" @commands %{"open" => :open, "close" => :close, "...
04fde0fa5f359e7a1dbd335fe5efa55cd3142731
7,007
[ 282181917 ]
[]
defmodule DealogBackoffice.Messages.Aggregates.Message do defstruct [ :message_id, :title, :body, :category, :status, :approval_notes, :rejection_reasons, published?: false ] alias DealogBackoffice.Messages.Aggregates.Message alias DealogBackoffice.Messages.Commands.{ Creat...
04feb2f44a8593403c9c9f73f9d286dbd8e311f4
2,435
[ 717958176 ]
[ "test", "phoenix" ]
defmodule EctoMultiDemoWeb.PersonControllerTest do use EctoMultiDemoWeb.ConnCase import EctoMultiDemo.PersonsFixtures alias EctoMultiDemo.Persons.Person @create_attrs %{ name: "some name" } @update_attrs %{ name: "some updated name" } @invalid_attrs %{name: nil} setup %{conn: conn} do ...
04ff0cb8b5c44e6508f3ecbb22ce46b6ac5657d8
8,559
[ 89630812 ]
[ "documented", "phoenix" ]
defmodule WebGib.Web.Components.Details.Query do @moduledoc """ This contains the query details view, shown when the user clicks the query menu command. """ use Marker use WebGib.MarkerElements import WebGib.Gettext use IbGib.Constants, :ib_gib use IbGib.Constants, :validation use WebGib.Constant...
04ff187a16f90806b2ea7a9a834f49a72486d477
12,070
[ 149017621 ]
[]
defmodule Dispatcher do use Matcher define_accept_types [ json: [ "application/json", "application/vnd.api+json" ], pdf: [ "application/pdf" ], html: [ "text/html", "application/xhtml+html" ], any: [ "*/*" ] ] define_layers [ :static, :services ] ## Static frontend resources of all kinds ...
04ff2e5f5bd6d030a7107aaf63c9b971141d285a
2,567
[ 433929203 ]
[]
defmodule Day10P1 do def solve(filename) do points = %{")" => 3, "]" => 57, "}" => 1197, ">" => 25137} File.read!(filename) |> String.trim() |> String.split("\n") |> Enum.map(&String.graphemes/1) |> Enum.map(&is_corrupt/1) |> Enum.filter(fn {result, _} -> result == :corrupt end) |> E...
04ff3a661086636d1f4c9ae6a5c30afef56fc687
2,063
[ 978009060 ]
[]
defmodule ImageIO do def load_image(image_path) do image_path |> Image.open!() end @image_filetypes [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff"] def is_image?(filename) do file_extension = filename |> Path.extname() |> String.downcase() Enum.member?(@image_filetypes, file_...
04ff83e7e02361d75229a6d927b31ac2a4d0585e
2,480
[ 757505901 ]
[ "documented", "ecto" ]
defmodule Bookstore.People do @moduledoc """ The People context. """ import Ecto.Query, warn: false alias Bookstore.Repo alias Bookstore.People.Author @doc """ Returns the list of authors. ## Examples iex> list_authors() [%Author{}, ...] """ def list_authors do Repo.all(Autho...
05007aa4a8b409747fb67922463ed75c535e11cb
13,024
[ 942811655, 920024200 ]
[ "test" ]
defmodule Front.ActivityMonitor.Repo.Test do use ExUnit.Case alias Front.ActivityMonitor.Repo setup do Support.Stubs.init() Support.Stubs.build_shared_factories() end test "describe_organization() returns valid org details" do organization_describe_response = InternalApi.Organization.Desc...
0501133ae6534c17daf8f6cae8ae1b821a80f711
1,560
[ 966945031 ]
[ "liveview", "phoenix" ]
defmodule SocketGatewayWeb.Endpoint do use Phoenix.Endpoint, otp_app: :socket_gateway # 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...
0501683478b1e4807b0daa163e3da418aa7c7e7c
1,896
[ 90782234, 153311332 ]
[ "macro" ]
defmodule UcxChat.Settings do alias UcxChat.{Notification, Repo} [ general: UcxChat.Config.General, message: UcxChat.Config.Message, layout: UcxChat.Config.Layout, file_upload: UcxChat.Config.FileUpload ] |> Enum.map(fn {field, mod} -> Enum.map mod.__schema__(:fields) -- [:id], fn name -> ...
050187148ab2a609af1aaf779633c3d28b7991d9
2,120
[ 29387790 ]
[ "test" ]
defmodule Brando.Sites.GlobalsTest do use ExUnit.Case use Brando.ConnCase use BrandoIntegration.TestCase alias Brando.Factory setup do ExMachina.Sequence.reset() user = Factory.insert(:user) {:ok, %{user: user}} end test "get_global_path", %{user: user} do params = Factory.params_...
05019238f4c89e3279fccfe127ba9fbd530a8ed8
1,615
[ 335243209 ]
[ "typespec" ]
defmodule Anoma.Node.Transport.GRPC.Servers.IntraNode do alias Anoma.Node.Registry alias Anoma.Node.Transaction.Mempool alias Anoma.Proto.IntraNode.Call alias Anoma.Proto.IntraNode.Cast alias GRPC.Server.Stream use GRPC.Server, service: Anoma.Proto.IntraNodeService.Service require Logger import Anoma...
0502491f82e086ab0d3ac68b3c0a9722578fed9c
1,975
[ 88105666 ]
[ "test" ]
defmodule Quasar.PageControllerTest do use Quasar.ConnCase alias Quasar.Page @valid_attrs %{} @invalid_attrs %{} setup %{conn: conn} do {:ok, conn: put_req_header(conn, "accept", "application/json")} end test "lists all entries on index", %{conn: conn} do conn = get conn, page_path(conn, :index...
05027504cf26617ad6f5664c51e30d33799594d0
3,926
[ 263443612 ]
[ "typespec", "phoenix" ]
defmodule LearnElixirLandingWeb.BlogView do use LearnElixirLandingWeb, :view alias LearnElixirLandingWeb.MarkdownViewHelper alias LearnElixirLanding.{BlogPost, Config} @blog_path "lib/learn_elixir_landing_web/templates/blog/markdown/" if Mix.env() === :prod do @blog_files @blog_path |> Path.expan...
050311fbae760cf6a52fb442d6e98d44f6183b4c
11,998
[ 367278931 ]
[ "documented" ]
defmodule Google.Bigtable.Admin.V2.RestoreSourceType do @moduledoc false use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :RESTORE_SOURCE_TYPE_UNSPECIFIED, 0 field :BACKUP, 1 end defmodule Google.Bigtable.Admin.V2.Table.TimestampGranularity do @moduledoc false use Pro...
05031cc03c9eeeab2f880fe478e7e5463fc1d826
3,192
[ 478322442 ]
[ "test", "phoenix" ]
defmodule SurveFormWeb.SurveyControllerTest do use SurveFormWeb.ConnCase import SurveForm.Form_surveyFixtures alias SurveForm.Form_survey.Survey @create_attrs %{ comments: "some comments", course: "some course", email: "some email", name: "some name", regno: "some regno", year: 42 }...
05037c5c0d317e1a627c2da6a04d3924925ee149
2,183
[ 161179495 ]
[]
# https://www.decentlab.com/products/dendrometer-for-lorawan defmodule DecentlabDecoder do @protocol_version 2 defp sensor_defs do [ %{ length: 2, values: [ %{ :name => "Dendrometer position", :convert => fn x -> ((Enum.at(x, 0) + Enum.at(x, 1)*65536) /...
0503f748986ff3e23d310e30ff70aa6617ac8c07
1,686
[ 159971277 ]
[ "macro", "documented", "phoenix" ]
defmodule EbooklyPhoenixWeb 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 EbooklyPhoenixWeb, :controller use EbooklyPhoenixWeb, :view The definitions below will be executed for every...
050427bb11c40de810776daacc1eda3397c7c60f
8,658
[ 125843928 ]
[ "macro", "documented" ]
defmodule Mix.Config do @moduledoc ~S""" Module for defining, reading and merging app configurations. Most commonly, this module is used to define your own configuration: use Mix.Config config :plug, key1: "value1", key2: "value2" import_config "#{Mix.env}.exs" All `config...
050454737d291d6a5ef2b71d0383eef206d492f4
8,214
[ 209454701 ]
[ "genserver", "documented" ]
defmodule PushSumNode do use GenServer require Logger @impl true def init(init_arg) do {:ok, init_arg} end @moduledoc """ Documentation for PushSumNode. """ @gossip "Gossip" @push_sum "PushSum" @push_sum_limit 1/:math.pow(10, 10) @gossip_limit 10 def gossip do @gossip end def push_sum...
05046bb47025f243fd8c917705206b5e2084f0f3
1,802
[ 396480010 ]
[ "macro", "documented", "phoenix" ]
defmodule PirateWeb 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 PirateWeb, :controller use PirateWeb, :view The definitions below will be executed for every view, controller, etc...
050478dcde87e8888259d7cf5fa2fe89c4e55170
3,064
[ 411863018 ]
[ "liveview", "documented" ]
defmodule AmbryWeb.Admin.MediaLive.Chapters.SourceImportForm do @moduledoc false use AmbryWeb, :live_component import AmbryWeb.Admin.Components alias Ambry.Media.Chapters alias Phoenix.LiveView.AsyncResult @impl Phoenix.LiveComponent def mount(socket) do {:ok, socket} end @impl Phoenix.LiveCom...
05049406e4f5d03654dcb0c7ca492bb6414c6efa
2,902
[ 337348249 ]
[]
defmodule Kaffy.ResourceError do use Phoenix.HTML def form_error_border_class(form, default_class) do if Enum.count(form.errors) > 0 do "border-left-danger" else default_class end end def display_errors(conn, form) do errors = case length(form.errors) do 0 -> ...
0504a16f2d3832a60109c521d6b1783f57ae4198
2,163
[ 191423461 ]
[ "test" ]
defmodule MeadowWeb.Schema.Mutation.CreateSheet do use Meadow.DataCase use Meadow.S3Case use MeadowWeb.ConnCase, async: true use Wormwood.GQLCase load_gql(MeadowWeb.Schema, "test/gql/CreateIngestSheet.gql") @sheet_key "/create_sheet_test/ingest_sheet.csv" @sheet_fixture "test/fixtures/ingest_sheet.csv" ...
05052dc765bba09ccd14bf5651f62c0bea4230d1
6,051
[ 131993126 ]
[ "documented", "ecto", "phoenix" ]
defmodule AdminAPI.V1.ErrorHandler do @moduledoc """ Handles API errors by mapping the error to its response code and description. """ import Ecto.Changeset, only: [traverse_errors: 2] import Phoenix.Controller, only: [json: 2] import Plug.Conn, only: [halt: 1] alias Ecto.Changeset alias AdminAPI.V1.{Er...
0505d74bac5dcfc0cbd563f1afbdc5267a22fcdf
2,320
[ 298695275 ]
[ "typespec", "supervisor", "documented" ]
defmodule Database do @workers_count 3 @base_folder "./persist/" @spec start_link() :: :ignore | {:error, any} | {:ok, pid} def start_link() do workers_spec_list = Enum.map(1..@workers_count, &worker_spec/1) [Database.Registry.child_spec(nil) | workers_spec_list] |> Supervisor.start_link(strategy:...
050630877d89aa3b26d7e694e35e941af4300e90
6,303
[ 242712527 ]
[ "test" ]
defmodule CommutoxApiWeb.Graphql.Mutations.AcceptContactTest do use CommutoxApiWeb.ConnCase import CommutoxApiWeb.GraphqlHelpers import CommutoxApiWeb.ConnHelpers import CommutoxApi.Fixtures @accept_contact_mutation """ mutation AcceptContact($input: AcceptContactInput!) { acceptContact(input: $input)...
050638187a5c0423bcc847f67542500eae67fb81
8,537
[ 511981727 ]
[ "macro", "test" ]
defmodule Room.StateMachineTest do use ExUnit.Case import Room.StateMachine doctest Room.StateMachine @effect_timeout 10 @effect_timeout_margin 5 @recv_timeout 3 setup do effect_timeout = @effect_timeout - @effect_timeout_margin {:ok, pid} = start_link([self(), [sensor_timeout: effect_timeout]])...
0507855231537816e3358c9fa28161e9baf30b73
6,521
[ 518668388 ]
[ "test" ]
defmodule SmsPartCounterTest do use ExUnit.Case doctest SmsPartCounter describe "can count how many characters are in a message" do test "can count english alphabet" do assert SmsPartCounter.count("abc") == 3 assert SmsPartCounter.count("asdf") == 4 assert SmsPartCounter.count("") == 0 ...
05080001046e9e77e08babcdff4be0bbfa75267b
13,677
[ 128714359 ]
[ "test", "ecto" ]
defmodule Rapcor.ClinicianAccountsTest do use Rapcor.DataCase alias Rapcor.ClinicianAccounts alias Rapcor.Clinician alias Rapcor.ClinicianAccounts.ClinicianToken @clinician_valid_attrs %{administrative_area: "some administrative_area", country: "some country", email: "<EMAIL>", first_name: "some first_name"...
05083f643aab71e1fb89a0958e68699061209077
1,661
[ 911730162 ]
[ "documented" ]
defmodule Mix.Tasks.Dicom.Scp do @moduledoc """ Run a standalone C-STORE SCP service class provider (SCP). The task takes following arguments: * `--port <PORT>`: Port to listen on for incoming DICOM connections * `--print`: If set, received data sets are printed to standard out. * `--save <BASE_PATH>`: If...
0508bb36640d8f1e93049f8b5c4e3997615b0eee
5,680
[ 111205037 ]
[]
defmodule UIKitDemo.Core.Component.Notification do use Taggart.HTML, except: [table: 2] use UIKit import UIKitDemo.Core.Common def demo_content do taggart do uk_container do h1 do "Notification" end div(class: "uk-child-width-1-2@m", "uk-grid": true) do di...
0508d5fc3cca35023c1868d676b35dae1c9964bb
5,089
[ 163776791 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]...
05093bfebb291955df897bda31d6164f4c78717c
4,325
[ 212535951 ]
[ "test" ]
defmodule ElasticsearchElixirBulkProcessor.Bulk.BulkStageTest do use ExUnit.Case, async: false import Mock alias ElasticsearchElixirBulkProcessor.Items.Index alias ElasticsearchElixirBulkProcessor.Bulk.{Client, QueueStage, BulkStage} @index_item_byte_size 40 describe ".set_byte_threshold" do setup do...
050963a3331a661991b11de09c1604ea24ff2e3b
3,901
[ 433034488 ]
[]
defmodule Y2023.Day05 do use Advent.Day, no: 05 @operation_order [:seed, :soil, :fertilizer, :water, :light, :temperature, :humidity, :location] @block_size 1000 def part1(input) do conversion_rules = generate_conversion_rules(input) input.seeds |> Enum.map(&convert(conversion_rules, &1, tl(@ope...
05099d16e74193a4512d068ae69247874797a900
2,776
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.ContainerAnalysis.V1.Model.Recipe do @moduledoc """ Steps taken to build the artifact. For a TaskRun, typically each container corresponds to one step in the recipe. ## Attributes * `arguments` (*type:* `list(map())`, *default:* `nil`) - Collection of all external inputs that influenced ...
050a07a85aa2383a4be3d4b3b8ec433cf7633a29
3,015
[ 65153243 ]
[ "test" ]
defmodule KratosApi.CommitteeSyncTest do use KratosApi.ModelCase import Ecto.Query alias KratosApi.{ Repo, Committee, Person } test "syncing creates Committee" do KratosApi.Sync.Committee.sync assert Repo.all(Committee) |> Enum.count == 2 committee = Repo.one!( from c in Comm...
050a08cfac6dec5d9e25e0f64dd345099bcc3596
2,219
[ 865751549 ]
[ "genserver", "typespec", "macro", "supervisor" ]
defmodule UA.ServerHandler do @callback disassemble_msg(msg :: term) :: {:ok, tpdu :: term, mti :: term, proc_code :: term, body :: term} | {:error, reason :: term} @callback assemble_msg(tpdu :: term, mti :: term, proc_code :: term, body :: term) :: {:ok, msg :: term} | {:error, reason :: term} ...
050a47d2b3d62548249bca24eeceb79a9ba1dc0c
5,467
[ 93552083 ]
[ "test" ]
defmodule ElixirLS.Debugger.ServerTest do # Awkwardly, testing that the debugger can debug ExUnit tests in the fixture project # gives us no way to capture the output, since ExUnit doesn't really distinguish # between the debugger's tests and the fixture project's tests. Expect to see output printed # from both...
050b29bf2224a1f9d5befd48695aebed674548fa
16,237
[ 492823415 ]
[ "test", "phoenix" ]
defmodule OceanconnectWeb.AuctionControllerForTermTest do use OceanconnectWeb.ConnCase alias Oceanconnect.Auctions setup do buyer_company = insert(:company, is_supplier: true) buyer = insert(:user, company: buyer_company) buyer_vessels = insert_list(3, :vessel, company: buyer_company) selected_ve...
050ba6e680356d7f7e6b5d74b9754494dc2de54b
2,759
[ 359098618 ]
[ "phoenix" ]
defmodule TodoListWeb.Endpoint do use Phoenix.Endpoint, otp_app: :todo_list # 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: "_todo_l...
050cbfef2f26fa950750d9b0bf293010a03c00e1
3,496
[ 101890347, 244421451, 317778299 ]
[ "typespec", "documented" ]
defmodule Result.Calc do @moduledoc """ Result calculations """ @doc """ Calculate the AND of two results r_and :: Result e1 a -> Result e2 b -> Result [e1, e2] [a, b] ## Examples iex> Result.Calc.r_and({:ok, 1}, {:ok, 2}) {:ok, [1, 2]} iex> Result.Calc.r_and({:ok, 1}, {:error, 2}) ...
050d1d02fd57867b985c00410858a28d2d5af5d4
5,005
[ 33454270 ]
[ "test" ]
defmodule MustacheFeatureTest do use ExUnit.Case test "No Interpolation" do assert Mustache.render("Hello from {Mustache}!\n") == "Hello from {Mustache}!\n" end test "Basic Interpolation" do assert Mustache.render("Hello, {{subject}}!\n", %{subject: "world"}) == "Hello, world!\n" end test "HTML ...
050d44416d322e5ae130aad75bbe38a937ad7bef
1,614
[ 85755265 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule UrlShot.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use UrlShot.Web, :controller use UrlShot.Web, :view The definitions below will be executed for every view, controller, etc, so keep them sho...
050df541cf9cd7a135274ef4a5c5d175dcf83c12
2,805
[ 297139144 ]
[]
defmodule Jurby.Modifier do alias Scenic.Graph import Scenic.Primitives import Scenic.Components alias Jurby.Container alias Jurby.Widget alias Jurby.Space import Furlong.Solver @default_font_size 20 @default_font :roboto def set_position_and_size( %Scenic.Primitive{module: Scenic.Primitiv...
050e6b3dd881f3881b1c1c0a3cd26d14ad9c03c0
2,921
[ 225970993 ]
[]
Code.require_file("../util/util.ex", __DIR__) defmodule Day03 do def parse_pathdir(tok) do {dir, num} = String.split_at(tok, 1) {String.to_existing_atom(dir), Integer.parse(num) |> elem(0)} end def parse_path(line) do line |> String.codepoints |> Util.stream_comma_seperated |> Stream.ma...
050e7b8dfceae48a7ac48636baf920f19cab53be
1,579
[ 401447715 ]
[]
defmodule SurfaceFormatterBugWeb.TextInputNew do alias Surface.Components.Form.TextInput use Surface.Component prop field, :atom prop type, :string, default: "text", values: [ "date", "datetime-local", "email", "number", "password", "search", "tel", "tex...
050f41505899541f1c663e0124d8e03ecedd6f37
1,967
[ 109010426 ]
[ "documented", "ecto" ]
defmodule Learningai.Instructors do @moduledoc """ The Instructors context. """ import Ecto.Query, warn: false import Ecto alias Learningai.Repo alias Learningai.Instructors.Course @doc """ Returns the list of courses. ## Examples iex> list_courses() [%Course{}, ...] """ def li...
050f928ed6f619deada8d0a19889a6fb7b0ee87e
3,674
[ 834671321 ]
[ "typespec", "liveview", "supervisor", "documented" ]
defmodule Nosedrum.ComponentHandler do @moduledoc """ Handles incoming interactions triggered by interacting with a component. ## Register components Before the component handler can handle incoming interactions, you must register some [custom ids](https://discord.com/developers/docs/interactions/message...
050fa15085c07ffa607ee241a2ae81f8b68c7a66
3,908
[ 300841538 ]
[ "documented", "ecto" ]
defmodule Hotex.Hotels do @moduledoc """ The Hotels context. """ import Ecto.Query, warn: false alias Hotex.Repo alias Hotex.Hotels.Supplier @doc """ Returns the list of suppliers. ## Examples iex> list_suppliers() [%Supplier{}, ...] """ def list_suppliers do Repo.all(Supplie...
050ff89ceafe8e8486f74122e2e709ee3a742019
2,078
[ 115975611 ]
[ "documented" ]
defmodule Durango.Api.Vertex do @doc """ GET /_api/gharial/{graph_name}/vertex List vertex collections """ def list(repo, graph_name) do Durango.Api.get(repo, "/_api/gharial/#{graph_name}/vertex") end @doc """ POST /_api/gharial/{graph_name}/vertex Add vertex collection """ def add_to_collec...
051002a5f7d6234fef2279bb47213b4f2375a346
5,102
[ 352108899 ]
[ "typespec", "documented", "phoenix" ]
defmodule QRCodeEx.SVG do @moduledoc """ Render the QR Code matrix in SVG format ```elixir qr_code_content |> QRCodeEx.encode() |> QRCodeEx.svg(color: "#cc6600", shape: "circle", width: 300) ``` You can specify the following attributes of the QR code: * `background_color`: In hexadecimal format or ...
0510454e6439bd5d752f2f2931ab5dc5e33835f4
2,328
[ 470360368 ]
[ "test" ]
defmodule Maps.HighScoreTest do use ExUnit.Case alias Maps.HighScore test "new/1 result in empty score map" do assert Maps.HighScore.new() == %{} end test "add_player/2 add player without score to empty score map" do scores = HighScore.new() assert Maps.HighScore.add_player(scores, "José Valim")...
051057c5bc513b2009639d11368966a52982a00d
3,748
[ 688371480 ]
[ "typespec", "documented" ]
defmodule ExRTCP.Packet.TransportFeedback.NACK do @moduledoc """ Transport layer feedback message with generic NACKs packet type (`RFC 4585`, sec. 6.2.1). """ import Bitwise alias ExRTCP.Packet @behaviour ExRTCP.PacketTranscoder @packet_type 205 @feedback_type 1 @typedoc """ Generic NACK mess...
0510b428e830b38622b6db36ac2938d48d5e8691
2,123
[ 978987182 ]
[ "liveview" ]
defmodule NlsqlWeb.TucanDemoLive do use NlsqlWeb, :live_view alias NlsqlWeb.Live.Components.TucanChartComponent @impl true def mount(_params, _session, socket) do # Sample data for charts sales_data = [ %{label: "Jan", value: 12500}, %{label: "Feb", value: 17800}, %{label: "Mar", valu...
0510fabf61a9d9f69c28c2a7bc99b9ed1b97f604
2,795
[ 345866618 ]
[ "test" ]
defmodule SumOverListTest do use ExUnit.Case describe "enum_sum/1" do test "should return the sum of all elements of a list" do list = [1, 2, 3, 4, 5, 6, 7] return = SumOverList.enum_sum(list) expected = 28 assert return == expected end end describe "enum_max/1" do test "s...
05117c9cf70bbd3cde7cb477fc209003d0e275f2
2,006
[ 726203358 ]
[]
defmodule App do def process_file do {:ok, text} = File.read("./input.txt") lines = String.split(text, "\n", trim: true) games = parse_games(lines) # compute_wins(games) {total_count, card_count_map} = compute_scratch_cards(games) IO.inspect(card_count_map) total_count end def parse_...
051273765fb52fb13634e2e7f98f94e12eca7763
2,525
[ 570562155 ]
[]
file = "input.txt" input_data = File.stream!(file) |> Stream.map(&String.replace(&1, "\n", "")) |> Enum.map(fn x -> x |> String.split(["=", ",", ":"]) |> Enum.filter(&String.match?(&1, ~r/^[-0-9]+$/)) |> Enum.map(&String.to_integer/1) |> Enum.chunk_every(2) |> Enum.map(&List.to_tuple/1) ...
051310a41e6018b8680e79715f6209be864a2e98
1,997
[ 482555587 ]
[ "typespec", "documented", "ecto" ]
defmodule ExOAPI.Stripe.Schemas.PaymentMethodDetailsP24 do use TypedEctoSchema import Ecto.Changeset @type params :: map() @moduledoc """ **:bank** :: *:string* The customer's bank. Can be one of `ing`, `citi_handlowy`, `tmobile_usbugi_bankowe`, `plus_bank`, `etransfer_pocztowy24`, `banki_spbdzielcze`, `...
051339e431d2259ad4da0504de1b364b5810c09c
4,020
[ 151559050 ]
[ "test" ]
defmodule ExProtobuf.Decoder.Test do use ExProtobuf.Case alias ExProtobuf.Decoder, as: D test "fix :undefined values to nil in proto2" do defmodule UndefinedValuesProto2 do use ExProtobuf, """ message Msg { optional string f1 = 1; optional int32 f2 = 2; optional bo...
0513d320149679be1feac067348f7d2cdd63b96e
1,650
[ 160422838 ]
[]
defmodule Day10 do defp read_and_parse do File.read!("input.txt") |> String.split("\n", trim: true) |> Enum.map(fn line -> Regex.run(~r/(-?\d+)\D+?(-?\d+)\D+?(-?\d+)\D+?(-?\d+)/, line) |> Enum.slice(1, 4) |> Enum.map(&String.to_integer/1) end) |> Enum.map(fn line -> %{ ...
0514e01923f7b6bcfeb8aa1eac17ff0b6fb4347f
1,679
[ 716657553 ]
[]
defmodule Term.Instruction.Image do def instructions() do [ {:OpSampledImage, 5, 86}, {:OpImageSampleImplicitLod, 5, 87}, {:OpImageSampleExplicitLod, 7, 88}, {:OpImageSmapleDrefImplicitLod, 6, 89}, {:OpImageSampleDrefExplicitLod, 8, 90}, {:OpImageSampleProjImplicitLod, 5, 91}, {:OpImageSamplePr...
05150e552fc764e93ff3ff5b5d95b6b8af052782
1,582
[ 157756674, 174984358, 225081315, 271306295 ]
[ "macro", "documented", "phoenix" ]
defmodule CmsWeb 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 CmsWeb, :controller use CmsWeb, :view The definitions below will be executed for every view, controller, etc, so keep...
0515482bea05fcf1b7bb219e0025030c41899277
2,041
[ 112857727 ]
[]
defmodule AdventOfCode2019.Day12 do def part1(args, steps) do args |> String.split("\n", trim: true) |> Enum.map(fn moon -> [_, xp, yp, zp] = Regex.run( ~r/<x=(-?\d+), y=(-?\d+), z=(-?\d+)>/, moon ) {{String.to_integer(xp), String.to_integer(yp), String.to_...
05162953875e8922bffadd3a72901ad1636ea595
4,876
[ 72154249 ]
[]
defmodule ProjectEuler do def main(args) do args |> parse_args |> Problem8.run |> IO.puts end defp parse_args(args) do {_, [str], _} = OptionParser.parse(args) str end end defmodule Problem119 do @count 30 def run(str) do (for i <- 2..70, j <- 2..10, do: round(:math.pow(...
05165dbedaed9993fa26b063b0d361825915d9af
1,568
[ 871379115 ]
[ "macro", "documented", "phoenix" ]
defmodule StudyPortalWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, components, channels, and so on. This can be used in your application as: use StudyPortalWeb, :controller use StudyPortalWeb, :html The definitions below will be executed for every co...
05166b010f1459e43e879c834de3cc99330a6100
2,188
[ 969999971 ]
[ "documented" ]
defmodule DeeperHub.Core.Data.Migrations.BxCreditsWithdrawals do @moduledoc """ Migration para criar e remover a tabela bx_credits_withdrawals. """ alias DeeperHub.Core.Data.Repo alias DeeperHub.Core.Logger require DeeperHub.Core.Logger @doc """ Cria a tabela de bx_credits_withdrawals. """ def up ...
0516d74d0ad4624f94a9c48114aae2c1e68cf898
3,412
[ 41632959 ]
[ "typespec", "test" ]
defmodule ParserTest do use ExUnit.Case alias Vimdoc.Parser, as: VP test "tokenize" do result = """ aaa "" " foo " bbb " bar ccc "" " baz " bazz ddd eee "" " empty line start " " end fff """ |> String.split(~r"\r?\n") |> V...
0517031fe31f8d4e6d1eba4f0b788ab332bed46d
2,501
[ 594880409 ]
[]
import Config # Configure your database config :branding_hut, BrandingHut.Repo, username: "postgres", password: "postgres", hostname: "localhost", database: "branding_hut_dev", stacktrace: true, show_sensitive_data_on_connection_error: true, pool_size: 10 # For development, we disable any cache and enab...
051718ea69449f0b9e97c9d157dc29b173f3af20
3,782
[ 336911652 ]
[]
%{ "brod": {:hex, :brod, "3.15.1", "073b0e16f4193291a05e01ae36351ddba1bda85ad4f90f66566c8123a335150e", [:rebar3], [{:kafka_protocol, "2.3.6", [hex: :kafka_protocol, repo: "hexpm", optional: false]}, {:supervisor3, "1.1.11", [hex: :supervisor3, repo: "hexpm", optional: false]}], "hexpm"}, "cowboy": {:hex, :cowboy, "...
05172388cbeb88043060f5467081b231077135ec
5,483
[ 572983850 ]
[ "documented" ]
defmodule AdventOfCode2022Elixir.Day02RockPaperScissors do @moduledoc """ --- Day 2: Rock Paper Scissors --- The Elves begin to set up camp on the beach. To decide whose tent gets to be closest to the snack storage, a giant Rock Paper Scissors tournament is already in progress. Rock Paper Scissors is a game b...
05172c22882598e3a8848f354df8a15dda965b8e
2,464
[ 201734927 ]
[ "phoenix" ]
defmodule TodoTutorialWeb.Api.TaskController do use TodoTutorialWeb, :controller use PhoenixSwagger alias TodoTutorial.Todo alias TodoTutorial.Todo.Task action_fallback TodoTutorialWeb.FallbackController def swagger_definitions do %{ Task: swagger_schema do title("Task") ...
05173afc210382cb18d64f5dde360272a6a9f656
1,563
[ 102129748 ]
[]
defmodule Eth.Mixfile do use Mix.Project @version "0.6.7" @source_url "https://github.com/izelnakri/eth" def project() do [ app: :eth, version: @version, elixir: "~> 1.14", description: description(), start_permanent: Mix.env() == :prod, package: package(), deps: ...