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
077e840adc7c231acb760e188a48f2906e1e92ee
3,995
[ 238809263 ]
[ "test" ]
defmodule Kalevala.Brain.VariableTest do use ExUnit.Case alias Kalevala.Brain.Variable describe "replacing action data with event data" do test "simple string replacement" do event_data = %{ channel_name: "general", text: "Hello!" } data = %{ channel_name: "${chann...
077e9a5708eb13f12df88610b6d7258f6a935cde
2,216
[ 71727570 ]
[]
defmodule ConduitAMQP.Mixfile do use Mix.Project def project do [ app: :conduit_amqp, version: "0.6.4", elixir: "~> 1.3", build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, deps: deps(), # Docs name: "ConduitAMQP", source_url: "https:...
077eb78184764f37a49f228c69cb4dc51e96b4ee
3,346
[ 87027 ]
[]
defmodule Venieri.MixProject do use Mix.Project def project do [ app: :venieri, version: "0.1.0", elixir: "~> 1.15", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), listeners: [Phoenix.CodeReloader] ...
077f8ff015badcbd37b8aecec9b62b7f27fddb24
3,078
[ 634376730 ]
[ "phoenix" ]
defmodule SmsWeb.Router do use SmsWeb, :router import SmsWeb.UserAuth pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {SmsWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug :fetch_current...
077fad683094fc2ff6b1d56d6fcdd5d3b2b6f57c
2,220
[ 119571466 ]
[ "test" ]
defmodule Werewolf.Action.CurseTest do use ExUnit.Case alias Werewolf.{Player, Action, KillTarget} import Werewolf.Support.PlayerTestSetup describe "resolve/4" do setup [:additional_player_map] test "when werewolf_collector targetted, successfully hunts player", context do players = context[:add...
077ff948adc3eaec07fe08ff9cb0b8c1aebbaa4e
1,991
[ 582170896 ]
[ "test", "ecto" ]
defmodule PhoenixReactChat.Chat.MessageTest do use PhoenixReactChat.DataCase alias PhoenixReactChat.Chat.Message describe "messages" do alias PhoenixReactChat.Chat.Message.Message import PhoenixReactChat.Chat.MessageFixtures @invalid_attrs %{content: nil} test "list_messages/0 returns all mes...
0780288dd8a43cbe66089520dcbc770eb00b32a0
3,511
[ 835780740 ]
[ "test", "phoenix" ]
defmodule QuestApiV21Web.QuestControllerTest do use QuestApiV21Web.ConnCase import QuestApiV21.QuestsFixtures alias QuestApiV21.Quests.Quest @create_attrs %{ address: "some address", end_date: ~D[2023-08-23], name: "some name", quest_type: "some quest-type", redemption: "some redemption",...
0780c736f3a80ca4840ba321cb0ebc4bafec1ca4
2,060
[ 243129821, 239182752, 231666876, 238344742, 248292846, 229153691, 234219270, 244384132, 264116374, 229675082, 342416435, 230283143, 228101047, 236226315 ]
[ "test" ]
defmodule Ecto.Integration.LoggingTest do use Ecto.Integration.Case, async: true alias Ecto.Integration.TestRepo alias Ecto.Integration.PoolRepo alias Ecto.Integration.Post test "log entry is sent to telemetry" do log = fn event_name, measurements, metadata -> assert Enum.at(event_name, -1) == :qu...
0780de376bbba9ca40906d634c3c4a0df09f7074
2,109
[ 278212684 ]
[ "test", "phoenix" ]
defmodule VotingWeb.Admin.ElectionControllerTest do use VotingWeb.ConnCase, async: true import VotingWeb.AdminAuth describe "create/2" do setup %{conn: conn} do conn = authenticated(conn) %{conn: conn} end test "returns 201 when election is created successfully", %{conn, conn} do ...
0780e9ecec0569991e3eba872e5409c62218eb9e
3,212
[ 67560455 ]
[]
%{"certifi": {:hex, :certifi, "0.4.0", "a7966efb868b179023618d29a407548f70c52466bf1849b9e8ebd0e34b7ea11f", [:rebar3], []}, "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], []}, "cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae...
0781396fdbac2c75e353cb154bce4e7987a4f473
3,490
[ 852964353 ]
[ "ecto" ]
defmodule MockupBank.Repo.Migrations.AccountUsers do use Ecto.Migration def change do create table(:account_users) do add :email, :string, null: false add :name, :string, null: false add :customer_number, :string add :first_name, :string add :last_name, :string add :phone, ...
07813dd539e3f539f3109f579953c8a91949f5f4
2,762
[ 127584548 ]
[ "documented" ]
defmodule Servy.Handler do @moduledoc """ Handles requests- parses, logs, rewrites, routes and then responds to requests """ import Servy.Parser, only: [parse: 1] import Servy.Utils, only: [log: 1, track: 1, rewrite_path: 1] alias Servy.Conv alias Servy.BearController @pages_path Path.expand("pages"...
0781a374607f9b2cd509fac9fbb096195ec336ef
4,819
[ 585915775 ]
[ "phoenix" ]
defmodule Pleroma.Web.MastodonAPI.InstanceView do use Pleroma.Web, :view alias Pleroma.Config alias Pleroma.Web.ActivityPub.MRF @mastodon_api_level "2.7.2" def render("show.json", _) do instance = Config.get(:instance) %{ uri: Pleroma.Web.Endpoint.url(), title: Keyword.get(instance, :n...
0781af6c1fec4d1871ad4af375fe2b3971b30e90
3,440
[ 782108650 ]
[ "liveview", "test" ]
defmodule FoodTruckWeb.TruckLiveTest do use FoodTruckWeb.ConnCase import Phoenix.LiveViewTest import FoodTruck.TrucksFixtures @create_attrs %{address: "some address", food_items: "some food_items", name: "some name"} @update_attrs %{address: "some updated address", food_items: "some updated food_items", nam...
0781b7f7a8d9dafb4af2f724d245bd0c9ab2eb7f
7,209
[ 89348467 ]
[ "test" ]
defmodule KronosTest do use ExUnit.Case doctest Kronos # Timestamp for : 2017/04/25 22:21:15 @ts 1493158875 @dt DateTime.from_unix!(@ts) def mock(:day, year, month, day) do Kronos.new!({year, month, day}, {0, 0, 0}) end def mock(:day, year, month, day, h, m, s) do Kronos.new!({year, month,...
0781dd3359777f8c08d44f1c2c6427038975e99f
2,804
[ 177067538 ]
[ "test", "phoenix" ]
defmodule Tasks3Web.TaskControllerTest do use Tasks3Web.ConnCase alias Tasks3.Tasks alias Tasks3.Tasks.Task @create_attrs %{ completed: true, desc: "some desc", duration: 42, name: "some name" } @update_attrs %{ completed: false, desc: "some updated desc", duration: 43, nam...
07820bd3b4825099cbd020f967f9f92dfca56403
6,080
[ 963738865 ]
[ "typespec", "liveview", "documented" ]
defmodule DoclingViewerWeb.Input do @moduledoc """ Input component with label and error messages. """ use Phoenix.Component import DoclingViewerWeb.CoreComponents, only: [icon: 1] alias DoclingViewerWeb.CoreComponents.InputHelpers @doc """ Renders an input with label and error messages. A `Phoenix...
078230aeff6173cb359710db850e41b57c6f412a
3,497
[ 413723373 ]
[ "liveview", "test" ]
defmodule AppWeb.UserLiveTest do use AppWeb.ConnCase import Phoenix.LiveViewTest alias App.Accounts @create_attrs %{age: 42, name: "some name"} @update_attrs %{age: 43, name: "some updated name"} @invalid_attrs %{age: nil, name: nil} defp fixture(:user) do {:ok, user} = Accounts.create_user(@creat...
07824565282b2cb887dc02c362970b6d65ecdb52
1,563
[ 796120002 ]
[ "typespec", "documented" ]
defmodule KVServer.Command do @moduledoc false alias KV.{Bucket, Registry} @spec parse(String.t()) :: tuple() def parse(line) do case String.split(line) do ["CREATE", bucket] -> {:ok, {:create, bucket}} ["GET", bucket, key] -> {:ok, {:get, bucket, key}} ["PUT", bucket, key, value] -> {:o...
07825fb867fec50c9a24d98aae9581827b91d662
3,617
[ 160069062 ]
[ "documented" ]
defmodule Probe do @moduledoc """ Documentation for Probe. """ import Submarine.CLI alias Probe.Parser, as: Parser @doc """ Parse arguments and call puzzle part methods. ## Parameters - argv: Command-line arguments """ def main(argv) do {input_file, opts} = parse_args(argv) if Enum.mem...
0782cd206b75abe9fc068543cf1fc0df98499fe0
1,644
[ 461250874 ]
[ "phoenix" ]
defmodule WhatsappInactiveMembersHandlerWeb.Router do use WhatsappInactiveMembersHandlerWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {WhatsappInactiveMembersHandlerWeb.LayoutView, :root} plug :protect_from_forgery ...
0783f8a3f9a79b768720819dbdb43998f8f8be81
1,504
[ 225150880 ]
[ "test" ]
defmodule AdventOfCode2019.Day2.Test do use ExUnit.Case alias AdventOfCode2019.Day2 describe "part 1" do test "example program 1" do initial = {[1, 9, 10, 3, 2, 3, 11, 0, 99, 30, 40, 50], 0} middle = {[1, 9, 10, 70, 2, 3, 11, 0, 99, 30, 40, 50], 4} middle2 = {[3500, 9, 10, 70, 2, 3, 11, 0, ...
078435ad1a5c1b1c59658853f7a68e06bffa060a
7,633
[ 354184528 ]
[ "supervisor", "documented" ]
defmodule Oro do @moduledoc """ Opinionated interface to Monero-wallet-RPC API. This probject is largely based off the Bitcoin RPC implementation Gold. """ use Application require Logger alias Oro.Transfer alias Oro.Payment alias Oro.Transaction alias Oro.Receipt alias Oro.PoisonedDecimal def...
078452ef354e45bbc51890715705dffebd6b2ee1
2,350
[ 313948265 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse...
0785103cd6fae098e37aac726eee1b50b38f04f3
2,657
[ 119708367 ]
[]
use Mix.Config # For production, we configure the host to read the PORT # from the system environment. Therefore, you will need # to set PORT=80 before running your server. # # You should also configure the url host to something # meaningful, we use this information when generating URLs. # # Finally, we also include t...
0785319383ef088f2a0e06024ee53009aebb0e10
8,075
[ 262831656 ]
[]
# Assumption: A border can match at most one other border # Assumption: Tiles are square defmodule Tile do @monster_middle ~r/#....##....##....###/ @monster_bottom ~r(#..#..#..#..#..#) defstruct [id: 0, lines: [], loc: {0, 0}] def from_strs(strs) do [<<"Tile ", tile_num_str::binary-size(4), ":">> | lines]...
0785323130784bafb1e514c3eea87988b86bcd7e
2,533
[ 309664950 ]
[ "test" ]
defmodule TapperContextualTest do use ExUnit.Case describe "contextual ids" do test "put/get in context" do Tapper.Ctx.delete_context() id = Tapper.Id.test_id() ^id = Tapper.Ctx.put_context(id) assert ^id = Tapper.Ctx.context() end test "put overrides existing value" do ...
0785820f36f54be262bbd5c38449396dba45c0f6
1,709
[ 177433678 ]
[ "macro", "documented", "phoenix" ]
defmodule InstacookapiDeliveryWeb 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 InstacookapiDeliveryWeb, :controller use InstacookapiDeliveryWeb, :view The definitions below will be ...
0785e658a7521a1004c0a7800bd11d017663d5cb
1,992
[ 470453569 ]
[ "test" ]
defmodule Mindful.LocationsTest do use Mindful.DataCase, async: true import Mindful.Test.Support.OfficeHelper import Mindful.Test.Support.ProviderHelper import Mindful.Test.Support.StateHelper alias Mindful.Locations doctest Mindful.Locations setup do {:ok, office: given_office()} end describe...
078603cc39c25817dd5721ac60812a99b8d1f5ce
1,759
[ 94849686 ]
[]
defmodule YtGet do def get_movie_list(keyword, page) do url = "https://www.youtube.com/results?search_query=#{keyword}&p=#{page}" %HTTPoison.Response{status_code: 200, body: body} = HTTPoison.get!(url) body |> Floki.parse |> Floki.find(".yt-uix-tile-link") |> get_title_and_url end def get...
07865b174e853eec6fffb2c6858c2ab58811d51c
1,702
[ 937520208 ]
[ "liveview" ]
defmodule Gchatdemo1Web.WatchOldLive do use Gchatdemo1Web, :live_view alias Gchatdemo1.Streams def mount(%{"display_name" => display_name, "stream_id" => stream_id}, _session, socket) do stream_info = Streams.get_stream_infor!(stream_id) streamer_id = Streams.get_streamer_id_by_name(display_name) st...
0786fc8fe1d1cfa0819b68f9091d81c6906cf25c
2,073
[ 353539504 ]
[ "test", "ecto" ]
defmodule BlogsApi.ResourcesTest do use BlogsApi.DataCase alias BlogsApi.Resources describe "blogs" do alias BlogsApi.Resources.Blog @valid_attrs %{likes: 42, name: "some name", views: 42} @update_attrs %{likes: 43, name: "some updated name", views: 43} @invalid_attrs %{likes: nil, name: nil, v...
0787119cb4bebce3237c54f5fa66dad85844d750
1,576
[ 338434866 ]
[ "typespec" ]
defmodule Teamsort.Solver do @spec solve([Player]) :: {:ok, [Team]} | {:error, binary()} def solve(players) do result = run_solver(players) case result do {:error, _} -> result {:ok, result} -> {:ok, result_to_teams(players, result)} end end @spec run_solver([Player]) ...
07876e5b30cd76a48e23d7aee6eac59c58e1fdd3
3,673
[ 248817168 ]
[ "typespec", "documented" ]
defmodule Membrane.RTP.TWCCReceiver.PacketInfoStore do @moduledoc false # The module stores TWCC sequence number along with their arrival timestamps, handling sequence # number rollovers if necessary. Stored packet info can used for generating statistics used for # assembling a TWCC feedback packet. require...
0788180b168bba94b6af1da677c7570b74b44fc7
4,674
[ 502455113 ]
[ "liveview", "documented", "ecto" ]
defmodule PlayaWeb.ListLive.ItemFormComponent do alias Productivity.ActivityLog use PlayaWeb, :live_component alias Productivity.Works @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> for <%= @list.title %> <:subtitle>Create item to implement and apply it t...
07883aad78211c30fcb9f6ab1f72236a6af8b3cb
10,715
[ 104223581 ]
[]
defmodule IcdCode.ICDCode.Codes_K50 do alias IcdCode.ICDCode def _K5000 do %ICDCode{full_code: "K5000", category_code: "K50", short_code: "00", full_name: "Crohn's disease of small intestine without complications", short_name: "Crohn's disease of small intestine without co...
0789573eaa7925120ce2894b4f3a8f0f21e3d391
3,258
[ 52233330 ]
[ "phoenix" ]
defmodule PingpongServer.RoomController do require IEx use PingpongServer.Web, :controller alias PingpongServer.Room plug :scrub_params, "room" when action in [:create, :update] def increment(conn, %{"id" => id, "team" => team}) do room = Repo.get!(Room, id) key = "team_#{team}_score" team_sc...
07895c2af89905279d400ad8e68803152dff4724
3,677
[ 95495914 ]
[ "documented" ]
defmodule SudokuSolver do @cell_size 9 defmodule UnsolvedCell do defstruct row: -1, col: -1, blk: -1, unused: [] end defmodule SolvedCell do defstruct row: -1, col: -1, blk: -1, val: -1 end defmodule Result do defstruct initials: [], results: [] end defp blk(row, col) do [ [0, ...
078965af4c4242018013a9a1c119f0559c2aa4f0
2,525
[ 79055206 ]
[ "test" ]
defmodule BandageWeb.AlbumControllerTest do use BandageWeb.ConnCase alias Bandage.Artists @create_attrs %{} @update_attrs %{} @invalid_attrs %{} def fixture(:album) do {:ok, album} = Artists.create_album(@create_attrs) album end describe "index" do test "lists all albums", %{conn: conn} ...
0789dc6c12bbb7e86d0d214adbf965e246ed86e7
2,385
[ 36687089 ]
[ "test" ]
defmodule ConsTheMagnificentTest do use ExUnit.Case import Schemer.ConsTheMagnificent test "rember" do [:lamb, :chops, :and, :jelly] = rember(:mint, [:lamb, :chops, :and, :mint, :jelly]) [:lamb, :chops, :and, :flavored, :mint, :jelly] rember(:mint, [:lamb, :chops, :and, :mint, :flavored, :m...
078a036650e90d5d69249b4882745a537a3235f4
3,236
[ 316577321 ]
[ "typespec", "documented" ]
defmodule RobotSimulator do defstruct direction: nil, position: nil defguard is_not_valid_direction(direction) when direction not in [:north, :south, :west, :east] defguard is_not_valid_position(position) when not (is_tuple(position) and tuple_size(position) == 2 and is_number(...
078a24549bf3fc918abd6340da077596f5fe4d9e
5,613
[ 52314174 ]
[ "supervisor", "documented" ]
defmodule EventStore.Storage.Database do @moduledoc false require Logger def create(config), do: storage_up(config) def drop(config), do: storage_down(config) def execute(config, script) do opts = Keyword.put(config, :timeout, :infinity) case run_query(script, opts) do {:ok, _} -> :ok ...
078a63ab8e85cf1892062aaad54b7e7d4151130b
1,662
[ 576527248 ]
[]
defmodule OpentelemetryTesla.MixProject do use Mix.Project def project do [ app: :opentelemetry_tesla, version: "2.1.0", elixir: "~> 1.10", start_permanent: Mix.env() == :prod, deps: deps(), package: package(), description: description(), docs: docs() ] end...
078b83fccd3900c7da26d492245eaec83ae97943
2,712
[ 943992723 ]
[ "supervisor" ]
defmodule UpgradeManager do def get_upgrades() do %{ "iron_boost" => %{cost: 2500, resource: :iron, multiplier: 1.25, name: "Iron Harvesting Boost", description: "Increase iron production by 25%"}, "gold_boost" => %{cost: 5000, resource: :gold, multiplier: 1.25, name: "Gold Mining Boost", description...
078bfb8282ee2bca401a405e6a8e5920e4dec7ad
2,692
[ 607697321 ]
[ "test", "phoenix" ]
defmodule StacApiWeb.AccountControllerTest do use StacApiWeb.ConnCase import StacApi.AccountsFixtures alias StacApi.Accounts.Account @create_attrs %{ email: "some email", hash_password: "some hash_password" } @update_attrs %{ email: "some updated email", hash_password: "some updated hash_...
078c31963013b0e4b1efd21ed91694ac7cc5f294
1,694
[ 995651883 ]
[ "typespec", "documented" ]
defmodule Torngen.Client.Schema.FactionContributor do @moduledoc false use Torngen.Client.SchemaObjectAccess, deprecated: [] @behaviour Torngen.Client.Schema @keys [:value, :username, :in_faction, :id] defstruct [ :value, :username, :in_faction, :id ] @type t :: %__MODULE__{ ...
078c85430b4cf897cb67c1489837dac65a7cbe72
2,611
[ 287567183 ]
[ "documented" ]
defmodule TalkLikeAX.Translator do @moduledoc false @leading_punctuation_regex ~r/\A([^a-zA-Z0-9]*)/ @trailing_punctuation_regex ~r/[a-zA-Z0-9]+([^a-zA-Z0-9]*)\Z/ def translate_to_lingo(words, lingo_map) do words |> String.trim() |> String.split(" ") |> Enum.map(fn word -> translate_word(lingo...
078c97c8511949b6e1f431888f54d4ae986ab9df
1,680
[ 493683467 ]
[]
defmodule DiscordHr.Storage do use Agent require Logger def start_link(storage) do {:ok, data} = load(storage) Agent.start_link(fn -> %{data: data, storage: storage} end, name: __MODULE__) end defp load(storage) do Logger.info("loading data from #{storage}") with {:ok, contents} <- File.rea...
078ce40dfe675a0d5749aa4008a5e561bfe4e510
1,843
[ 147534687 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule AskAGatorWeb 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 AskAGatorWeb, :controller use AskAGatorWeb, :view The definitions below will be executed for every view, contro...
078d0649c1900fc83329e74bf0acedc36922ab22
4,813
[ 842684760 ]
[ "test" ]
defmodule Feeb.DB.Repo.Manager.RegistryTest do use Test.Feeb.DBCase, async: true import ExUnit.CaptureLog alias Feeb.DB.Repo.Manager alias Feeb.DB.Repo.Manager.Registry @ets_table_name :feebdb_manager_registry describe "fetch_or_create/2" do test "creates a previously non-existent Manager", %{shard_id...
078d5cd02b340ffa5c6aac91cea454530497c457
1,861
[ 88205474, 401777961 ]
[]
defmodule ExJira.Mixfile do use Mix.Project def project do [ aliases: aliases(), app: :ex_jira, version: "0.0.5", elixir: "~> 1.4", description: description(), package: package(), build_embedded: Mix.env() == :prod, source_url: "https://github.com/TheFirstAvenger...
078ebe2460d279f903369a48847d7b1ba9efc92e
1,658
[ 915910257 ]
[ "liveview", "phoenix" ]
defmodule QartWeb.Endpoint do use Phoenix.Endpoint, otp_app: :qart # 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: "_qart_key", ...
078ee39fecc861a2cb3df12dfa93f4180a4041f3
1,618
[ 218259029 ]
[ "typespec", "documented" ]
defmodule Zippex.Meta do @moduledoc """ The metadata of a `Zippex` zipper. The `Meta` struct contains the following fields: * `is_branch` - A function that receives a node and returns `true` if the node is a branch * `children` - A function that receives a node and returns it's children * `make_node` - A fu...
078f6b6dc54651ad58a7942d59fda7964292ad73
2,894
[ 163352839 ]
[]
defmodule BnetApi.Request.Diablo do import BnetApi.Request require Logger def get_acts(%{"region" => region}) do make_call("/d3/data/act", region) end def get_act(%{"region" => region, "act_id" => act_id}) do make_call("/d3/data/act/#{act_id}", region) end def get_artisan(%{"region" => region, "artisan_s...
078fa6740c0dd30e4391fe9d36cdfe87eace9871
2,192
[ 372334720 ]
[ "genserver" ]
defmodule TodoAppPhoenix.Horde.Server do use GenServer, restart: :temporary alias TodoAppPhoenix.Todo.List alias TodoAppPhoenix.Horde.Server alias TodoAppPhoenix.Horde.Registry # Callback functions @impl GenServer def init(name) do IO.puts("Starting todo server for #{name}") {:ok, {name, List.ne...
0790a03e3b5d1861cd597cdc22a08269b18432c9
1,818
[ 798939985 ]
[ "macro", "test", "documented", "phoenix" ]
defmodule TalentlinkWeb.ConnCase do @moduledoc """ This module defines the test case to be used by tests that require setting up a connection. Such tests rely on `Phoenix.ConnTest` and also import other functionality to make it easier to build common data structures and query the data layer. Finally, if...
0790bdedf3c53eb8dcfbb96a43ba4ae15ef44a33
1,637
[ 112242495 ]
[ "documented" ]
defmodule Util do def replicate(n, _) when n == 0, do: [] def replicate(n, x), do: for _ <- 1..n, do: x def nth(list, idx) when is_number(idx) and idx < 0 do throw 'Index must be positive' end def nth(list, idx) when idx > length(list) - 1 do throw ' index bigger the list size' end def nth([ ...
0792282a6792825b6a92b144e9e31f1e501a735b
2,112
[ 129613339 ]
[]
defmodule Effect.Item do defstruct type: :damage, rolls: {0, 0}, duration: 0, target_type: %{ enemies: true, allies: true, user: true, bulb: true, leek: true }, max_stack: :infinity @ef...
07922b17a87a8b8521b730f8998b1f0234bdc8c4
2,382
[ 280264667 ]
[ "documented" ]
defmodule MassaProxy.Reflection do @moduledoc false require Logger def prepare(file_descriptor) do ctx = %Protobuf.Protoc.Context{gen_descriptors?: true, plugins: ["grpc"]} |> find_types(file_descriptor) file_descriptor |> Stream.map(fn desc -> {desc.name, MassaProxy.Generator.gene...
0792ca02a709a046cb92fe03d5c99c6cacedd59e
2,017
[ 103230269 ]
[ "typespec", "documented" ]
defmodule AOC2016.Day9 do @moduledoc """ Day 9: Explosives in Cyberspace """ def run1 do File.read!("priv/2016/9.txt") |> String.trim() |> decompress() end def run2 do File.read!("priv/2016/9.txt") |> String.trim() |> decompress2() end @doc """ Decompress input. iex> AOC2...
0792ef8ef08fe693ad132677d0f3188220a00d97
3,789
[ 248164199 ]
[ "documented" ]
defmodule OrbitMap do @moduledoc """ The documentation for OrbitMap is in the README.md """ @doc """ Takes profit from list operations to calculate the distance between nodes """ def calculate_transfers(map, origin, destination) do map = prepare_data(map) to_origin = get_orbits(map, [], origin) ...
079311324a9bc5329c72b35b9e174883227af04d
1,599
[ 877866898 ]
[ "documented", "ecto" ]
defmodule TimeManager.Accounts.User do use Ecto.Schema import Ecto.Changeset import Bcrypt # Importez Bcrypt @derive {Jason.Encoder, only: [:id, :username, :email, :role_id, :inserted_at, :updated_at]} schema "users" do field :username, :string field :password, :string field :email, :string ...
07938f2566ccb64fc2ed049e7f574cb293ab53b7
3,122
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.RealTimeBidding.V1.Model.NativeContent do @moduledoc """ Native content for a creative. ## Attributes * `advertiserName` (*type:* `String.t`, *default:* `nil`) - The name of the advertiser or sponsor, to be displayed in the ad creative. * `appIcon` (*type:* `GoogleApi.RealTimeBidding...
0793ae8b3afe4f021573ee6cf0b182a0d52a9dfb
2,631
[ 597426177 ]
[ "genserver" ]
defmodule MessageBroker.Client do def serve(socket) do msg = with {:ok, data} <- read_line(socket), {:ok, command} <- MessageBroker.Command.parse(data), do: MessageBroker.Command.run(socket, command) write_line(socket, msg) serve(socket) end def start_link(opts) do GenServer.st...
07942ea85a727aa3a9c59cbebfcf8cb8e8aacb6b
3,027
[ 886372940 ]
[ "genserver" ]
defmodule LlamaApi.Worker.MainWorker do use GenServer use AMQP alias LlamaApi.{ Tools } alias LlamaApi.Worker.{ ProcessRunWorker } def assign_job(chan, tag, _redelivered, payload) do task_uuid = Ecto.UUID.generate :ets.insert(:tasks_logger, {task_uuid, NaiveDateTime.utc_now, self(), payload}) tr...
07942fa22ceb7ef6adef3867d71296466b4dfd02
6,996
[ 503967040 ]
[]
defmodule PczoneWeb.Schema.Orders do use Absinthe.Schema.Notation alias Absinthe.Resolution.Helpers object :customer do field :name, non_null(:string) field :phone, non_null(:string) end enum :order_state do value :cart value :submitted value :canceled value :approved value :proc...
07946d5592ebe7f77bcf67891e46e979fa8364ad
3,770
[ 309451922 ]
[ "typespec", "documented" ]
# Module for an arbitrary client that can connect to a Calvin deployment via a # Sequencer component of the system, which is responsible for collecting Transaction # requests defmodule Client do @enforce_keys [:sequencer] import Emulation, only: [send: 2] import Kernel, except: [send: 2] defstruct(sequencer:...
07947ddcd36bb49308ed1151faf2b1b7d01add88
4,112
[ 93328802 ]
[ "typespec", "documented" ]
defmodule GameOfLife.Board do @moduledoc """ Pure data structure for calculating transitions of Game of Life """ defstruct cells: %{}, step: 0 @typep index :: non_neg_integer @type cell_state :: 1 | 0 ## 1 for alive, 0 for dead cell @type step :: non_neg_integer @typep cells :: %{ row :: index => ...
0794aa3f3e8928402d4f0c02ae1bb8ef0247cfc7
2,305
[ 31404445 ]
[ "documented", "ecto" ]
defmodule Hello.Question do @moduledoc """ The Question context. """ import Ecto.Query, warn: false alias Hello.Repo alias Hello.Question.QuestionTemplate @doc """ Returns the list of question_templates. ## Examples iex> list_question_templates() [%QuestionTemplate{}, ...] """ de...
0794e91f8f7fa47a6418434df9d3ff0e94fce0cc
1,520
[ 343322146 ]
[ "phoenix" ]
defmodule MyAppWeb.Router do use MyAppWeb, :router pipeline :api do plug :accepts, ["json"] plug :fetch_session end pipeline :api_auth do plug :ensure_authenticated end scope "/api", MyAppWeb do pipe_through :api post "/users/sign_in", UserController, :sign_in end scope "/api", M...
07958b22b02fdceba3171b5b2908b51acb333154
1,521
[ 127859563 ]
[ "test" ]
defmodule BudgetTrackerWeb.ExpenseTagControllerTest do use BudgetTrackerWeb.ConnCase alias BudgetTracker.Tracker @expense_attrs %{amount: 120.5, date: ~D[2010-04-17], description: "some description"} @tag_attrs %{name: "tag"} def fixture(:expense) do {:ok, expense} = Tracker.create_expense(@expense_att...
07965bd1da8d578d9d9e8f78387d2a561782fe6b
7,587
[ 65788823 ]
[ "test", "supervisor" ]
defmodule JobbitTest do use ExUnit.Case, async: true alias Jobbit.Configuration alias Jobbit.TaskError alias Jobbit.TimeoutError alias Jobbit.ExitError @moduletag capture_log: true doctest Jobbit describe "start_link/0" do test "starts a Task.Supervisor" do assert {:ok, pid} = Jobbit.start...
0796c0ca708cdf383379b22c3a6783ea70c7667a
1,630
[ 171220100 ]
[ "macro", "documented", "phoenix" ]
defmodule ScriptdWeb 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 ScriptdWeb, :controller use ScriptdWeb, :view The definitions below will be executed for every view, controller, ...
0796c9c0206eb37bbe47365946f5ef080f6d58cb
2,725
[ 202137419 ]
[ "typespec", "supervisor", "documented" ]
defmodule TaskBunny.WorkerSupervisor do @moduledoc """ Supervises all TaskBunny workers. You don't have to call or start the Supervisor explicity. It will be automatically started by application and configure child workers based on configuration file. It also provides `graceful_halt/1` and `graceful_halt/...
07974c61f6a37397f0b1c85a57e1c091e7c6abe0
1,759
[ 159991182 ]
[]
defmodule Eerf.MixProject do use Mix.Project def project do [ app: :eerf, version: "0.1.0", elixir: "~> 1.5", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), dep...
07974fb3955446681da462458a575aac8e299537
2,004
[ 596042984 ]
[ "genserver" ]
defmodule Aggregator do use GenServer def start_link do GenServer.start_link(__MODULE__, {%{}, 0}) end def init(state) do {:ok, state} end def collect_text(pid, hash, text) do place(pid, hash, :text, text) end def collect_sentiment(pid, hash, sentiment) do place(pid, hash, :sentiment...
0797694b059003bbd0dd053251446ed6d3711b30
2,262
[ 70412021 ]
[ "genserver", "documented" ]
defmodule Workflow.Container do @moduledoc """ Genserver to hold Aggregates or Process Managers """ use GenServer require Logger alias Workflow.Container alias Workflow.Persistence defstruct [ module: nil, uuid: nil, data: nil, version: nil ] ## API ...
0797c6bdad680039913476ae68377f081e3615f6
1,814
[ 112857108 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule PhoenixChatbot.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use PhoenixChatbot.Web, :controller use PhoenixChatbot.Web, :view The definitions below will be executed for every view, controller, ...
0797c6d588c57d68b1f007a02730042e5bc4ffe3
2,799
[ 228669162, 261996035 ]
[ "test", "ecto" ]
defmodule Catcasts.MultimediaTest do use Catcasts.DataCase alias Catcasts.Multimedia describe "videos" do alias Catcasts.Multimedia.Video @valid_attrs %{ duration: "some duration", thumbnail: "some thumbnail", title: "some title", video_id: "some video_id", view_count: 42 ...
079800ccd49135d2f60c843c8ed567197fe4d134
3,903
[ 47336810 ]
[ "test" ]
defmodule BeachlineTest do use ExUnit.Case doctest Beachline test "a site falls to the 'left' of the first arc" do arc = %Point{ x: 2, y: 5.449 } site = %Point{ x: 0, y: 1.586 } assert [%Point{x: 2, y: 5.449}, %Point{x: 4.45, y: 3}, %Point{x: 2, y: 5.449}] |> Beachline.find_arc(site, site.y) =...
0798271b9ab4d6826871f3a8846501df88e2bacc
4,647
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Drive.V3.Model.FileImageMediaMetadata do @moduledoc """ Output only. Additional metadata about image media, if available. ## Attributes * `aperture` (*type:* `number()`, *default:* `nil`) - Output only. The aperture used to create the photo (f-number). * `cameraMake` (*type:* `String...
0798df4764161a101f406eb704ca560124dfb5b5
2,269
[ 94367748 ]
[ "phoenix", "ecto" ]
defmodule Rumbl.Web.VideoController do use Rumbl.Web, :controller alias Rumbl.ContentCreation plug :load_categories when action in [:new, :create, :edit, :update] def action(conn, _) do apply(__MODULE__, action_name(conn), [conn, conn.params, conn.assigns.current_user]) end def index(conn, _...
079902a5d8b1f652187e92ea6b69ddf7a500975d
20,100
[ 338348248, 350401094, 378601878, 368971442, 380063243 ]
[]
%{ "accept": {:hex, :accept, "0.3.5", "b33b127abca7cc948bbe6caa4c263369abf1347cfa9d8e699c6d214660f10cd1", [:rebar3], [], "hexpm", "11b18c220bcc2eab63b5470c038ef10eb6783bcb1fcdb11aa4137defa5ac1bb8"}, "amqp": {:hex, :amqp, "2.1.1", "ad8dec713ba885afffffcb81feb619fe7cfcbcabe9377ab65ab7a110bd4f43a0", [:mix], [{:amqp_cl...
07996d58fb4f498ceb1fff8c996b2f354303ccc5
2,022
[ 672168262 ]
[ "liveview" ]
defmodule GuimbalWaterworksWeb.RateLive.Show do use GuimbalWaterworksWeb, :live_view alias GuimbalWaterworks.Bills @impl true def mount(_params, _session, socket) do {:ok, socket} end @impl true def handle_params(%{"id" => rate_id}, _url, socket) do rate = Bills.get_rate(%{"id" => rate_id}) ...
0799b4bff6a28091ed82d70a351f51cf328b24f5
3,787
[ 310810277 ]
[]
defmodule :m_ssh_acceptor_sup do use Bitwise @behaviour :supervisor require Record Record.defrecord(:r_ssh, :ssh, role: :undefined, peer: :undefined, local: :undefined, c_vsn: :undefined, s_vsn: :undefined, c_version: :undefined, s_version: :undefined, c_keyinit: :undefined, ...
0799c5a7ae9570adbdc1c2f966403f0e0ae4b762
5,501
[ 416383998 ]
[ "liveview", "ecto" ]
defmodule BikeBrigadeWeb.CampaignLive.FormComponent do use BikeBrigadeWeb, :live_component alias BikeBrigade.LocalizedDateTime alias BikeBrigade.Locations.Location alias BikeBrigade.Delivery alias BikeBrigade.Delivery.{Campaign, Program} alias BikeBrigade.GSheetsImporter alias BikeBrigadeWeb.Components....
079a0fc326f44cc0f419f454de0ba3bf0dcb2cb3
12,233
[ 585915775, 500260157 ]
[ "test" ]
defmodule Pleroma.UserSearchTest do alias Pleroma.Repo alias Pleroma.User use Pleroma.DataCase import Pleroma.Factory setup_all do Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end) :ok end describe "User.search" do setup do: clear_config([:instance, :limit_to_loc...
079a1721cba9060be55d98e180d9ff025aa71c14
1,946
[ 112765011 ]
[]
defmodule BoardTestHelper do alias TicTacToe.{Board, AI} # takes a list of {move, player} and applies them in sequence to a board def batch_update(moves, board) do Enum.reduce moves, board, fn({mv, player}, acc) -> Board.update(acc, mv, player) end end # takes a list of moves and applies them ...
079a29d60f9b24f050dcb035144efa400e83e548
5,807
[ 701119954 ]
[ "test", "ecto" ]
defmodule Pinpoint.RelationshipsTest do use Pinpoint.DataCase alias Pinpoint.Accounts alias Pinpoint.Accounts.User alias Pinpoint.Relationships describe "relationships" do alias Pinpoint.Relationships.Relationship import Pinpoint.RelationshipsFixtures @invalid_attrs %{status: nil} test "l...
079a97577669bec2c872405b9bdf1ec1c6bc7178
2,240
[ 161040216 ]
[]
defmodule Message do def parse_inputs(file) do file |> File.stream!() |> Enum.map(fn line -> [[x], [y], [vx], [vy]] = Regex.scan(~r/(-?\d+)/, line, capture: :all_but_first) {{String.to_integer(x), String.to_integer(y)}, {String.to_integer(vx), String.to_integer(vy)}} end) end def step...
079ab924dba74e0bd2cd02c76d571f5868014235
2,430
[ 207218146 ]
[]
defmodule TestCluster do require Logger def start_nodes(number) do Enum.each(1..number, fn index -> with_deadline(30_000, fn -> # create a peer node {:ok, _pid, node} = :peer.start_link(%{ host: 'localhost', name: 'peer_#{index}', args: [~c"-env", ~c"MIX_ENV"...
079abc1ed88c403a031a2b67f9d5c6981547bf7d
4,414
[ 559140492 ]
[]
# Iesus Hominum Salvator <3 defmodule IHS do defmodule Fiat do def lux() do IO.puts("Operations:\n") operations() IO.puts("Signals:\n") signals() IO.puts("Addition:\n") addition() IO.puts("Multiplication:\n") ...
079b19ef73150564d6431b341f73d2505a6ef3d1
2,538
[ 675638506 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule UrbandevWeb 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 UrbandevWeb, :controller use UrbandevWeb, :view The definitions below will be executed for every view, controlle...
079c3c8282d7decd9e41314a6c5b511e3801dcd6
11,356
[ 187523933 ]
[]
#============> TYPES <========================== defmodule Syntax.Types do @tuple {2,3,5} def sum(a, b) do a + b end def showTuple do IO.inspect(@tuple) end def addToTuple (n) do new_tuple = put_elem(@tuple,1,n) IO.inspect(new_tuple) end end #==> NUMBERS <== # Numbers can be integers or floats, and...
079c6f460a1c8a7564f2a7fc3fd789322e2055d7
1,547
[ 82565541 ]
[ "phoenix" ]
defmodule Skillswheel.Router do use Skillswheel.Web, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers plug Skillswheel.Auth, repo: Skillswheel.Repo end pipeline :api do plug :accep...
079c7c4b003e4a297359775327a0fb9688a05b7f
5,483
[ 616065257 ]
[ "typespec", "documented" ]
defmodule SmeeFeds.Export do @moduledoc """ Converts lists of federations into other formats suitable for export and use in other applications. Some exports are focused on presenting the data (such as `markdown/1`, others are lossy summaries (`csv/1`) and some are contain all data (`json/1`). """ alias...
079c9f9c688948949f08c3db5e0d5722d8963daa
3,906
[ 141718317 ]
[ "documented" ]
defmodule Andy.GM.ConjectureActivation do @moduledoc """ A conjecture instantiated about something, and possibly considered a goal" """ alias __MODULE__ alias Andy.GM.{Conjecture, Belief, Round} defstruct conjecture: nil, # e.g. "robot1" vs "robot2"; two conjecture activations can be the same ...
079cc3635de4732e08e18db7cf8e8f0d26f3888c
8,867
[ 132711429 ]
[ "test" ]
defmodule FutureButcherApiWeb.GameChannelTest do use FutureButcherApiWeb.ChannelCase import Ecto.Query alias FutureButcherApiWeb.{GameChannel, UserSocket} alias FutureButcherApi.{Repo, Player, Score} alias FutureButcherEngine.Game describe "join" do test "join succeeds for new player" do player_n...
079cc6f44bf345c473f0104f063de03e4c44f03b
2,253
[ 424662266 ]
[ "test", "ecto" ]
defmodule Games.GameTest do use Games.DataCase alias Games.Game describe "scores" do alias Games.Game.Score @valid_attrs %{goal: 42, goal_scorer: "some goal_scorer", red_card: 42, yellow_card: 42} @update_attrs %{goal: 43, goal_scorer: "some updated goal_scorer", red_card: 43, yellow_card: 43} ...
079cde349822a97eaf4b3dcc2fbd8a9ceb0ababb
2,478
[ 554101673 ]
[ "typespec", "documented" ]
defmodule Stormstout.Import.Stage do @moduledoc """ Behaviour used to chunk `changes_list` into multiple `t:Ecto.Multi.t/0`` that can run in separate transactions to limit the time that transactions take and how long blocking locks are held in Postgres. """ alias Ecto.Multi alias Stormstout.Explorer.Import...