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
0307c260836f82a1c9d7895cb3b4e687444b3de3
2,010
[ 796060990 ]
[]
defmodule Complex.Mixfile do use Mix.Project def project do [ app: :complex, version: "0.5.0", description: description(), package: package(), elixir: "~> 1.12", deps: deps(), docs: [ main: "Complex", authors: package()[:maintainers], extras: []...
03086c638b857742960b294a31b4725efa2a04c2
2,530
[ 114043693 ]
[ "test" ]
defmodule ListAndTablesTest do use ExUnit.Case defp ul lines do """ <ul> #{Enum.map( lines, &("<li>#{&1}\n</li>\n") )}</ul> """ end test "Simple list render with |" do result = Monocle.as_html!(["* one | half", "* two | third"]) expected = ul([ "one | half", "two | third" ]) assert...
0308b2e57b59b603f6ca58de669ee74523af28df
2,192
[ 247417321 ]
[ "typespec", "documented" ]
defmodule RlStudy.MDP.State do @typedoc """ Custom type of State. """ @type t :: %RlStudy.MDP.State{row: integer, column: integer} defstruct row: -1, column: -1 @doc """ # Examples iex> RlStudy.MDP.State.new() %RlStudy.MDP.State{} """ @spec new :: RlStudy.MDP.State.t() def new() do ...
0308dc39f030254360568e9259f7aa007abd4708
2,354
[ 744229428 ]
[]
defmodule KVServer do require Logger def accept(port) do {:ok, listen_socket} = :gen_tcp.listen(port, [ :binary, packet: :line, active: false, reuseaddr: true ]) Logger.info("Accepting connections on port #{port}") loop_acceptor(listen_socket) end # thi...
0308e1a7cb9b73fd9bb4ea3f2488d4953273204e
5,658
[ 465889334 ]
[ "typespec" ]
defmodule Moves do import ListP @type wagon() :: {:var, atom()} @type track() :: {:main, atom()} | {:one, atom()} | {:two, atom()} @type train() :: [] | [wagon(), ...] @type move() :: {track(), {:num, number()}} @type state() :: {[train()], [train()], [train()]} # #...
0308e7995dcdfa79263214a0d9af16e1ddec35ff
2,662
[ 162134264, 244421451, 317778299 ]
[ "documented" ]
defmodule MatrixReloaded do @moduledoc """ Documentation for Matrix Reloaded library. This a library is focusing only on updating, rearranging, getting/dropping row/column of a matrix. Also contains a few matrix operations like addition, subtraction or multiplication. Anyway if you need make fast operations ...
0308f4f7953bf9362b1f2e18caa352772fae3667
2,048
[ 904332297 ]
[]
defmodule Tunnels do # - Filtra as leituras do input para # deixar apenas as que possuem sensores que possam cobrir a linha # fornecida def relevant_readings(readings, row) do Enum.filter(readings, fn reading -> sensor = reading.sensor x = sensor |> elem(0) Utils.manhattan_distance({x, row...
03093f5f4cb0e2a2f200ff8f4afbf1eb7556edd0
1,588
[ 195524549, 59223100, 672902900 ]
[ "typespec", "macro", "documented" ]
defmodule Xandra.TypeParser do @moduledoc false @type type :: atom | {atom, [type]} @builtin_types [ :text, :blob, :ascii, :bigint, :counter, :int, :varint, :boolean, :decimal, :double, :float, :inet, :timestamp, :uuid, :timeuuid, :date, :small...
03098ca4f6bb15164808781669fbfcf3c585d9dd
3,230
[ 527558259 ]
[ "liveview", "test" ]
defmodule TwilixirBotWeb.LoginLiveTest do use TwilixirBotWeb.ConnCase import Phoenix.LiveViewTest import TwilixirBot.AccountsFixtures @create_attrs %{} @update_attrs %{} @invalid_attrs %{} defp create_login(_) do login = login_fixture() %{login: login} end describe "Index" do setup [:c...
0309d4b7aa9224b94c521240a8d33d49dc92ffc3
2,765
[ 209074830 ]
[]
defmodule MarkevichMoney.Pipelines.Help.Messages do use MarkevichMoney.Constants alias MarkevichMoney.Steps.Telegram.{SendMessage} @output_message """ Привет! Нужна помощь по какому-то вопросу? Жми кнопку с интересующей тебя темой! """ def call(payload) do payload |> Map.put(:output_message, @outp...
0309f85b21703847db164cacbe4f4b983a36296d
3,302
[ 120193931 ]
[]
defmodule IslandsInterfaceWeb.GameChannel do use IslandsInterfaceWeb, :channel alias IslandsEngine.{Game, GameSupervisor} def join("game:" <> _player, _payload, socket) do {:ok, socket} end def handle_in("hello", payload, socket) do broadcast!(socket, "said_hello", payload) {:noreply, socket} ...
030a28582c6f45906bdc676fff8c025d949e8015
1,722
[ 205228081 ]
[]
defmodule CiMetrics.GithubClient do require Logger @http_client Application.get_env(:ci_metrics, :http_client, CiMetrics.HTTPClient) @callback create_webhook(map()) :: {:ok, nil} | {:error, any()} def create_webhook(webhook) do secret = Application.get_env(:ci_metrics, :github_secret) url = "ht...
030a4b64897a2beb01433e14ac90ea85ab087d31
7,932
[ 555225235 ]
[ "documented", "ecto" ]
defmodule Apartman.Facility do @moduledoc """ The Facility context. """ import Ecto.Query, warn: false alias Apartman.Repo alias Bolt.Sips, as: Neo alias Apartman.Facility.Building @doc """ Convert result from Neo4j (map) into Absinthe prefered format """ def map_to_absinthe(node) do %{ ...
030a6f9e0dff921ea2589413256c7fef2ab9c731
1,949
[ 418440087 ]
[ "test", "ecto" ]
defmodule CpLadder.AuthenticationTest do use CpLadder.DataCase alias CpLadder.Authentication describe "users" do alias CpLadder.Authentication.User import CpLadder.AuthenticationFixtures @invalid_attrs %{email: nil, password_hash: nil} test "list_users/0 returns all users" do user_fixtu...
030ae024875a2f45fdf8f6f48fd8beb6f29efa44
21,065
[ 315437505 ]
[]
%{ "circuits_spi": {:hex, :circuits_spi, "0.1.5", "5f1901c77fb982217a956498ba0d9d0d47cc58ec47731020621b5c95eee296c0", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "134e1ded8e0379e3314a507e80a304cf5ba54edf294e157b7e7ecedcdca30dfd"}, "cowboy": {:hex, :cowboy...
030aedc2510b5e9a6c08c7ad30bcd485f31ad43e
2,996
[ 384547149 ]
[]
import Config # Use shoehorn to start the main application. See the shoehorn # docs for separating out critical OTP applications such as those # involved with firmware updates. config :shoehorn, init: [:nerves_runtime, :nerves_pack], app: Mix.Project.config()[:app] # Nerves Runtime can enumerate hardware devices...
030b27381466aea4ec2fc06d83e31daf198d376f
2,123
[ 439746840 ]
[]
defmodule AdventOfCode.Day09 do def plot_line(line, acc) do {grid, {_x, y}} = line |> String.split("", trim: true) |> Enum.map(&String.to_integer/1) |> Enum.reduce(acc, &plot/2) {grid, {0, y + 1}} end def plot(elem, {grid, {x, y}}) do {Map.put(grid, {x, y}, elem), {x + 1, y}}...
030bdb3bb1f23cdc613e477dbd813fc0b92d275f
4,256
[ 145753762 ]
[ "typespec", "documented", "ecto" ]
defmodule BankLogic do @moduledoc """ Module that implements Bank's public interface """ alias BankLogic.Account @doc """ Returns all accounts ## Examples iex> BankLogic.all() {:ok, [%BankLogic.Schemas.Account{ __meta__: #Ecto.Schema.Metadata<:loaded, "accounts">, amount: %Money{amount: ...
030c0a21597a47730fe44383ffcfc586a7577a67
2,154
[ 290317857 ]
[ "documented", "ecto" ]
defmodule Remembrall.Library do @moduledoc """ The Library context. """ import Ecto.Query, warn: false alias Remembrall.Repo alias Remembrall.Library.{ Passage, PassageQuery } @doc """ Returns the list of passages. ## Examples iex> list_passages() [%Passage{}, ...] """ ...
030c3e181c62a2b8e7445074f8700e84a619a160
1,746
[ 697235602 ]
[ "liveview", "documented" ]
defmodule SimonWeb.Core.Input do @moduledoc false use Phoenix.Component attr :id, :any, default: nil attr :name, :any attr :label, :string, default: nil attr :value, :any attr :type, :string, default: "text", values: ~w(checkbox color date datetime-local email file hidden month number password ...
030d1f8536071b8bfab4a2f7c9b3914ced15a71a
2,760
[ 165673817 ]
[ "test" ]
if !System.get_env("EXERCISM_TEST_EXAMPLES") do Code.load_file("simple_cipher.exs", __DIR__) end ExUnit.start() ExUnit.configure(trace: true, exclude: :pending) defmodule SimpleCipherTest do use ExUnit.Case # @tag :pending test "encoding with 'a' returns the original text" do assert SimpleCipher.encode("...
030d5707d62a94039eb44e07972affa1c9dc2ee9
3,154
[ 989439969 ]
[]
defmodule AshJsonApiSwaggerRepro.MixProject do use Mix.Project def project do [ app: :ash_json_api_swagger_repro, version: "0.1.0", elixir: "~> 1.14", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, consolidate_protocols: Mix.env() != :dev, ...
030d7369e7f1afa16e8613aaf04a40880deecbd3
2,689
[ 40109433 ]
[ "documented" ]
defmodule Ace.HTTP2.Settings do @moduledoc false @enforce_keys [ :enable_push, :max_concurrent_streams, :initial_window_size, :max_frame_size ] defstruct @enforce_keys @max_frame_size_default 16384 @max_frame_size_maximum 16_777_215 @initial_window_size_default 65535 @initial_window_s...
030dcf36846d2586e9b2fb43181c8812cababf2d
2,369
[ 457259031 ]
[ "genserver" ]
defmodule ModularAudioElixir.AudioServer do use GenServer def start_link(_opts) do GenServer.start_link(__MODULE__, :ok, name: AudioServer) end def init(:ok) do Process.send_after(self(), :ready4more, 0) avail_mods = Application.get_env(:modular_audio_elixir, :audio_modules) # TODO: this crea...
030ea4f5b4705641cc71889374abaf7d2feb90d1
1,601
[ 58168642 ]
[ "phoenix" ]
defmodule Sonora.ArtistController do use Sonora.Web, :controller alias Sonora.Artist plug :scrub_params, "artist" when action in [:create, :update] def index(conn, _params) do artists = Repo.all(Artist) render(conn, "index.json", artists: artists) end def create(conn, %{"artist" => artist_params...
031058101821647e3af71f7a466e2b6b9fc559b1
2,591
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.NetworkSecurity.V1.Model.AuthorizationPolicy do @moduledoc """ AuthorizationPolicy is a resource that specifies how a server should authorize incoming connections. This resource in itself does not change the configuration unless it's attached to a target https proxy or endpoint config selector r...
0310be60deaaaf1206abb7c8a2e3c8a1d85281ab
2,856
[ 364321886 ]
[]
%{ type: :level, ref: "6399103b-603a-4b6e-9e71-aa3c8188a458", title: "Obstacle course", ast_templates: [nil], available_blocks: [:move_forward, :turn_left, :turn_right, :loop, :while, :repeat, :if, :if_else, :halt], description: "TODO", goal_description: [ primary: "Move the robot to the destinated lo...
0310e1b6d5ed4e83c5c76746931de3eeea1428a2
4,539
[ 401949847, 423405342, 681629586, 882758430, 290969763, 837319868, 389721503, 694781452, 425181504, 929037144, 858623909, 677687005, 299711271, 922960360, 294468145, 678714584, 612062134, 22305306, 376928281, 377273858, 514687923 ]
[ "typespec", "documented" ]
defmodule Timex.Comparable.Diff do @moduledoc false alias Timex.Types alias Timex.Duration alias Timex.Comparable @spec diff(Types.microseconds(), Types.microseconds(), Comparable.granularity()) :: integer @spec diff(Types.valid_datetime(), Types.valid_datetime(), Comparable.granularity()) :: integer de...
0310f38da27731bac7c4066c7e2415928f7b80e2
4,270
[ 81265838 ]
[]
require IEx defmodule Reasoner do require Logger def run_loop(agent) do reason_cycle(agent) end def reason_cycle(agent) do agent_state = ExAgent.Mod.agent_state(agent) {_, new_agent_state} = reason(agent_state) ExAgent.Mod.set_agent_state(agent, new_agent_state) end def reason(%AgentStat...
0311426c2288a38de1918109599fe3a54da88bce
3,017
[ 278490391 ]
[ "typespec" ]
defmodule Slurp.Adapter do @type endpoint :: String.t() @type latest_block_number :: String.t() @type earliest_block_number :: String.t() @type pending_block_number :: String.t() @type hex_block_number :: String.t() @type block_number :: non_neg_integer() @type event_signature :: String.t() @type hash...
0311714718753a6837e905ef36e774169dab10cf
7,255
[ 764883932 ]
[ "test" ]
defmodule DevopsInsights.DeploymentFrequency.DeploymentFrequencyMetricTest do alias DevopsInsights.DeploymentFrequency.DeploymentFrequencyGateway alias DevopsInsights.EventsIngestion.IntervalFilter alias DevopsInsights.EventsIngestion.Deployments.DeploymentsGateway use DevopsInsights.DataCase test "date rang...
0311ac1d75f16f2e16b0d6ef14db39af6d3d1d3d
2,176
[ 115302761 ]
[ "phoenix" ]
defmodule PmApiWeb.UserinterestController do use PmApiWeb, :controller alias PmApi.Projectmode alias PmApi.Projectmode.Userinterest alias PmApi.Projectmode.Interest action_fallback PmApiWeb.FallbackController # def index(conn, _params) do # userinterests = Projectmode.list_userinterests() # rende...
03120a3de24cb70da7d632286bcf544ea024f094
2,374
[ 972810178, 168643505 ]
[]
defmodule Web.Admin.QuestStepController do use Web.AdminController alias Web.Quest def new(conn, %{"quest_id" => quest_id, "quest_step" => %{"type" => type}}) do quest = Quest.get(quest_id) changeset = Quest.new_step(quest) conn |> assign(:type, type) |> assign(:quest, quest) |> assign(...
03128cd6506bebc7506ec53124a038bfdb1b9176
2,581
[ 973907049 ]
[ "test", "ecto" ]
defmodule Pair.RecordingsTest do use Pair.DataCase alias Pair.Recordings describe "recordings" do alias Pair.Recordings.Recording import Pair.RecordingsFixtures @invalid_attrs %{upload_url: nil, transcription: nil, actions: nil} test "list_recordings/0 returns all recordings" do recordi...
0312ea860f81efc19befa817920cb0c901e7913f
2,096
[ 203434040 ]
[ "documented", "ecto" ]
defmodule Gradi.Directors do @moduledoc """ The Directors context. """ import Ecto.Query, warn: false alias Gradi.Repo alias Gradi.Directors.Director @doc """ Returns the list of directors. ## Examples iex> list_directors() [%Director{}, ...] """ def list_directors do Repo.al...
0312f1514d9961d4f76952e43e31317c289c353f
13,077
[ 567291298 ]
[ "typespec", "documented", "ecto" ]
defmodule TalkWeb.Resolver.Messages do @moduledoc "Resolver module for messages queries and mutations" import Ecto.Query, warn: false import Absinthe.Resolution.Helpers require Logger alias Ecto.Changeset alias Talk.AssetStore alias Talk.{Groups, Messages, Medias, Users} alias Talk.Schemas.{Group, Mes...
0313231584253eccea0397c5d19d1815a61c7588
1,699
[ 663911265 ]
[ "documented" ]
defmodule TorCell.Authenticate do defstruct type: nil, auth: nil defp decode_type(type) do case type do 1 -> :rsa_sha256_tlssecret 3 -> :ed25519_sha256_rfc5705 end end defp decode_auth(auth, type) do case type do :rsa_sha256_tlssecret -> TorCell.Authenticate.RsaSha256...
03132e5a422a9740d7d0975bfe18b223a73eb3d6
2,421
[ 241048728, 83907624, 173038798 ]
[ "phoenix", "ecto" ]
defmodule PlatformWeb.PlayerController do use PlatformWeb, :controller alias Platform.Accounts alias Platform.Accounts.Player plug(:authorize when action in [:edit]) def index(conn, _params) do players = Accounts.list_players() render(conn, "index.html", players: players) end def new(conn, _pa...
0313657022d5f94982eef3035a7e5bae13e3116a
2,176
[ 434349090 ]
[]
defmodule Day17.Launcher do # ------------------------------------------------------- # Configuration # ------------------------------------------------------- alias Day17.Probe, as: Probe alias Day17.Target, as: Target defstruct [:target] # ------------------------------------------------------- ...
03138b8ab0971d5b04a9dd946a548a664cfbda02
1,651
[ 817211236 ]
[ "liveview" ]
defmodule PentoWeb.GameLive.Board do use PentoWeb, :live_component alias Pento.Game.{Board, Pentomino} import PentoWeb.GameLive.{Colors, Component} def render(assigns) do ~H""" <div id={ @id } phx-window-keydown="key" phx-target={ @myself }> <.canvas view_box="0 0 200 70"> <%= for shape <...
0313bed14244ca85132b86ab5d4b5c1dbd82e17e
2,860
[ 585656687 ]
[ "genserver", "liveview" ]
defmodule WebBaitWeb.AgentLive.Commands do use WebBaitWeb, :live_view alias WebBait.Presence alias WebBait.C2 alias WebbaitWeb.AgentLive.SearchComponent alias WebbaitWeb.AgentLive.OnlineStatusComponent @impl true def mount(%{"id" => id}, _session, socket) do if connected?(socket) do Phoenix.Pu...
031421c0125a83153065fc25c60cf8be346a9b11
4,189
[ 164505694 ]
[ "test" ]
defmodule Rolodex.SchemaTest do use ExUnit.Case alias Rolodex.Schema alias Rolodex.Mocks.{ Comment, NotFound, Parent, User, WithPartials } doctest Schema describe "#schema/3 macro" do test "It generates schema metadata" do assert User.__schema__(:name) == "User" asser...
03148384a70cea66a558ead9a0e72c1b8a94c8b5
4,012
[ 572828566 ]
[ "documented" ]
import AOC aoc 2023, 19 do @moduledoc """ https://adventofcode.com/2023/day/19 """ @doc """ iex> p1(example_string()) 19114 iex> p1(input_string()) 434147 """ def p1(input) do {rules, xmas} = input |> parse_input() xmas |> Enum.map(fn x -> execute_p1(rules...
0314952054e0ad08d8a405e291098aaf6a106f11
1,742
[ 195721073, 249574380, 382794397 ]
[ "ecto" ]
defmodule Rumbl.Multimedia do import Ecto.Query, warn: false alias Rumbl.Repo alias Rumbl.Multimedia.{Video, Category} alias Rumbl.Accounts def list_videos do Repo.all(Video) end def create_category!(name) do Repo.insert!(%Category{name: name}, on_conflict: :nothing) end def list_alphabeti...
0314bbc28d79797879b00ef50a8a5b21eb4e4a65
1,643
[ 585915775, 589089007, 589866492, 691980346, 215544723, 500260157 ]
[]
defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do @behaviour Pleroma.Web.ActivityPub.MRF.Policy alias Pleroma.Config alias Pleroma.User alias Pleroma.Web.CommonAPI require Logger @impl true def filter(message) do with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]), ...
031506a60b74c60f03e7947264dc5ae6ad6bb2c2
8,406
[ 1018736946 ]
[ "genserver", "typespec", "liveview", "documented" ]
defmodule LiveFilter.Components.QuickFilter do @moduledoc """ A dynamic filter component that renders the appropriate input based on filter type. This component automatically detects the filter type and renders the appropriate UI element (text input, select, date picker, etc.) with consistent styling and beh...
0315482c43da6376993b78b05c64ca803b357545
1,748
[ 95003206 ]
[ "phoenix" ]
defmodule Todo.TodoController do use Todo.Web, :controller alias Todo.Todo def index(conn, _params) do todos = Repo.all(Todo) render(conn, "index.html", todos: todos) end def new(conn, _params) do changeset = Todo.changeset(%Todo{}) render(conn, "new.html", changeset: changeset) end de...
0315badf0f3b10b57660700a9f774ec600aced53
1,886
[ 697745458 ]
[]
# 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 :time_manager, :phoenix_swagger, swagger_fil...
03162c068a1a73c817fa1dc8524d5caf075fbe81
4,574
[ 145299388 ]
[]
%{ "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65...
03171dac3b0466b5fe517b236f5111b0b8a3827e
6,127
[ 814278644 ]
[]
%{ "bandit": {:hex, :bandit, "1.6.11", "2fbadd60c95310eefb4ba7f1e58810aa8956e18c664a3b2029d57edb7d28d410", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optio...
0317840ae60203107198f3fa7181976514bb9e05
1,680
[ 91567566 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule Greenfitdiety.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use Greenfitdiety.Web, :controller use Greenfitdiety.Web, :view The definitions below will be executed for every view, controller, etc...
0318952b36b35fa4254207a0a8b3f7ea03b59520
6,708
[ 470294292 ]
[ "typespec", "documented" ]
defmodule StarkInfra.CreditNote.Log do alias __MODULE__, as: Log alias StarkInfra.Utils.Rest alias StarkInfra.Utils.API alias StarkInfra.Utils.Check alias StarkInfra.CreditNote alias StarkInfra.User.Project alias StarkInfra.User.Organization alias StarkInfra.Error @moduledoc """ Groups CreditNote.L...
0319c806544c5b336b19792ac533c722a368684b
2,810
[ 557183263 ]
[ "test", "phoenix" ]
defmodule ApiWeb.WorkingtimeControllerTest do use ApiWeb.ConnCase import Api.WorkingtimesFixtures alias Api.Workingtimes.Workingtime @create_attrs %{ end: ~N[2022-10-24 07:56:00], start: ~N[2022-10-24 07:56:00] } @update_attrs %{ end: ~N[2022-10-25 07:56:00], start: ~N[2022-10-25 07:56:00...
0319edd346b961261ca9fdb49826a717e52e089f
3,623
[ 63152974 ]
[ "genserver", "documented" ]
defmodule Day5 do @input "ojvtpuvg" defmodule Crypto do @prefix "00000" #@prefix :binary.compile_pattern("00000") def hash(input, n) do :crypto.hash(:md5 , input <> Integer.to_string(n)) |> Base.encode16(case: :lower) end def interesting(@prefix <> rest), do: rest def interesting(_), ...
031a97c0332e06645a331d59ff5e6d9f1cb39c60
1,703
[ 421526769 ]
[ "documented", "ecto" ]
defmodule Xxx.Posts do @moduledoc """ The Posts context. """ import Ecto.Query, warn: false alias Xxx.Repo alias Xxx.Posts.Users @doc """ Returns the list of users. ## Examples iex> list_users() [%Users{}, ...] """ def list_users do Repo.all(Users) end @doc """ Gets a ...
031ad0ccd1969ef90dcccee42fc25caa6031dc88
3,709
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Offer do @moduledoc """ Represents an offer made to resellers for purchase. An offer is associated with a Sku, has a plan for payment, a price, and defines the constraints for buying. ## Attributes * `constraints` (*type:* `GoogleApi.CloudChannel...
031ba2386154de74d0c2a872033ceda8980a12e3
1,826
[ 672584521 ]
[ "test", "ecto" ]
defmodule PeerLearning.AccountsTest do use PeerLearning.DataCase alias PeerLearning.Factory alias PeerLearning.{Accounts, Auth} alias PeerLearning.Accounts.User alias PeerLearning.Accounts.UserProfile describe "create_user/1" do test "success: it inserts a Apport.Accounts.User account in the db when v...
031c0602060c220dfcc84857f974f48166ac8d88
4,282
[ 674654866 ]
[ "documented", "ecto" ]
defmodule Tester.Scan4transports.Scan4transport do use Ecto.Schema import Ecto.Changeset schema "scan4transports" do field(:ship_to_locality, :string) field(:not_after_delivery_date, :date) field(:before_delivery_date, :date) field(:symbol, :string) field(:ship_to_phone_number, :integer) ...
031c7e6804564579ba2834b779322d37e89c027e
2,503
[ 129426758 ]
[ "typespec", "documented" ]
defmodule Acl.GraphSpec do alias Updates.QueryAnalyzer.Iri, as: Iri alias Acl.GraphSpec, as: GraphSpec alias Acl.GraphSpec.Constraint.Resource, as: ResourceConstraint require Logger require ALog @type t :: %GraphSpec{graph: String.t(), constraint: ResourceConstraint.t()} defstruct [:graph, :constraint]...
031c9db1cdb4a43f0eea0cd1819c55849f54ef03
8,021
[ 61282343 ]
[ "test" ]
defmodule SolrDocTest do use ExUnit.Case, async: true doctest SolrJournal setup do solr_article = %{ "_version_" => 1535294313411379200, "abstract_ts" => ["In this paper we present an alternative viewpoint on recent studies of regularity of solutions to the Navier-Stokes equations in critical spac...
031cadf85546b38b78d4cf4279e42c0f3a2740c0
1,654
[ 628742497 ]
[ "typespec", "documented" ]
defmodule ExUnitJumpstart.Templates do @moduledoc false # These functions generate output files from templates. # Name of app, used to get config from app environment @app :mix_deploy @doc "Generate file from template" @spec write_template(Keyword.t(), Path.t(), binary) :: boolean def write_template(va...
031d2801d5464d69e7b672bd97445c082c18a0c4
2,473
[ 809920907 ]
[ "documented" ]
defmodule Unleash.Config do @moduledoc false @defaults %{ url: "", appname: "unleash_ex", instance_id: Atom.to_string(node()), auth_token: {:env_var, "UNLEASH_CLIENT_KEY"}, metrics_period: 10 * 60 * 1000, features_period: 15 * 1000, strategies: Unleash.Strategies, backup_file: nil, ...
031d80e007c94e10dad23171056c63aef1d1014a
2,215
[ 346156988 ]
[ "ecto" ]
defmodule ParallelReportGenerator do alias ParallelReportGenerator.{MapMerger, Parser} def generate_parallel(filenames) do filenames |> Task.async_stream(&generate_from/1) |> Enum.reduce(initial_acc(), fn {:ok, result}, report -> merge_values(result, report) end) end # def generate_paral...
031d9ba5e8bd8081e5eef62463ef668b01e7d13d
1,589
[ 257287947 ]
[ "liveview", "phoenix" ]
defmodule RenaWeb.Endpoint do use Phoenix.Endpoint, otp_app: :rena # 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: "_rena_key", ...
031dbb57f840c0b08ecb6270902aed3a01b204dc
5,549
[ 10414427 ]
[]
defmodule IexTest.Runner do import IexTest.Splitter, only: [ split_tests: 2] import Enum, only: [ each: 2, join: 2, map: 2, reduce: 3 ] import String, only: [ split: 2, trim: 1 ] alias IexTest.TestSequence, as: TS alias IexTest.Test, as: T alias IexTest.IexBlock, as: I...
031dfa7ffbd721fbb1fee8227fc0934da3fdb7ea
2,508
[ 582609171 ]
[ "genserver", "liveview" ]
defmodule HandinWeb.ModulesLive.Index do use HandinWeb, :live_view alias Handin.Modules alias Handin.Modules.{Module} @impl true def mount(_params, _session, socket) do modules = Modules.list_module(socket.assigns.current_user) {:ok, assign(socket, :current_page, :modules) |> stream(:modules, modules...
031e705d710b0c4b4f15db07a85c67864775fa89
4,667
[ 672584521 ]
[]
# 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 :peer_learning, ecto_repos: [PeerLearning.Re...
031ec453264fee020a32f1a6a99addb382575ec7
1,696
[ 32404260 ]
[ "documented" ]
defmodule ESpec.Assertions.ThrowTerm do @moduledoc """ Defines 'throw_term' assertion. it do: expect(function).to throw_term it do: expect(function).to throw_term(term) """ use ESpec.Assertions.Interface defp match(subject, []) do try do subject.() {false, false} catch term ->...
031edd0478207fea925847ea5ae8a124ebd62533
2,419
[ 209825798, 480133219 ]
[ "test", "ecto" ]
defmodule Ms.DeliveryManagementTest do use Ms.DataCase alias Ms.DeliveryManagement describe "deliveries" do alias Ms.DeliveryManagement.Delivery @valid_attrs %{address: %{}, details: %{}, fare: 120.5} @update_attrs %{address: %{}, details: %{}, fare: 456.7} @invalid_attrs %{address: nil, detail...
031f0ad9ca47b7b6b86d224816c582c211189033
2,983
[ 640656590, 599193220, 606850121, 564964111, 576295356, 637945987, 258138756, 600362606, 607779167, 580858551, 660716857, 669079833, 575449429, 790205522, 61451301, 449346660, 575507361, 592311457, 534653779, 594893960, 597952057, 216080783, 587331839, 212964174, 42779...
[ "test" ]
defmodule CommunityGardenTest do use ExUnit.Case @tag task_id: 1 test "start returns an alive pid" do assert {:ok, pid} = CommunityGarden.start() assert Process.alive?(pid) end @tag task_id: 2 test "when started, the registry is empty" do assert {:ok, pid} = CommunityGarden.start() assert ...
03210317d0628792ad38efa70fd7d87306ba75b6
10,906
[ 23626547 ]
[]
%{ "absinthe": {:hex, :absinthe, "1.4.16", "0933e4d9f12652b12115d5709c0293a1bf78a22578032e9ad0dad4efee6b9eb1", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, "bunt": {:hex, :bunt, "0.2.0", "951c6...
0321340e8b781548440508490fc4608fd7062243
2,004
[ 103827883 ]
[ "ecto" ]
import Logger import Ecto.Query import Khcpl.Service.BandcampCrawler defmodule Khcpl.Service.EventCrawler do def crawl do # id = "1528494680505018" id = "1890678421255855" token = "EAACEdEose0cBANCEBvUZChlhUnbLAcu0V6bKRM1cz8ZAA0s4Y3UIwDtWtH0NKWSGykUHH3WFuiY6A4jdQAw9hTXTEYuxq0L9FzUE8MouF9EN9Hig7jX9vsAt...
03213b1ceb176bad6c38eb40d3fdf1b3b5c9a6c1
1,628
[ 939686414 ]
[ "liveview", "phoenix" ]
defmodule CoinExchangeWeb.Endpoint do use Phoenix.Endpoint, otp_app: :coin_exchange # 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: ...
032169494776635474003c22690e0bfd56499d93
5,961
[ 668682762 ]
[ "phoenix" ]
# 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 :planet, ecto_repos: [Planet.Repo] # Config...
032268121fe487985bdafa96f4d72789fbda6a8e
3,524
[ 277226464 ]
[ "test" ]
defmodule HayaiLedger.Accounts.AccountTest do use HayaiLedger.DataCase import Support.Fixtures.AccountFixtures alias HayaiLedger.Accounts.Account alias HayaiLedger.Repo describe "validations" do test "returns error if no currency" do bad_name = Map.delete(account_attrs(), "currency") changeset =...
0322685d09aeeac883e39f7e892b8b8af5570daa
2,399
[ 326433191 ]
[ "test", "phoenix" ]
defmodule UapiWeb.OrdesControllerTest do use UapiWeb.ConnCase alias Uapi.Accounts alias Uapi.Accounts.Ordes @create_attrs %{ price: 42 } @update_attrs %{ price: 43 } @invalid_attrs %{price: nil} def fixture(:ordes) do {:ok, ordes} = Accounts.create_ordes(@create_attrs) ordes end ...
032278b77462267a3f91ba104663e8d338ff5777
1,626
[ 75267198 ]
[]
defmodule Five do def five_zeroes?(sequence) do first_five = Enum.take(sequence, 5) if first_five === '00000' do {true, [Enum.at(sequence, 5)], [Enum.at(sequence, 6)]} else false end end def solve_day_five_part_one(door_id) do do_solve_day_five_part_one(door_id, '0', '') end...
0322d55f8ab5330c2b0dc3130de577f87ad5b080
1,649
[ 378636119 ]
[ "documented", "ecto" ]
defmodule CattlePurchase.Commissions do alias CattlePurchase.{ Commission, Repo } import Ecto.Query, only: [from: 2] @doc """ Get commission from purchase """ def get_commission_from_purchase(purchase_id) do from(commission in Commission, where: commission.purchase_id == ^purchase_id) |> Rep...
03244c07dc019b00594630c5478b0feeae77f4a7
2,027
[ 803809623 ]
[]
import Config config :operately, :app_env, :test # Only in tests, remove the complexity from the password hashing algorithm config :bcrypt_elixir, :log_rounds, 1 # Configure your database # # The MIX_TEST_PARTITION environment variable can be used # to provide built-in test partitioning in CI environment. # Run `mix...
0325384c904160faf32202b0673fe898ab6c5ff2
2,299
[ 24563398 ]
[ "genserver", "documented" ]
defmodule FileWatcher do use GenServer @name FileWatcher @folder_rescan_interval 500 @flag_defaults [ allow_dir: false, allow_hidden: false, recursive: false] @doc """ Convenience method for starting the file watcher """ def start_link do GenServer.start_link(__MODULE__, :ok, name: ...
03258d2f40a34ddab9f3aec6d61f20532c9ebf16
12,820
[ 15400465 ]
[ "documented" ]
defmodule Hex.SCM do alias Hex.Registry.Server, as: Registry @moduledoc false @behaviour Mix.SCM @packages_dir "packages" @request_timeout 60_000 @fetch_timeout @request_timeout * 2 def fetchable? do true end def format(_opts) do "Hex package" end def format_lock(opts) do case Hex....
03263728b17a79c39f7c4c5d39597a26a5269962
7,658
[ 123528600 ]
[ "test", "supervisor", "documented", "ecto" ]
defmodule OMG.Watcher.State.PersistenceTest do @moduledoc """ Test focused on the persistence bits of `OMG.Watcher.State.Core` """ use ExUnitFixtures use ExUnit.Case, async: false import OMG.Watcher.TestHelper require OMG.Watcher.Utxo require Logger alias Ecto.Adapters.SQL.Sandbox alias OMG.Eth.Co...
0326bf928ec9b3fcfff5aac07a1def484b58cf1d
1,903
[ 84061804 ]
[ "typespec", "documented" ]
defmodule ProteinTranslation do def stop_position([h|t]) do cond do h == "STOP" -> stop_position(t) Enum.any?(t, fn(s) -> s == "STOP" end) -> stop_position(t) :else -> [h] ++ t end end @doc """ Given an RNA string, return a list of proteins specified by codons, in order. """ ...
032724f6761890d810d28b0c6efdff1f1a729f7f
3,641
[ 933514757 ]
[ "supervisor", "documented" ]
defmodule ExESDB.EmitterPool do @moduledoc false use Supervisor require Logger alias ExESDB.Themes, as: Themes def name(store, sub_topic), do: :"#{store}:#{sub_topic}_emitter_pool" def start_link({store, sub_topic, subscriber, pool_size, filter}) do Supervisor.start_link( __MODULE__, ...
03272ad96bcea7108de75bc220db33655367dce4
2,019
[ 51052378 ]
[ "macro", "documented" ]
defmodule :posterize_xt_timestamp do @moduledoc false @behaviour Postgrex.Extension import Postgrex.BinaryUtils, warn: false use Postgrex.BinaryExtension, [send: "timestamp_send"] @unix_epoch :calendar.datetime_to_gregorian_seconds({{1970, 1, 1}, {0, 0, 0}}) @gs_epoch :calendar.datetime_to_gregorian_second...
0327ee852486780afc0d96ef016d9c0d5a7de623
2,634
[ 75939131 ]
[]
%{"comeonin": {:hex, :comeonin, "3.0.1", "ec71ee1dac6271e7b319d4b14c72f79f51631bd668cd3dcfdd3fe5aea0436bbf", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, optional: false]}]}, "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], []}, "...
03283072a716e4c81f600aeee69a7db6683bce95
1,524
[ 162377738 ]
[ "phoenix" ]
defmodule Innerpeace.PayorLink.Web.EmailView do use Innerpeace.PayorLink.Web, :view def invite_url(url, password_token) do test = url |> String.split(":") |> Enum.at(1) case Mix.env do :dev -> "/create?password_token=#{password_token}" :prod -> "http:#{test}/create?password_toke...
0328718ebf56c3e7864fee2d6d5eb32b14939b3a
5,260
[ 30836972 ]
[ "documented" ]
defmodule Plant do @moduledoc """ Defines methods for interacting with an agent for modeling a species of plant within a SmartFarm simulation. The population is represented as a list of keyword lists, where each keyword list holds an individual plant's state. Sowing adds new plant states to ...
0328c4f7f4e04c633d0c8f5bb9476c057cf9f251
7,816
[ 365994433 ]
[ "macro", "documented" ]
defmodule Graphism.Auth do @moduledoc "Authorization module definition" alias Graphism.Entity def auth_funs(schema, scopes, default_policy, roles_expr) do unless roles_expr do raise "No role expression set in schema and no custom authorization is being used" end [ role_fun(roles_expr), ...
0328c7ecc30df11cf4397a2347f2f2897d8bdac9
2,334
[ 929711688 ]
[]
# 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 # Configure esbuild (the version is required) config ...
0328e43a5be5504d8a6e7c58bab73940523fb23f
12,942
[ 1000579716 ]
[ "test" ]
defmodule Object.MetaDSLTest do use ExUnit.Case, async: true alias Object.MetaDSL setup do object = Object.new( id: "test_object", state: %{position: [0, 0], energy: 1.0}, methods: [:move, :sense, :learn], goal: fn state -> Map.get(state, :energy, 0) end ) meta_dsl =...
032902a190cdf120638656a4b839b0e64fde84b1
3,523
[ 868807230 ]
[ "phoenix" ]
defmodule TimemanagerWeb.WorkingTimeController do use TimemanagerWeb, :controller use PhoenixSwagger alias Timemanager.WorkingTimes alias Timemanager.WorkingTimes.WorkingTime action_fallback TimemanagerWeb.FallbackController def swagger_definitions do %{ WorkingTime: swagger_schema do t...
03296c6a6618dd016b0ad8dd1265a33bd1e5e7cf
22,573
[ 482159182 ]
[ "typespec", "documented" ]
defmodule Schema.Generator do @moduledoc """ Random data generator using the event schema. """ use Agent alias __MODULE__ alias Schema.Types alias Schema.Utils require Logger defstruct ~w[countries tactics techniques names words files]a @spec start :: {:error, any} | {:ok, pid} def start(), d...
032972d5e6dc94cd19fa021544f82ef946092677
2,369
[ 11558011 ]
[]
defmodule Helpers do @header_status_sample 'HTTP/1.0 200 OK' @header_params_sample [{'date', 'Fri, 16 Aug 2013 10:58:53 GMT'}, {'server', 'inets/5.9.5'}, {'content-length', '526'}, {'content-type', 'text/html'} ] ...
032973aa9f13f16d9f066fbe9036caf94e60fcc8
2,478
[ 139330443 ]
[ "typespec", "documented" ]
defmodule Spat.Geometry.Point do use Bitwise @doc """ Obtain the indexes of a point within the subdivided bounds. iex> Spat.Geometry.Point.index({ 0 }, Spat.Bounds.new({ 10 }), 1) [[0]] iex> Spat.Geometry.Point.index({ 5 }, Spat.Bounds.new({ 10 }), 1) [[0], [1]] ...
032973bb472900e3e8e01ae0229cfa2de910b8f4
1,807
[ 617766875 ]
[ "typespec" ]
defprotocol AwesomeElixir.SynchronizerDeps do alias AwesomeElixir.Synchronizer.Index @spec fetch_categories(deps :: t()) :: [Index.category_item()] def fetch_categories(deps) @spec delete_stale_categories(deps :: t(), existing_category_names :: [String.t()]) :: :ok def delete_stale_categories(deps, existing...
0329b33612ee49d36c1a5bcddcfa47305f655c09
4,654
[ 102634070 ]
[]
%{ "artificery": {:hex, :artificery, "0.2.6", "f602909757263f7897130cbd006b0e40514a541b148d366ad65b89236b93497a", [], [], "hexpm"}, "briefly": {:hex, :briefly, "0.3.0", "16e6b76d2070ebc9cbd025fa85cf5dbaf52368c4bd896fb482b5a6b95a540c2f", [], [], "hexpm"}, "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1...
0329dac0469703d40d9ee1be8251ad56fb330c6a
2,205
[ 58600323 ]
[ "phoenix" ]
defmodule Peepchat.RoomController do use Peepchat.Web, :controller alias Peepchat.Room import Ecto.Query plug Guardian.Plug.EnsureAuthenticated, handler: Peepchat.AuthErrorHandler # List of rooms by owner def index(conn, %{"user_id" => user_id}) do rooms = Room |> where(owner_id: ^user_id) ...
032ac352ecaf5f2b60ac7acff3e0f93ac94871ff
3,154
[ 50959324 ]
[ "documented" ]
defmodule Lex.ChapterParser do @docmodule "CAPITULO = TITLE? (SUBTITULO+ | SECCION+ | ARTICULO+)" @chapter_expression ~r{CAPITULO (UNICO|PRIMERO|SEGUNDO|TERCERO|CUARTO|QUINTO|SEXTO|SEPTIMO|OCTAVO|NOVENO|DECIMO|I|II|III|IV|V|VI|VII|VIII|IX|X)} import Lex.ArticleParser, only: [parse_article: 1, article_expression...
032bf9fda83f149e65c92e19a5b3e978ca7dac05
9,001
[ 933514757 ]
[ "documented" ]
defmodule ExESDB.Options do @moduledoc """ This module contains the options helper functions for ExESDB Modified to support umbrella configuration patterns where configurations are stored under individual app names instead of the global :ex_esdb key. """ alias ExESDB.EnVars, as: EnVars @data_d...