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
00365a537f3f7ff04bc093935f56ec3a3ffaaeca
2,860
[ 898802679 ]
[]
defmodule Day07 do def run(src, part) do case {src, part} do {:test, 1} -> data_example_txt() |> part1() {:test, 2} -> data_example_txt() |> part2() {:input, 1} -> data_txt() |> part1() {:input, 2} -> data_txt() |> part2() _ -> {:error, "Invalid arguments. Expecting (:test | :...
0036c179e9205373a04694fb4d7e90b5a8023b1f
4,440
[ 43284446 ]
[]
%{"connection": {:hex, :connection, "1.0.0-rc.1", "e980d21874fd2413481aba270c58d2d32af83b1e90fc07d69e7f625979462780", [:mix], []}, "cowboy": {:hex, :cowboy, "1.0.3", "101a5f826ce9a1ebb2ea53a2cdfffc74736e99807e9e492ecd5f26544c04082b", [:rebar, :make], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "...
0036c86c5bed83845b144b558fac6a071a6e60a6
9,455
[ 160483718 ]
[]
defmodule Aoc2018.Day7 do def a do pairs = parse_input() grouped = Enum.group_by( pairs, fn({_,x}) -> x end, fn({l, _}) -> l end ) missing_keys = Enum.map(65..90, fn(x) -> [x] end) -- Map.keys(grouped) Enum.reduce(missing_keys, grouped, fn(k, a) -> Map.put_new(a,...
0036d1a5d22fa28550336b36dbb905f3cab39ace
8,955
[ 202142872 ]
[ "documented", "ecto" ]
defmodule Mix.Tasks.Codegap.Gen.Html do @shortdoc "Generates controller, views, and context for an HTML resource" @moduledoc """ Generates controller, views, and context for an HTML resource. mix codegap.gen.html Accounts User users name:string age:integer The first argument is the context module follo...
0037099d43b5cfc28604a8e4b807491aa9fa5fc6
1,723
[ 27632754 ]
[ "test" ]
if !System.get_env("EXERCISM_TEST_EXAMPLES") do Code.load_file("bob.exs", __DIR__) end ExUnit.start() ExUnit.configure(exclude: :pending, trace: true) defmodule BobTest do use ExUnit.Case test "stating something" do assert Bob.hey("Tom-ay-to, tom-aaaah-to.") == "Whatever." end test "shouting" do ...
00370b4e62d52119aa4834d4b106ed2ca8e62000
7,849
[ 583413349 ]
[ "typespec", "documented" ]
defmodule Smee.Filter do @moduledoc """ Process a stream of entities to include or exclude entity structs matching the specified criteria. These functions are intended to be used with streams but should also work with simple lists too - but using lists to process larger metadata files is **strongly discourage...
0037296165679e0869a47f4aafef5d0aa0d9ce44
7,408
[ 370813738, 450993182 ]
[ "typespec", "test" ]
defmodule StellarBase.XDR.FeeBumpTransactionEnvelopeTest do use ExUnit.Case import StellarBase.Test.Utils alias StellarBase.XDR.{ EnvelopeType, Ext, FeeBumpInnerTx, FeeBumpTransaction, FeeBumpTransactionEnvelope, Int64, Memo, MemoType, OptionalMuxedAccount, Operation, ...
00374d7b92bb8ca219ed6040d47570e531320d92
1,507
[ 98602422 ]
[ "genserver", "typespec" ]
defmodule Tai.VenueAdapters.Ftx.Stream.ProcessAuth do use GenServer alias Tai.VenueAdapters.Ftx.Stream defmodule State do @type venue :: Tai.Venue.id() @type t :: %State{venue: venue} @enforce_keys ~w[venue]a defstruct ~w[venue]a end @type venue :: Tai.Venue.id() @type state :: State.t() ...
00379c370d499a54e63322e2e2c4f6f6fa21b5cd
2,156
[ 756484733 ]
[ "documented" ]
defmodule Importer.MixProject do use Mix.Project def project do [ app: :importer, version: "0.1.0", elixir: "~> 1.12", start_permanent: Mix.env() == :prod, deps: deps() ] end def application do [ extra_applications: [:logger], mod: {Importer.Application, [...
0037df9d716f0bd016987994747e1b515a305b2c
1,672
[ 423942783 ]
[ "documented", "ecto" ]
defmodule Edgehog.Repo.Migrations.InstallAshFunctionsExtension420241004151245 do @moduledoc """ Installs any extensions that are mentioned in the repo's `installed_extensions/0` callback This file was autogenerated with `mix ash_postgres.generate_migrations` """ use Ecto.Migration def up do execute("...
0037e0d568564d41f87d483ccbde1d41a016cc04
7,942
[ 325017943 ]
[ "liveview" ]
defmodule StrangerWeb.SettingsLive do use StrangerWeb, :live_view alias Stranger.{Accounts, Accounts.User, Accounts.Profile, Uploaders.Avatar} @impl Phoenix.LiveView def mount(_params, session, socket) do socket = assign_defaults(socket, session) {:ok, socket |> assign( password_chang...
003804a26c0db85c07ccb6e028820e7b5d236d3c
1,598
[ 661911751 ]
[ "genserver" ]
defmodule Mastery.Boundary.QuizManager do alias Mastery.Core.Quiz use GenServer # Lifecycle # def init(quizzes) when is_map(quizzes) do {:ok, quizzes} end def init(_quizzes), do: {:error, "quizzes must be a map"} def start_link(options \\ []) do GenServer.start_link(__MODULE__, %{}, options) ...
00382073814bf68e03ba1176c4cec54dba014a38
2,280
[ 48301569 ]
[ "test" ]
defmodule Stripe.SubscriptionTest do use ExUnit.Case #these tests are dependent on the execution order # ExUnit.configure w/ seed: 0 was set setup_all do Helper.create_test_plans customer = Helper.create_test_customer "subscription_test@localhost" {:ok, sub1} = Stripe.Subscriptions.create customer....
003874a3384ce532744599de7f33e3c5af171f47
5,481
[ 503057535 ]
[ "test", "documented" ]
defmodule Skyscrapers7x7FastTest do @moduledoc """ Upper level tests from kata """ use ExUnit.Case import Skyscrapers7x7Fast @moduletag :capture_log test "medium" do clues = [ 7,0,0,0,2,2,3, 0,0,3,0,0,0,0, 3,0,3,0,0,5,0, 0,0,0,0,5,0,4 ] expected = [ [1,5,6,7,4,...
0038e5ee85fe1e26f3968ea3cea7250a90d164fe
1,864
[ 784159322 ]
[ "genserver", "liveview" ]
defmodule CalendlexWeb.ScheduleEventLive.Index do use CalendlexWeb, :live_view alias Calendlex.Event @impl true def mount(params, _session, socket) do %{"event_type_slug" => slug, "time_slot" => time_slot} = params with {:ok, event_type} <- Calendlex.get_event_type_by_slug(slug), {:ok, start...
00390a19b131dfd67d22d3b9cbb8e19ef75acf58
2,349
[ 244810505 ]
[]
%{ "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"}, "db_connection": {:hex, :db_connection, "2.2.1", "caee17725495f5129cb7faebde001dc4406796f12a62b8949f4ac69315080566", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "he...
003912667e89042879d5383149981854bfce48df
1,879
[ 215597871 ]
[]
use Mix.Config # For production, don't forget to configure the url host # to something meaningful, Phoenix uses this information # when generating URLs. # # Note we also include the path to a cache manifest # containing the digested version of static files. This # manifest is generated by the `mix phx.digest` task, # ...
00392a4602092bfeb305f19f2148455352762566
8,160
[ 768649037 ]
[]
defmodule NodeProto do def ping() do tip = Consensus.chain_tip_entry() temporal = tip |> Map.take([:header, :signature, :mask]) rooted = Fabric.rooted_tip_entry() |> Map.take([:header, :signature, :mask]) %{op: :ping, temporal: temporal, rooted: rooted, ts_m: :os.system_time(1000)} end def pong(t...
0039447e3d1ee273004f742e244564a61af2b23a
2,033
[ 315800584 ]
[]
defmodule Main do """---------------Funciones interactivas con usuario------------------------------------------ """ def saludar_usuario do obtener_usuario() |> formato_mensaje|> mostrar_mensaje end def obtener_usuario do IO.gets '¿Cúal es tu nombre? : ' end def formato_mensaje...
0039533ae3c9c01ffe75039dc9c9637a0b0eb4db
2,757
[ 218215245 ]
[ "test", "phoenix" ]
defmodule TimesheetsWeb.JobControllerTest do use TimesheetsWeb.ConnCase alias Timesheets.Jobs @create_attrs %{budget: 42, desc: "some desc", jobcode: "some jobcode", name: "some name"} @update_attrs %{budget: 43, desc: "some updated desc", jobcode: "some updated jobcode", name: "some updated name"} @invalid...
00396a7ccb362adc47704d518dc614c9cdef77f4
2,214
[ 343959665 ]
[ "test" ]
defmodule GodwokenExplorer.Graphql.LogTest do use GodwokenExplorerWeb.ConnCase import GodwokenExplorer.Factory, only: [insert!: 2, insert: 2] setup do {:ok, args} = GodwokenExplorer.Chain.Data.cast( "0x01000000060000001600000000000000000000000000000001000000000000000000000000000000" ) ...
00398a210c87e00aff66a0bd10aafd4e614220d0
2,042
[ 894134094 ]
[]
# 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 :realtime_todo, ecto_repos: [RealtimeTodo.Re...
0039cab7b271d21cb796d3a4ed6560a648e062ac
16,737
[ 100649989 ]
[ "macro", "documented" ]
defmodule Cldr.Unit.Additional do @moduledoc """ Additional domain-specific units can be defined to suit application requirements. In the context of `ex_cldr` there are two parts of configuring additional units. 1. Configure the unit, base unit and conversion in `config.exs`. This is a requirement since ...
0039df7f3a1e0a20fab1574aeb512c91ac336076
1,716
[ 39408645 ]
[ "macro", "documented", "phoenix" ]
defmodule PhoenixCart.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use PhoenixCart.Web, :controller use PhoenixCart.Web, :view The definitions below will be executed for every view, controller, etc, so k...
0039ffd14b0257bdef72e9ed5c06221fb9a7cca0
10,417
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Webmaster.V3.Api.Sitemaps do @moduledoc """ API calls for all endpoints tagged `Sitemaps`. """ alias GoogleApi.Webmaster.V3.Connection alias GoogleApi.Gax.{Request, Response} @library_version Mix.Project.config() |> Keyword.get(:version, "") @doc """ Deletes a sitemap from this si...
003a483f559534123cd7b6634241805eb6b4e0ab
8,655
[ 287367434 ]
[ "macro", "test", "documented", "ecto" ]
defmodule FlowAssertions.Ecto.ChangesetA do use FlowAssertions.Define alias FlowAssertions.Ecto.Messages use FlowAssertions alias Ecto.Changeset alias FlowAssertions.MapA @moduledoc """ Assertions for `Ecto.Changeset` structures. """ # ----------------------------------------------------------...
003bd6014298dcee449acb48f2c1ef684d63754b
1,600
[ 213195304 ]
[ "macro", "documented", "phoenix" ]
defmodule FinancesappWeb 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 FinancesappWeb, :controller use FinancesappWeb, :view The definitions below will be executed for every view, ...
003beba1d1606b5a0015d1bf6eebdbeb6a89b623
1,777
[ 676720643 ]
[ "test" ]
defmodule Membrane.APIBackCompabilityTest do # this module tests if API in membrane_core v0.12 has no breaking changes comparing to api in v0.11 use ExUnit.Case, async: true import Membrane.ChildrenSpec alias Membrane.Testing test "if action :remove_child works" do defmodule Filter do use Membran...
003c6a2d2f0395cf85fcd6d7fa85a23440f2278c
3,736
[ 165997818 ]
[ "documented" ]
defmodule RisteysWeb.Utils do @doc """ Custom sorter that puts nil values at the end. To be used as the sorter of Enum.sort_by/3 """ def sorter_nil_end(direction) do fn aa, bb -> case {aa, bb, direction} do {nil, _, _} -> false {_, nil, _} -> true {_, _, :asc} -> aa < bb ...
003c778cf0a4d1675f7ac0d945c8718b7bcec1ed
2,176
[ 75855124 ]
[ "test" ]
defmodule GenAMQP.ConnTest do use ExUnit.Case alias GenAMQP.{Conn, Chan} use GenDebug setup_all do {:ok, counter_pid} = Agent.start(fn -> 0 end) {:ok, counter: counter_pid} end setup %{counter: counter_pid} do counter_name = "test_#{Agent.get_and_update(counter_pid, fn state -> {state, s...
003c96a41df427bc2965ce60ebf78135161bd8e9
1,965
[ 45707801, 45689952 ]
[ "phoenix" ]
defmodule MovieStore.TheaterController do use MovieStore.Web, :controller alias MovieStore.Theater plug :scrub_params, "theater" when action in [:create, :update] def index(conn, _params) do theaters = Repo.all(Theater) render(conn, "index.html", theaters: theaters) end def new(conn, _params) do...
003d038a3d6a8cf5204e7098c021cf5cb2eb16bd
2,585
[ 273386261 ]
[]
defmodule Telegex.MixProject do use Mix.Project @version "1.10.0-dev" @description "A Telegram bot framework, with its client-side based on data and code generation, boasts unparalleled adaptation speed and correctness for new versions." def project do [ app: :telegex, version: @version, ...
003d19187ebdabba70e711684c491c8d26dbc3ca
2,629
[ 856307667 ]
[ "liveview" ]
defmodule WhoamiWeb.UserResetPasswordLive do use WhoamiWeb, :live_view alias Whoami.Users def render(assigns) do ~H""" <div class="mx-auto max-w-sm"> <.header class="text-center">Reset Password</.header> <.simple_form for={@form} id="reset_password_form" phx-submit="...
003d4321267ace3bf5435fb1c63777fb5ce27ff3
5,827
[ 1008733310 ]
[ "documented", "ecto" ]
defmodule Mymoney.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias Mymoney.Repo alias Mymoney.Accounts.User alias Mymoney.Accounts.Tag @doc """ Returns the list of users. ## Examples iex> list_users() [%User{}, ...] """ def authenticate_...
003d6b04393998f04f8f601f559c01535e4e276c
11,399
[ 558575089 ]
[ "test", "documented" ]
defmodule ApiKeyMgmtTest do @moduledoc """ External app tests TODO: I never settled on a concrete scope for this case, so currently it acts like a combined integration, response validation and header handling test case. I probably can be split up and/or improved considerably. """ use ExUnit.Case, asyn...
003e3c704e29d92552c0d964e74e9c31b4417380
2,415
[ 51177905 ]
[ "documented" ]
defmodule Microformats2.Items.Value do @moduledoc false import Microformats2.Helpers alias Microformats2.Items def get_value(class, p, child, doc, url, opts, state) do cond do is_a?(class, "p") and p[normalized_key("properties", opts)][normalized_key("name", opts)] != nil -> {List.first(p[no...
003e63e744698287a23889401523ebbce53ca9f4
3,432
[ 515602918 ]
[ "test", "phoenix" ]
defmodule OportunidadesWeb.ClienteControllerTest do use OportunidadesWeb.ConnCase import Oportunidades.ComercialFixtures alias Oportunidades.Comercial.Cliente @create_attrs %{ cnpj: "some cnpj", emails: [], nome: "some nome", nomeFantasia: "some nomeFantasia", origem: 42, origemDescri...
003f518e02d257f00b741b143ccac73f7c654240
4,702
[ 358724772 ]
[ "ecto" ]
defmodule RobbyWeb.Profile do use RobbyWeb.Web, :model alias RobbyWeb.Profile alias RobbyWeb.LdapRepo alias RobbyWeb.ProfileHelper import RobbyWeb.Gettext require Logger @primary_key {:dn, :string, autogenerate: false} schema "users" do field(:bribeMeWith, :string) field(:cn, :string) field...
003f8664a5503ffc9657a4a3b56d08bbcc2a8394
2,218
[ 70340432 ]
[]
defmodule MyList do # Write a function MyList.span(from, to) that returns a list of the numbers # from from up to to. # stop recursion when from > to def span(from, to) when from > to, do: [] # create list with from at head and tail made of # recursive calls to span def span(from, to), do: [ from | span(f...
003fce16b8e9ed8ed5635d11447063876a84cf48
2,047
[ 130158404 ]
[ "test", "ecto" ]
defmodule Bustracker.AccountsTest do use Bustracker.DataCase alias Bustracker.Accounts describe "users" do alias Bustracker.Accounts.User @valid_attrs %{email: "some email", name: "some name"} @update_attrs %{email: "some updated email", name: "some updated name"} @invalid_attrs %{email: nil, n...
00408d74bedca0706f9e56f139229f394dccb0ee
3,797
[ 945597922 ]
[ "documented" ]
defmodule TrackerShortcutMapper do @moduledoc """ Handles mapping of Pivotal Tracker URLs to Shortcut URLs. """ defstruct [:mapping] @doc """ Creates a new TrackerShortcutMapper instance with the provided mapping. ## Examples iex> mapping = %{"111111111" => "https://app.shortcut.com/org/story/11...
00411db7fac2f8d9bcf177fdf1e6616c6cecc3db
2,096
[ 378538397 ]
[ "liveview", "ecto" ]
defmodule FiveHundredWeb.PageLive do use FiveHundredWeb, :live_view alias FiveHundred.{Game, Player, GameServer} alias FiveHundredWeb.GameStarter @impl true def mount(params, session, socket) do # TODO: ensure user ID exists in session {:ok, socket |> assign( changeset: GameStarter....
004163fb7327f610076d79b5b574b4599fabfd5f
6,608
[ 334283416 ]
[]
%{ "artificery": {:hex, :artificery, "0.4.3", "0bc4260f988dcb9dda4b23f9fc3c6c8b99a6220a331534fdf5bf2fd0d4333b02", [:mix], [], "hexpm", "12e95333a30e20884e937abdbefa3e7f5e05609c2ba8cf37b33f000b9ffc0504"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "...
00422bf01be0377b2f175141a30906d85320ba3c
2,018
[ 913550144 ]
[ "liveview" ]
defmodule DsStationWeb.UserConfirmationLive do use DsStationWeb, :live_view alias DsStation.Accounts def render(%{live_action: :edit} = assigns) do ~H""" <div class="mx-auto max-w-sm"> <.header class="text-center">Confirm Account</.header> <.simple_form for={@form} id="confirmation_form" ph...
00427bebb2f1f6ddf930e97b379f55a5e07ee5a2
1,949
[ 501494654 ]
[ "phoenix" ]
defmodule HousebookWeb.Router do use HousebookWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {HousebookWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api do ...
0043776ee5872a8962b7ecb746d8476d71c68ccf
3,688
[ 710514599 ]
[ "test" ]
defmodule CalculatorTest do use ExUnit.Case doctest Calculator describe "Operation - [sum]" do test "when sum only one number it should return itself" do assert Calculator.sum([1]) == 1 assert Calculator.sum([2]) == 2 assert Calculator.sum([5]) == 5 end test "when sum t...
0043ab6d18c8f4b87daced4128d13e8396f1084b
1,857
[ 146636103 ]
[]
defmodule TextingWeb.Dashboard.AnalyticsCommander do use Drab.Commander alias Texting.{Sales, Messenger, Analytics, Bitly} defhandler show_stats(socket, sender) do order_id = sender.params["campaign_id"] user_id = socket.assigns.current_user_id order = Sales.get_order_by_id(order_id, user_id) mes...
0043f1995d673baa711737e71858db6427b2be9e
6,319
[ 808443482 ]
[ "typespec", "documented" ]
defmodule Teiserver.Account.RecacheUserStatsTask do @moduledoc """ Used to recalculate certain user stats after various events """ # alias Teiserver.Repo # import Ecto.Query, warn: false alias Teiserver.{Account, Game} alias Teiserver.Game.MatchRatingLib alias Teiserver.Battle.MatchLib alias Teiserver...
00440fe1ab5703685349f43aa8d8ef1a3b31e56c
8,268
[ 386502083 ]
[]
books = %{ "1" =>"https://leeyongkyu.s3-us-west-1.amazonaws.com/1.prepare_the_way_of_the_lord.pdf", "2" => "https://leeyongkyu.s3-us-west-1.amazonaws.com/2.exposition_on_song_of_songs.pdf", "3" => "https://leeyongkyu.s3-us-west-1.amazonaws.com/3.work_out_your_salvation.pdf", "4" => "https://leeyongkyu.s3-us-wes...
004414ffc9494e4a383abb3d0695e78b01e3bbf8
2,475
[ 985251604 ]
[ "liveview", "ecto" ]
defmodule CcReportWeb.UserLive.Registration do use CcReportWeb, :live_view alias CcReport.Accounts alias CcReport.Accounts.User def render(assigns) do ~H""" <Layouts.app flash={@flash} current_scope={@current_scope}> <div class="mx-auto max-w-sm"> <.header class="text-center"> ...
00446070cdfd3844689a3c89e04bb571c97cbdf5
2,239
[ 653053618 ]
[ "documented", "ecto" ]
defmodule HotPlate.StaffMembers do @moduledoc """ The StaffMembers context. """ import Ecto.Query, warn: false alias HotPlate.Repo alias HotPlate.StaffMembers.StaffMember @doc """ Returns the list of staff_members. ## Examples iex> list_staff_members() [%StaffMember{}, ...] """ d...
0044e023a35e77736c39cf077ae1120437e1fb9c
2,368
[ 879461460 ]
[]
defmodule Game do def get_initial_game() do [ [ false, false, false, false, false, false, false, false ], [ false, false, false, false, false, false, false, false ], [ false, false, false, false, false, false, false, false ], [ false, false, false, true , true , true , false, false ], ...
00451df49771f9afe0126ecd2c5cab427cdab74d
2,972
[ 406599509 ]
[ "documented" ]
defmodule Dna do require Util @dna_bases [:a, :t, :g, :c] @doc """ Return a list consisting of n random bases from @dna_bases """ def get_random_bases(n) when is_integer(n) do Enum.map(1..n, fn _i -> Enum.random(@dna_bases) end) end @doc """ Very rough simulation of genome after mating...
00452ef399d63db5c2e21343006cab3818cdcee8
5,687
[ 432524514 ]
[ "liveview", "documented" ]
defmodule UserdocsDesktopWeb.ProjectPicker do @moduledoc false use UserdocsDesktopWeb, :live_component use Phoenix.HTML alias Schemas.Projects.Project def dropdown_trigger(assigns, name, _highlight, do: block) do ~L""" <div class="nested navbar-item dropdown"> <div class="dropdown-trigger">...
00454abcaae2313f1366084d38b4976d4652286a
1,876
[ 573811508 ]
[ "typespec", "documented" ]
defmodule Whatlangex do @moduledoc """ NIF bindings for Whatlang, a natural language detection library written in Rust. """ use Rustler, otp_app: :whatlangex, crate: "whatlang_nif" defmodule Detection do @moduledoc """ Module of the Detection type. """ @type t :: %__MODULE__{ la...
004556a6c1d5a42f4aae6a5d7639dca167745a7f
1,577
[ 218393177 ]
[]
# Script for populating the database. You can run it as: # # mix run priv/repo/seeds.exs # # Inside the script, you can read and write to any of your # repositories directly: # # Timesheets.Repo.insert!(%Timesheets.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as the...
00456c79d0549aab578cf4f0046439bb8b0a78f8
2,041
[ 150101643 ]
[ "test" ]
defmodule BubbleLib.MapUtilTest do use ExUnit.Case defmodule Location do defstruct [:lat, :lon, :data] end import BubbleLib.MapUtil alias BubbleLib.MapUtil.AutoMap.ETS test "deatomize" do assert [%{"a" => %{"b" => :c}}] == deatomize([%{a: %{b: :c}}]) end test "deatomize retains structs" do ...
0045740ab19323674551ac4ce17af2f267718849
2,190
[ 603826504 ]
[ "test" ]
defmodule GoogleNews.ParseTest do use ExUnit.Case, async: true alias GoogleNews.{Feed, FeedInfo, Entry} alias GoogleNews.Parse alias GoogleNews.ParseError test "error on parse, reason: :parser_error (invalid rss 1)" do error = %ParseError{ reason: :parser_error, value: 'Can\'t detect charact...
0045a9f697fc39ed2ca844f4c72cb181562420d9
4,734
[ 446836618 ]
[ "test" ]
defmodule HangmanImplGameTest do use ExUnit.Case alias Hangman.Impl.Game test "new game returns structure" do game = Game.new_game assert game.turns_left == 7 assert game.game_state == :intializing assert length(game.letters) > 0 end test "new game returns correct word" do game = Game...
0045bddcc01ac15e82fe6af4119df4d3f8061db3
6,923
[ 296161038 ]
[ "documented" ]
defmodule Server.MPCwallet do @moduledoc """ Library for the server part of the MPC-based API keys. Glossary of terms: - MPC: Multi-party computation. A method to have multiple parties compute a function while keeping their inputs private. For our case, the function is creating a digital signature and the ...
0045ef35e8f0c244ba0b41566f0b1f922deb4769
4,854
[ 609926983 ]
[ "liveview", "test", "ecto" ]
defmodule AuthzWeb.AuthorizationLiveTest do use AuthzWeb.ConnCase import Phoenix.LiveViewTest import Authz.BlogFixtures @update_attrs %{body: "some updated body", title: "some updated title"} defp create_post(%{user: user}) do post = post_fixture(creator_id: user.id) %{post: post} end describe...
0045f7036f01e1e75931546c71469f6f657961e5
8,150
[ 202939111 ]
[ "typespec", "documented" ]
defmodule Ecto.Adapters.Neo4j.Behaviour.Schema do @moduledoc false alias Ecto.Adapters.Neo4j.Cql.Node, as: NodeCql alias Ecto.Adapters.Neo4j.Condition alias Ecto.Adapters.Neo4j.Query def autogenerate(:id), do: :erlang.system_time(:microsecond) def autogenerate(:binary_id), do: Ecto.UUID.generate() def a...
00460281962287c146c4641c5eec80cbaf969435
5,919
[ 436553571 ]
[ "test" ]
defmodule Realtime.SubscriptionManagerTest do use ExUnit.Case import Mock alias Realtime.SubscriptionManager @user_id "bbb51e4e-f371-4463-bf0a-af8f56dc9a71" @user_email "<EMAIL>" setup_all do start_supervised(Realtime.RLS.Repo) :ok end test "track_topic_subscriber/1" do mess = { :tr...
00463bc4416a6a6e4055f5d80e85cc586a657cb5
1,551
[ 786846015 ]
[ "documented", "ecto" ]
defmodule Violacorp.Schemas.Currencies do use Ecto.Schema import Ecto.Changeset alias Violacorp.Schemas.Currencies @moduledoc "Currencies Table Model" schema "currencies" do field :countries_id, :integer field :currency_name, :string field :currency_code, :string field :currency_symbol, :str...
00467a701928474e0db243ae7562bf9d0d300a42
12,722
[ 130748338 ]
[ "phoenix", "documented" ]
defmodule Pleroma.Web.MastodonAPI.AccountController do use Pleroma.Web, :controller import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2, truthy_param?: 1, assign_account_by_id: 2, json_response: 3] alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.Plugs.RateLimiter alias Pleroma.User alias...
0047e092e7916b76924af2cff1eccc5d97874098
2,100
[ 346460621 ]
[]
defmodule FreelaReports do @months %{ "1" => "janeiro", "2" => "fevereiro", "3" => "março", "4" => "abril", "5" => "maio", "6" => "junho", "7" => "julho", "8" => "agosto", "9" => "setembro", "10" => "outubro", "11" => "novembro", "12" => "dezembro" } def build(file...
004820470c62af7265ca089108145a1c77a25c2d
5,467
[ 426781486 ]
[ "test" ]
defmodule NestruEncodeTest do use ExUnit.Case, async: true import ErrorRegex describe "For a struct adopting Encoding protocol Nestru should" do test "encode struct to map receiving customized map value from Nestru.Encoder.gather_fields_from_struct/2" do struct = %Order{id: "123785-558", max_total: 50...
004823ce0ba1cb2c5280b558de349c8214c8ca25
2,413
[ 248817168 ]
[ "test", "documented" ]
defmodule Membrane.RTP.Vad.AudioLevelQueueTest do @moduledoc """ AudioLevelQueue api tests. """ use ExUnit.Case alias Membrane.RTP.Vad.{AudioLevelQueue, VadParams} @target_levels_length VadParams.target_levels_length() describe "new" do test "creates new empty queue" do queue = AudioLevelQue...
0048708af19e72bcb1fc187a9ee7f5a613805463
3,806
[ 79044379 ]
[]
defmodule Volapi.WebSocket.Server do require Logger @behaviour :websocket_client @volafile_wss_url "wss://#{Application.get_env(:volapi, :server, "volafile.org")}/api/?rn=<%= rn %>&EIO=3&transport=websocket&t=<%= t %>&cs=<%= cs %>&nick=<%= nick %>&room=<%= room %>" defstruct [ room: "", connected: fals...
0048d80ddad0126746c5fd7776ba26535a74cf5a
2,081
[ 239822890, 419435907, 459291087 ]
[ "liveview" ]
defmodule OliWeb.Common.DeleteModal do use OliWeb, :html attr(:id, :string, required: true) attr(:description, :string, required: true) attr(:entity_name, :string, required: true) attr(:entity_type, :string, required: true) attr(:delete_enabled, :boolean, required: true) attr(:validate, :any, required: t...
004949ac760021cfc2857eaf64f55a4395f815aa
3,520
[ 271523395 ]
[]
%{ "certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"}, "excoveralls": {:hex, :excoveralls, "0....
004976c4cb9f7aa6e7dc04a443b86176f4a92f3f
1,881
[ 350555167 ]
[ "macro", "documented", "phoenix" ]
defmodule AppPhxWeb 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 AppPhxWeb, :controller use AppPhxWeb, :view The definitions below will be executed for every view, controller, etc...
0049c016547de06afdaa0fa718b4c18d5cdc3f7f
2,426
[ 664568260 ]
[ "liveview", "test" ]
defmodule ApolloWeb.UserLoginLiveTest do use ApolloWeb.ConnCase import Phoenix.LiveViewTest import Apollo.AccountsFixtures describe "Log in page" do test "renders log in page", %{conn: conn} do {:ok, _lv, html} = live(conn, ~p"/users/log_in") assert html =~ "Log in" assert html =~ "Regi...
004a888fb8bf79bf42c79bc82d8308e8c546b3e3
5,321
[ 229644297 ]
[ "test" ]
defmodule Postoffice.HttpWorkerTest do use Postoffice.DataCase, async: true use Oban.Testing, repo: Postoffice.Repo import Mox alias GoogleApi.PubSub.V1.Model.PublishResponse alias Postoffice.Adapters.HttpMock alias Postoffice.Adapters.PubsubMock alias Postoffice.HttpWorker alias Postoffice.Fixtures ...
004a9c5f3e78af5d6851356f6fabd5273daacd4d
2,972
[ 950867903 ]
[ "liveview", "ecto" ]
defmodule TechTreeWeb.CourseModuleLive.FormComponent do # Renamed use TechTreeWeb, :live_component alias TechTree.Learning # alias TechTree.Learning.CourseModule # Not directly used here @impl true def render(assigns) do ~H""" <div> <.header> {@title} <:subtitle>Use...
004b5100ed8d518e12d60318316918ee6b6b69a1
2,546
[ 49529180 ]
[ "test" ]
defmodule Back.Monster11ControllerTest do use Back.ConnCase alias Back.Monster11 @valid_attrs %{description: "some content", name: "some content"} @invalid_attrs %{} test "lists all entries on index", %{conn: conn} do conn = get conn, monster11_path(conn, :index) assert html_response(conn, 200) =~ "...
004b5c2044cd33a1be5567086736247208c2f655
4,238
[ 760480218 ]
[ "typespec" ]
defmodule Reglito.Chapters do alias Reglito.Chapters.Chapter @spec all :: [%Chapter{}] def all do [ %Chapter{ name: "De la cooperativa", code: :cooperative, description: "Aquí pondremos cuestiones generales relacionadas a la normativa a la que está sujeta el reglamento...
004bc506ad4613a2b6749f36407d4a6f91201cba
2,197
[ 573190431 ]
[ "typespec", "documented" ]
defmodule AdventOfCode.Y22.Day3 do @moduledoc """ https://adventofcode.com/2022/day/3 """ alias AdventOfCode.Helpers @doc """ Examples: iex> Day3.part_1() 7_875 """ @spec part_1() :: integer def part_1() do rucksacks = get_rucksacks() rucksacks |> Enum.map(&find_and_priorit...
004d02be5273f926614f6f2bcdb3dc2c064bdd11
4,120
[ 166092965 ]
[ "typespec", "documented" ]
defmodule State.Vehicle do @moduledoc """ Maintains the list of currently active vehicles. Queryable by: * vehicle ID * trip ID * route ID * label """ use State.Server, indices: [:id, :trip_id, :effective_route_id], parser: Parse.VehiclePositions, recordable: Model.Vehicle, hibernate: f...
004d113284fed6698b3b2ccf9c651f4d18e3bc97
3,257
[ 264298168 ]
[ "documented" ]
defmodule Sitex.Config.Loader do @moduledoc """ Module responsible for loading and processing site configuration. Reads and processes the `sitex.yml` configuration file, converting it into an Elixir data structure that can be used by other modules in the system. """ require Logger @doc """ Loads a ...
004d145e69179dc69df0ee26a4f168e8df2256f4
6,036
[ 638863870 ]
[ "liveview", "documented", "ecto" ]
defmodule BrightWeb.UserRegisterSocialAccountLive do @moduledoc """ OAuth 認証でユーザー登録 """ use BrightWeb, :live_view alias BrightWeb.UserAuthComponents alias Bright.Accounts alias Bright.Accounts.User alias Bright.Accounts.SocialIdentifierToken def render(%{live_action: :show} = assigns) do ~H""" ...
004d52847b3f0d45b2df2fb774767f6657ea2fa1
1,843
[ 120904852 ]
[ "test", "documented" ]
defmodule PrinterErrors do @moduledoc """ In a factory a printer prints labels for boxes. For one kind of boxes the printer has to use colors which, for the sake of simplicity, are named with letters from a to m. The colors used by the printer are recorded in a control string. For example a "good" control s...
004e570f109385db8907059c9545845bcd9937a2
1,575
[ 150175133 ]
[ "documented" ]
defmodule BillingProcessor.ErrorMessage do @moduledoc false def for_wrong({:structure, field}, _value), do: "call record don't have #{field}" def for_wrong({:duplicated_in_database, field}, value), do: "call record with #{field}: #{value} already exists in database" def for_wrong({:duplicated_in_list_be...
004eb013bcf005d6b7ef9f06cf9f72a3f0912135
1,677
[ 911748958 ]
[ "documented", "ecto" ]
defmodule Dailynotes.Notes do @moduledoc """ The Notes context. """ import Ecto.Query, warn: false alias Dailynotes.Repo alias Dailynotes.Notes.Note @doc """ Returns the list of notes. ## Examples iex> list_notes() [%Note{}, ...] """ def list_notes do Repo.all(Note) end ...
004f3af120d286d8a21f6878a2dab9851fef5354
7,866
[ 894201359 ]
[]
%{ "decimal": {:hex, :decimal, "2.2.0", "df3d06bb9517e302b1bd265c1e7f16cda51547ad9d99892049340841f3e15836", [:mix], [], "hexpm", "af8daf87384b51b7e611fb1a1f2c4d4876b65ef968fa8bd3adf44cff401c7f21"}, "ecto": {:hex, :ecto, "3.12.4", "267c94d9f2969e6acc4dd5e3e3af5b05cdae89a4d549925f3008b2b7eb0b93c3", [:mix], [{:decimal...
004f88a38acdedd1dd3fdd2c668821a22619560e
4,203
[ 822862116 ]
[ "macro", "documented" ]
defmodule QuestionsWeb.QuestionsSwagger do @moduledoc false use PhoenixSwagger alias QuestionsWeb.Swagger.CommonParameters defmacro __using__(_opts) do quote do swagger_path :index do get("/questions") description("List Questions") CommonParameters.question() response...
004fb1870145e69a69a8d55158f932f6aeea50f6
1,577
[ 50764865 ]
[ "test" ]
defmodule ElixirShop.Transactions.RemoveFromCartTest do use ElixirShop.ModelCase alias ElixirShop.{Repo, Order, Order.Line} alias ElixirShop.Transactions.{AddToCart, RemoveFromCart} setup do order = create(:order) {:ok, order, _line, _log} = AddToCart.run(order, create(:product), 2) {:ok, order, l...
00504e662545730028d9be08edde96ef7633fc23
10,375
[ 927234821, 492752264, 327711808, 554455380 ]
[ "typespec", "test", "documented" ]
defmodule Livebook.Runtime.Evaluator.Doctests do @test_timeout 5_000 @line_width 80 @pad_size 3 @doc """ Runs doctests in the given modules. """ @spec run(list(module()), String.t()) :: :ok def run(modules, code) do doctests_specs = for module <- modules, doctests_spec = doctests_spec(module)...
005097f18621a48eaa88766876f6dd7ec6303b32
2,706
[ 221046953 ]
[ "test", "phoenix" ]
defmodule SocialWeb.ConnectionControllerTest do use SocialWeb.ConnCase alias Social.Connections alias Social.Connections.Connection @create_attrs %{ status: "some status" } @update_attrs %{ status: "some updated status" } @invalid_attrs %{status: nil} def fixture(:connection) do {:ok, c...
0050b7a435144a52f08a4ab783dc71acf12f9705
9,164
[ 514485705 ]
[ "test" ]
defmodule NextLS.Commands.AliasTest do use ExUnit.Case, async: true alias GenLSP.Structures.TextEdit alias GenLSP.Structures.WorkspaceEdit alias NextLS.Commands.Alias # @parse_error_code -32_700 describe "alias-refactor" do test "works with single calls" do uri = "my_app.ex" text = ...
00515466e7b3dfaee97e782a011cd8e26280bcfc
2,042
[ 114292472, 124299332 ]
[ "test" ]
defmodule MeasurementTest do alias ElixirBench.Benchmarks.Measurement use ElixirBench.DataCase @attrs %{ "average" => 465.8669101807624, "ips" => 2146.5357984150173, "maximum" => 13092.0, "median" => 452.0, "minimum" => 338.0, "percentiles" => %{"50" => 452.0, "99" => 638.0}, "run_tim...
0051d1d3d4599ca9d3c275cf0ebca58cc95721bb
1,707
[ 63543964, 64819412 ]
[]
%{"cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:rebar, :make], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.0", [hex: :ranch, optional: false]}]}, "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23de...
0051e4e16a987533896496c1843be73b65ac1be0
2,889
[ 933247247 ]
[ "liveview" ]
defmodule SportsEventQuizAppWeb.EventListLive do use SportsEventQuizAppWeb, :live_view alias SportsEventQuizApp.Event def mount(_params, _session, socket) do events = Event.list_events() IO.inspect(events, label: "events list") {:ok, assign(socket, events: events)} end def render(assigns) do ...
0051f958dfd89c782bc95824ff0789d62d996785
2,570
[ 734497735 ]
[ "phoenix" ]
defmodule StockExWeb.Router do use StockExWeb, :router import StockExWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {StockExWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers ...
0051fb1d4faee72d3af50bc70fe1894da4629c06
11,651
[ 771023416 ]
[ "phoenix", "ecto" ]
defmodule Pleroma.Web.TwitterAPI.UtilController do use Pleroma.Web, :controller require Logger alias Pleroma.Activity alias Pleroma.Config alias Pleroma.Emoji alias Pleroma.Healthcheck alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.Auth.WrapperAuthenticator, as: Authe...
00521a7b055318bef2ed2085b5a85e29cffc28f7
2,805
[ 78030894 ]
[ "documented" ]
defmodule ExTwitter.API.Base do @moduledoc """ Provides basic and common functionalities for Twitter API. """ # https://dev.twitter.com/overview/api/response-codes @error_code_rate_limit_exceeded 88 @doc """ Send request to the api.twitter.com server. """ def request(method, path, params \\ []) do ...
0052c151842c083f84beec7efc2e0f06abdce531
2,557
[ 616668801 ]
[]
%{ "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65...
0052d9db6d3de0dc7e3323f22df61c0ef527f701
1,693
[ 798027185, 798482821, 798481890, 798479617, 798507327, 801688240, 808014465, 808360054, 798944439, 797513620, 798481258, 797378329 ]
[ "documented" ]
defmodule Tic do @moduledoc """ Implementing a tic tac toe game. """ defstruct rows: 3, cols: 3, board: nil, turn: :x @doc """ Start a new game, and X goes first """ def new_game() do rows = 3 cols = 3 board = Enum.map(1..(rows * cols), fn _ -> nil end) %Tic{rows: rows, cols: cols, boa...
005332102872b4a47e8b41b1c209cfe05e8a1dd6
2,963
[ 793296541 ]
[ "liveview", "test" ]
defmodule CanvasCombatWeb.DrawLiveTest do use CanvasCombatWeb.ConnCase import Phoenix.LiveViewTest import CanvasCombat.GameFixtures @create_attrs %{} @update_attrs %{} @invalid_attrs %{} defp create_draw(_) do draw = draw_fixture() %{draw: draw} end describe "Index" do setup [:create_d...
00533affdfcade1b55aac7a25cd2d149c78ac606
4,645
[ 424331658 ]
[]
# Task: Completar las funciones loop y consensus para que, # al final de un número de ejecuciones de loop, # todos los hilos tengan el mismo número decidido, # el cual será enviado al hilo principal # (mediante un mensaje en consensus). defmodule Consensus do # Función que crea n hilos. # Cada hilo escogerá un núm...