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
0b27c4989a75abf28dee267c9e5286b2eadb8878
2,822
[ 682981176 ]
[ "documented" ]
defmodule Mix.Tasks.FlowbiteIcons.Update do # Updates the icon set via download from github. @moduledoc false @shortdoc false @vsn "1.2.1" @tmp_dir_name "flowbite_icons" # Updates the icons in the assets/icons directory use Mix.Task require Logger def vsn, do: @vsn def svgs_path, do: Path.join(...
0b280171c604b1cf5c1bfaf06f5c0ab8a5e906fb
2,490
[ 720300622 ]
[ "liveview", "ecto" ]
defmodule IntegrationBeeWeb.StudentLive.FormComponent do use IntegrationBeeWeb, :live_component alias IntegrationBee.Competition @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> <:subtitle>Use this form to manage student records in your database.</:subtitle> ...
0b286a5fcdc70d3bfe81f06f3c1f2a460a3fdf48
2,234
[ 871097171 ]
[ "phoenix", "ecto" ]
defmodule BackendWeb.ClockController do use BackendWeb, :controller alias Backend.{Repo, Clock} import Ecto.Query # Fetch all clocks for a specific user def index(conn, %{"user_id" => user_id}) do clocks = Repo.all(from(c in Clock, where: c.user_id == ^user_id)) if clocks == [] do conn |...
0b28d940e7472621a3a8527dc3d6601d6662fcfd
3,223
[ 332777079 ]
[]
double = fn x -> 2 * x end triple = fn x -> 3 * x end filter = fn n -> rem(n, 4) == 0 end is_mod3_plus_1 = fn n -> rem(n, 3) == 1 end is_mod3_plus_2 = fn n -> rem(n, 3) == 2 end list = 0..7 # a |> proc(fun) #proc(a, fun) result_enum = Enum.filter(Enum.map(list, double), filter) # result_enum1 = Enum.map(list, double...
0b2915e8c49a3865ba8fc314f966e1d6e3ca14f2
11,684
[ 420456836 ]
[ "test" ]
defmodule Flawless.RuleTest do use ExUnit.Case, async: true alias Flawless.Error import Flawless.Rule import Flawless.Utils.Interpolation, only: [sigil_t: 2] describe "rule/2 and evaluate/3" do test "returns a valid rule with a simple string error" do test_rule = rule( fn value ->...
0b293c2ebdbb450b9887f6aaf7e9b848ba9a023b
7,397
[ 129757886 ]
[ "typespec", "documented" ]
defmodule Liquid.TableRow do @moduledoc""" `tablerow` tag iterates over an array or collection splitting it up to a table with pre-set columns number Several useful variables are available to you within the loop. """ alias Liquid.Render alias Liquid.Block alias Liquid.Variable alias Liquid.Context al...
0b2969db8cff710fe93eba195f83a65613daf5d8
1,760
[ 896842644 ]
[]
defmodule D10 do def parse(s) do ls = s |> String.split("\n") |> Enum.map(&String.graphemes/1) pos = for {l, i} <- Enum.with_index(ls) do for {c, j} <- Enum.with_index(l), do: {i, j, c} end |> List.flatten() pos_map = Enum.reduce(pos, %{}, fn {i, j, c}, ...
0b296a2e8fff6b3de4643c224311d94f54e1383e
2,160
[ 201751657 ]
[ "phoenix" ]
defmodule DerivcoAppWeb.DerivcoAppController do use DerivcoAppWeb, :controller import OpenApiSpex.Operation, only: [response: 3] alias DerivcoApp.LeagueSeasonPairs alias DerivcoAppWeb.Schemas.{ResultsResponse, LeagueSeasonPairsResponse} alias OpenApiSpex.Operation plug(OpenApiSpex.Plug.Cast) plug(OpenA...
0b29c92aaabaea10abc404640cc77b19486479c7
2,555
[ 559744925, 789802355, 872091867, 913995146, 915448704, 934044764, 962529983, 744142491, 828087786, 670103538, 713860590, 734242561, 882758430, 884344453, 939645202, 771989527, 773846987, 924963573, 718072585, 800967832, 803459398, 805634608, 710549260, 731178722, 8691...
[ "liveview" ]
defmodule Phoenix.LiveDashboard.ChartComponent do use Phoenix.LiveDashboard.Web, :live_component @impl true def mount(socket) do {:ok, socket |> stream_configure(:data, dom_id: &data_dom_id/1) |> stream(:data, [])} end defp data_dom_id(_), do: "unused" @impl true def update(assigns, ...
0b29ee9c401a8a33ef4b79375dd93eb3ac2c1bc9
5,408
[ 725917324 ]
[ "documented" ]
defmodule AoC.Day20 do @moduledoc """ """ alias :queue, as: Q def part1(filename) do filename |> parse() |> press_button(1000) |> elem(2) |> Enum.reduce([0, 0], fn {_name, :high}, [lows, highs] -> [lows, highs + 1] {_name, :low}, [lows, highs] -> [lows + 1, highs] end) |...
0b2a1a629c9dd84760794316a59de44601e0f2c3
6,675
[ 882897832 ]
[ "ecto" ]
defmodule FleetControl.DigUnitActivityAgent.Update do alias FleetControl.Helper, as: DHelper alias HpsData.Schemas.Dispatch.DigUnitActivity alias FleetControl.TimeAllocation.Helper alias Ecto.Multi alias HpsData.Schemas.Dispatch.TimeAllocation alias HpsData.Repo import Ecto.Query, only: [from: 2] req...
0b2a3ace9928b90e730165a29a2e29e874f57401
1,905
[ 177278976 ]
[ "test" ]
defmodule Geolix.Adapter.MaxMindCSV.Lookup.CountryDecimalTest do use Geolix.Adapter.MaxMindCSV.RepoCase alias Geolix.Adapter.MaxMindCSV.Repo alias Geolix.Adapter.MaxMindCSV.Schema.CountryBlockDecimal alias Geolix.Adapter.MaxMindCSV.Schema.CountryLocation test "lookup :country" do location = Repo.i...
0b2ac6ae50b63363c5ce5057b0c4615274e559ce
1,600
[ 1007182436 ]
[ "liveview", "phoenix" ]
defmodule BidMatchWeb.Endpoint do use Phoenix.Endpoint, otp_app: :bid_match # 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: "_bid_ma...
0b2ae5a8d7cc6175fe0dcecd25c33043c2b4544a
2,053
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.FirebaseDynamicLinks.V1.Model.DeviceInfo do @moduledoc """ Signals associated with the device making the request. ## Attributes * `deviceModelName` (*type:* `String.t`, *default:* `nil`) - Device model name. * `languageCode` (*type:* `String.t`, *default:* `nil`) - Device language co...
0b2af59475e9ae2ec294b571a9cb433ebc513f6c
5,554
[ 179747860 ]
[ "typespec", "test", "documented", "ecto" ]
defmodule ExGpgme.Context do @moduledoc """ """ alias __MODULE__ alias ExGpgme.Key @type t :: Context @type path :: binary() @type reason :: :foo defstruct home: nil, path: nil, version: nil, protocol: nil, ref: nil @spec create(path()) :: {:ok, t()}...
0b2b67373e9863577db667b25f2ccf2476422c00
2,542
[ 77644257 ]
[ "test" ]
defmodule PeoplePetsParty.PersonPetsConnectionControllerTest do use PeoplePetsParty.ConnCase alias PeoplePetsParty.PersonPetsConnection @valid_attrs %{} @invalid_attrs %{} setup %{conn: conn} do {:ok, conn: put_req_header(conn, "accept", "application/json")} end test "lists all entries on index", %...
0b2c89f48f8ac266f2190f357bd32a10e852d4ea
2,881
[ 62920508 ]
[ "documented", "ecto" ]
defmodule Ex338.FantasyPlayers do @moduledoc false import Ecto.Query, warn: false alias Ex338.Championships.Championship alias Ex338.FantasyPlayers.FantasyPlayer alias Ex338.FantasyPlayers.SportsLeague alias Ex338.Repo def all_players_for_league(league) do FantasyPlayer |> FantasyPlayer.with_te...
0b2ca1e38a93f25874da4d6312ed0e22fdcd5693
2,736
[ 764046132 ]
[ "liveview", "ecto" ]
defmodule CalenDazeWeb.BusinessRegistrationLive do use CalenDazeWeb, :live_view alias CalenDaze.BusinessAccounts alias CalenDaze.BusinessAccounts.Business def render(assigns) do ~H""" <div class="mx-auto max-w-sm"> <.header class="text-center"> Register for an account <:subtitle>...
0b2cd490c8168df763100173dd5b3e72366a62e9
2,604
[ 190499547, 116601036 ]
[ "test" ]
defmodule BlockquoteWeb.QuoteControllerTest do use BlockquoteWeb.ConnCase alias Blockquote.Admin @create_attrs %{body: "some body"} @update_attrs %{body: "some updated body"} @invalid_attrs %{body: nil} def fixture(:quote) do {:ok, quote} = Admin.create_quote(@create_attrs) quote end describ...
0b2d158b045390d007b904e33e7f340cf74222a7
4,194
[ 166714922 ]
[]
%{ "artificery": {:hex, :artificery, "0.4.0", "e0b8d3eb9dfe8f42c08a620f90a2aa9cef5dba9fcdfcecad5c2be451df159a77", [:mix], [], "hexpm"}, "certifi": {:hex, :certifi, "2.4.2", "75424ff0f3baaccfd34b1214184b6ef616d89e420b258bb0a5ea7d7bc628f7f0", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", opti...
0b2d8ee5d1adf66bae65bb14e289005909406734
7,258
[ 996920193 ]
[ "genserver", "test" ]
# test/foundation/services/service_behaviour_test.exs defmodule Foundation.Services.ServiceBehaviourTest do use ExUnit.Case, async: false # ServiceBehaviour is used via macro, ProcessRegistry via Foundation services # Simple test service implementation defmodule TestService do use Foundation.Services.Serv...
0b2dcc83152af89d2b0dea38f754ee2f0593fb5a
1,574
[ 604327763 ]
[]
defmodule GameserverWeb.MixProject do use Mix.Project def project do [ app: :gameserver_web, version: "0.1.0", build_path: "../../_build", config_path: "../../config/config.exs", deps_path: "../../deps", lockfile: "../../mix.lock", elixir: "~> 1.12", elixirc_path...
0b2f008f4f77bcab20bb08caac8a5385642a75c4
6,447
[ 370813738, 450993182 ]
[ "test" ]
defmodule StellarBase.XDR.Operations.HostFunctionTest do use ExUnit.Case alias StellarBase.XDR.{ AccountID, ContractIDPreimage, ContractIDPreimageFromAddress, ContractIDPreimageType, CreateContractArgs, ContractExecutable, ContractExecutableType, Hash, HostFunctionType, Host...
0b2f0ce7d57896cf55e009c818c5524c0b60992c
6,449
[ 319448136 ]
[ "test" ]
Code.require_file("../test_helper.exs", __DIR__) defmodule Config.ProviderTest do use ExUnit.Case doctest Config.Provider alias Config.Provider import PathHelpers import ExUnit.CaptureIO @tmp_path tmp_path("config_provider") @env_var "ELIXIR_CONFIG_PROVIDER_BOOTED" @sys_config Path.join(@tmp_path, "s...
0b2f6a9f68d1d993ffba75e9c4bbe74671b317f5
2,459
[ 728069974 ]
[]
# Problem text: https://adventofcode.com/2023/day/8 defmodule AOC2023.HauntedWastelandPart2 do def solve do path = relative_from_here("input.txt") lines = read_file(path) do_solve(lines) end def do_solve(lines) do instructions = get_lr_instructions(lines) map = get_map(lines) sta...
0b2f9d6d7a14895a1e089ff5c2813f19bfa5d40e
14,448
[ 300764794 ]
[ "documented" ]
defmodule PhoenixWithPrettyDebugger.Plug.PrettyDebugger.Highlighter do @moduledoc false alias Makeup.Lexer alias Makeup.Registry # The ElixirLexer is treated a bit specially because it's always # used to highlight function parameters alias Makeup.Lexers.ElixirLexer alias Makeup.Formatters.HTML.HTMLFormatt...
0b2fdb9accf3f9e12f5ea73663699a65511afe6e
4,272
[ 764844821 ]
[ "genserver", "liveview" ]
defmodule QuicWeb.SessionLive.FullScreenControls do use QuicWeb, :live_view alias Quic.Sessions alias QuicWeb.QuicWebAux @impl true def mount(_params, _session, socket) do {:ok, socket} end @impl true def handle_params(%{"id" => id}, _, socket) do if Sessions.exists_session_with_id?(id) && Se...
0b3019dd3f66fc49777c7ca77b0114a343b31615
4,927
[ 524413162 ]
[]
defmodule Filex.Storage.FileHandler do require Logger import Filex.Storage.FileState, only: [adapter: 1, user_dir: 1, put_adapter_state: 2] # Event Callbacks def after_event(event, _prev_state, {outcome, _new_state} = return) do Logger.debug("event: #{inspect(event)} :: #{inspect(outcome)}") retu...
0b307c8f71162647ba71b44589e40b016605e253
1,856
[ 206452166 ]
[ "test" ]
defmodule Inkfish.Autograde.TapTest do use ExUnit.Case alias Inkfish.Autograde.Tap @tap_good """ 1..8 ok 1 - square binary executable ok 2 - sq(0) ok 3 - sq(2) ok 4 - sq(10) ok 5 - cube binary executable ok 6 - cu(0) ok 7 - cu(3) ok 8 - cu(10) """ test "handles good TAP", _ do assert ...
0b30da13859a3795d7d0b454ba7b66495b8c97ec
4,988
[ 543302849 ]
[]
defmodule Mnemo.Engines.Block do alias Mnemo.Access.Schemas.{Block, ReviewBlock, Section, Enrollment} alias Mnemo.Resources.Postgres.Repo, as: PGRepo def next_block(enrollment, "review") do review_block = ReviewBlock |> ReviewBlock.where_student(enrollment.student_id) |> ReviewBlock.where_s...
0b317f83618ba8dd437ad7ea5822dd0ceb8dae5e
4,350
[ 850193518 ]
[ "documented", "ecto" ]
defmodule PlotsCreator.Dashboard do @moduledoc """ The Dashboard context. """ import Ecto.Query, warn: false alias PlotsCreator.Repo alias PlotsCreator.Dashboard.{YourPlots, SharedWithYou} @doc """ Returns the list of your_plots. ## Examples iex> list_your_plots() [%YourPlots{}, ...] ...
0b31899d7c497edcfc536a7189fca7a01088e514
2,452
[ 60463102 ]
[ "test" ]
defmodule PhoenixApi.CashTradeControllerTest do use PhoenixApi.ConnCase alias PhoenixApi.CashTrade @valid_attrs %{cash_holding_id: 42, quantity: 120.5} @invalid_attrs %{cash_holding_id: nil} setup %{conn: conn} do {:ok, conn: put_req_header(conn, "accept", "application/json")} end test "lists all e...
0b31f6240971be390bc6abd03529e6b8d0b3c94d
1,776
[ 943973456 ]
[ "ecto" ]
defmodule Pagebuilder.Repo.Migrations.AddMenuitems do use Ecto.Migration def change do execute( "CREATE EXTENSION ltree", "DROP EXTENSION ltree" ) create table(:menuitems, primary_key: false) do add :id, :binary_id, primary_key: true add :title, :string add :slug, :string...
0b3248f8841cc7c7df95151c58b1da4d86157a60
1,519
[ 446970191 ]
[ "typespec", "documented" ]
defmodule CurrencyConverter.Utils.DataManipulation do @moduledoc """ Module responsible for concentrating data manipulation with Ecto Query """ import Ecto.Query, warn: false @doc """ Apply data operations (pagination, filters and sorting) to query """ @spec apply_operations(Ecto.Query.t(), map) :: Ec...
0b338c8025ee07e493104d4a618dd1c1905e8ccb
2,548
[ 257787813 ]
[ "liveview" ]
defmodule Web.Settings.IdentityProviders.Mock.Components do use Web, :component_library def provider_form(assigns) do ~H""" <div class="max-w-2xl px-4 py-8 mx-auto lg:py-12"> <.form for={@form} phx-change={:change} phx-submit={:submit}> <.step> <:title>Configure the Mock adapter</:t...
0b33a595ec17dfdb5291d5ed370fb3c92c65ab8e
1,941
[ 81080290 ]
[ "test" ]
defmodule VectorTest do use ExUnit.Case alias Vivaldi.Simulation.Vector test "Vector Distance" do points_and_results = [ {[0, 0], [0, 0], 0}, {[0, 0], [0, 1], 1}, {[0, 0], [0, 2], 2}, {[0, 3], [4, 0], 5}, {[0, 1], [1, 0], :math.sqrt(2)} ] Enum.each(points_and_results, fn ...
0b34234c175bed246274d57a9ee7f44c4156c9a3
2,331
[ 64040574 ]
[ "test" ]
defmodule FetchMeIfYouCan.JobControllerTest do use FetchMeIfYouCan.ConnCase alias FetchMeIfYouCan.Job @valid_attrs %{content: "some content", job_id: "some content", status: "some content"} @invalid_attrs %{} test "lists all entries on index", %{conn: conn} do conn = get conn, job_path(conn, :index) ...
0b3445d9ba15b671df31fce519c981eb1aa4ae5a
2,422
[ 252505137 ]
[ "documented" ]
defmodule Ueberauth.Strategy.Streamlabs.OAuth do @moduledoc """ OAuth2 for Streamlabs. Add `client_id` and `client_secret` to your configuration: config :ueberauth, Ueberauth.Strategy.Streamlabs.OAuth, client_id: System.get_env("STREAMLABS_CLIENT_ID"), client_secret: System.get_env("STREAMLABS_CLIENT_...
0b348f5e84d75fcf03dacb2f5b3a00e8bbce56ba
2,021
[ 109804810 ]
[ "phoenix", "ecto" ]
defmodule MangalikeWeb.SerieController do use MangalikeWeb, :controller alias Mangalike.Manga alias Mangalike.Manga.Serie def index(conn, _params) do series = Enum.sort(Mangalike.get_titles()) random = Mangalike.random_manga() render(conn, "index.html", series: series, random: random) end de...
0b354e9c002df5690429b669164dc982101b9e24
6,366
[ 896952078 ]
[]
defmodule AdventOfCode.Day16 do def part1(args) do {start_position, end_position, map} = parse_input(args) {score, _visited} = find_score({start_position, :right}, end_position, map) score end def part2(args) do {start_position, end_position, map} = parse_input(args) {_score, visited} = find_...
0b35592870d8ebc9121a8be3be7727ac65d2961b
2,262
[ 670913549 ]
[ "documented", "ecto" ]
defmodule ThreatShield.Members.Invite do use Ecto.Schema alias ThreatShield.Accounts.{Organisation, User} import Ecto.Changeset import ThreatShield.Const.RetentionTimes, only: [invite_lifetime_in_seconds: 0] schema "invites" do field :token, :string field :email, :string belongs_to :organisati...
0b35702db90797ecfc40ccbff1aefb9cef0e8363
12,262
[ 263151554 ]
[ "test" ]
defmodule OscarexTest do use ExUnit.Case doctest Oscarex defp hex_to_bin(message) when is_binary(message) do message |> String.split(~r/\s+/, trim: true) |> hex_to_bin() end defp hex_to_bin(hex_bytes) when is_list(hex_bytes) do hex_bytes |> Enum.map(&String.upcase/1) |> Enum.map(&Base.decode...
0b35795597cad6e8d7dc744366f4d8dd2c9330a7
9,865
[ 198546741, 230659468, 189624457, 191000630, 349082708, 294468145, 192243128 ]
[ "typespec", "documented" ]
defmodule Postgrex.Types do @moduledoc """ Encodes and decodes between Postgres' protocol and Elixir values. """ alias Postgrex.TypeInfo import Postgrex.BinaryUtils @typedoc """ Postgres internal identifier that maps to a type. See http://www.postgresql.org/docs/9.4/static/datatype-oid.html. """ @...
0b3579e549edef847b77e58f6bd4d4ba1ad6a899
1,668
[ 813275217 ]
[ "typespec" ]
defmodule Phys3D.Vec3 do @type t :: {float(), float(), float()} @spec new(x :: number(), y :: number(), z :: number()) :: t() def new(x, y, z) do {x + 0.0, y + 0.0, z + 0.0} end @spec add(vec1 :: t(), vec2 :: t()) :: t() def add({x1, y1, z1}, {x2, y2, z2}) do {x1 + x2, y1 + y2, z1 + z2} end @...
0b35be13be8777adb8cd9907b6a2faed80565031
2,649
[ 858998715 ]
[ "typespec", "macro", "documented", "ecto" ]
defmodule ExPixBRCode.ValueObject do @moduledoc """ Value object is a data structure that has no identity. We use value objects as a means of defining a data structure with its validations. Also, it has helpers for turning structs into maps (the opposite of `ExPixBRCode.Changests.cast_and_apply`). """ ...
0b35e97912de16e89880c7ff82a7c304fc298a69
2,648
[ 559926405 ]
[ "phoenix", "ecto" ]
defmodule BookshareWeb.ReviewController do use BookshareWeb, :controller alias Bookshare.Auth alias Bookshare.Comments alias Bookshare.Comments.Review alias Bookshare.Comments.CommentNotifier action_fallback BookshareWeb.FallbackController def index(conn, %{"id" => id}) do reviews = Comments.list_r...
0b36979dd1080cbd7c0310e4ce7266e8b0b98df4
1,806
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.RemoteBuildExecution.V2.Model.GoogleDevtoolsRemoteworkersV1test2CommandOutputs do @moduledoc """ DEPRECATED - use CommandResult instead. Describes the actual outputs from the task. ## Attributes * `exitCode` (*type:* `integer()`, *default:* `nil`) - exit_code is only fully reliable if th...
0b36c754de16984dddfb1550dd3e49b4939d9cbb
11,395
[ 989918778 ]
[ "genserver", "documented" ]
defmodule MCPChat.Agents.ClusterManager do @moduledoc """ Cluster management for distributed agent orchestration. Handles node discovery, cluster formation, and cross-node communication for the distributed agent system. """ use GenServer require Logger alias MCPChat.Agents.{DistributedSupervisor, Dis...
0b37049911c5ae8e641548c7cc681bb90e4c1228
2,400
[ 82238227 ]
[ "test" ]
defmodule Teaminterface.ScoreControllerTest do use Teaminterface.ConnCase alias Teaminterface.Score @valid_attrs %{availability: "120.5", evaluation: "120.5", security: 42} @invalid_attrs %{} test "lists all entries on index", %{conn: conn} do conn = get conn, score_path(conn, :index) assert html_re...
0b3741d4cbae8057cdb1de818e591316f7830401
2,447
[ 105913697 ]
[ "test", "ecto" ]
defmodule Skoller.SchoolsTest do use Skoller.DataCase alias Skoller.Schools describe "school_email_domains" do alias Skoller.Schools.EmailDomain @valid_attrs %{email_domain: "some email_domain"} @update_attrs %{email_domain: "some updated email_domain"} @invalid_attrs %{email_domain: nil} ...
0b3771ddb79a6cf11950bec1c956b5e55ac43aac
6,429
[ 756716345 ]
[ "liveview" ]
defmodule Helpers do use Phoenix.Component alias Phoenix.LiveView.JS import LibraryWeb.Gettext slot :inner_block, required: true def error(assigns) do ~H""" <p class="flex gap-3 mt-3 leading-6 text- text-rose-600"> <.icon name="hero-exclamation-circle-mini" class="mt-0.5 h-5 w-5 flex-none" /> ...
0b37b6a297707b06bac23f7f6374a82b6dabdfe3
3,264
[ 62237113 ]
[ "genserver", "test" ]
require Logger defmodule Serverboards.WebsocketTest do use ExUnit.Case @moduletag :capture_log @port 8123 doctest Serverboards.IO.HTTP setup_all do {:ok, http} = case Serverboards.IO.HTTP.start_link(port: @port, name: __MODULE__) do {:ok, http} -> {:ok, http} {:error, {...
0b3897b8e06c4e118a316605df64ef03c07494d2
1,831
[ 396994603 ]
[ "documented" ]
defmodule BinanceFuturesBot.TradeManager.TradeServer.ReversalShort do @moduledoc """ This module encapsulates the strategy for when we want to reverse a rising chart and take a short position """ require Logger alias BinanceFuturesBot.TradeManager.TradeServer.{State, OrderManager} def run(%State{trade_...
0b397c879a36a7332dcac238a0a1c054d7dadaab
2,556
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Run.V1.Model.GoogleDevtoolsCloudbuildV1RepoSource do @moduledoc """ Location of the source in a Google Cloud Source Repository. ## Attributes * `branchName` (*type:* `String.t`, *default:* `nil`) - Regex matching branches to build. The syntax of the regular expressions accepted is the sy...
0b39f8d9081559201990883f583e48a907ad2cc3
3,729
[ 418324559, 100891628 ]
[ "typespec", "documented" ]
defmodule Forth do @moduledoc """ An evaluator for the Forth Programming Language. """ @tokens ~r/[[:graph:]]+/u @start_definition ":" @end_definition ";" @opaque evaluator :: %{stack: list, words: map, definition: boolean} @doc """ Create a new evaluator. """ @spec new() :: evaluator def new...
0b3a474e3152734e1302929469d8b03a85bdc3ca
2,703
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.Sheets.V4.Model.UpdateBordersRequest do @moduledoc """ Updates the borders of a range. If a field is not set in the request, that means the border remains as-is. For example, with two subsequent UpdateBordersRequest: 1. range: A1:A5 `{ top: RED, bottom: WHITE }` 2. range: A1:A5 `{ left: BLUE }` ...
0b3a9ce63f1d3196c24a5a2637002a350105fb24
2,390
[ 969026654 ]
[]
defmodule TodoList do defstruct next_id: 1, entries: %{} def new(), do: %TodoList{} def add_entry(todo_list, entry) do entry = Map.put(entry, :id, todo_list.next_id) new_entries = Map.put( todo_list.entries, todo_list.next_id, entry ) %TodoList{ todo_list | ...
0b3af7d42f939e256362b8662f9b5842784cc6b9
1,880
[ 933778439 ]
[]
defmodule Todo.Bench do @total_keys 1_000_000 def run(module, opts \\ []) do IO.puts("") concurrency = min(Keyword.get(opts, :concurrency, 1), @total_keys) num_updates = Keyword.get(opts, :num_updates, 10) items_per_process = div(@total_keys, concurrency) module.start_link() {time, _} = ...
0b3b57d681b916529d5f442c5c2d495c1c21eae5
8,454
[ 114827450, 110203993 ]
[ "genserver" ]
defmodule PhoenixClient do require Logger def main(args) do {_, args, _} = OptionParser.parse(args) server_ip = Enum.at(args, 0) port = 4000 start_link(server_ip, port, :interactive) end def start_link(server_ip, port, mode \\ :interactive, username \\ None, users \\ None, frequency \\ :mediu...
0b3b679c93668f76ca14f9b66bb1810a0a134543
3,891
[ 193244709, 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1AnnotatedDataset do @moduledoc """ AnnotatedDataset is a set holding annotations for data in a Dataset. Each labeling task will generate an AnnotatedDataset under the Dataset that the task is requested for. ## Attributes * `annotat...
0b3bc4cf50a96463c79a3ec88ef21fb351f1c449
3,265
[ 614957742 ]
[ "liveview", "ecto" ]
defmodule ZaqueuWeb.CreditCardLive.FormComponent do use ZaqueuWeb, :live_component alias Zaqueu.Financial alias Zaqueu.Financial.Schemas.CreditCard @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> </.header> <.simple_form for={@form} id...
0b3be6174cdf47c1ce650731d00808a55d1c18ae
6,242
[ 1008670264 ]
[ "documented" ]
defmodule EveDmv.Historical.KillmailImporter do @moduledoc """ Core functionality for importing historical killmails. This module contains the core logic extracted from the Mix task to reduce module dependencies and improve maintainability. """ require Logger @doc """ Transform killmail data from arc...
0b3c20495e30f3cec5536938156c42af027b445d
2,537
[ 405770007 ]
[]
defmodule River.Transactions do alias River.Transaction @headers ~w(date tx_type price quantity)a def process(stream, option) do stream |> stream_to_transactions() |> Enum.split_with(&(&1.tx_type == "buy")) |> sell(option) |> print() end defp stream_to_transactions(transactions_stream) ...
0b3c2dfa7c3853a59189d0f85db9df7cafce9c40
2,229
[ 195789749 ]
[ "test", "ecto" ]
defmodule NetworkApi.DirectoryTest do use NetworkApi.DataCase alias NetworkApi.Directory describe "nodes" do alias NetworkApi.Directory.Node @valid_attrs %{description: "some description", name: "some name", tag: "some tag"} @update_attrs %{description: "some updated description", name: "some updat...
0b3c2facf82232963019c77d5603da0ce994ed2a
1,897
[ 416448015 ]
[ "test" ]
defmodule PuzzleTest do use ExUnit.Case doctest Water.Puzzle test "find_drops(0, 4) returns []" do assert Water.Puzzle.find_drops(0, 4) == [] end test "find_drops(1, 4) returns 'AAAA'" do assert Water.Puzzle.find_drops(1, 4) == 'AAAA' end test "transfer drop from first vial and drop into last (...
0b3cd179eac5b2e6e2894d19b2f1a58d7fea736d
9,851
[ 117159219 ]
[ "macro", "documented" ]
defmodule SpaceEx.Gen do alias SpaceEx.Util @moduledoc false defmacro __using__(opts) do quote location: :keep, bind_quoted: [opts: opts] do @service_name opts[:name] || SpaceEx.Util.module_basename(__MODULE__) @service SpaceEx.API.service_data(@service_name) @service_overrides opts[:overr...
0b3cd5f54b5b2037e49bd3410d6c2f045b307695
4,613
[ 996920193 ]
[ "genserver", "documented" ]
defmodule Foundation.Telemetry.SpanManager do @moduledoc """ GenServer that manages span context storage using ETS. This module replaces the Process dictionary usage in span tracking with a centralized ETS-based solution that provides: - Per-process span stack management - Automatic cleanup when processes...
0b3cd8c40cc315877759433534197db2e795e340
1,989
[ 564968248 ]
[ "liveview" ]
defmodule ChileanbirdsWeb.Live.Pages.Home.Index do use ChileanbirdsWeb, :live_view alias ChileanbirdsWeb.Live.Components.{ Navbar, Searchbar, Footer, Spinner } alias ChileanbirdsWeb.Live.Pages.Home.Components.{ Birds, Modal } @impl true def handle_event( "on:search:change"...
0b3d1059f438e80e49f1a955bb1ca92daa7c1442
1,906
[ 421196745 ]
[ "documented", "ecto" ]
defmodule Forms.Accounts do @moduledoc """ The Accounts context. """ import Ecto.Query, warn: false alias Forms.Repo alias Forms.Accounts.Owner @doc """ Returns the list of owner. ## Examples iex> list_owner() [%Owner{}, ...] """ def list_owner do Repo.all(Owner) end @do...
0b3d1bac3eded5942be2cba51acb30ee47235de2
1,876
[ 480590824 ]
[ "test" ]
defmodule TecSolfacilCepApi.AccountsTest do use TecSolfacilCepApi.DataCase import TecSolfacilCepApi.AccountsFixtures alias TecSolfacilCepApi.Accounts alias TecSolfacilCepApi.Entities.Accounts.User describe "create_user/1" do test "fail to create invalid user when email is short" do invalid_user_m...
0b3df9a265f1d26c613e8cab91f60afb36fb792a
5,381
[ 343407947 ]
[ "typespec", "documented" ]
defmodule Legl.Countries.Uk.Article.Taxa.LRTTaxa do @moduledoc """ Functions to build the content of the Taxa family of fields in the Legal Register Table """ alias Legl.Countries.Uk.LeglRegister.LegalRegister, as: LR alias Legl.Countries.Uk.LeglRegister.Taxa.GovernedRoles, as: Actor alias Legl.Countries....
0b3e4676adbe5adaf06719c20f567ad8e0fa30ca
8,115
[ 590309917 ]
[ "phoenix" ]
defmodule ApiWeb.WorkingTimeController do use ApiWeb, :controller import Ecto.Query alias Api.WorkingTimes alias Api.User alias Api.Repo alias Api.Member def create(conn, params) do if(conn.assigns == %{}) do conn |> render(ApiWeb.ErrorView, "error.json", %{status: 401, error: "Unauthorize"}...
0b3e95b8f90d5d63722a0fe4499213bd7490e519
2,197
[ 257003101 ]
[ "liveview", "macro", "documented", "phoenix" ]
defmodule ManageWeb 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 ManageWeb, :controller use ManageWeb, :view The definitions below will be executed for every view, controller, etc...
0b3f49a7e883af0786bbd1ff278d9dac6a95811b
4,216
[ 58971458 ]
[ "macro", "documented" ]
defmodule Prometheus do @moduledoc """ [Prometheus.io](https://prometheus.io) client library powered by [prometheus.erl](https://hexdocs.pm/prometheus) Prometheus.ex is a thin, mostly macro-based wrapper around prometheus.erl. While it's pretty straightforward to use prometheus.erl from Elixir, you might ...
0b3f6aae28d47730c0f525a129a103511030a04a
5,387
[ 904533394 ]
[ "liveview", "ecto" ]
# lib/hyacinth/labeling/label_job_type/comparison_heapsort.ex defmodule Hyacinth.Labeling.LabelJobType.ComparisonHeapsort do # 모듈 이름 수정 alias Hyacinth.Labeling.LabelJobType alias Hyacinth.Warehouse.Object alias Hyacinth.Labeling.{LabelJob, LabelSession, LabelElement} defmodule ComparisonHeapsortOptions do #...
0b400ded53d134862b9eed17c0b9436ba1fe217d
12,447
[ 29960573 ]
[ "documented" ]
defmodule Gex do # folder to store repo information @gex_dir ".gex" # system dependent root directory @system_root Path.join(["/"]) # initial contents of a gex repo @gex_init_tree [ HEAD: "ref: refs/heads/master\n", config: "", objects: [], refs: [ heads: [ master: "" ], ...
0b403a504858931094ae14650856b28409b29e11
3,443
[ 853932113 ]
[ "documented", "ecto" ]
defmodule PayfyPokemon.Tamagotchi do @moduledoc """ The Tamagotchi context. """ import Ecto.Query, warn: false alias PayfyPokemon.Repo alias PayfyPokemon.Tamagotchi.Pokemon def update_all_hunger do Repo.transaction(fn -> from(p in Pokemon, where: p.hunger < 150, update: [inc: ...
0b407b1c2900dbe52471ce4fb4e10cdc6a88da24
1,569
[ 238124875 ]
[]
defmodule Dat.Hypercore.Config do @feed_size 8 * 1024 * 1024 @message_size 10 * 1024 * 1024 # "json" or "utf-8" defstruct value_encoding: "binary" end defmodule Dat.Hypercore.Feed do @max_feed_size 8 * 1024 * 1024 @max_message_size 10 * 1024 * 1024 defstruct bitfield: '', tree: '', ...
0b40b7c9f5a6aaf972bd58d9b80319b08dbbbdd9
4,070
[ 322345781 ]
[ "test" ]
defmodule MessageStoreTest do use ExUnit.Case alias MessageStore.{MessageData, Repo, VersionConflictError} setup do start_supervised!(MessageStore.Repo) Repo.truncate_messages() :ok end def build_new_message(attrs) do defaults = [type: "VideoCreated", data: %{name: "YouTube Video"}] at...
0b410414002f7800e122ebd5258e17c43f3ea208
3,871
[ 896729983 ]
[ "typespec" ]
defmodule AoC do def zip_tail_with(xs, f) do Enum.zip_with(tl(xs), Enum.drop(xs, -1), f) end def heads(xs) do Enum.scan(xs, [], fn item, acc -> acc ++ [item] end) end def tails(xs) do Enum.scan(xs, xs, fn _, acc -> tl(acc) end) en...
0b4118f313f123f32966493f5721acf396e18c1b
4,348
[ 232779035 ]
[ "typespec", "macro" ]
defmodule ElixirKeeb.Macros do alias ElixirKeeb.Structs.KeycodeBehavior alias ElixirKeeb.Usb.{Report, Gadget} alias ElixirKeeb.Usb.Keycodes import ElixirKeeb.Usb.Keycodes, only: [shifted?: 1, is_normal?: 1, normal?: 1, is_modifier?: 1, modifier?: 1] require Logger @type reset_input_report :: boolean() ...
0b4197a32ba06ddfb355359bb4d9b980ce59610e
4,809
[ 787014808 ]
[ "typespec", "documented" ]
defmodule Emulation do @moduledoc """ This module is a wrapper around ComBase that simplifies its use in student code. It does so by saving the context as a named Agent, and retrieving it when necessary. """ require ComBase require Fuzzers @context :emu_context @doc """ Setup the emulation """ ...
0b41cf52b9cb9d06b1b478a13cb6a50b7c469af4
2,011
[ 62417876 ]
[ "test" ]
defmodule IntegerMatchersTest do use ExUnit.Case, async: true use ExMatchers import AssertHelpers describe "an integer" do setup do %{actual: 42} end test "is equal to another", %{actual: a_integer} do expect a_integer, to: eq(42) end test "is less than another", %{actual: a_i...
0b41f42358ef4c04a55c688803b4c930f3b443a3
2,661
[ 484849633 ]
[ "test", "ecto" ]
defmodule Alfred.CoreTest do use Alfred.DataCase alias Alfred.Core describe "config_params" do alias Alfred.Core.ConfigParam import Alfred.CoreFixtures @invalid_attrs %{key: nil, value: nil} test "list_config_params/0 returns all config_params" do config_param = config_param_fixture() ...
0b41ff91238c9206851aae832b9bbf48942f8a6d
1,656
[ 338169793 ]
[ "documented" ]
defmodule ToyRobot.CLI do @moduledoc """ Main entry point which allows application to be run from the command line. This module is built using the `escript.build` `mix` command: ```elixir > mix escript.build Generated escript toy_robot with MIX_ENV=dev > ``` The application can then be run as a comma...
0b422c69e2418db5b2e9c0144d0c153da57da2d8
2,973
[ 204611994 ]
[ "genserver", "typespec", "documented" ]
defmodule ExZkb.Client do @moduledoc """ Websocket Client for zkillboard See https://github.com/zKillboard/zKillboard/wiki/Websocket for documentation on the Websocket and supported channels """ use WebSockex require Logger alias ExZkb.{Parser, Handler} @url "wss://zkillboard.com:2096" @process_name...
0b42358f8d5e13ac8ef9f9d3c8219ddc84390184
1,892
[ 706405223 ]
[ "genserver", "liveview" ]
defmodule LiveViewStudioWeb.FlightsLive do use LiveViewStudioWeb, :live_view alias LiveViewStudio.Flights def mount(_params, _session, socket) do socket = assign(socket, airport: "", flights: [], loading: false ) {:ok, socket} end def handle_event("search", %{"a...
0b429d1e1ffd8d3729a3e4f23e885470991684b6
2,340
[ 757458855 ]
[ "documented", "ecto" ]
defmodule LoanSavingsSystem.FlexcubeLogs do @moduledoc """ The FlexcubeLogs context. """ import Ecto.Query, warn: false alias LoanSavingsSystem.Repo alias LoanSavingsSystem.FlexcubeLogs.FlexcubeLog @doc """ Returns the list of flexcubeconfigs. ## Examples iex> list_flexcubeconfigs() [...
0b42c398ef3f44c82b7f3724279eb61474b2210f
1,534
[ 166866293 ]
[ "test" ]
defmodule Harald.Host.L2CAPTest do use ExUnit.Case, async: true alias Harald.Host.{ATT, L2CAP} alias Harald.Host.ATT.ExchangeMTUReq test "decode/1" do decoded_mtu = 185 decoded_exchange_mtu_rsp = 2 encoded_att_data = << decoded_exchange_mtu_rsp, decoded_mtu::little-size(16) >> ...
0b42dc998c7847a5d8062e4a6515242ab13c36dc
3,075
[ 613123477 ]
[ "typespec", "liveview", "documented", "phoenix" ]
defmodule NetDiacriticalWeb.Router do @moduledoc "Defines a `Phoenix.Router` router." @moduledoc since: "0.2.0" use Phoenix.Router, helpers: false import Phoenix.LiveView.Router alias NetDiacriticalWeb, as: Web alias Web.{Controller, Endpoint, HTML, LiveView} @typedoc "Represents the connection." @...
0b4308af07007dc4792ddf4a645308e08b8bb18f
4,990
[ 572972102 ]
[ "test", "ecto" ]
defmodule Ecto.Integration.JoinsTest do use Ecto.Integration.Case import Ecto.Query alias Ecto.Integration.TestRepo alias Ecto.Integration.{Post, Permalink, Comment} test "joins" do _p = TestRepo.insert!(%Post{title: "1"}) p2 = TestRepo.insert!(%Post{title: "2"}) c1 = TestRepo.insert!(%Permalink...
0b431e660c2f134eed4b848b81c0446457ee1081
3,206
[ 144751817 ]
[ "test" ]
defmodule MangoWeb.Admin.SupplierControllerTest do use MangoWeb.ConnCase alias Mango.Warehouse @create_attrs %{contact_person: "some contact_person", email: "some email", name: "some name", phone: "some phone"} @update_attrs %{contact_person: "some updated contact_person", email: "some updated email", name: "...
0b4330338d76eeae798aa1b3a7ef1ba5a10fdb52
4,461
[ 334336088 ]
[]
defmodule Blackjack do def start do #Entry point for the game #Create a dealer and a player dealer = create_player(:dealer, 1000) player = create_player(:human, 1000) #Show the starting welcome message IO.puts("Welcome to Blackjack!") #start the first game play_new_hand(dealer, pla...
0b4451a239299d8d1e18771415c71aaf850934e6
16,551
[ 1005465765 ]
[ "typespec", "documented" ]
defmodule ExSaml.IdpData do @moduledoc false import SweetXml require Logger require ExSaml.Esaml alias ExSaml.{Esaml, Helper, IdpData, SpData} @type nameid_format :: :unknown | charlist() @type certs :: [binary()] @type url :: nil | binary() defstruct id: "", sp_id: "", base...
0b448de3e90f9bfffbad85c3da30cba122eab8c7
2,730
[ 273417117 ]
[]
defmodule Inkfish.Uploads.Data do import Inkfish.Text, only: [corrupt_invalid_utf8: 1] alias Inkfish.Uploads.Upload def read_data(%Upload{} = upload) do read_tree(Upload.unpacked_path(upload)) end def read_tree(base) do read_tree(base, "") end def read_tree(base, rel) do path = Path.join(ba...
0b44d541caeeec907edaebcb8e5277299d5ec8dc
1,730
[ 392870324 ]
[ "documented", "ecto" ]
defmodule ProcuraPet.Images do @moduledoc """ The Images context. """ import Ecto.Query, warn: false alias ProcuraPet.Repo alias ProcuraPet.Images.Image @doc """ Returns the list of images. ## Examples iex> list_images() [%Image{}, ...] """ def list_images do Repo.all(Image) ...
0b4528cc14ec596c2813d2dae778a5c24df07e76
2,458
[ 558026208 ]
[ "genserver" ]
defmodule Rtp.Aggregator do use GenServer alias Rtp.Utils.Tweet, as: Tweet @sink :sink @batch_size 1 @timeframe 2000 def start_link(name) do GenServer.start_link(__MODULE__, [], name: name) end def init([]) do Process.send_after(self(), :sink_send, @timeframe) {:ok, %{}} end def han...
0b4559c00fc4aaf2b8e89574fef77605f8480866
2,624
[ 120882028 ]
[ "test" ]
defmodule ReceiptTest do use ExUnit.Case doctest Receipt setup_all do Application.put_env(:sale_taxes, :basic_tax_exempt_good, [food: ["chocolate", "milk"], medical_prod: ["headache pill"], book: ["book"]]) Application.put_env(:sale_taxes, :basic_tax_rate, 0.1) Application.put_env...
0b45d1943f6a098734322153eae55173b4e6cbcf
1,606
[ 143164828, 91143120 ]
[]
defmodule OneChatWeb.FlexBar.Tab.Notification do use OneChatWeb.FlexBar.Helpers alias OneChat.Notification alias OneChat.AccountService alias InfinityOne.{Accounts, TabBar.Tab} def add_buttons do TabBar.add_button Tab.new( __MODULE__, ~w[channel group direct im], "notifications", ...
0b464ea41c24eae8436260c8bc307010facd2d19
6,590
[ 30836972 ]
[ "documented" ]
defmodule PlantWebSocketHandler do @moduledoc """ This module upgrades an HTTP connection to a WebSocket that manages a SmartFarm plant model editing session. Because JavaScript measures time in milliseconds since 1/1/1970, we will use that representation for simulation time as well. """ @...