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
07d5bd8c9d34fa41fa588989a83891914871a4a9
3,263
[ 18029194 ]
[ "documented" ]
defmodule Issues.TableFormatter do import Enum, only: [ each: 2, map: 2, map_join: 3, max: 1 ] @doc """ Takes a list of row data, where each row is a HashDict, and a l headers. Prints a table to STDOUT of the data from each row identified by each header. That is, each header identifies a co and those column...
07d5c4483905abb26445b6166270d23b9c4f8a0f
4,278
[ 218348549 ]
[ "typespec", "documented" ]
defmodule GlassFactoryApi.Vacations do @moduledoc """ Provides functions to get vacations of all or a specific user. """ alias GlassFactoryApi.ApiClient alias GlassFactoryApi.Vacations.Vacation @doc """ Return a tuple with `:ok` atom and an list of vacations. or a tuple with `:error` and a string with...
07d5ee67847ca3cc1d0170826144d9939eeb984e
1,658
[ 303697704 ]
[]
defmodule GSearcherWeb.HomePage.ViewReportPageTest do use GSearcherWeb.FeatureCase @selectors %{ report_summary_card: ".card .card__body h2", report_summary_counter: ".card .card__body h1.card__counter", report_status_span: ".card-report-detail .card__header span", keyword_titles: ".table-search-re...
07d5ff41fa453a405e48c85e0a510c87e040f067
1,681
[ 1010207071 ]
[ "liveview", "phoenix" ]
defmodule TerminalphxWeb.Endpoint do use Phoenix.Endpoint, otp_app: :terminalphx # 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: "_t...
07d657b51f9decff865853eb168d57ad6d7c6e9b
3,181
[ 29019035 ]
[]
%{"alarms": {:git, "git://github.com/chrzaszcz/alarms.git", "24a8bf0f4e09d88075719537aa90bfee52cf4317", [branch: "master"]}, "base16": {:git, "git://github.com/goj/base16.git", "1e9dd28bdbcfb8f4aedf82b9900cfb0f094f137d", [ref: "1e9dd28bdbcfb"]}, "bear": {:git, "git://github.com/boundary/bear.git", "5f998064d178b1b8...
07d68bb9724a7886dd9adfacc2e131c2bafa62cf
1,920
[ 636492552 ]
[ "typespec", "documented" ]
defmodule Exactly.Book do @moduledoc """ Models a lilypond top-level \\book context """ alias Exactly.{Bookpart, Header} defstruct [:bookparts, header: nil, output_name: nil, output_suffix: nil] @type t :: %__MODULE__{ bookparts: [Bookpart.t()], header: Header.t() | nil } d...
07d6a2c92beb72726966ef2bf180de581e8289de
3,226
[ 318617659 ]
[]
defmodule AdventOfCode.Puzzle16 do use AdventOfCode.Puzzle, no: 16 def parse_input do data = get_input() |> Enum.to_list() %{ validation_rules: data |> Enum.slice(0..19) |> Enum.reduce(%{}, fn rule, rules_map -> %{ "rule_name" => rule_name, "...
07d6e72f886f51841faf6d4ecb890a63a2a64c51
6,141
[ 120256782 ]
[ "documented" ]
defmodule Litelist.Factory do @moduledoc """ The home for all factories. """ use ExMachina.Ecto, repo: Litelist.Repo alias Litelist.Auth.Neighbor alias Litelist.Posts.Post alias LitelistWeb.Utils.SharedUtils alias FakerElixir, as: Faker alias Litelist.Moderation.Flag alias Litelist.Discussions.Disc...
07d8202ca733a38b1d9f93dfe6fd57c8732f1c41
3,355
[ 226476902 ]
[ "liveview" ]
defmodule LivebookWeb.ExploreLive do use LivebookWeb, :live_view import LivebookWeb.SessionHelpers import LivebookWeb.UserHelpers alias LivebookWeb.{SidebarHelpers, ExploreHelpers, PageHelpers} alias Livebook.Notebook.Explore @impl true def mount(_params, _session, socket) do [lead_notebook_info | ...
07d84d0afb3ca69c2413b3b0961c7182fbfb7096
2,482
[ 186511989 ]
[ "typespec", "documented" ]
defmodule Dash.Harvest.Filter do @moduledoc "Turns raw API data into something usable" alias Dash.Harvest.{Report, Time} @doc "Cherry pick the report attributes we want" @spec report_keys(Report.t()) :: {:ok, Report.t()} def report_keys(%Report{projects: projects, time_entries: time_entries} = report) do ...
07d8fe4ccb46dd818e12a32224010bfb02dae8fa
1,501
[ 410121215 ]
[ "ecto" ]
defmodule Sig.HR.Payslips.Categories.Category do use Sig.Schema alias Sig.Organizations.Org schema "payslip_categories" do belongs_to :org, Org, primary_key: true field :code, :string field :description, :string field :entry_type, Sig.EntryType field :is_payment_advance, :boolean times...
07d909c154a7728e935fec8030ef7825d067fe47
2,024
[ 608821024 ]
[ "typespec", "documented" ]
defmodule Haystack.Index.Document do @moduledoc """ A module for preparing documents to be stored. """ alias Haystack.{Tokenizer, Transformer} # Types @type t :: %__MODULE__{ ref: String.t(), fields: %{String.t() => list(Tokenizer.Token.t())} } @enforce_keys ~w{ref fields}a...
07d9378901eb47ceb7628ae06c17f0e8af866e37
1,622
[ 778440369 ]
[ "genserver", "liveview" ]
defmodule RubberDuckWeb.ChatsLive.Index do use RubberDuckWeb, :live_view @impl true def mount(_params, _session, socket) do socket = socket |> assign(:messages, []) |> assign(:running, false) {:ok, socket} end @impl true def handle_event("submit", %{"content" => content}, socket...
07d991fe4e9b530864fc239f58c5a6ec99ae17a9
7,800
[ 150137343 ]
[ "test" ]
defmodule InterceptorOnSuccessTest do use ExUnit.Case @process_name :on_success_test_process describe "module with a single function" do test "it intercepts the function after it is successfully called" do {:ok, _pid} = spawn_agent() result = InterceptedOnSuccess1.to_intercept() callback...
07d9e9f642e5b1506bfbd62066b37aff16272099
14,979
[ 319789425 ]
[ "documented" ]
defmodule Krug.FileUtil do @moduledoc """ Utilitary module to handle files and directories. """ alias Krug.StringUtil @doc """ Creates a new directory with name specified. If already exists a directory with this name, only preserve these directory. If exists a file with this name tr...
07da729db8739be7aae3658b28db82679f67492a
2,001
[ 67994946 ]
[ "documented" ]
defmodule StringFormatterUtils do @moduledoc """ Contains various helper methods to avoid duplicating the stuff all over """ @doc """ Transforms a map or a keyword list into a new map where all keys are strings """ def normalize_params(params) do params |> Enum.map(fn {key, val} -> {to_string(k...
07dab6c2bec1fb9ac90318b7cafdd421145c7cb6
17,151
[ 169013084 ]
[ "typespec", "documented" ]
defmodule Scenic.Scrollable.Components do alias Scenic.Graph alias Scenic.Scrollable alias Scenic.Scrollable.ScrollBars alias Scenic.Scrollable.ScrollBar alias Scenic.Primitive alias Scenic.Primitive.SceneRef @moduledoc """ This module contains helper functions for adding scrollable components to, or m...
07dac7962d059737925d86c10bd8daa282245d74
2,776
[ 75336215 ]
[]
defmodule PathFinder do def run(path) do path |> parse |> walk |> Map.get(:history) end def total_distance(history) do {x, y} = hd history (abs x) + (abs y) end def first_repeat(history), do: first_repeat(MapSet.new, Enum.reverse(history)) defp first_repeat(acc, [head|tail]) do ...
07db7933a4511f10fe06ce613d1439834fe50cfa
3,132
[ 466273894 ]
[ "liveview", "ecto" ]
defmodule DovecotWeb.RaceLive.Form do use DovecotWeb, :live_view alias Dovecot.Races alias Dovecot.Races.Race alias Ecto.Changeset @impl true def mount(_params, _session, socket) do {:ok, socket} end @impl true def handle_params(params, _url, socket) do {:noreply, apply_action(socket, socke...
07db7ccb0ebc7bd1f56b4c326ff4c856ffe4a921
1,502
[ 827754735 ]
[ "liveview" ]
defmodule NeverlandWeb.UserForgotPasswordLive do use NeverlandWeb, :live_view alias Neverland.Accounts def render(assigns) do ~H""" <div class="mx-auto max-w-sm"> <.header class="text-center"> 忘记密码了? <:subtitle>别着急,我们会向你的邮箱发送一个密码重置链接</:subtitle> </.header> <.simple_for...
07dbc1418cb838e6567752432c7978ccd10bc820
2,670
[ 293627365 ]
[ "documented", "ecto" ]
defmodule ArenaLiveview.Organizer do @moduledoc """ The Organizer context. """ import Ecto.Query, warn: false alias ArenaLiveview.Repo alias ArenaLiveview.Organizer.Room alias ArenaLiveviewWeb.Presence def list_present(slug) do Presence.list("room:" <> slug) # Check extra metadata needed from...
07dc8f48efcbaeb9a28b0d71acd47bd05863a2c7
3,441
[ 930600936 ]
[ "documented" ]
defmodule TriviaAdvisorWeb.Helpers.CurrencyHelpers do @moduledoc """ Helper functions for formatting currencies across views. """ require Logger @doc """ Formats an amount in cents to a proper currency string using the Money library. Takes the amount in cents and a currency code. ## Examples ie...
07dc904d96f925ad8af41fd827debae18468e723
7,407
[ 257787813 ]
[ "test" ]
defmodule Web.SignIn.EmailTest do use Web.ConnCase, async: true setup do Domain.Config.put_env_override(:outbound_email_adapter_configured?, true) account = Fixtures.Accounts.create_account() provider = Fixtures.Auth.create_email_provider(account: account) actor = Fixtures.Actors.create_actor(acco...
07dd15350bb6ee58b2fae2995b0ba07748b343b8
2,772
[ 829154819 ]
[ "genserver", "documented", "phoenix" ]
defmodule GameServer do use GenServer # API @doc """ Inicia el servidor de juego y genera un número aleatorio. """ def start_link(_) do GenServer.start_link(__MODULE__, :ok, name: __MODULE__) end @doc """ Permite que un jugador se una al servidor de juego. """ def join(player...
07dd3129be57d0ed5e9ee2379d209702f6c1b742
23,154
[ 897655349 ]
[ "typespec", "documented" ]
defmodule AstralDiscord.Interactions.Register do @moduledoc """ Handles /register slash command for creating an account on Astral. """ import Nostrum.Struct.Embed alias Nostrum.Constants.InteractionCallbackType alias Nostrum.Struct.{ApplicationCommand, Interaction} alias Astral.Database.Tables.{Accounts,...
07dd6ae7f74f27b27a3ff455cb3f54047159bdd1
2,678
[ 629520493 ]
[ "typespec" ]
defmodule Solution do @after_compile __MODULE__ def __after_compile__(_, _), do: run() def run() do current_pos = read_coord() read_board() |> find_dirt() |> next_move(current_pos) |> IO.puts() end defp read_coord do IO.read(:line) |> String.trim() |> String.split() |> ...
07dde20ef97fe2b43042f648882561d87d6e8876
1,908
[ 363419449, 123528600 ]
[ "test" ]
defmodule OMG.Eth.Encoding.ContractConstructorTest do use ExUnit.Case, async: true alias OMG.Eth.Encoding.ContractConstructor @moduletag :common doctest ContractConstructor describe "extract_params/1" do test "returns a tuple with empty lists when given an empty list" do encoded = ContractConstr...
07dde24ab6d7d4a2ea44f736c9e3fadf10842a82
1,923
[ 317792122 ]
[ "typespec", "documented" ]
defmodule Day02 do @moduledoc """ Documentation for `Day02`. """ @signs ["R", "P", "S"] @sign_translation %{ "A" => "R", "X" => "R", "B" => "P", "Y" => "P", "C" => "S", "Z" => "S" } @sign_point %{ "R" => 1, "P" => 2, "S" => 3 } @beats %{ "R" => "S", "S" ...
07dde44eff007e6283625eb52adda879dfddd3f3
2,319
[ 225945165 ]
[ "documented" ]
defmodule Identicon do @moduledoc """ Documentation for Identicon. """ @doc """ Main function to generate picture. ## Examples iex> Identicon.main("Vladimir Krylov") :world """ def main(input) do input |> hash_input |> pick_color |> build_grid |> filter_odd_squares ...
07ddf7cb0ba6ae22dd8acffb94712372deec2a77
4,524
[ 249746763 ]
[ "documented" ]
defmodule Kandis.Payment do @moduledoc false alias Kandis.PaymentAttempt alias Kandis.PaymentEvent @callback create_payment_attempt({binary(), binary()}, binary(), map(), map()) :: Kandis.PaymentAttempt.t() @callback update_payment_attempt_if_needed( Kandis.PaymentAttempt.t(), ...
07de000cc5c3837de088678affa8057679f70bba
4,441
[ 607205597 ]
[ "phoenix" ]
defmodule InstacampWeb.Router do use InstacampWeb, :router import InstacampWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {InstacampWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_head...
07de03d1c6bca484e5e1ff36984bd2a601223e52
1,961
[ 145496015 ]
[ "typespec", "documented" ]
defmodule TtrCore.Players.DB do @moduledoc false alias TtrCore.Players.User @type user_id :: binary @type username() :: String.t @type password() :: String.t # API @spec start_link() :: {:ok, pid()} def start_link do Agent.start_link(fn -> Map.new end, name: __MODULE__) end @spec child_spec...
07de0a849d5403e08b29782815ec3199e0131ab9
3,122
[ 89146650 ]
[ "typespec", "documented" ]
defmodule HorasTrabalhadasElixir.Business do @moduledoc """ Módulo com as Regras de Negócio da Aplicação. """ alias HorasTrabalhadasElixir.Utils.TimeUtils @space_delimiters [" ", "\t"] @doc """ Realiza o processamento do arquivo de entrada `filepath`. """ @spec proccess_file(String.t) :: [[String...
07defeef29b7485e2af487bd616d7b091bc59ab2
15,025
[ 967831208 ]
[ "test", "documented" ]
defmodule WebsockexNova.Integration.ConfigPrecedenceAdvancedTest do @moduledoc """ Advanced configuration precedence tests covering complex settings like reconnection policies, rate limiting, auth, error handling, etc. """ use ExUnit.Case, async: true alias WebsockexNova.Defaults.DefaultAuthHandler alia...
07df833e6b2e77fb6b37c792c282c4b24f66ffff
4,521
[ 1014340631 ]
[ "documented" ]
defmodule Thundereye.Monitor do @moduledoc """ Thunder Monitor - comprehensive system monitoring and metrics tracking. Monitors performance, security, resource usage, and health across all Thunder aspects and components. """ use Ash.Resource, domain: Thundereye.Domain, data_layer: AshSqlite.Da...
07dfebbb6375870ca3dce2ade23611d434fd8c35
2,816
[ 121399547 ]
[ "genserver" ]
defmodule TwitterClient do use GenServer def start(opts) do GenServer.start(__MODULE__, opts) end def register(pid) do GenServer.call(pid, {:register}) end def handle_call({:register}, _from, state) do servernode = Map.get(state, :servernode) userid = Map.get(state, :userid) {_status,...
07e01a691564d460a058aaac519ea799c0f52e4f
2,719
[ 138208143 ]
[ "genserver" ]
defmodule Master do use GenServer require Logger alias Events.{BalanceEvent, CreateEvent, WithdrawEvent, DepositEvent, RegisterEvent} defmodule MasterState do defstruct [:balances, :slaves] end def master_name(), do: :master def balance(name), do: GenServer.call(master_name(), %BalanceEvent{name:...
07e02ef54391f043f12eb29623019d1efbdd9b69
2,106
[ 616665524 ]
[ "phoenix" ]
defmodule LearnkzWeb.Router do use LearnkzWeb, :router import LearnkzWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {LearnkzWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plu...
07e0fa429e937eeff0443c8f4882a09695e3e6bd
3,960
[ 122058751 ]
[ "documented" ]
defmodule Learn.TestHelpers do @moduledoc false alias Learn.{ NovosTestes, Relacionamentos, Repo, Thing } @button2 """ 111=default\n61=default\n58=default\n145=default\n118=default\n49=default\n 10=default\n137=default\n92=default\n143=default\n37=default\n115=default\n 78=default\n79=defa...
07e144389d648f40b0e6ed9c5a6a7f92bd5364e0
6,006
[ 131530086, 133927323, 135370449, 138562706, 99375517, 136631125, 140890391, 129655759, 136191275, 141999411, 139498406, 136571370, 131906103, 137103031, 131931201, 128484901, 133340028, 138584540, 130879442 ]
[ "macro", "documented" ]
defmodule Phoenix.HTML.Link do @moduledoc """ Conveniences for working with links and URLs in HTML. """ import Phoenix.HTML.Tag @doc """ Generates a link to the given URL. ## Examples link("hello", to: "/world") #=> <a href="/world">hello</a> link("<hello>", to: "/world") #=> ...
07e27c8b276758170110af4bd48ee303af4de0b0
2,966
[ 759562626, 756087399 ]
[ "test", "phoenix" ]
defmodule BackendFightWeb.TransactionControllerTest do use BackendFightWeb.ConnCase import BackendFight.BankFixtures setup %{conn: conn} do {:ok, conn: put_req_header(conn, "accept", "application/json")} end describe "create transaction" do test "renders transaction when data is valid", %{conn: con...
07e294c443172331bfa78273eff80f7979e1a31f
1,597
[ 123749125 ]
[ "documented" ]
defmodule ExBitcoinTask.GenerateRpc.ListCmd do @moduledoc """ Process document for "bitcoin-cli help". """ require Logger @regex ~r/==\s*(?<name>\w+)\s*==/ @docs %{ "Blockchain" => [ns: :Core, desc: "General blockchain RPC"], "Control" => [desc: "Control how bitcoin node works"], "Generating" ...
07e2a852b7e6a1e970d7ace919b793e396a20e66
1,642
[ 125713374 ]
[ "macro", "documented", "phoenix" ]
defmodule TimeTrackerWeb 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 TimeTrackerWeb, :controller use TimeTrackerWeb, :view The definitions below will be executed for every view, ...
07e2afd6bb272166554171f8eb436423d1dcb21b
2,709
[ 65019938 ]
[ "test" ]
defmodule BSONEach.EachReadTest do use ExUnit.Case, async: true import Test.Support.DocumentAssertions doctest BSONEach @fixtures [ notfound: "test/fixtures/x.bson", empty: "test/fixtures/0.bson", single: "test/fixtures/1.bson", three: "test/fixtures/3.bson", many: "test/fixtures/30.bson", ...
07e2faa6bac726e08082473c0ca6fe971416dfb5
4,145
[ 329821832 ]
[ "test" ]
defmodule AlphameticsTest do use ExUnit.Case # test "puzzle with three letters" do puzzle = "I + BB == ILL" solution = %{ ?I => 1, ?B => 9, ?L => 0 } assert Alphametics.solve(puzzle) == solution end test "solution must have unique value for each letter" do puzzle = "...
07e3467c04a4d89b156d2ecd09f8327a71d9e437
1,537
[ 192407200 ]
[ "documented", "ecto" ]
defmodule Andi.InputSchemas.MessageErrors do @moduledoc false alias Andi.Repo alias Ecto.Changeset alias Andi.InputSchemas.MessageError use Properties, otp_app: :andi import Ecto.Query, only: [from: 1, from: 2] require Logger def get_all() do query = from(messageError in MessageError) Repo....
07e3e3dd13b1a4817f5033f779ef68b2f847e0fc
3,738
[ 945131865 ]
[ "test" ]
defmodule BubblegumNif.MerkleTreeTest do use ExUnit.Case use PropCheck @moduletag :property property "merkle tree properties" do forall {leaves, index} <- {list(binary(32)), non_neg_integer()} do tree = create_test_tree(leaves) # Property 1: Root is always 32 bytes root = get_root...
07e3ed91ca0f8303082c3b01245a97b83740e4be
2,259
[ 122058751 ]
[ "genserver" ]
defmodule SendNumber.Server.MainServer do use GenServer def start_link(arg) do server = GenServer.start_link(__MODULE__, arg, name: {:global, MainServer}) case server do {:ok, pid} -> {:ok, pid} {:error, {:already_started, pid}} -> Process.link(pid) {:ok, pid} end ...
07e4ac914d0ec04ff3b89b2ac6d28737d28d3600
1,530
[ 738602073 ]
[]
[ version: "0.6.4", # Can also be set/reset with `--autocorrect`/`--no-autocorrect`. autocorrect: true, # With "--dry" no changes will be written to the files. # Can also be set/reset with `--dry`/`--no-dry`. # If dry is true then verbose is also active. dry: false, # Can also be set/reset with `--verbo...
07e4b75b597a4393121c69f0b6695973dc66d1c8
9,824
[ 517748616, 25846077 ]
[ "genserver", "typespec", "documented" ]
defmodule Mongo.Topology do @moduledoc false use GenServer alias Mongo.Events.{ ServerDescriptionChangedEvent, ServerOpeningEvent, ServerClosedEvent, TopologyDescriptionChangedEvent, TopologyOpeningEvent, TopologyClosedEvent } alias Mongo.TopologyDescription alias Mongo.ServerDesc...
07e512b3858da93dc8c9d282b636b330c63e5dcb
3,090
[ 143164828, 91143120 ]
[ "typespec", "documented" ]
defmodule OneBackupRestoreWeb.FlexBar.Tab.GenCert do @moduledoc """ Backup Certificates Flex Tab. """ use OneChatWeb.FlexBar.Helpers use OneLogger alias InfinityOne.{TabBar.Tab} alias InfinityOne.{TabBar} alias OneBackupRestoreWeb.FlexBarView alias OneBackupRestore.Backup alias OneUiFlexTab.FlexTab...
07e51cf4d34f4f6267b2efc71289173e042b8286
7,940
[ 52797857 ]
[ "macro", "documented" ]
defmodule Cloak.DataSource.Driver.SQL.AnalystTables do @moduledoc "Common implementation of analyst tables functionality for SQL based drivers." alias Cloak.DataSource.{Driver, SqlBuilder} alias __MODULE__ @doc "Returns the list of analyst tables." @callback analyst_tables(Driver.connection()) :: [String.t(...
07e51fe3477d95e797f07ed96261ad9a7f7f6fe1
2,366
[ 67368302 ]
[ "phoenix" ]
defmodule LeanCoffee.MeetupController do use LeanCoffee.Web, :controller alias LeanCoffee.Meetup def action(conn, _) do apply(__MODULE__, action_name(conn), [conn, conn.params, conn.assigns.current_user]) end def index(conn, params, user) do page = user_meetups(user) |> order_by(desc: :...
07e524135bead940c79851ed707ea4d52aa25a16
2,924
[ 583406231 ]
[ "ecto" ]
defmodule Adapters.Mutations.Users do import Ecto.Query, warn: false alias Adapters.Repo alias Schemas.User alias Schemas.View alias Adapters.Queries.Users, as: Query def like_profile(user_id, target_id, liked) do fav = from(v in View, where: v.viewerId == ^target_id and v.targetId == ^u...
07e59bda423cac08f62e792efd21f9329e4eb2b1
6,590
[ 147609128 ]
[ "test" ]
defmodule Links.TestRepo do use ExUnit.Case alias Links.{Repo, Link, User} setup do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo) seed_tables() on_exit(fn -> Repo.delete_all(Link) Repo.delete_all(User) end) end test "find by URL" do result = Link.find_by_url("http://localho...
07e5b045612fc8cea03a780a19af11919fa738b5
1,700
[ 395965930 ]
[ "typespec", "documented" ]
defmodule AllYourBase do @doc """ Given a number in input base, represented as a sequence of digits, converts it to output base, or returns an error tuple if either of the bases are less than 2 """ @spec convert(list, integer, integer) :: {:ok, list} | {:error, String.t()} def convert(digits, input_base, o...
07e5be32dedbe80dc217262f100dd72f6b206153
2,229
[ 931652055 ]
[ "documented" ]
defmodule Blog.Game.TicTacToeBoard do @moduledoc """ Module for handling Tic-Tac-Toe board operations. Provides functions for board initialization, marking positions, and checking game status. """ @board_size 3 @doc """ Initialize an empty 3x3 board. """ def initialize do for _row <- 1..@board_s...
07e5cb3211941b96d923cc60746854da467f3b60
1,590
[ 254763900 ]
[ "phoenix" ]
defmodule Covid19Web.DataController do use Covid19Web, :controller alias Covid19.Data require Logger action_fallback Covid19Web.FallbackController def all_states(conn, _params) do states = Data.list_states() render(conn, "state_index.json", states: states) end def all_counties(conn, _params) ...
07e5f3ff2187601f74499f148a99702618257a38
1,644
[ 894477316 ]
[ "phoenix" ]
defmodule PentoWeb.UserConfirmationController do use PentoWeb, :controller alias Pento.Accounts def new(conn, _params) do render(conn, :new) end def create(conn, %{"user" => %{"email" => email}}) do if user = Accounts.get_user_by_email(email) do Accounts.deliver_user_confirmation_instructions...
07e637b7ad78ec6cb5984c8c68f28556e8118881
3,865
[ 327711808 ]
[ "typespec", "documented" ]
defmodule Livebook.ZTA do @moduledoc """ Enable zero-trust authentication within your Plug/Phoenix application. The following ZTA providers are supported: * Livebook.ZTA.Cloudflare * Livebook.ZTA.GoogleIAP * Livebook.ZTA.Tailscale ...
07e6d6cd760cee07e59213f2b0f1cfc8939e260b
11,086
[ 363032271 ]
[]
%{ "base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, "castore": {:hex, :castore, "0.1.10", "b01a007416a0ae4188...
07e6e6475955fa166a7a95b2bdfa712b2987853e
11,684
[ 497769481, 478522297 ]
[ "typespec", "documented" ]
defmodule IEx.State do @moduledoc false # This state is exchanged between IEx.Server and # IEx.Evaluator which is why it is a struct. defstruct parser_state: "", counter: 1, prefix: "iex", on_eof: :stop_evaluator, evaluator_options: [], previous_state:...
07e6ed9295b6a6b8a93c9d62c1b0e5755472e106
4,582
[ 153329715 ]
[ "test", "ecto" ]
defmodule PredictionAnalyzer.Predictions.DownloadTest do use ExUnit.Case, async: false import ExUnit.CaptureLog import Ecto.Query, only: [from: 2] import Test.Support.Env alias PredictionAnalyzer.Predictions.Download alias PredictionAnalyzer.Predictions.Prediction alias PredictionAnalyzer.Predictions.Dow...
07e7203595f2bf5debeff301363202575126310c
3,086
[ 91369511 ]
[]
defmodule Resampler.Bucket do alias Resampler.Statistics def lazy(ts, width, opts) do case Keyword.fetch(opts, :start) do {:ok, start} -> do_lazy(ts, width, start, opts) _ -> case Enum.take(ts, 1) do [{start, _}] -> do_lazy(ts, width, start, opts) _...
07e732850cdfe4e41359aa9af7d1b70448e561d4
4,118
[ 243353432 ]
[]
defmodule PostApp.Response do def parse_changeset(errors) do Poison.encode!(%{ status: "error", errors: Enum.map(errors, fn err -> err_name = err |> elem(0) %{ err_name => elem(elem(err, 1), 0) } end) }) end def error(code) do htt...
07e73d807663accec5d44f9e2ea314932c85ce1e
2,430
[ 617506807, 772552983, 708454087, 612311792 ]
[]
defmodule Featureflagservice.MixProject do use Mix.Project def project do [ app: :featureflagservice, version: "0.1.0", elixir: "~> 1.12", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: a...
07e7597a9febad040567106fb7ce99775db47b7a
3,644
[ 100649989 ]
[ "macro", "test" ]
defmodule Cldr.Unit.Conversion.Test do use ExUnit.Case, async: true alias Cldr.Unit.Test.ConversionData @unsupported_unit [155] for t <- ConversionData.conversions(), t.line not in @unsupported_unit do test "##{t.line} that #{t.from} is convertible to #{t.to}" do {:ok, from} = Cldr.Unit.BaseUnit.ca...
07e7c6d891b3037f6abee24dd42168a403e89493
3,236
[ 230558100 ]
[ "test" ]
defmodule ProteinTranslationTest do use ExUnit.Case describe "of_codon" do # @tag :pending test "AUG translates to methionine" do assert ProteinTranslation.of_codon("AUG") == {:ok, "Methionine"} end test "identifies Phenylalanine codons" do assert ProteinTranslation.of_codon("UUU") == ...
07e83001e019ec3f655d044fe9628c1c1d43d487
8,751
[ 455872535 ]
[ "genserver", "typespec", "supervisor", "documented" ]
defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do @moduledoc """ Supervises the `Indexer.BlockerFetcher.Catchup` with exponential backoff for restarts. """ # NOT a `Supervisor` because of the `Task` restart strategies are custom. use GenServer require Logger alias Indexer.{Block, BoundInterval...
07e8bf3c9217c8af1637073149628fd6b0af791c
1,905
[ 268193842 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule GigMemsV2Web 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 GigMemsV2Web, :controller use GigMemsV2Web, :view The definitions below will be executed for every view, contro...
07e910aff22ceaf7987f995191a3058b2d78259b
7,470
[ 347285600 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hex...
07e9b51bffbb399ebcc7ad31036ea9c538a70669
3,850
[ 185043559 ]
[ "typespec", "test", "genserver", "macro", "documented" ]
defmodule Fixex do @moduledoc """ Specification of the Fixex adapter API implemented by various custom implementations """ use GenServer defmacro __using__(opts) do quote do use ExUnit.Case require ExUnit.Callbacks require Logger import Fixex @adapter_name Keyword.get(unq...
07e9f8255539e02ccd7a6efda3e023787e42120d
1,703
[ 348451602 ]
[ "typespec", "documented" ]
defmodule Matrix do defstruct matrix: nil @doc """ Convert an `input` string, with rows separated by newlines and values separated by single spaces, into a `Matrix` struct. """ @spec from_string(input :: String.t()) :: %Matrix{} def from_string(input) do matrix = input |> String.split(~r{...
07ea069845863df67dba3805587d7b7341b0f5fe
1,723
[ 329643665 ]
[ "phoenix" ]
defmodule AnneWeb.Router do use AnneWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {AnneWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug AnneWeb.Plugs.Locale, "en" end ...
07ea28acff07ec6a639a824d28f90784001d34be
1,642
[ 216672307 ]
[ "macro", "documented", "phoenix" ]
defmodule TogetherWeb 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 TogetherWeb, :controller use TogetherWeb, :view The definitions below will be executed for every view, controlle...
07ea7a54e832b1b84e4ddbd66620d51b146cf6a7
3,851
[ 259925114 ]
[ "liveview", "test" ]
defmodule MasterBrainWeb.CommentLiveTest do use MasterBrainWeb.ConnCase import Phoenix.LiveViewTest alias MasterBrain.Timeline @create_attrs %{body: "some body", reaction: "some reaction", username: "some username"} @update_attrs %{body: "some updated body", reaction: "some updated reaction", username: "so...
07eae1481d6ca48cb7b1eb0b7a94afa61c9b7284
4,551
[ 562957518, 401949847, 858623909, 94545160, 130756758, 22305306 ]
[ "documented" ]
defmodule MyApp.DateTimeTokenizers.Humanized do @moduledoc """ See https://hexdocs.pm/timex/custom-parsers.html for more context. This custom tokenizer accepts format strings containing the following tokens: - `{day}` - The phonetic name of the ordinal day of the month, i.e. third - `{month}` - The full...
07ec432759a25e66dafbdb0cc25e47c152603914
1,799
[ 949671329 ]
[ "liveview" ]
defmodule PentoWeb.WrongLive do use PentoWeb, :live_view def mount(_params, session, socket) do # this code will replaced by on_mount later on in this chapter! {:ok, assign(socket, score: 0, message: "Make a guess:", time: time(), answer: 1..10|>Enum.random(), session_id: session["live_socket_id"])} ...
07ecbec7f2f927360394b389ddecb970cb6c33fd
1,637
[ 97859813 ]
[ "genserver" ]
defmodule OpenWeatherMap.Worker do use GenServer def start_link(opts \\ []) do GenServer.start(__MODULE__, :ok, opts) end def init(:ok) do {:ok, %{}} end def get_temparature(pid, location) do GenServer.call(pid, {:location, location}) end def handle_call({:loc...
07ecf014eb26e367e32e578793d2a3381b757318
1,630
[ 218889900 ]
[ "macro", "documented", "phoenix" ]
defmodule PairvizWeb 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 PairvizWeb, :controller use PairvizWeb, :view The definitions below will be executed for every view, controller, ...
07ecf7e1da4c9ba265278a9cd544db53bed2a3ea
2,766
[ 392760102 ]
[ "test", "phoenix" ]
defmodule ClientManagementWeb.ClientControllerTest do use ClientManagementWeb.ConnCase alias ClientManagement.Management alias ClientManagement.Management.Client @create_attrs %{ description: "some description", title: "some title" } @update_attrs %{ description: "some updated description", ...
07ecff3c717574d2c46f5e74012caf9298ede832
6,264
[ 246593441 ]
[]
defmodule Covenant.LoanProcessor do alias Covenant.Utils.CSVParser alias Covenant.{Bank, Loan, Facility} @file_path_base "#{File.cwd!()}/reference_data/large" @banks_file_path "#{@file_path_base}/banks.csv" @covenants_file_path "#{@file_path_base}/covenants.csv" @facilities_file_path "#{@file_path_base}/f...
07ed0c974d99804340ae0cd027be46d7f36601a1
9,287
[ 810146441 ]
[ "documented" ]
defmodule ChinaAdminDivisions.Gen.Lv4xg.M2101 do @moduledoc false def name("210181209000"), do: "于家窝堡乡" def name("210181207000"), do: "姚堡乡" def name("210181206000"), do: "卢家屯乡" def name("210181205000"), do: "红旗乡" def name("210181120000"), do: "新农村镇" def name("210181119000"), do: "金五台子镇" def name("21018...
07ed14a3e1f1d09ad60c6b34fe04b310de0c61cc
1,512
[ 327738787 ]
[]
defmodule Solution do def filter_by(input, at, fun) when length(input) < 2 do hd(input) |> Enum.reverse() |> decimal() end def filter_by(input, at, fun) do grouped_by = input |> Enum.group_by(&Enum.at(&1, at)) input = fun.(grouped_by) filter_by(input, at + 1, fun) end de...
07ed2d0727dc2bff2cb9ba10ac350ee1094f5549
3,357
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3FormParameter do @moduledoc """ Represents a form parameter. ## Attributes * `advancedSettings` (*type:* `GoogleApi.Dialogflow.V3.Model.GoogleCloudDialogflowCxV3AdvancedSettings.t`, *default:* `nil`) - Hierarchical advanced settings for this p...
07edf2401bfbc0b4b8f62ced3e55feb5c3b82707
1,822
[ 118387032 ]
[ "documented" ]
defmodule TwscClient do @moduledoc """ Client for accessing reservations, and eventually check avilability and make reservations. """ require Logger @http_client Application.get_env(:twsc_client, :http_client) || TwscClient.HttpClient @default_fleet Application.get_env(:twsc_client, :default_fleet) || "Si...
07ee338fb765b4de50430c4a102aabe1595e9b03
5,162
[ 205244286 ]
[ "genserver", "test" ]
defmodule StateServerTest.Callbacks.HandleCallTest do use ExUnit.Case, async: true defmodule Instrumented do use StateServer, [start: [tr: :end], end: []] def start_link(fun), do: StateServer.start_link(__MODULE__, fun) @impl true def init(fun), do: {:ok, fun} def state(srv), do: StateServe...
07ee8d8aaa3615401c54889bfd4ece6344f9ae7e
2,183
[ 986089801 ]
[]
# 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 :price_dashboard, ecto_repos: [PriceDashboar...
07ee8ef417cc47c0f93b129cff9a30933d1fb665
3,276
[ 709515496 ]
[ "genserver" ]
defmodule SyncThing.Core.Connection do use GenServer, restart: :temporary alias SyncThing.BEP.Message alias SyncThing.Core.Folder require Logger def start_link(socket) do GenServer.start_link(__MODULE__, socket) end defstruct([:socket, :remote_device_id, cluster_received: false, buffer: <<>>]) ...
07ef54a50b517df9f7329c29b824e78949f1b9f8
1,587
[ 159571344 ]
[ "documented" ]
defmodule GeoPartition.Output do @moduledoc """ Output formatting for the result of a partitioning """ def format(list, :multipolygon) do coords = Enum.map(list, &(&1.coordinates)) %Geo.MultiPolygon{coordinates: coords} end def format(list, :multipolygon_json) do format(list, :multipolygon) ...
07ef694d065906ed39f901bbfcaf7d3b3cff1a82
2,711
[ 101639674 ]
[ "typespec", "documented" ]
defmodule ExInsights.Telemetry.ExceptionTelemetry do @moduledoc """ Telemetry about the exception thrown by the application """ # see the following resources for details # https://github.com/microsoft/ApplicationInsights-node.js/blob/2855952b7348b407f370bef4a10af006425f6508/Library/EnvelopeFactory.ts#L...
07efa13d2f9569406fa96cb7f5afd8486b2bcb0c
3,196
[ 308447825 ]
[ "genserver", "liveview", "phoenix" ]
defmodule PhxWsCliWeb.PageLive do use Phoenix.LiveView, layout: {PhxWsCliWeb.LayoutView, "live.html"}, container: {:div, class: "h-screen"} use PhxWsCliWeb, :view_helpers alias Phoenix.PubSub alias PhxWsCli.SocketCli alias Phoenix.Channels.GenSocketClient @impl true def mount(_params, _session,...
07efbb0fea3c70ce1c77d6921448ab2af1e2020f
3,246
[ 760045532 ]
[]
# distributed algorithms, n.dulay, 14 jan 2024 # coursework, raft consensus, v2 defmodule ClientRequest do # Handles client request and sends entries to all followers def handle_client_request(leader, request) do # Check if client request has been processed by leader request_status = check_request_status...
07f018af381a5b1c87b172b1755dfaeacff6d586
1,887
[ 80299082 ]
[ "macro", "test" ]
defmodule Tracer do def dump_args(args) do args |> Enum.map(&inspect/1) |> Enum.join(", ") end def dump_defn(name, args), do: "#{name}(#{dump_args(args)})" defmacro def(definition = {:when, [{name, _, args}, _guard]}, do: content), do: traced_def(definition, name, args, content) defmacro...
07f028b6dee32bf2d3e7457c20bb7bf7118ab613
2,118
[ 90559172 ]
[ "test" ]
defmodule WebApi.AccountControllerTest do use WebApi.ConnCase alias WebApi.Account @valid_attrs %{name: "some content"} @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 co...
07f03a110d88aee87ed23289fd2989d84f989677
3,758
[ 195772405 ]
[ "documented", "ecto" ]
defmodule Bookclub.Messages do @moduledoc """ The Messages context. """ import Ecto.Query, warn: false alias Bookclub.Repo alias Bookclub.Messages.Chat @topic inspect(__MODULE__) # def subscribe do # Phoenix.PubSub.subscribe(Bookclub.PubSub, @topic) # end def get_topic(book_id) do @top...
07f07f8ab45643d3da5e2962d7cc393930ca6891
2,445
[ 807904878, 887377354 ]
[]
defmodule Pleroma.Web.ActivityPub.MRF.AntiMentionSpamPolicy do alias Pleroma.Config alias Pleroma.User require Pleroma.Constants @behaviour Pleroma.Web.ActivityPub.MRF.Policy defp user_has_posted?(%User{} = u), do: u.note_count > 0 defp user_has_age?(%User{} = u) do user_age_limit = Config.get([:mrf_...
07f0aa22fc2fb4e1f40ebb2dde31c4a2a84059e0
2,291
[ 173425915 ]
[ "phoenix" ]
defmodule VocialWeb.SessionController do use VocialWeb, :controller alias Vocial.Accounts plug Ueberauth def new(conn, _) do render(conn, "new.html") end def delete(conn, _) do conn |> delete_session(:user) |> put_flash(:info, "Logged out successfully!") |> redirect(to: "/") e...
07f0fb314610583d21f83f691e044faedf6c767c
2,783
[ 805616069, 1008214681, 1010774883 ]
[ "genserver", "liveview", "documented" ]
defmodule ControlServerWeb.Live.StatefulSetShow do @moduledoc false use ControlServerWeb, {:live_view, layout: :sidebar} import CommonCore.Resources.FieldAccessors import ControlServerWeb.PodsTable import ControlServerWeb.ResourceComponents alias EventCenter.KubeState, as: KubeEventCenter alias KubeServ...
07f117a4a5b1bab0b55a1f7cff60e2371e48a70b
1,901
[ 67804760 ]
[ "test" ]
defmodule PhoenixSocial.Integration.Wall.CommentLiveUpdateSpec do use ESpec.Phoenix.Extend, :integration import PhoenixSocial.Integration.Steps.Post let! :user, do: insert(:user) let! :friend, do: insert(:user) let! :post, do: insert(:post, user: friend, author: friend) let! :comment, do: insert(:comment, ...