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
ff9af8b50e78b741b8868fd89703b19deb8ccf85
1,661
[ 228236830 ]
[ "documented" ]
defmodule Day6 do @moduledoc false import IEx def prepare_structure(lines) do lines |> Enum.map(fn x -> String.split(x, ")") end) |> Enum.group_by(fn [id, _] -> id end, fn [_, destinations] -> destinations end) end def mark(structure) do mark(structure, "COM", nil, 0) end def mark(struc...
ff9b1d82f7fcd078835837c6dd4a4036b73f48c3
4,352
[ 72472891 ]
[]
defmodule TM.Mercury.Reader.Config do use TM.Mercury.Utils.Enum, # Key tag buffer records off of antenna ID as well as EPC; # i.e., keep separate records for the same EPC read on different antennas # 0: Disable -- Different antenna overwrites previous record. # 1: Enable -- Different Antenna creat...
ff9c1b83813df6b9fe23966b25f986f4af6da3fc
1,586
[ 823244037, 847838755 ]
[ "liveview", "phoenix" ]
defmodule CounterByMyselfWeb.Endpoint do use Phoenix.Endpoint, otp_app: :counter_by_myself # 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, ...
ff9c840fc641bab6f2d779e5fd7e292761ce60f9
1,816
[ 183024922 ]
[ "phoenix", "ecto" ]
defmodule TopRoleWeb.SheetController do use TopRoleWeb, :controller alias TopRole.Character alias TopRole.Character.Sheet def index(conn, _params) do character_sheets = Character.list_character_sheets() render(conn, "index.html", character_sheets: character_sheets) end def new(conn, _params) do ...
ff9cd20f4d04003d4e47432a0d61ddd58c716665
1,613
[ 423144873 ]
[ "test" ]
defmodule Elasticlunr.TokenizerTest do use ExUnit.Case alias Elasticlunr.{Token, Tokenizer} describe "tokenizing string" do test "splits to list of tokens" do str = "the man came home" tokenized_str = [ Token.new("the", %{start: 0, end: 3}), Token.new("man", %{start: 4, end: 3})...
ff9d13eecb053ee7333c21cd9d3386f3878e591f
1,629
[ 286896789 ]
[ "test" ]
defmodule ExMonTest do use ExUnit.Case import ExUnit.CaptureIO alias ExMon.Player describe "create_player/4" do test "returns a player" do expected_response = %Player{ life: 100, moves: %{move_avg: :punch, move_heal: :heal, move_rnd: :kick}, name: "Horla" } assert...
ff9d98e86762e4863b1182b9825829ba874c56b9
4,398
[ 333239824 ]
[ "typespec", "documented" ]
defmodule MscmpSystLimiter.Impl.RateLimiter do @moduledoc false alias MscmpSystLimiter.Types require Logger @spec get_counter_name(Types.counter_type(), Types.counter_id()) :: Types.counter_name() def get_counter_name(counter_type, counter_id), do: Atom.to_string(counter_type) <> "_" <> counter_id @...
ff9db27554043e37410fc07a31e0a1a3e16692c7
5,148
[ 195417708 ]
[ "test" ]
defmodule TicketsystemWeb.Resolvers.AccountsMutationTest do use TicketsystemWeb.ConnCase, async: true use Plug.Test import Ticketsystem.AbsintheHelpers alias Ticketsystem.Accounts alias TicketsystemWeb.Schema describe "Accounts resolver mutations" do setup do %{ user: insert(:user_with_...
ff9e68e61873dbaa73d0729fee93e9e411214f74
7,295
[ 933514757 ]
[ "test", "documented" ]
defmodule ExESDB.ComprehensiveVersioningTest do @moduledoc """ Comprehensive test to verify all stream versioning operations work correctly after the 0-based simplification """ use ExUnit.Case, async: true alias ExESDB.StreamsHelper alias ExESDB.GatewayWorker describe "Stream versioning operations...
ff9e72faa4fcdba8a9c565e8b856856223856178
3,796
[ 183218490 ]
[ "phoenix" ]
defmodule AeChannelInterfaceWeb.ConnectController do use AeChannelInterfaceWeb, :controller require AeChannelInterfaceWeb.SocketConnectorChannel alias AeChannelInterfaceWeb.SocketConnectorChannel, as: SocketConnectorChannel require Logger require SessionHolderHelper @ae_url Application.get_env(:ae_socket_...
ff9e97f545441da01cc32363493e607554a1e5c7
1,987
[ 44746436 ]
[]
defmodule Familiada.Mixfile do use Mix.Project def project do [app: :familiada, version: "0.0.1", elixir: "~> 1.0", elixirc_paths: elixirc_paths(Mix.env), compilers: [:phoenix] ++ Mix.compilers, build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, aliases: ali...
ff9fdc58bb399ad3f982be5817302eed45ca8b84
6,271
[ 578860487 ]
[ "typespec", "documented" ]
defmodule GitHub.App.Permissions do @moduledoc """ Provides struct and type for a App.Permissions """ use GitHub.Encoder @type t :: %__MODULE__{ __info__: map, actions: String.t() | nil, administration: String.t() | nil, checks: String.t() | nil, codespaces: ...
ff9ff46788c5dc164411856733c356b8c7b6d904
4,357
[ 550796194 ]
[ "documented" ]
defmodule BorutaGateway.Logger do @moduledoc false require Logger def start do handlers = [ { :boruta_gateway_server, [:boruta_gateway, :endpoint, :stop], &__MODULE__.boruta_gateway_server_handler/4 }, { :boruta_gateway_requests, [:boruta_gateway, :r...
ffa15df6723ad66a5bd158cef9ad1f4eead883b7
1,900
[ 248702688 ]
[ "documented" ]
defmodule ServerWeb.GraphQL.Schemas.Skills.UniversityTypes do @moduledoc """ The University GraphQL interface. """ use Absinthe.Schema.Notation alias ServerWeb.GraphQL.Resolvers.Skills.UniversityResolver @desc "The University on the site" object :university, description: "University" do field :id, ...
ffa166fb9b716c9ebb1999c8788c3c8eef9b51af
2,926
[ 42716040 ]
[ "genserver" ]
defmodule SummerSinger.Player do use GenServer alias SummerSinger.{Track, Repo, Queue, BackendPlayer} def start_link do inital_state = %{ playback: false, start_time: nil, paused_duration: 0, volume: 100, } GenServer.start_link(__MODULE__, inital_state, name: __MODULE__) end...
ffa2bc2e801898faab74c91a6c661ad07066b9a7
4,457
[ 898776424 ]
[ "typespec", "documented" ]
defmodule Aletopelta.Year2021.Day11 do @moduledoc """ Day 11 of Year 2021 """ defmodule Common do @moduledoc """ Common part for Day 11 """ @type point() :: {integer(), integer()} @type octopus() :: %{point() => integer()} @spec parse_input([binary()]) :: octopus() def parse_input(i...
ffa2dba76c9807994d0305532a7c3c08a95e0a4b
1,857
[ 87568030 ]
[ "supervisor", "documented" ]
defmodule PCAPredict.Client do @moduledoc """ An HTTP client for PCAPredict. """ # Build the client on top of HTTPoison use Application use HTTPoison.Base alias PCAPredict.{Error, AddressItem, GeocodeItem} def start(_type, _args) do PCAPredict.Supervisor.start_link end @doc """ Creates the...
ffa2f3d152713dcfd002bb90ec2887e556a91063
2,572
[ 761396057 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule PostboxWeb 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 PostboxWeb, :controller use PostboxWeb, :html The definitions below will be executed for every controller, ...
ffa301bf7b6e2fa8cce40ae0b0dffa9db3672a26
2,126
[ 850960350 ]
[ "liveview", "documented", "phoenix" ]
defmodule CaseManagerWeb.LiveUserAuth do @moduledoc """ Helpers for authenticating users in LiveViews. """ use CaseManagerWeb, :verified_routes import Phoenix.Component alias CaseManager.Teams.User def on_mount(:live_user_optional, _params, _session, socket) do case socket.assigns[:current_user] d...
ffa312c65cfde7efc8be3ab75666791782cedfba
3,201
[ 589056575 ]
[ "test" ]
defmodule RandomPick.Lotteries.LotteryTest do use RandomPick.DataCase, async: true import RandomPick.Factory alias Ecto.UUID alias RandomPick.Lotteries.Lottery alias RandomPick.Repo describe "describe/2" do test "when params are invalid" do params = %{ name: 123, description: 12...
ffa3ccb32c0afd5fd4a35854340bfcd13764add8
1,749
[ 798953768 ]
[ "liveview", "phoenix" ]
defmodule ExtodosWeb.Endpoint do use Phoenix.Endpoint, otp_app: :extodos # 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: "_extodos_k...
ffa4407399a153ba775a20931c1440913ef2998e
1,962
[ 238710616, 35695907 ]
[ "documented" ]
defmodule Issues.Tabler do @moduledoc """ Take our HashDict Key/Values and map them into a SQL-esque display table. `Tabler` is passed a list of columns to be printed and writes them to `:stdio`. """ import Enum, only: [each: 2, map: 2, map_join: 3, max: 1] @doc """ Called from our main `process()...
ffa4ce01c35cdbe52f7680a2b0dbc3f192326e0d
6,430
[ 585633950 ]
[ "typespec", "liveview", "documented" ]
defmodule SanityWebhookPlug do @external_resource "README.md" @moduledoc "README.md" |> File.read!() |> String.split("<!-- MDOC !-->") |> Enum.fetch!(1) @behaviour Plug require Logger alias SanityWebhookPlug.Signature @derive {Inspect, except: [:secret]} @type t :...
ffa4e9b12f045591a7f9b6f30c3054511d49e82e
3,954
[ 144351894 ]
[]
defmodule Mix.Tasks.Integration do use Mix.Task @impl Mix.Task def run(_) do current_date_time = DateTime.utc_now() |> DateTime.to_unix(:millisecond) connect_secret_name = "test-connect-name-#{current_date_time}" connect_secret_value = "test-connect-value-#{current_date_time}" cert_connect_secr...
ffa5361bea92617d71f33bd71e1735b4005a06da
1,957
[ 797331361 ]
[ "phoenix" ]
defmodule NervesHubWeb.OrgUserController do use NervesHubWeb, :controller alias NervesHub.Accounts alias NervesHub.Accounts.SwooshEmail alias NervesHub.Accounts.Org alias NervesHub.SwooshMailer plug(NervesHubWeb.Plugs.OrgUser when action in [:delete, :edit, :update]) plug(:validate_role, org: :admin) ...
ffa60df3e399843e755156b0f65277e6d10a9a76
3,367
[ 229167567 ]
[ "liveview" ]
defmodule PersonalSiteWeb.DesktopLiveView do use Phoenix.LiveView def render(assigns) do Phoenix.View.render(PersonalSiteWeb.DesktopView, "index.html", assigns) end def mount(%{}, socket) do {:ok, assign(socket, root_files: PersonalSite.Directory.root().files, programs: %{}, ...
ffa6dec0f49d51a5908ffc58f42e2caa2578d056
2,654
[ 153766636 ]
[ "macro" ]
defmodule Vampyre.HTML.Engine.Segment do @container_tag Vampyre.HTML.Engine.Segment.Container @static_tag Vampyre.HTML.Engine.Segment.Segment.Static @dynamic_tag Vampyre.HTML.Engine.Segment.Segment.Dynamic @support_tag Vampyre.HTML.Engine.Segment.Support @fixed_tag Vampyre.HTML.Engine.Segment.Segment.Fixed ...
ffa7078d1f48e950c4c7065cbe7d7be998655907
5,034
[ 323051019 ]
[ "macro", "test" ]
defmodule Assertion do # This __using__/1 macro is called when our Assertion module is used defmacro __using__(_options) do quote do # import Assertion import unquote(__MODULE__) # This is used to create module attributes, the `accumulate: true` option # ensures that several calls to t...
ffa774c4e9784ab4a197f5149ea73be4e5dbedad
1,899
[ 219623634 ]
[ "documented", "ecto" ]
defmodule Timesheets2.Sheets.Sheet do use Ecto.Schema import Ecto.Changeset schema "sheets" do field :approved, :boolean, default: false field :workdate, :date belongs_to :user, Timesheets2.Users.User has_many :logs, Timesheets2.Logs.Log timestamps() end @doc false def changeset(sheet...
ffa80930013acf91d0e25ebbf82d7f96f916d45f
2,338
[ 185450127 ]
[ "phoenix", "ecto" ]
defmodule LibraryApiWeb.ReviewController do use LibraryApiWeb, :controller alias LibraryApi.Library alias LibraryApi.Library.Review plug :authenticate_user when action in [:create, :update, :delete] def index(conn, _params) do reviews = Library.list_reviews() render(conn, "index.json", data: reviews...
ffa886139cd3b116d053c9779d965eecd340d763
1,748
[ 54856715 ]
[ "documented" ]
defmodule IEEx do @moduledoc """ Valida a inscrição estadual com base na UF. ## Exemplos iex> IEEx.is_valid?("56456", "pr") false iex> IEEx.is_valid?("52.504.085/2-0", "pr") true iex> IEEx.is_valid?("1207580984", "PR") true """ alias IEEx.UF.{AC, AL, AM, AP, BA, CE,...
ffa8a724c786e4bed307934cf27eaf8ee4501370
10,611
[ 1004256260 ]
[ "test", "ecto" ]
defmodule CrimeToGo.PlayerTest do use CrimeToGo.DataCase alias CrimeToGo.Player alias CrimeToGo.Player.Player, as: PlayerSchema alias CrimeToGo.Game describe "players" do setup do {:ok, game} = Game.create_game(%{invitation_code: "test123"}) %{game: game} end @valid_attrs %{nickname...
ffa8d08705df5037355dabd52a8773823a3c8d46
1,977
[ 314127513 ]
[ "liveview", "ecto" ]
defmodule MomogogoWeb.PostLive.FormComponent do use MomogogoWeb, :live_component alias Momogogo.Timeline @impl true def update(%{post: post} = assigns, socket) do changeset = Timeline.change_post(post) {:ok, socket |> assign(assigns) |> assign(:changeset, changeset) |> assign(:act...
ffa968b7ce19a100352d85ab8d6af5e2418eef3a
1,862
[ 867481788 ]
[ "liveview", "test" ]
defmodule TodoWeb.PathForgotPasswordLiveTest do use TodoWeb.ConnCase, async: true import Phoenix.LiveViewTest import Todo.RouteFixtures alias Todo.Route alias Todo.Repo describe "Forgot password page" do test "renders email page", %{conn: conn} do {:ok, lv, html} = live(conn, ~p"/path/reset_pas...
ffa9b7581fadbe92f70400cc0f2bd18ca201829d
2,037
[ 619823973 ]
[ "macro" ]
defmodule DSLm.Complex.Polar do defstruct mag: 0, angle: 0 defmacro is_polar(c) do quote do is_struct(unquote(c), unquote(__MODULE__)) end end defmacrop is_rect(c) do quote do is_struct(unquote(c), DSLm.Complex.Rect) end end def to_polar(c) when is_polar(c), do: c def to_po...
ffa9f1311c89b4f26a7822f0c4c9d65f87af2099
3,172
[ 909471257 ]
[ "typespec", "liveview", "documented" ]
defmodule Aurora.Uix.Layout.Options do @moduledoc """ Provides utilities for retrieving and creating a rendering layout options based on the assigns context. ## Key features * Delegates option retrieval to tag-specific modules (e.g., `Aurora.Uix.Layout.Options.Page`) when applicable. * Logs warnings and...
ffa9f2503beba484e283dad9b6ce73438166848e
2,581
[ 385109190 ]
[ "test" ]
defmodule ArpeggioWeb.Database.UserTest do use ArpeggioWeb.ConnCase test "insert users", %{conn: _conn} do {tok, _val} = Arpeggio.DB.new_local_user(%Arpeggio.LocalUser{ email: "<EMAIL>", username: "upperia", password: "asdf", # in the real world we hash before inserting }, %Arpeggio.User{...
ffaa06161f138d4f67520c7f91a19e38de3058ce
4,093
[ 998210700 ]
[ "genserver" ]
defmodule Rex.ListSubscriptionServer do use GenServer require Logger defstruct subscribers: [] def start_link(args) do GenServer.start_link(__MODULE__, args, name: __MODULE__) end @impl GenServer def init(_args) do {:ok, %__MODULE__{}} end def subscribe(args) do GenServer.call(__MODUL...
ffaab20318f0418b37183eb089a8051b61c8cf29
1,503
[ 92110537 ]
[ "macro", "documented", "phoenix" ]
defmodule Forum.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use Forum.Web, :controller use Forum.Web, :view The definitions below will be executed for every view, controller, etc, so keep them short and...
ffaac112f22d37825828b28ceba360fd93bfab48
4,372
[ 1006160294 ]
[ "liveview", "test" ]
defmodule PortfolioWeb.EducationLiveTest do use PortfolioWeb.ConnCase import Phoenix.LiveViewTest import Portfolio.ResumeFixtures @create_attrs %{period: "some period", institution_name: "some institution_name", degree_en: "some degree_en", degree_jp: "some degree_jp", gpa: "some gpa", description_en: "some d...
ffaacd3fea29cc55450986dd3c92c6d92e65892f
1,665
[ 612677577 ]
[ "supervisor", "documented" ]
defmodule Notme.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false use Application @impl true def start(_type, _args) do :ok = OpentelemetryPhoenix.setup() topologies = Application.get_env(:libcluster, :topologies) || [] ...
ffaaf36e476d061eef147d4ecfe39dec23054930
1,862
[ 1016376851 ]
[ "macro", "phoenix" ]
defmodule Drops.Relation.Plugins.Views do use Drops.Relation.Plugin, imports: [view: 2, derive: 1] defmacro view(name, do: block) do quote do @context update_context(__MODULE__, :view, [unquote(name), unquote(Macro.escape(block))]) end end defmacro derive(do: block) do quote do @contex...
ffac038f67de34db665ec53e1853d2b82859e92f
1,598
[ 997280154 ]
[ "typespec" ]
defmodule GottaSnatchEmAll do import MapSet @type card :: String.t() @type collection :: MapSet.t(card()) @spec new_collection(card()) :: collection() def new_collection(card), do: new([card]) @spec add_card(card(), collection()) :: {boolean(), collection()} def add_card(card, collection) do {member...
ffac0c37c791a2f5acf1aea6c5ace1925484cf1e
1,902
[ 780678723 ]
[ "test" ]
defmodule KeyValue.RouterTest do use ExUnit.Case use Plug.Test alias KeyValue.Storage alias KeyValue.Router @opts Router.init([]) setup_all do on_exit fn -> File.rm("storage_test") :ok end end test "check GET 404" do conn = :get |> conn("/?key=test", "") |>...
ffac4c753ff607663b034e1a3f1d52a36a7c8523
9,993
[ 237304008 ]
[ "test", "ecto" ]
defmodule ApiBanking.FinancialTest do use ApiBanking.DataCase alias ApiBanking.Financial describe "users" do alias ApiBanking.Financial.User @valid_attrs %{username: Faker.Name.name(), name: "some name", password: "some password"} @update_attrs %{username: Faker.Name.name(), name: "some updated nam...
ffaca70537c76e77edfe1026de99560bd18c5e90
3,078
[ 821707923 ]
[ "test" ]
defmodule Exa.Std.MosTest do use ExUnit.Case import Exa.Std.Mos doctest Exa.Std.Mos test "simple" do mos = new() |> add(:foo, 1) |> add(:foo, 2) |> add(:foo, 1) assert 2 == size(mos, :foo) assert member?(mos, :foo, 1) assert member?(mos, :foo, 2) assert not member?(mos, :foo, 9) assert...
ffad22edebabd08d3b243856d9b966f379cb47de
9,965
[ 426470708 ]
[ "genserver", "documented" ]
defmodule Mqtt.Endpoint do @moduledoc false use GenServer require Logger alias Blinkchain.Color defmodule State do defstruct [:status, :device_id] end defmodule Attributes do defstruct name: "", datatype: "", unit: "", format: "", retained...
ffada0c20db47c4a46302ed658c1052d7e53549d
1,720
[ 449448658 ]
[ "liveview", "phoenix" ]
defmodule WineOInventoryApiWeb.Endpoint do use Phoenix.Endpoint, otp_app: :wine_o_inventory_api # 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: :cooki...
ffae7a02571515f62e3eab65b6d04823ea81a79a
5,054
[ 734747893 ]
[ "test" ]
# iex --werl # chcp 65001 # from https://groups.google.com/g/elixir-lang-talk/c/C6YrOKQ81PI # iex # c(["lib/todo_list.ex", "lib/ch_4.ex"]) # Ch4.test_ch4_1() defmodule MultiDict do def new(), do: %{} def add(dict, key, value) do Map.update(dict, key, [value], fn values -> [value | values] end) end def get...
ffaeb1be727c3c137f9e698e25d2a7109febdacc
1,783
[ 160639824 ]
[]
defmodule Sentences do alias Sentences.Sentence @sentences [ %Sentence{sentence: "Pilet maksab sada eurot", translation: "Билет стоит сто евро"}, %Sentence{sentence: "Ma tahaksin ühte tassi kohvi, palun", translation: "Мне пожалуйста одну чашку кофе"}, %Sentence{sentence: "See on minu arvates parem", tr...
ffaed3d32ca3f7855563365e65d2cabf06605836
13,794
[ 340929377 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "...
ffaeea9c367e41eda4a835b4939d9574936087f1
2,154
[ 640897985 ]
[]
import Config # config/runtime.exs is executed for all environments, including # during releases. It is executed after compilation and before the # system starts, so it is typically used to load production configuration # and secrets from environment variables or elsewhere. Do not define # any compile-time configurati...
ffb01d86b4c6b4843c0825626ed8ea2da984070f
5,711
[ 376022826 ]
[ "test", "phoenix" ]
defmodule MonopolyWeb.GameControllerTest do use MonopolyWeb.ConnCase describe "#create" do test "sets a players name from user input" do params = %{ "name" => "Kevin", } conn = post(build_conn(), "/api/v1/games", params) assert conn.status == 200 %{ "players" =>...
ffb01e69970b8782218002f3066fa44e116f46e0
1,611
[ 142361809 ]
[ "test" ]
defmodule JsonSchemaTest.Parser.EnumParser do use ExUnit.Case doctest JsonSchema.Parser.EnumParser, import: true alias JsonSchema.Parser.EnumParser alias JsonSchema.Types.EnumType test "parse enum type with integer values" do parser_result = """ { "type": "integer", "enum": [...
ffb0d7effaa671c271cfc6a9b663ba1de7bb4298
3,151
[ 317513189 ]
[]
defmodule TreeHouse do def read_file() do File.read!("./years/aoc2022/input/8.txt") |> String.split("\n", trim: true) |> Enum.with_index() |> Enum.reduce(%{}, fn {values, y}, map -> values |> String.trim("\n") |> String.graphemes() |> Enum.with_index() |> Enum.reduce(map,...
ffb1a200265f8056266879c120ec2ad6d65f77c9
2,936
[ 617756265 ]
[ "ecto" ]
defmodule Statisch.File do use Ecto.Schema import Ecto.Changeset alias Statisch.Metadata alias Statisch.Utils alias Statisch.Template embedded_schema do field(:path, :string) field(:output_path, :string) embeds_one(:metadata, Metadata) field(:contents, :binary) end def changeset(file,...
ffb275a28db9b27424f495b44c3a04bca08e8fdd
6,788
[ 834876995 ]
[ "documented", "ecto" ]
defmodule DevTimesheet.Tracking do @moduledoc """ The Tracking context. """ import Ecto.Query, warn: false alias DevTimesheet.Repo alias DevTimesheet.Tracking.Employee @doc """ Returns the list of employees. ## Examples iex> list_employees() [%Employee{}, ...] """ def list_employ...
ffb303a51b2a6a6420ef14414efd553f7e455e03
3,960
[ 64747901 ]
[ "documented" ]
defmodule Proj.Geodesic do @moduledoc """ Provides functions to solve problems involving geodesic lines. Common problems this can solve: - Finding the distance between two locations - Finding the bearings between two locations - Finding the resulting location after moving `x` metres forwards facing a ...
ffb34e169b9763efb13878aa43c65138ad271f80
2,258
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.PrivateCA.V1.Model.SubjectDescription do @moduledoc """ These values describe fields in an issued X.509 certificate such as the distinguished name, subject alternative names, serial number, and lifetime. ## Attributes * `hexSerialNumber` (*type:* `String.t`, *default:* `nil`) - The seria...
ffb38bc0275f7ae7090b6f62f570e333fb0f52cb
5,124
[ 166092965 ]
[ "test" ]
defmodule ApiWeb.ScheduleViewTest do use ApiWeb.ConnCase use Timex # Bring render/3 and render_to_string/3 for testing custom views import Phoenix.View alias Model.Schedule @schedule %Schedule{ trip_id: "trip", route_id: "route", stop_id: "stop", direction_id: 1, arrival_time: 100, ...
ffb4a0716ce14b8a2d4dc705d5e13a84d0d19d29
2,519
[ 403822924 ]
[ "phoenix" ]
defmodule ElixirIcWeb.Router do use ElixirIcWeb, :router import ElixirIcWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers plug :fetch_current_user end # coveralls-ignore-start ...
ffb57cc26a91c35f4518bd34d08610fdd703937d
1,834
[ 555782310 ]
[ "test" ]
defmodule ExMonTest do use ExUnit.Case import ExUnit.CaptureIO alias ExMon.Player describe "create_player/4" do test "returns a player" do expected_response = %Player{ life: 100, moves: %{move_avg: :soco, move_heal: :cura, move_rnd: :chute}, name: "Joel" } asser...
ffb6033fd4aacafff845104f26c861f449975e0a
3,073
[ 905008845 ]
[ "documented" ]
defmodule Redezvous do @moduledoc """ Redezvous keeps the contexts that define your domain and business logic. Contexts are also responsible for managing your data, regardless if it comes from the database, an external API or others. """ @doc """ def user_infos(params, contexts) This function sho...
ffb66a8ada03dc5ac33633b71cd3eb6aef7f7893
2,650
[ 732638656 ]
[ "liveview", "ecto" ]
defmodule IndicatorsWeb.MeasurementLive.FormComponent do use IndicatorsWeb, :live_component alias Indicators.Measurments @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> <:subtitle>Use this form to manage measurement records in your database.</:subtitle> ...
ffb6a6ce806a975cd72a993a7b8a653e44a4b912
6,815
[ 897245564 ]
[]
defmodule AshAuthExample.Accounts.User do use Ash.Resource, otp_app: :ash_auth_example, domain: AshAuthExample.Accounts, data_layer: AshPostgres.DataLayer, authorizers: [Ash.Policy.Authorizer], extensions: [AshAuthentication] postgres do table "users" repo AshAuthExample.Repo end a...
ffb6e3289b22731758f34f179562035cf1cf2abc
1,760
[ 475198924 ]
[ "typespec", "documented" ]
defmodule XtbClient.Messages.CalendarInfo do @moduledoc """ Calendar event. ## Parameters - `country` two letter country code, - `current` market value (current), empty before time of release of this value (time from "time" record), - `forecast` forecasted value, - `impact` impact on market, - `period`...
ffb6f4bee2b3b749cee61b678beb3491ab14e5bd
2,152
[ 187374425 ]
[]
defmodule Dscrum.StoryQuery do import Ecto.Query alias Dscrum. { StorySchema, UserSchema, DifficultySchema } def paged_list(size, index, team_id) do from s in StorySchema, where: s.team_id == ^team_id, order_by: [desc: s.id], limit: ^size, offset: ^index end def total_list(...
ffb716c060938fec0f2de6d7f06a20b4aedabace
3,932
[ 173731461 ]
[ "typespec", "documented" ]
defmodule FP.MemoiDP do @moduledoc """ Elixir solutions for HackerRank functional programming challenges: memoisation, dynamic programming """ # https://www.hackerrank.com/challenges/pentagonal-numbers/problem # Looking at the figure on HackerRank, the number can be modelled # with this equation: P(n)...
ffb7575f039b3fb375f97ae82e3f49905482052e
2,207
[ 63644191 ]
[ "ecto" ]
defmodule OnboardingService.Validation do import Ecto import Ecto.Changeset def validate_format_code(changeset, field, regex, code) do validate_format(changeset, field, regex, message: "validate.format." <> code) end # example: +1-999-999-9999 def validate_phone_number(changeset, field) do valid...
ffb92ab684a5602cbef86680107ea072108c6bdb
6,529
[ 64859844 ]
[]
%{"bbmustache": {:hex, :bbmustache, "1.0.4", "7ba94f971c5afd7b6617918a4bb74705e36cab36eb84b19b6a1b7ee06427aa38", [:rebar], []}, "cf": {:hex, :cf, "0.2.1", "69d0b1349fd4d7d4dc55b7f407d29d7a840bf9a1ef5af529f1ebe0ce153fc2ab", [:rebar3], []}, "comeonin": {:hex, :comeonin, "2.5.2", "bbad773af30a7632a63053014d5cfebf6df2c...
ffb9ac67b038a7a5df4857771bedec3f4606fe40
8,955
[ 587571701 ]
[]
%{ "castore": {:hex, :castore, "1.0.5", "9eeebb394cc9a0f3ae56b813459f990abb0a3dedee1be6b27fdb50301930502f", [:mix], [], "hexpm", "8d7c597c3e4a64c395980882d4bca3cebb8d74197c590dc272cfd3b6a6310578"}, "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "...
ffba10937df4e986285db808b15cdc3c1c2350d0
1,577
[ 904332297 ]
[ "documented" ]
defmodule Day01 do @moduledoc """ Dia 01 do Advent Of Code de 2021 """ def run(input_file) do input = parse_input(input_file) {time, result} = :timer.tc(&part_01/1, [input]) IO.puts( "==Part 01== \nResult: #{result}" <> "\nCalculated in #{time / 1_000_000} seconds\n" ) {tim...
ffba210e798e785694a452308da66c38c43d19b5
2,850
[ 316784087 ]
[]
%{ "cmark": {:hex, :cmark, "0.9.0", "c0e673019e125eb5878b6c5610af919d737e881369e0cd2247c89e767f42c029", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "0cfb4d8888bc801f2decc23eee3b3b756b682dff976d15a46861a596fdb00079"}, "covertool": {:hex, :covertool, "2.0.3...
ffbac762bce1316730f4dd3d3c450bdc5238bdd5
7,106
[ 783273356, 688782933 ]
[ "genserver", "liveview" ]
defmodule EmojiWeb.HomeLive do use EmojiWeb, :live_view alias Emoji.Predictions @preprompt "A TOK emoji of a " @fail_image "https://github.com/replicate/zoo/assets/14149230/39c124db-a793-4ca9-a9b4-706fe18984ad" def mount(_params, _session, socket) do {:ok, socket |> assign(form: to_form(%{"pro...
ffbacc43d533ce8d9c8d8fb4735d88f934a98cb9
4,569
[ 542274222 ]
[ "test" ]
defmodule Satie.NoteheadTest do use ExUnit.Case, async: true alias Satie.{Interval, Notehead, Pitch} describe inspect(&Notehead.new/1) do test "returns a notehead from a pitch" do pitch = Pitch.new("c+'") assert Notehead.new(pitch) == %Notehead{ written_pitch: pitch, ...
ffbb3eeb242c3469bcab2fd1a28524055f13a12e
8,216
[ 572974863 ]
[ "documented" ]
defmodule Day7 do import Advent2022 @doc ~S""" --- Day 7: No Space Left On Device --- You can hear birds chirping and raindrops hitting leaves as the expedition proceeds. Occasionally, you can even hear much louder sounds in the distance; how big do the animals get out here, anyway? The device the Elves gav...
ffbb5bf645812c7206f1fc93f912838750f6f34e
2,478
[ 78417353 ]
[]
# --- Day 4: Passport Processing --- defmodule Passports do @required_fields ["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"] def read_passports(file) do File.read!(file) |> String.split(~r{\n\n}, trim: true) |> Enum.map(fn x -> String.split(x, ~r{\s}, trim: true) end) |> Enum.map(fn x -> parse_p...
ffbc07b31daf1bca928ef63bb33d45ae38328351
5,187
[ 149154480, 97959122, 98229759, 240457680, 91951005, 95606261 ]
[ "documented" ]
defmodule Credo.Check.Runner do alias Credo.CLI.Output.UI alias Credo.Execution alias Credo.SourceFile alias Credo.Execution.Issues @doc false def run(source_files, exec) when is_list(source_files) do {_time_run_on_all, _source_files_after_run_on_all} = :timer.tc fn -> run_checks_that_run...
ffbc3fd579ea7032c23558271f87cccfb788fc1c
3,215
[ 545502803 ]
[ "documented", "ecto" ]
defmodule Rasbet.Games do use Phoenix.HTML alias Rasbet.Game.TwoTeams.Game alias Rasbet.Game.Bets alias Rasbet.Game.Bets.Bet alias Rasbet.Wallet.Transaction alias Rasbet.Wallet alias Ecto.Multi alias Rasbet.Accounts.Subscription alias Rasbet.Accounts.Notification import Ecto.Query require Logge...
ffbc85e226f4aefcce8f021451f826362e9faf6c
1,801
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DocumentAI.V1beta3.Model.GoogleCloudDocumentaiV1beta3TrainProcessorVersionRequestInputData do @moduledoc """ The input data used to train a new ProcessorVersion. ## Attributes * `testDocuments` (*type:* `GoogleApi.DocumentAI.V1beta3.Model.GoogleCloudDocumentaiV1beta3BatchDocumentsInputCo...
ffbc8e7410a37cc3369c229852cf84f0831a1ace
1,732
[ 90821790 ]
[ "documented", "ecto", "phoenix" ]
defmodule NoaWeb.SigninController do @moduledoc false use NoaWeb, :controller import Ecto.Changeset alias NoaWeb.{SigninReq} def show_signin(conn, %{} = params) do # make sure that there is already a session with OAuth2 authroize request information cs = SigninReq.show_signin_cs(params, get_session...
ffbc9f04d69ffd4ab011e0d2849263e88019504f
1,516
[ 434058815 ]
[]
defmodule Graph do def out(map, {x, y}) do [{0, 1}, {0, -1}, {1, 0}, {-1, 0}] |> Enum.map(fn {ox, oy} -> coord = {x + ox, y + oy} if Map.has_key?(map, coord) do if Map.fetch!(map, coord) == 9 do nil else coord end else ...
ffbcbd37b31c2f417a8565e94b3b52af807fb7a7
3,260
[ 52663085 ]
[]
defmodule Parallel do #http://www.selectedintelligence.com/page/3 def map(collection, timeout \\ 1000, function) do me = self collection |> Enum.map(fn(elem) -> # Here I spawn a result receiving process which will either # timeout or return a result to the original caller, i.e. ...
ffbccef755fdddaf61760dccc5a1632918b8e2c4
3,120
[ 257787813 ]
[ "ecto" ]
defmodule Domain.Repo.Migrations.MigrateInternetResources do use Ecto.Migration def change do # Step 1 # # Delete all connections where the resource is an internet resource and the gateway group is not the internet site. # The Internet resource is / will not be a multi-site resource. execute(""...
ffbd16eef5e7613ba614819aef77348e14f1e90f
1,729
[ 391085711 ]
[]
# = is match operator when not being used to assigned a variable x = 1 # output: 1 1 = x # output: 1 2 = x # output: ** (MatchError) no match of right hand side value: 1 # Can be used on tuples {a, b, c} = {:hello, "world", 42} # output: {:hello, "world", 42} a # output: :hello b # output: "world" # Doesn't work with...
ffbd2b01a2712ab6da71bbff26452a71900cd328
2,193
[ 248702688 ]
[]
defmodule Mix.Tasks.Compile.Erlexec do def run(_) do if match? {:win32, _}, :os.type do IO.warn("Windows is not supported.") else {result, _error_code} = System.cmd("make", [], cd: "deps/erlexec", env: [{"MIX_ENV", "test"}], stderr_to_stdout: true) IO.binwrite result end :ok end en...
ffbd5a53ef4b11346e115874ee6ebea376daa05d
4,287
[ 57000047 ]
[]
defmodule Sheets do import Lang def mary_had_a_little_lamb do %Staff{bpm: 160, measures: [ %Note{name: "B", octave: 4, type: 4}, %Note{name: "A", octave: 4, type: 4}, %Note{name: "G", octave: 4, type: 4}, %Note{name: "A", octave: 4, type: 4}, %Note{name: "B", octave: 4, type: 4}, %Note{na...
ffbdab824efde49593e3c9f2e9133cfd8e22191c
1,514
[ 390873020 ]
[ "liveview", "ecto" ]
defmodule UrlShortenWeb.SlugLive.FormComponent do use UrlShortenWeb, :live_component alias UrlShorten.Shortener @impl true def update(%{slug: slug} = assigns, socket) do changeset = Shortener.change_slug(slug) {:ok, socket |> assign(assigns) |> assign(:changeset, changeset)} end @...
ffbdb40af85e49c0a7f40043bba99a47b7f8124a
1,838
[ 448030575 ]
[ "documented", "ecto", "phoenix" ]
defmodule ChatsController do @moduledoc false use ChatAppWeb, :controller alias ChatApp.{Accounts, Chats} alias Ecto.Changeset def create_chat_room(conn, %{"chat_members" => chat_members} = params) do user = conn.assigns[:current_user] params = Map.put(params, "chat_members", chat_members ++ [%{own...
ffbdc5322435c1fb7959969aebb12ce9f32d3690
3,401
[ 882666524 ]
[ "typespec", "documented" ]
defmodule Exercism.TwoBucket do alias Exercism.TwoBucket defstruct [:bucket_one, :bucket_two, :moves] @type t :: %TwoBucket{bucket_one: integer, bucket_two: integer, moves: integer} @doc """ Find the quickest way to fill a bucket with some amount of water from two buckets of specific sizes. ## E...
ffbe54da2ee1ca5d39bc290596303d64d61d39fa
2,872
[ 333239824 ]
[ "typespec", "documented", "ecto" ]
defmodule Msdata.SystOwnerPasswordRules do @moduledoc """ Establishes Owner specific rules defining the minimum allowed password complexity. Rules defined here may further strengthen the rules defined by `SystGlobalPasswordRules`, but may not be weaken those definitions. Defined in `MscmpSystAuthn`. """...
ffbe81ae46c5e68c9bf9371563963a2b172250b4
7,116
[ 486466984 ]
[ "genserver" ]
defmodule TinkerBellSimServer do use GenServer #GenServer API def init(state) do {:ok, state} end def handle_call({:update_worker_state, id}, _from, state) do pid = Enum.at(Map.keys(state), id) workerstate = GenServer.call(pid, :get_workerstate) IO.inspect workerstate state = Map.update(...
ffbeb0763033c36d094e7c21fa50c75c110f9d64
1,703
[ 124185998 ]
[]
defmodule Noizu.Cms.V2.TagRepo do @behaviour Noizu.Cms.V2.Cms.TagRepoBehaviour alias Noizu.Cms.V2.Database.TagTable use Noizu.Cms.V2.Database.TagTable use Amnesia def new(options) do %TagTable{ article: options[:article], tag: options[:tag] } end def article_tags(entity, con...
ffbec106514c31f85f6712853db5fb3847ca47e0
1,662
[ 573119086 ]
[]
defmodule AdventOfCode.Day13 do def eval_line(line) do {term, _} = Code.eval_string(line) term end def in_order?([[p1h | p1t], [p2h | p2t]]) when is_integer(p1h) and is_integer(p2h) do if p1h == p2h do in_order?([p1t, p2t]) else p1h < p2h end end def in_order?([[], []]), do: ...
ffbf06509acbb4b639e150f6e9739a7171f1d205
2,246
[ 357138874 ]
[]
import 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, # w...
ffbf50fad11e3196424325196fd2e81b88b09223
2,608
[ 1010122054 ]
[]
# 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 :pythonx, :uv_init, pyproject_toml: """ [p...
ffbf56223bc3c1b7f354624153a356ef6653b72d
2,064
[ 886979408 ]
[]
# 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 :phoenix_finflow, ecto_repos: [PhoenixFinflo...
ffc15be0f76438ddbd3c2ff78f3767e86c9d40bf
1,525
[ 632551473 ]
[ "test" ]
defmodule ExM3U8.Tags.MediaInitTest do use ExUnit.Case import ExM3U8.TestUtils, only: [serialize: 1] test "serialize media init" do header = %ExM3U8.Tags.MediaInit{ uri: "header.mp4" } assert """ #EXT-X-MAP:URI="header.mp4" """ |> String.trim_trailing() == ser...
ffc19537d2a99377cca594cc5e1591ae4d1bea1f
2,462
[ 317598273 ]
[ "typespec", "documented" ]
defmodule Problem8 do @moduledoc """ The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product? ## Examples iex> Problem8.execu...
ffc197f7a0e131425317167176c8090d9091420f
5,618
[ 314728671 ]
[ "typespec", "documented", "ecto" ]
defmodule ExNylas.Event do @moduledoc """ A struct representing a event. [Nylas docs](https://developer.nylas.com/docs/api/v3/ecc/#tag/events) """ use Ecto.Schema import Ecto.Changeset import PolymorphicEmbed alias ExNylas.Notetaker alias ExNylas.Schema.Util alias ExNylas.Event.{ Conferencing...