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
041a41417e81d1d9da9b9f543eadbddb6dbf0f24
6,229
[ 606918732 ]
[ "typespec", "liveview", "ecto" ]
defmodule AceGraderWeb.ExerciseLive.Form do use AceGraderWeb, :live_view alias AceGrader.Exercises alias AceGrader.Exercises.Exercise def mount(_params = %{"id" => id}, _session, socket) do exercise = Exercises.get_exercise!(id) |> AceGrader.Repo.preload(:classes) if !Exercise.is_owner?(exercise, sock...
041aa755e5cf1c01fb0d360e976a14ebe4034a29
8,076
[ 928928433 ]
[]
# 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: # # IgActus.Repo.insert!(%IgActus.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will...
041bc45a3954795f3549c58283dde5ef8280daca
2,121
[ 160505655 ]
[ "documented", "ecto" ]
defmodule Notes.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias Notes.Repo alias Notes.Accounts.User alias Comeonin.Pbkdf2 alias Notes.Accounts.Guardian @doc """ Returns the list of users. ## Examples iex> list_users() [%User{}, ...] ""...
041bea8260de4d3d14c5ce710aaac894411c09fc
1,682
[ 690601070 ]
[ "test" ]
defmodule ExWebRTC.RTP.JitterBuffer.HeapTest do use ExUnit.Case, async: true alias ExWebRTC.RTP.JitterBuffer.Heap test "stores things and reports size" do heap = Heap.new() assert Heap.size(heap) == 0 assert Heap.root(heap) == nil heap = Heap.push(heap, 123) assert Heap.size(heap) == 1 ...
041c72ef868b2718e9dc0002c3d64ad5785d7327
11,646
[ 62237113 ]
[ "test" ]
require Logger defmodule Serverboards.RuleV2Test do use ExUnit.Case @moduletag :capture_log @http_port 8124 setup do # Explicitly get a connection before each test :ok = Ecto.Adapters.SQL.Sandbox.checkout(Serverboards.Repo) # Setting the shared mode must be done only after checkout Ecto.Adapte...
041e29fa19edfe5e8ddb1bf0b2afc02a59c4e788
13,523
[ 158604277 ]
[ "typespec", "documented" ]
defmodule Problem13 do @moduledoc """ Solution for Project Euler problem 13: > Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. > * 37107287533902102798797998220837590246510135740250 > * 46376937677490009712648124896970078050417018260538 > * 7432498619952474105...
041e38ffd65f565afe5dfa04a5e5f69f08ab322b
1,544
[ 950747020 ]
[ "test" ]
defmodule Aoc2023.Day8Test do use ExUnit.Case doctest Aoc2023.Day8 defp sample_data() do """ RL AAA = (BBB, CCC) BBB = (DDD, EEE) CCC = (ZZZ, GGG) DDD = (DDD, DDD) EEE = (EEE, EEE) GGG = (GGG, GGG) ZZZ = (ZZZ, ZZZ) """ end test "it parses the input correctly" do ...
041e3b046fbbb6b01dee77e8401c839f7531e86a
2,295
[ 436100750 ]
[ "documented" ]
defmodule Phx.New.Umbrella do @moduledoc false use Phx.New.Generator alias Phx.New.{Ecto, Web, Project} template :new, [ {:eex, "phx_umbrella/gitignore", :project, ".gitignore"}, {:eex, "phx_umbrella/config/config.exs", :project, "config/config.exs"}, {:config, "phx_umbrel...
041e6f4376b69a6b881ecf39ad8c99034af55e16
18,264
[ 890956444 ]
[ "documented", "ecto" ]
defmodule ECommerce.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias ECommerce.Repo alias ECommerce.Accounts.{User, UserToken, UserNotifier} ## Database getters @doc """ Gets a user by email. ## Examples iex> get_user_by_email("<EMAIL>") %Us...
041e92d288d30be94da079b30ea719c783143e4c
1,927
[ 113530302 ]
[]
use Mix.Config # For development, we disable any cache and enable # debugging and code reloading. # # The watchers configuration can be used to run external # watchers to your application. For example, we use it # with brunch.io to recompile .js and .css sources. config :til, TilWeb.Endpoint, http: [port: 4000], d...
041ea36645a9b8aeabc75418d1ee75ad204eac7b
2,970
[ 649013489 ]
[ "phoenix" ]
defmodule BmvpWeb.Router do # alias BmvpWeb.PageController use BmvpWeb, :router import BmvpWeb.UserAuth pipeline :browser do plug(:accepts, ["html"]) plug(:fetch_session) plug(:fetch_live_flash) plug(:put_root_layout, {BmvpWeb.Layouts, :root}) plug(:protect_from_forgery) plug(:put_secu...
041ed4ed9998bc9e2d920f2eb28f0f1bb482d350
9,480
[ 127430141, 863118743, 887750784, 863118926 ]
[]
defmodule Astarte.TriggerEngine.EventsConsumer do alias Astarte.Core.Triggers.SimpleEvents.IncomingIntrospectionEvent alias Astarte.Core.Triggers.SimpleEvents.InterfaceVersion alias Astarte.Core.Triggers.SimpleEvents.SimpleEvent alias Astarte.Core.Triggers.Trigger alias Astarte.DataAccess.Database alias CQE...
041f345526ff426ed63099fa9cd6aaba880eeae5
4,202
[ 294868597, 323203037 ]
[ "test", "phoenix" ]
defmodule AngioWeb.Cath_radiationControllerTest do use AngioWeb.ConnCase alias Angio.Caths @create_attrs %{ car_area_product_units: "some car_area_product_units", car_comulative_kerma: "some car_comulative_kerma", car_dose_area_meas_method: "some car_dose_area_meas_method", car_dose_area_product...
041f36b05565a24f7c319df781783893cb6e78ad
2,502
[ 609674774 ]
[ "genserver", "documented" ]
defmodule Hello.Server do @moduledoc """ An example GenServer that runs arbitrary functions and emits telemetry events when called """ use GenServer # A common prefix for :telemetry events @prefix [:hello, :server, :call] def start_link(fun) do GenServer.start_link(__MODULE__, fun, name: __MODULE__...
041f855121b44ad4b086c92f22086d64f3b02dd2
3,796
[ 947948879 ]
[ "test" ]
# Enum.reduce(has_permissions, %{}, fn {key, value}, acc -> # atom_key = permission_to_operation(key) # Map.put(acc, atom_key, value) # end) defmodule CredoUnnecessaryReduce.MapNewTest do use Credo.Test.Case, async: true alias CredoUnnecessaryReduce.Check test "Map.new is good" do """ defmodule Neo...
0420ac855484da2312db4c0f364cff7375243896
5,035
[ 666095064 ]
[ "test" ]
defmodule Surface.Components.Form.CheckboxTest do use Surface.ConnCase, async: true alias Surface.Components.Form alias Surface.Components.Form.Checkbox test "checkbox" do html = render_surface do ~F""" <Checkbox form="user" field="admin" /> """ end assert html =~ ...
0420e15fbc6fcd113aa580ef835ee2d5e8815934
2,215
[ 887743893 ]
[ "test" ]
defmodule Bumblebee.Vision.VitTest do use ExUnit.Case, async: true import Bumblebee.TestHelpers @moduletag model_test_tags() test ":base" do assert {:ok, %{model: model, params: params, spec: spec}} = Bumblebee.load_model({:hf, "hf-internal-testing/tiny-random-ViTModel"}) assert %Bumble...
042103b980c24406109b773d542f647fbf0dfc4f
6,863
[ 225689728 ]
[ "documented" ]
defmodule Day11 do @area_index -2 @output_mode_index -3 @moduledoc """ Documentation for Day11. """ @doc """ Painted panels ## Examples iex> Day11.white_panels() 91 """ def white_panels() do 0..length(input()) |> Stream.zip(input()) |> Enum.into(%{}) |> Map.put(-1, 0)...
0421380dd1691f68415ada07ddce2dd0fadc41c9
2,269
[ 572950047 ]
[]
defmodule Day14Rweork do import Day14 # execute methods def execute() do get_data() |> parse_data() |> go_through_sand_piramide() end def go_through_sand_piramide(cave_formation) do # get cave bounds and depth bounds = get_cave_bounds(cave_formation) %{y: [_, max_depth]} = bounds ...
0421a9f9ed15324925b45f15a0e16000fc34a880
1,705
[ 423168600 ]
[ "liveview", "documented" ]
defmodule Philtre.Block do @moduledoc """ Defines what the structure of a block should be """ alias Philtre.Block.ContentEditable alias Philtre.Block.ContentEditable.Selection @doc """ Takes the struct for the specific block type and returns its id """ @callback id(struct) :: String.t() @doc """ ...
0421d7dce27ba96abce5b784146221c5130f0181
2,094
[ 5896829 ]
[]
defmodule Fct do @behaviour Identification @magic_number << 0x46, 0x43, 0x54, 0x00 >> @impl Identification def is?(input) do << magic_number::bitstring-size(32), _rest::binary >> = input magic_number == @magic_number end @impl Identification def extension(), do: "fct" def info...
0421d9e98c63ed446925ea38154a5cd32545e74b
3,385
[ 273519787 ]
[]
%{ "blankable": {:hex, :blankable, "1.0.0", "89ab564a63c55af117e115144e3b3b57eb53ad43ba0f15553357eb283e0ed425", [:mix], [], "hexpm", "7cf11aac0e44f4eedbee0c15c1d37d94c090cb72a8d9fddf9f7aec30f9278899"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "he...
04230fb46bb1450bea8549d6a89d2fc3d1919fce
3,666
[ 564359760 ]
[ "test" ]
defmodule HydepwnsLiveview.Resources.ExampleUserResourceTest do use HydepwnsLiveview.DataCase alias HydepwnsLiveview.TestSupport.EventStoreTestHelper alias HydepwnsLiveview.Resources.TestExampleUserResource import HydepwnsLiveview.Events.ResourceIntegration.EventSourcedResource, only: [rebuild_from_events:...
0423ed9a57f0b2bce25acdaffb2228f66642372c
13,748
[ 844733583 ]
[ "typespec", "documented" ]
defmodule LagoClient.OrganizationObject do @moduledoc """ Provides struct and type for a OrganizationObject """ use LagoClient.Encoder @type t :: %__MODULE__{ __info__: map, address_line1: String.t() | nil, address_line2: String.t() | nil, billing_configuration: LagoCl...
0424624fb1a7ca5ede7f5c4f89c55d22811ca2e0
13,055
[ 152556800 ]
[]
defmodule Exconv.Mapper.Cp866 do def to_unicode(255), do: 160 # <<194, 160>> | " " def to_unicode(254), do: 9632 # <<226, 150, 160>> | "■" def to_unicode(253), do: 164 # <<194, 164>> | "¤" def to_unicode(252), do: 8470 # <<226, 132, 150>> | "№" def to_unicode(251), do: 8730 # <<226, 136, 154>> | "√" def to_...
0424ac2119452872a0dda2d1d19463217c58a4e3
3,894
[ 296295613 ]
[ "documented" ]
defmodule MoonWeb.Examples.Design.TableExample.Responsive do @moduledoc """ Responsive design for the table. To see what it's about - just resize the window, or press <F12> to open the console and resize it sizes can be ssen here - https://tailwindcss.com/docs/screens """ use Moon.StatelessComponent use ...
042587a790cb260fb08902cf99f562d227fb5928
1,728
[ 358707405 ]
[]
defmodule ExChroma.MixProject do use Mix.Project @version "0.1.1" @source_url "https://github.com/dkuku/ex_chroma" def project do [ app: :ex_chroma, version: @version, elixir: "~> 1.0", start_permanent: Mix.env() == :prod, deps: deps(), docs: docs(), description:...
0425ac3bb0b4cee1d567a0e65a770aa9afcbe874
3,815
[ 106712767 ]
[ "genserver", "liveview", "documented" ]
defmodule Sanbase.EventBus.BillingEventSubscriber do use GenServer alias Sanbase.{Accounts, ApiCallLimit} alias Sanbase.Billing.Subscription alias Sanbase.Accounts.EmailJobs require Logger def topics(), do: ["billing_events"] def start_link(opts \\ []) do GenServer.start_link(__MODULE__, opts, nam...
0426790ed7ce4720063a9f16e5f4428a425ecdeb
6,337
[ 650013467 ]
[ "typespec" ]
defmodule WorkflowEngine do use OK.Pipe alias WorkflowEngine.Actions alias WorkflowEngine.State @builtin_actions %{ "http" => Actions.Http, "parse_csv" => Actions.ParseCsv } @spec evaluate(map(), keyword() | map()) :: {:error, any} | {:ok, State.t()} def evaluate(workflow, opts_or_state \\ []) ...
042742902c5b678cada655e58fe20857744d70dc
2,373
[ 394467538 ]
[ "test" ]
defmodule Stellar.TxBuild.ClaimantTest do use ExUnit.Case alias Stellar.Test.Fixtures.XDR, as: XDRFixtures alias Stellar.TxBuild.{ClaimPredicate, Claimant, AccountID} setup do destination = "GBTG2POJVVSRBQSZVA3IYJEZJQLPTIVVYOYRLTZEAEFBMVP72ZTQYA2V" predicate1 = ClaimPredicate.new(:unconditional) ...
042766565003245760e2152af3d6a2a3221e6eef
2,814
[ 172607433 ]
[ "test", "phoenix" ]
defmodule TaskManager2Web.TaskControllerTest do use TaskManager2Web.ConnCase alias TaskManager2.Tasks @create_attrs %{completed: true, description: "some description", title: "some title"} @update_attrs %{completed: false, description: "some updated description", title: "some updated title"} @invalid_attrs ...
042788d197abd76d555aa7dae61102f2e279e6a1
3,822
[ 91725554 ]
[ "documented" ]
defmodule ZssService.Service.MessageHandler do @moduledoc """ A module that contains the logic to handle all message frames that the workers receive """ alias ZssService.Message alias ZssService.Service.Timer import ZssService.Error import ZssService.Service.Util, only: [send_reply: 2] require Logger ...
04279cdb47cb38b65aedc85a1c7f8d4300b75b22
2,570
[ 168643505 ]
[ "genserver", "typespec", "documented" ]
defmodule Game.Items do @moduledoc """ Agent for keeping track of items in the system """ use GenServer import Ecto.Query alias Data.Item alias Data.Repo @key :items @doc false def start_link() do GenServer.start_link(__MODULE__, [], name: __MODULE__) end @doc """ Get an item from th...
0428309b354095c2a690cc0ed9612cb4b1c9f8c0
1,982
[ 129004779 ]
[ "test" ]
defmodule EVM.Operation.BlockInformationTest do use ExUnit.Case, async: true doctest EVM.Operation.BlockInformation describe ".blockhash/2" do test "returns the hash of the block requested" do header_2 = build_block_header(2) header_1 = build_block_header(1) header_0 = build_block_header(0)...
04285fd4c166f3d3b27e5e2bb3d077381659ebf0
1,583
[ 407445749 ]
[]
defmodule Elrondex.Sc.RouterSc do alias Elrondex.{Sc, Account, Transaction, Network, REST, ESDT, Pair} alias Elrondex.Sc.{PairSc} @deprecated "Use get_all_pairs_managed_addresses/3 instead" def get_all_pairs_addresses(router_address, %Network{} = network, opts \\ []) do get_all_pairs_managed_addresses(rout...
0428b5475b844a299614cd703e9a6f59f1b2c9d1
1,692
[ 379771006 ]
[]
defmodule VhsDevTest.Http.Client do # use DebugTest.PipeDebug alias VhsDevTest.Http.Request @http_client Application.get_env(:vhs_dev_test, :http_client) @http_client_options [with_body: true] def request(%Request{ method: method, headers: headers, url: url, query: query, ...
0428d96a835f129dd17657294c0ae4b46cbeec52
2,076
[ 392067008 ]
[ "test", "ecto" ]
defmodule LoyaltyApi.AccountsTest do use LoyaltyApi.DataCase import LoyaltyApi.Factory alias LoyaltyApi.Accounts alias LoyaltyApi.Accounts.Customer describe "get_customer/1" do test "returns the customer with given id" do customer = insert!(:customer) assert Accounts.get_customer(customer.id...
0429546ed1f7a3fa105170c3576fd63ba5e0eaf7
6,561
[ 698777178 ]
[ "typespec", "ecto" ]
defmodule Core.Gameplay do use EctoInterface, [Core.Gameplay.Spell, :spells, :spell] use EctoInterface.Read.Slug, [Core.Gameplay.Spell, :spell] use EctoInterface.Read.Tagged, [Core.Gameplay.Spell, :spells] use EctoInterface, [Core.Gameplay.Background, :backgrounds, :background] use EctoInterface.Read.Slug, [C...
042962d0863a2201d0c82de073dcfa8c30379ade
2,149
[ 159866229, 948973699, 520217048 ]
[ "macro", "test" ]
defmodule Ockam.Messaging.Ordering.Tests do use ExUnit.Case, async: true alias Ockam.Messaging.Ordering.Tests.Shuffle monotonic_pipes = [Ockam.Messaging.Ordering.Monotonic.IndexPipe] continuous_pipes = [ Ockam.Messaging.Ordering.Strict.ConfirmPipe, Ockam.Messaging.Ordering.Strict.IndexPipe ] Enu...
042966897e1e7ee36afb0bc5dceffa12fd72150c
2,715
[ 258304916 ]
[ "macro", "test", "documented", "ecto" ]
defmodule CrawlyUI.DataCase do @moduledoc """ This module defines the setup for tests requiring access to the application's data layer. You may define functions here to be used as helpers in your tests. Finally, if the test case interacts with the database, we enable the SQL sandbox, so changes done to ...
0429c6c6f361473231badaf31fac790d6d83cbe2
3,048
[ 425955021 ]
[ "typespec" ]
defmodule ALF.Components.Unplug do use ALF.Components.Basic defstruct Basic.common_attributes() ++ [ type: :unplug, module: nil, source_code: nil ] @spec start_link(t()) :: GenServer.on_start() def start_link(%__MODULE__{} = state) do...
042aa08cfc9ca52ad8614168b096539c79f856c2
3,486
[ 749382617 ]
[ "test" ]
defmodule Mmoaig.RockPaperScissors.TurnTest do use Mmoaig.DataCase alias Mmoaig.RockPaperScissors.Turn test "build_turn_map/1 returns a map with the turn" do assert Turn.build_turn_map("rock") == %{turn: "rock"} assert Turn.build_turn_map("paper") == %{turn: "paper"} assert Turn.build_turn_map("scis...
042b4d5dc68301b519e9ea45025668b1be013b1d
2,302
[ 199274434 ]
[ "typespec", "documented" ]
defmodule WcaLive.FactoryHelpers do import WcaLive.Factory alias WcaLive.Competitions.Person alias WcaLive.Scoretaking.Round @doc """ Creates two subsequent rounds of the same event with results following the given specification. ## Options * `:first_round_ranks` * `:first_round_advancing_rank...
042bb5563c8ea98a34be35d1f3a4265ee38ad2b2
6,858
[ 318945858, 276023881 ]
[ "macro", "documented", "ecto" ]
defmodule Pleroma.UserRelationship do use Ecto.Schema import Ecto.Changeset import Ecto.Query alias Ecto.Changeset alias Pleroma.FollowingRelationship alias Pleroma.Repo alias Pleroma.User alias Pleroma.UserRelationship schema "user_relationships" do belongs_to(:source, User, type: FlakeId.Ecto...
042be7d9eb4b822f2dfe2eb86a5ee7ae65c44f6f
4,189
[ 239822890, 459291087 ]
[ "documented" ]
defmodule Oli.Interop.Ingest.Processor.Hierarchy do alias Oli.Interop.Ingest.State import Oli.Interop.Ingest.Processor.Common alias Oli.Publishing.ChangeTracker @doc """ We cannot (easily) bulk allocate containers, because of how many dependencies there are between them. So instead, we continue with the ...
042ca0e82fd58c4ca7217cbc4ae9d146717aeacd
2,531
[ 640342807 ]
[ "test", "documented" ]
defmodule Membrane.H265.StreamFormatTest do @moduledoc false use ExUnit.Case import Membrane.ChildrenSpec import Membrane.Testing.Assertions alias Membrane.H265 alias Membrane.Testing.Pipeline defp make_pipeline(in_path) do spec = [ child(:file_src, %Membrane.File.Source{chunk_size: 40_960, lo...
042cd8888b4b39f99e47f3994b4e5ff5989af193
2,680
[ 398198092 ]
[ "phoenix" ]
defmodule CodewarWeb.Router do use CodewarWeb, :router alias CodewarWeb.Plugs.SetLayoutClassName pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_flash plug :fetch_live_flash plug :put_root_layout, {CodewarWeb.LayoutView, :root} plug :protect_from_forgery ...
042d9108e69f092b4089ab8afa46a0cde41149db
4,989
[ 744421640 ]
[ "phoenix" ]
defmodule BlockScoutWeb.BlockTransactionController do use BlockScoutWeb, :controller import BlockScoutWeb.Chain, only: [ paging_options: 1, put_key_value_to_paging_options: 3, next_page_params: 3, split_list_by_page: 1, parse_block_hash_or_number_param: 1 ] import Explorer....
042d92be369e45f59b1c5d04a65875ae853a166d
3,988
[ 478605083 ]
[ "genserver", "liveview" ]
defmodule RestaurantWeb.RestaurantLive do use RestaurantWeb, :live_view import Transformer alias Restaurant.Kitchen.Stove.Controller, as: Stove alias Restaurant.Kitchen.CoffeeMachine alias Restaurant.Kitchen.CompletedMenu alias Restaurant.Orders alias Restaurant.MoneyStorage def render(assigns) do ...
042d9b2fe42dc87125b501bbd9d376d4d37b17ac
1,977
[ 107599083, 195623682 ]
[ "typespec" ]
defmodule Data.Result do @type t(e, a) :: {:ok, a} | {:error, e} @spec map(a :: t(e, a), f :: (a -> b)) :: t(e, b) when a: var, b: var, e: var def map({:error, _} = e, _), do: e def map({:ok, a}, f), do: {:ok, f.(a)} @spec map_error(a :: t(e1, a), f :: (e1 -> e2)) :: t(e2, a) when a: var, e1: var, e2: var ...
042dcfbf187db366cdad93e8559be48c00304441
4,679
[ 175019631 ]
[ "phoenix", "ecto" ]
defmodule Tasks2Web.TaskController do use Tasks2Web, :controller alias Tasks2.Tasks alias Tasks2.Tasks.Task alias Tasks2.Users alias Tasks2.Mentorships alias Tasks2.TimeBlocks def index(conn, _params) do tasks = Tasks.list_tasks() tasks = Enum.map(tasks, fn task -> user = Users.get_user(ta...
042df02c4cf4de1ee3c3609f24d6b727710b3239
2,019
[ 295698115 ]
[ "liveview", "documented", "ecto" ]
defmodule LocationsWeb.Live.Location.LocationModal do @moduledoc """ Displays the location modal that allows the user to add a new or update an existing location """ use LocationsWeb, :live_component use Phoenix.HTML alias Locations alias Locations.Schema.Location @impl true def mount(socket) do ...
042e064b122e5d0f435387df18c2284b5fb126b6
1,798
[ 162377738 ]
[]
defmodule Innerpeace.ImageUploader do use Arc.Definition use Arc.Ecto.Definition @acl :public_read def __storage do case Application.get_env(:db, :arc_storage) do :s3 -> Arc.Storage.S3 _ -> Arc.Storage.Local end end def s3_object_headers(version, {file, scope}) do [content_type: P...
042e131cbc7a422714a7a3eaef7f321e54803c38
3,204
[ 729196048 ]
[]
# Advent of Code 2022 Day 24 - Blizzard Basin # https://adventofcode.com/2022/day/24 # Commentary: https://walnut-today.tistory.com/228 defmodule Aoc2022.Day24 do @dir "data/day24/" def q1(file_name \\ "q.txt") do {map, map_width, map_height} = build_map(file_name) run(map, [{0, 1}], {map_height - 1, map...
042e15563e1b6cc99e4bfce4de696591a67ce04c
6,699
[ 859560680 ]
[ "documented" ]
defmodule CNFReaderV3 do @moduledoc """ Módulo para procesar archivos CNF, encontrar asignaciones de variables que satisfacen las cláusulas y optimizar el cálculo mediante paralelismo. """ defstruct variables: 0, clauses_count: 0, clauses: [] @cant_hilos 8 @doc """ Punto de entrada principal del progr...
042e996bd06c51d11039063391b012435608bb92
4,726
[ 651549330 ]
[ "test", "documented", "ecto" ]
defmodule LibEcto.Test do @moduledoc false use ExUnit.Case alias LibEcto.KsuidType defmodule Repo do @moduledoc false use Ecto.Repo, otp_app: :my_app, adapter: Ecto.Adapters.SQLite3 end defmodule Test.Schema do @moduledoc false use Ecto.Schema import Ecto.Changeset @...
042eba7a6d80530724b7f80be69f3f51b6f27da3
2,024
[ 795215887 ]
[ "test" ]
defmodule Distance do def distance({:point, x1, y1} , {:point, x2, y2}) do x_dist = x1 - x2 y_dist = y1 - y2 :math.pow(x_dist, 2) + :math.pow(y_dist, 2) |> :math.sqrt() end def point_inside_figure?(point, {:circle, center, radius}) do distance(point, center) <= radius end ...
042ed1f5820d4010603a19f2567dd4ecfa1e2167
2,308
[ 65637519 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule Spotthestation2Web 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 Spotthestation2Web, :controller use Spotthestation2Web, :view The definitions below will be executed for ev...
04308c3f79df6509708a8f60c084478e41ddc6dc
3,653
[ 449767606 ]
[ "test" ]
defmodule IntegrationTest do use ExUnit.Case, async: true alias Mix.Tasks.Format, as: MixFormat defp assert_mix_format_output(input_ex, expected, dot_formatter_opts \\ []) do filename = "index.html.heex" ex_path = Path.join(System.tmp_dir(), filename) dot_formatter_path = ex_path <> ".formatter.exs"...
04309872e7f70dbc0b5cf8c10b11dbbf56361c8e
7,276
[ 468342684 ]
[ "documented" ]
defmodule DbserviceWeb.SwaggerSchema.Student do @moduledoc false use PhoenixSwagger def student do %{ Student: swagger_schema do title("Student") description("A student in the application") properties do student_id(:string, "Id for the student") ...
043099e345c8aee1dc7532ecfe95d1ff84ed4294
2,496
[ 206417, 118678239 ]
[ "documented" ]
defmodule Couch.Test.Setup.Step.Start do @moduledoc """ Step to start a set of couchdb applications. By default it starts list of applications from DEFAULT_APPS macro defined in `test_util.erl`. At the time of writing this list included: - inets - ibrowse - ssl - config - couch_epi - cou...
0430b94024a4df93bfd4068b318264749c566098
2,741
[ 872091867, 828087786, 882758430, 884344453, 875852258, 884066936, 870390283, 896464338, 825443197, 857708817 ]
[ "genserver", "documented" ]
defmodule Bandit.HTTP1.Handler do @moduledoc false # An HTTP 1.0 & 1.1 Thousand Island Handler use ThousandIsland.Handler @impl ThousandIsland.Handler def handle_data(data, socket, state) do transport = %Bandit.HTTP1.Socket{socket: socket, buffer: data, opts: state.opts} connection_span = ThousandIs...
0430be50fed4463bbcc70dff263020768311e894
2,518
[ 160578684 ]
[ "documented" ]
defmodule ShortestPath do def part_1, do: load_graph("part1_graph.txt") |> brute_force def test_data, do: load_graph("test_graph.txt") @doc """ iex> ShortestPath.test_data |> ShortestPath.brute_force {14, ["0", "4", "1", "2", "3"]} """ def brute_force(graph) do graph |> nodes |> Enum....
0430e9add95a9c75735b0b2e3dccdf5acac20006
2,875
[ 288784084, 620042001 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, "credo": {:hex, :credo, "1.7.0", "6119bee47272e85995598ee04f2ebbed3e947678dee048d10b5feca139435f75", [:mix], [{:bunt, "~> 0....
0430fc57fe526b86b0fa3cc023ac36f02154bf89
2,252
[ 83444348 ]
[ "supervisor", "documented" ]
defmodule Nerves.Runtime.Application do @moduledoc false use Application alias Nerves.Runtime.FwupOps alias Nerves.Runtime.KV require Logger @impl Application def start(_type, _args) do load_services() options = Application.get_all_env(:nerves_runtime) children = [{FwupOps, options}, {KV,...
04316d06c62ca1b0252a69efe056113ac86ab8e6
10,651
[ 256005654 ]
[ "typespec", "ecto", "genserver", "macro", "documented" ]
defmodule Sally.Dispatch do require Logger use GenServer alias Sally.Types, as: Types @callback child_spec(Types.child_spec_opts()) :: Supervisor.child_spec() @callback process(struct()) :: struct() @callback post_process(struct()) :: struct() @optional_callbacks [post_process: 1] defstruct subsystem...
04321e1e7c2ad660549eff7dd621d742e8fe8419
2,715
[ 829460509 ]
[]
import Config # Configure your database config :drafter, Drafter.Repo, username: "postgres", hostname: "localhost", database: "drafter_dev", stacktrace: true, show_sensitive_data_on_connection_error: true, pool_size: 10 # For development, we disable any cache and enable # debugging and code reloading. # #...
04323794de2905e7801e9d082eaf45bd4127f7ac
1,620
[ 898399771 ]
[ "genserver", "test" ]
defmodule LiveDebuggerRefactor.API.System.ProcessImplTest do use ExUnit.Case, async: true alias LiveDebuggerRefactor.API.System.Process.Impl, as: ProcessImpl defmodule TestServer do use GenServer def start_link(opts) do GenServer.start_link(__MODULE__, opts) end def init(_opts) do ...
04345c7b07f3f0030ba6e107d8b8b108bece3886
8,257
[ 362285971 ]
[]
%{ "certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hexpm", "524c97b4991b3849dd5c17a631223896272c6b0af446778ba4675a1dff53bb7e"}, "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mi...
0434b851df2e386c1a708a488f6cca3609e1703e
5,157
[ 605242810 ]
[ "documented" ]
defmodule Lexical.RemoteControl.Search.Indexer.Source.Reducer do @moduledoc """ A module and struct that can reduce over elixir AST via Macro.prewalk/3 The reducer keeps track of blocks and parent / child relationships so extractors don't have to concern themselves with the AST's overall structure, and can foc...
0434fd3f3d2a0c4945f876015dd388d12deee2b5
1,553
[ 998553982 ]
[ "documented" ]
defmodule TuiChat.RtmpClient do @moduledoc """ Minimal RTMP client for processing video streams. No state management - just pure stream processing. """ @rtmp_server "rtmp://localhost:1935/live" @doc """ Get list of active streams from RTMP server. """ def list_streams do case HTTPoison.ge...
04352e8f7d355d9f57d7d52569d8da3263cabdd6
11,248
[ 910853725 ]
[ "genserver", "test" ]
defmodule ElixirRaft.Network.TcpTransportTest do use ExUnit.Case, async: true alias ElixirRaft.Network.TcpTransport alias ElixirRaft.Core.NodeId alias ElixirRaft.Core.{LogEntry, Term} alias ElixirRaft.RPC.Messages require Logger @moduletag :capture_log @connection_timeout 1000 @message_timeout 2000 ...
04354664304dbd3153abfbd69c6ba1ce92aa4b66
4,443
[ 479785625 ]
[]
defmodule Diagnostics do defmodule CountHolder do defstruct num0: 0, num1: 0 def put_value(value, count) do case value do 0 -> %CountHolder{count | num0: count.num0 + 1} 1 -> %CountHolder{count | num1: count.num1 + 1} _ -> count end end end def calc_diagnostics() ...
04354deb4ea072fe0a789665f369759f96135347
3,515
[ 429220654 ]
[ "typespec", "documented" ]
defmodule AdventOfCode2019 do @moduledoc """ AdventOfCode2019 is a a set of solutions to Advent of Code 2019 in Elixir! """ @doc """ Run the specified day with supplied input. Example: iex> ["12", "14", "1969", "100756"] |> AdventOfCode2019.stream_lines("1.1") 34_241 """ @spec stream_lines(Enume...
04356b7a8afd78d51ddd78c4f92f4df44535a34d
2,625
[ 870537691 ]
[ "liveview" ]
defmodule DemoWeb.DemoLive do use DemoWeb, :live_view @impl true def render(assigns) do ~H""" <div class="border-l-4 border-blue-400 bg-blue-50 p-4"> <div class="flex"> <div class="flex-shrink-0"> <.icon name="hero-information-circle-mini" class="h-5 w-5 text-blue-400" /> <...
04362df21b06c1916a1db892c95a32d7486e9424
1,707
[ 330301269 ]
[ "liveview", "phoenix" ]
defmodule TechFromScratchWeb.Endpoint do use Phoenix.Endpoint, otp_app: :tech_from_scratch # 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, ...
043639da43ee458b7ef6c232e3f21953aa583a10
1,928
[ 132272516 ]
[]
defmodule Gestalt.MixProject do use Mix.Project @version "2.0.0" def project do [ aliases: aliases(), app: :gestalt, deps: deps(), description: description(), dialyzer: dialyzer(), docs: docs(), elixir: "~> 1.15", package: package(), source_url: "https:/...
0436b63255b1ef5fb86c826cd0dace0547ed6265
1,844
[ 797331361 ]
[ "liveview", "phoenix" ]
defmodule NervesHubWeb.Endpoint do use Phoenix.Endpoint, otp_app: :nerves_hub use Sentry.PlugCapture @session_options [ store: :cookie, key: "_nerves_hub_key", signing_salt: "1CPjriVa" ] socket("/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]) socket("/...
0436cb5a45c7f79ed424d65d6941f1da0089e2ab
1,584
[ 828084018 ]
[ "test" ]
defmodule Azimutt.Blog.ArticleTest do use Azimutt.DataCase alias Azimutt.Blog.Article alias Azimutt.Blog.Article.Author describe "article" do test "path_to_id" do assert "the-story-behind-azimutt" = Article.path_to_id("priv/static/blog/2021-10-01-the-story-behind-azimutt/the-story-behind-azimutt.md")...
04379d032911240e25a74995e360514598e10d8a
4,024
[ 606714883 ]
[ "documented" ]
defmodule Fliplove.Bitmap.Maze do alias Fliplove.Bitmap @doc """ Generate a maze. Both width and height must be odd numbers """ require Integer require Logger def generate_maze(bitmap) do generate_maze(bitmap.width, bitmap.height) end def generate_maze(width, height) do if Integer.is_even(w...
0437d1664adb27be47e959225808f646fdc84ad7
3,418
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CloudScheduler.V1.Model.RetryConfig do @moduledoc """ Settings that determine the retry behavior. By default, if a job does not complete successfully (meaning that an acknowledgement is not received from the handler, then it will be retried with exponential backoff according to the settings in R...
0438286a7980ffb323fbc0d70419d8589a292152
13,255
[ 559744925, 18573162, 610034669, 884344453, 443129197, 694781452, 521625231, 574493719, 510809929, 612444079 ]
[ "typespec", "documented" ]
defmodule Faker.Company.En do import Faker, only: [sampler: 2] alias Faker.Person.En, as: Person @moduledoc """ Functions for company data in English """ @doc """ Returns a random complete English business related bullshit ## Examples iex> Faker.Company.En.bs() "syndicate e-business e-b...
0438be2d3eeff7b78d43dd73e1b72d89a3cc3d36
1,846
[ 408030046 ]
[ "documented", "ecto" ]
defmodule StoneMarkets.Order do @moduledoc """ This module is responsible for mapping any data source into a Order struct. """ use Ecto.Schema import Ecto.Changeset alias Ecto.Changeset alias StoneMarkets.{Customer, Marketplace, OrderProduct, Product} alias StoneMarkets.Marketplaces.FormatMonetaryVa...
0439048576ceb892e0d46ca4eda7fa7584c1b378
3,745
[ 393733153 ]
[ "typespec", "documented" ]
defmodule BrodMimic.GroupSubscriberWorker do @moduledoc """ Implements the `BrodMimic.TopicSubscriber` behaviour """ @behaviour BrodMimic.TopicSubscriber use BrodMimic.Macros import Record, only: [defrecordp: 2] alias BrodMimic.Utils, as: BrodUtils require Logger @starting_group_subscriber "Start...
0439069cc6bf77e84b1a940e59bd3ce772dd93e7
1,564
[ 258024188 ]
[ "macro", "documented", "phoenix" ]
defmodule CountersWeb 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 CountersWeb, :controller use CountersWeb, :view The definitions below will be executed for every view, controlle...
043915343c80e114bf01610830e8caf69aec52ed
1,642
[ 506799163 ]
[ "typespec" ]
defmodule Peridiod.SigningKey do defstruct type: :ed25519, public_der: nil @type t() :: %__MODULE__{ type: :ed25519, public_der: ed25519_public_key() } @type ed25519_public_key :: binary @ed25519_prefix <<0x30, 0x2A, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x70, 0x03, 0x21...
04392e74a1cf5aa93adc63db432a2dffe52b7358
4,565
[ 234686244 ]
[ "documented" ]
defmodule Identicon do @moduledoc """ Converts a string into an identicon This module uses md5 encoding to convert string into a binary We save the binary into a list we select the first 3 elements in the list to select the color for identicon The full list will be match to first 3 x 5 grids from identicon...
04393d95407dd3deed211811909f60146b7340aa
2,580
[ 698388260 ]
[ "documented" ]
defmodule AshEvents.EventLog.Transformers.AddActions do @moduledoc false use Spark.Dsl.Transformer def transform(dsl) do replay_overrides = AshEvents.EventLog.Info.replay_overrides(dsl) primary_key = AshEvents.EventLog.Info.event_log_primary_key_type!(dsl) persist_actor_primary_keys = AshEvent...
04394dd905017c98d027905a1aab1711582f4d07
3,076
[ 309451922 ]
[ "test" ]
defmodule LatencyExperiment.Raft do use ExUnit.Case doctest Calvin doctest Raft import Emulation, only: [spawn: 2] import Kernel, except: [spawn: 3, spawn: 1, spawn_link: 1, spawn_link: 3, send: 2] @tag timeout: :infinity test "run multiple latencies experiment with Raft replication" do Enum.m...
043952fc84931a38decdb5082d99dc5f4db199de
1,747
[ 487360938 ]
[ "genserver", "documented" ]
defmodule Server.Tcp.ConnectionListener do @moduledoc """ A GenServer with the only goal of accepting new connections. Upon a new connection, it will spawn a dedicated GenServer to handle the game for that player """ use GenServer def start_link(opts) do GenServer.start_link(__MODULE__, op...
043960a4e0827c2e8753a74ed1ef278fc96ea21d
3,535
[ 493899754 ]
[ "test" ]
defmodule FoodDiaryWeb.SchemaTest do use FoodDiaryWeb.ConnCase, async: true use FoodDiaryWeb.SubscriptionCase alias FoodDiary.User alias FoodDiary.Users describe "users query" do test "when a valid id is given, returns the user", %{conn: conn} do params = %{email: "<EMAIL>", name: "Caio"} {...
04396fe9a8d182b4ba8034421488e3424d5347bf
4,699
[ 672584521 ]
[ "typespec", "documented", "ecto" ]
defmodule PeerLearning.Courses.UserCourseOutline do @moduledoc false alias PeerLearning.Repo alias PeerLearning.Courses.Course alias PeerLearning.Accounts.{User, Children} alias PeerLearning.Courses.{CourseOutline, CourseSubscription} use PeerLearning.Schema import Ecto.Query import PeerLearning.Dynami...
0439f2aeb0703482161d9fac76c27ae5dd5a0d8d
7,743
[ 911007630 ]
[ "test", "liveview" ]
defmodule GoapTest do use ExUnit.Case doctest Goap defmodule Task do use TypedStruct typedstruct do field :id, Integer.t(), default: 0 field :status, String.t(), enforce: true, default: "pending" field :name, String.t(), enforce: true field :args, Map.t(), enforce: true end ...
043a5b4f9bfa9760e5caf8198bd82e8638357f7f
7,318
[ 942811655, 920024200 ]
[ "typespec", "documented" ]
defmodule InternalApi.Okta.OktaIntegration do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ id: String.t(), org_id: String.t(), creator_id: String.t(), created_at: Google.Protobuf.Timestamp.t(), updated_at: Google.Protobuf.Timestamp.t(), ...
043a7f639baa2cecb5d1c0cd38b22b41225b30d9
2,632
[ 205259136 ]
[ "documented" ]
defmodule Ipfinder.Validation.Ipvalidation do @moduledoc """ # IPFinder elixir Client Library The official elixir client library for the [IPFinder.io](https://ipfinder.io) get details for : - IP address details (city, region, country, postal code, latitude and more ..) - ASN details (Organization name,...
043a803fc3113f3f635548dcc5bfb2b9227aa998
1,958
[ 89542163 ]
[ "documented" ]
defmodule ALittleSketch.Mixfile do use Mix.Project def project do [app: :a_little_sketch, version: "0.0.#{committed_at()}", elixir: "~> 1.4", elixirc_paths: elixirc_paths(Mix.env), compilers: [:phoenix, :gettext] ++ Mix.compilers, start_permanent: Mix.env == :prod, aliases: aliase...
043af8577edc1ec6b2f037de1ac33bd1a60864f5
2,370
[ 628059268 ]
[ "liveview", "ecto" ]
defmodule GameLibraryWeb.GameLive.FormComponent do use GameLibraryWeb, :live_component alias GameLibrary.GameDB @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> <:subtitle>Use this form to manage game records in your database.</:subtitle> </.header> ...
043bec83dd69f67c3f3335a2b7c3b09b20dcb569
2,294
[ 932379402 ]
[]
defmodule Caltar.Calendar.Provider.Icalendar do use Caltar.Calendar.Provider use Caltar.Http alias Caltar.Storage.Provider alias Caltar.Calendar.Event alias Caltar.Calendar.Provider.Icalendar.Params, as: IcalendarParams alias Caltar.Calendar.Provider.Icalendar.Formula1Params alias Caltar.Storage.Configur...
043c5af72ab1cbc8fb0182b472549eff8694a0c6
3,358
[ 769695238 ]
[ "liveview", "test" ]
defmodule AuthorizeWeb.Buzz.TopicLiveTest do use AuthorizeWeb.ConnCase import Phoenix.LiveViewTest import Authorize.Buzz.TopicsFixtures @create_attrs %{title: "some title"} @update_attrs %{title: "some updated title"} @invalid_attrs %{title: nil} defp create_topic(_) do topic = topic_fixture() ...
043c719b5db0aa904a3a8d7448bd483015ec7589
1,759
[ 771337342 ]
[]
defmodule Foggy do alias Foggy.Repo alias Foggy.Db def foggy_weather(location, lat, long) do IO.puts( IO.ANSI.blue() <> "Wind’s howling. Don’t mistake the stars reflected in a pond at " <> "night for those in the sky. Consulting the weather..." <> IO.ANSI.reset() ) IO.w...