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
05372262c0f28644dc2bceebfbe540f4858ea9ad
3,560
[ 544534077 ]
[]
#Importing Named Functions # use the import directive to create a module that stores a list of tasks in a file defmodule TaskList do @file-name "task_list.md" #module attribute def add(task_name) do task = "[ ] " <> task_name <> "\n" File.write(@file_name, task, [:append]) end def show_list do File...
05372425ad1d6bd5972d590d2ac9f4eaeec974cf
11,448
[ 132878376 ]
[ "macro", "documented" ]
defmodule ExAliyunOts.Client.Table do @moduledoc false alias ExAliyunOts.TableStore.{ AddDefinedColumnRequest, DeleteDefinedColumnRequest, CreateTableRequest, PrimaryKeySchema, PrimaryKeyType, DefinedColumnSchema, DefinedColumnType, TableMeta, IndexMeta, CreateIndexRequest, ...
053746866515f697316943107c09962e27926784
7,035
[ 173431331, 350811664, 165165414, 163277988 ]
[ "documented" ]
defmodule Credo.ConfigFile do @doc """ `ConfigFile` structs represent all loaded and merged config files in a run. """ @config_filename ".credo.exs" @default_config_name "default" @default_config_file File.read!(@config_filename) @default_glob "**/*.{ex,exs}" @default_files_included [@default_glob] ...
05375d0afff900b06ba18b5f371199c82856f57a
1,742
[ 993958007 ]
[ "typespec", "documented" ]
defmodule ReplyExpress.Accounts.Commands.GeneratePasswordResetToken do @moduledoc """ Command to log in a registered user, including sanitization and validation fns """ use ExConstructor use Vex.Struct alias ReplyExpress.Accounts.Commands.GeneratePasswordResetToken alias ReplyExpress.Accounts.UsersConte...
05377463e5bb9d311288eed80d5b7c4e96ef5ea8
1,715
[ 960142181 ]
[ "liveview", "phoenix" ]
defmodule RecruitmentWeb.Endpoint do use Phoenix.Endpoint, otp_app: :recruitment # 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: "_r...
0537758fb5613c8612df03be1fb1bb6fddb7d48b
2,856
[ 168225131 ]
[ "test" ]
defmodule Perspective.Encoding.Test do use ExUnit.Case, async: true defmodule Example do defstruct [:data] end test "encode/decode a string" do string = "abc" encoded_string = Perspective.Encode.encode(string) decoded_string = Perspective.Decode.decode(encoded_string) assert "abc" == enc...
05377dc9ec04399416f10c5e3ae706fde951ef00
5,201
[ 485586448, 417664530, 509563030, 444472658 ]
[ "documented" ]
defmodule Kaffy.ResourceCallbacks do @moduledoc false alias Kaffy.Utils def create_callbacks(conn, resource, changes) do changeset = Kaffy.ResourceAdmin.create_changeset(resource, changes) repo = Kaffy.Utils.repo() repo.transaction(fn -> result = with {:ok, changeset} <- before_insert...
0537c1eeee8653be5c88faaeaf6dc25739ceed39
1,810
[ 996012648 ]
[ "documented" ]
defmodule Jabol.Migration.Runner do @moduledoc """ Executes migration commands by translating them to SQL. """ @doc """ Creates a table in the database. """ def create_table(table) do # Implementation would convert the table definition to SQL CREATE TABLE # and execute it against the database ...
05381b12f0e05d4d93097d79b8b46fca48bf94cc
1,595
[ 203172973 ]
[]
defmodule WhatsTheirFaceUserGenerator.CLI do def main(args) do create_image_folder() args |> parse_args |> process end def create_image_folder do File.mkdir_p!("./images") end def parse_args(args) do parse = OptionParser.parse(args, switches: [help: :boolean], a...
05384b16de39a6b3f6d2d44d5469178f2aef81e2
1,888
[ 220216161 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, "credo": {:hex, :credo, "1.1.5", "caec7a3cadd2e58609d7ee25b3931b129e739e070539ad1a0cd7efeeb47014f4", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1....
0538ab60c15dc418755526c85f49b09fa91ea78a
1,764
[ 320413007 ]
[ "test" ]
defmodule AdventOfCode.Day15Test do use ExUnit.Case import AdventOfCode.Day15 @tag :skip test "part1" do input = "Sensor at x=2, y=18: closest beacon is at x=-2, y=15 Sensor at x=9, y=16: closest beacon is at x=10, y=16 Sensor at x=13, y=2: closest beacon is at x=15, y=3 Sensor at x=12, y=14: closest beac...
053938bff538a7a94186e45d15703d7e555695f9
3,778
[ 51291223, 3126245 ]
[]
defmodule Dynamo.Filters.Exceptions.Debug do defmodule Frame do defstruct [:module, :function, :file, :line, :context, :index, :snippet, :link] end import Dynamo.Helpers.Escaping def service(conn) do { status, kind, value, stacktrace } = conn.assigns[:exception] assigns = [ frames: frames(c...
053983491fb3f3ae1de53cc9b911ae74224beb66
8,937
[ 159038989 ]
[ "genserver", "typespec", "documented" ]
defmodule DBConnection.Ownership.Manager do @moduledoc false use GenServer require Logger alias DBConnection.Ownership.{Proxy, ProxySupervisor} @timeout 5_000 @callback start_link({module, opts :: Keyword.t}) :: GenServer.on_start def start_link({module, opts}) do {owner_opts, pool_opts} = Keywo...
053a76d2eb621a73131873fed836e0596a83380b
2,397
[ 672062856 ]
[ "typespec", "documented", "ecto" ]
defmodule Lanttern.StudentsCycleInfoLog do @moduledoc """ The StudentsCycleInfoLog context. """ import Ecto.Query, warn: false alias Lanttern.Repo alias Lanttern.StudentsCycleInfo.StudentCycleInfo alias Lanttern.StudentsCycleInfoLog.StudentCycleInfoLog @doc """ Creates a student_cycle_info_log. ...
053a932c6138a4daac55d83a90e11739387a7f73
3,071
[ 125938964 ]
[ "typespec", "documented" ]
defmodule Ueberauth.Strategy.Slack.OAuth do @moduledoc """ An implementation of OAuth2 for Slack OAuth V2 API. To add your `client_id` and `client_secret` include these values in your configuration. config :ueberauth, Ueberauth.Strategy.Slack.OAuth, client_id: System.get_env("SLACK_CLIENT_ID"), ...
053a953b16d73a2e8c936aa6b5d7b3ae8e7e19de
3,725
[ 163669711 ]
[]
defmodule AC.Dec16 do @initial_state String.codepoints("abcdefghijklmnop") @iterations 1_000_000_000 # Part 1 # Doesn't work right if programs > length(list); this should never happen def spin(list, 0), do: list def spin(list, program_count) do len = length(list) last = Enum.slice(list, -program_...
053abae8d3f0a7f812858210efdaa243c0569906
10,305
[ 215904081 ]
[ "typespec", "documented" ]
defmodule DroneSimulator.Tube.Quadtree do @moduledoc """ The module defines a quad tree data structure to specify all the co-ordinates for tube stations and allows performing search for nearest neighbor of any given co-oridnate. ### Note! For simplicity and domain handling, only one point per node is allow...
053b65d329d9bc73c1166888300731641743682d
2,534
[ 71805301 ]
[]
defmodule Mastermind do @colors ["R", "G", "B", "Y", "P", "W"] def play, do: pick_code |> play(10) def play(code, guesses) do get_guess |> check_guess(code, guesses) |> end_game?(code) end def play_again? do response = IO.gets("Play again? (y/n)\n> ") |> String.trim case response do ...
053bfad40e452a17ef22846ffe391dd26eeede77
2,347
[ 593089915 ]
[ "liveview", "ecto" ]
defmodule LiveSelectBugWeb.ProfileLive.FormComponent do use LiveSelectBugWeb, :live_component import LiveSelect alias LiveSelectBug.Accounts @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> <:subtitle>Use this form to manage profile records in your database...
053c02476c2e90b3163c526829aa0dbc668a4e1e
1,690
[ 619972170 ]
[ "genserver", "liveview" ]
defmodule PlantAidWeb.LocationTypeLive.Index do use PlantAidWeb, :live_view alias PlantAid.LocationTypes alias PlantAid.LocationTypes.LocationType @impl true def mount(_params, _session, socket) do current_user = socket.assigns.current_user with :ok <- Bodyguard.permit(LocationTypes, :list_location...
053c8316986dfc7f8322f17c53bc73917198ef48
6,324
[ 125502282 ]
[ "documented" ]
defmodule Loginservice.Auth do @moduledoc """ The Auth context. """ import Ecto.Query, warn: false alias Loginservice.Repo alias Loginservice.Auth.User alias Loginservice.Auth.RefreshToken alias Loginservice.Auth.PasswordReset def list_users do Repo.all(User) end def get_user!(id), do: Rep...
053cce20e33d71ae58a528c9d0305b4791f6f136
2,340
[ 220646671 ]
[ "test", "ecto" ]
defmodule TimesheetDemo2.RequestsTest do use TimesheetDemo2.DataCase alias TimesheetDemo2.Requests describe "requests" do alias TimesheetDemo2.Requests.Request @valid_attrs %{approval: true, date: ~D[2010-04-17], name: "some name"} @update_attrs %{approval: false, date: ~D[2011-05-18], name: "some ...
053cddd6fe7e438a8f81837e29ef5f42425d5719
9,544
[ 666873172 ]
[ "liveview" ]
defmodule LiveViewStudioWeb.KurzCtaLive do use LiveViewStudioWeb, :live_view def mount(_params, _session, socket) do socket = assign(socket, :brightness, 10) {:ok, socket} end def render(assigns) do ~H""" <div class="kurzCta"> <span id="topLine"></span> <div> <span>cena:</spa...
053dc251d72fb56fe40c9cac8adfb426f8db7c44
2,011
[ 286274582 ]
[]
defmodule SubmitBlock do alias SubmitBlock.Transaction alias SubmitBlock.PrivateKey alias SubmitBlock.Transaction.Signature def opts() do [:private_key, :url] end def enterprise() do 0 end def submit_block(block_root, nonce, gas_price, "0x" <> _ = contract, opts) do submit_block(block_roo...
053dfee65d55c530d651856c2388bdcb63176391
3,691
[ 793071249 ]
[]
%{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "credo": {:hex, :credo, "1.7.5", "643213503b1c766ec0496d828c90c424471ea54da77c8a168c725686377b9545", [:mix], [{:bunt, "~> 0....
053e3c6cd0beb32755338d5dba22d716bbaf1ea3
1,964
[ 76076080 ]
[ "genserver" ]
defmodule Ballistic.Server do use GenServer require Logger def start_link(name) do GenServer.start_link(__MODULE__, :ok, name: name) end def go_live() do GenServer.cast(__MODULE__, {:go_live}) end def report_hit(device_id) do GenServer.cast(__MODULE__, {:report_hit, device_id}) end ## ...
053e494c457a2b532577f90470f159a6003e15d4
1,545
[ 74679462 ]
[ "macro", "documented", "phoenix" ]
defmodule WebWeb 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 WebWeb, :controller use WebWeb, :view The definitions below will be executed for every view, controller, etc, so keep...
053e6fff9509ab6005f38eda3525e83db5971f0b
4,774
[ 76291568 ]
[ "documented" ]
defmodule QueryEx do @moduledoc """ A sql query engine framework ## Example iex> Dummy.Person ...> |> QueryEx.from_query ...> |> QueryEx.side_load("organization.country") ...> |> QueryEx.filter("name", :like, "John D%") ...> |> QueryEx.filter("organization.name", :=, "Test ...
053ebf7e65d1c71de0d7939d7c884557b6c0d4c4
16,610
[ 632678934 ]
[ "test" ]
defmodule SubwaysideUi.TrainTest do use ExUnit.Case, async: true alias SubwaysideUi.Train import Jason.Sigil describe "from_json_map/1" do test "basic parsing" do actual = Train.from_json_map(base_map()) assert %Train{ id: 2_000_812_662, leader_car_nbr: "1468", ...
053edc1673ba829ad7cee8901e050c664bf514ce
5,210
[ 595528538 ]
[ "documented", "ecto" ]
defmodule GptTalkerbot.Access do @moduledoc """ The Access context. """ import Ecto.Query, warn: false alias GptTalkerbot.Repo alias GptTalkerbot.Access.User @doc """ Returns the list of users. ## Examples iex> list_users() [%User{}, ...] """ def list_users do Repo.all(User) ...
053f1a12703f87dc69686001479269e83a352cc1
4,168
[ 698356726 ]
[ "documented", "ecto" ]
defmodule Agrinomicon.Production do @moduledoc """ The Production context. """ import Ecto.Query, warn: false alias Agrinomicon.Repo alias Agrinomicon.Production.Tenure @doc """ Returns the list of tenures. ## Examples iex> list_tenures() [%Tenure{}, ...] """ def list_tenures do ...
05406cecbba69b76c0eda8a3062ace7f996e000c
4,553
[ 605242810 ]
[ "test", "documented" ]
defmodule Lexical.RemoteControl.CodeMod.AliasesTest do alias Lexical.Ast alias Lexical.RemoteControl alias Lexical.RemoteControl.CodeMod.Aliases import Lexical.Test.CursorSupport use Lexical.Test.CodeMod.Case use Patch setup do patch(RemoteControl, :get_project, %Lexical.Project{}) :ok end ...
0540a775992e13a7c4ee226eb4d4cee6e4bd3f3c
1,542
[ 117864729 ]
[]
defmodule Jorb.Mixfile do use Mix.Project def project do [ app: :jorb, version: "0.4.1", elixir: "~> 1.5", start_permanent: Mix.env() == :prod, deps: deps(), name: "Jorb", source_url: "https://github.com/appcues/jorb", homepage_url: "http://hexdocs.pm/jorb", ...
054114ab78084810b79edfdcf28c3b295ba529d8
1,782
[ 501788747 ]
[ "typespec", "documented" ]
# This code has been auto-generated # Changes to this file will be lost on next generation defmodule KeenAuthPermissions.Database.Parsers.AuthGetProviderUsersParser do @moduledoc """ This module contains functions to parse output from db's stored procedure's calls """ require Logger @spec parse_auth_get_pr...
054283c485605b96652e92bc749250c8ee3c80a0
2,277
[ 101434552, 198908023 ]
[ "typespec", "documented" ]
defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1ReasoningEngine do @moduledoc """ ReasoningEngine provides a customizable runtime for models to determine which actions to take and in which order. ## Attributes * `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Timestamp wh...
0543905ddd6c91c71320e8b238de3d012fd5a9a9
1,746
[ 894011223 ]
[]
# https://adventofcode.com/2016/day/7 defmodule Day7 do def parse_line(line) do String.split(line) end def split_hypernet(txt) do {in_chars, out_chars, _in_acc} = txt |> String.to_charlist() |> Enum.reduce( {~c"", ~c"", false}, fn c, {in_chars, out_chars, in_acc} -> ...
05439fa11558f1c943cd5295a0066b029cbb764c
2,647
[ 423848082 ]
[ "phoenix" ]
defmodule KefisWeb.SessionController do use KefisWeb, :controller alias Kefis.Repo alias Kefis.Users.User alias KefisWeb.Auth alias KefisWeb.ApiAuth def new(conn, _params) do changeset = Pow.Plug.change_user(conn) render(conn, "new.html", changeset: changeset) end def create(conn, %{"user" =...
0543da70185a9127b90a089ad9d25edcadceb1a3
3,888
[ 644161054, 708209739 ]
[ "genserver", "typespec", "documented" ]
defmodule Nostrum.Voice.Ports do @moduledoc false defmodule State do @moduledoc false defstruct [ :q, :port, :port_done, :awaiter, :input_pid ] def new(port, input_pid) do %__MODULE__{ q: :queue.new(), port_done: false, port: port, ...
05442f105af3d5c03d68e1ea68e78cfc72c7afad
2,739
[ 29387790 ]
[ "typespec", "documented", "ecto" ]
defmodule Brando.Cache.Palettes do @moduledoc """ Interaction with palettes cache """ alias Brando.Content @type changeset :: Ecto.Changeset.t() @doc """ Get palettes CSS from cache """ @spec get_css :: binary() | nil def get_css do case Cachex.get(:cache, :palettes_css) do {:ok, css} ->...
0544f43ce15b776e8fa1831140d0273e9fd13d4d
4,410
[ 837319868 ]
[ "genserver", "documented" ]
defmodule Spawn.Cluster.StateHandoff.Manager do @moduledoc """ This handles state handoff in a cluster. This module monitors node up and down events as well as node terminate events and triggers `Spawn.Cluster.StateHandoff.ControllerBehaviour` implementations to handle these events. """ use GenServer requi...
0544f94f71e40d1b72a9f1e60509e5dad95cf700
1,988
[ 666621981 ]
[]
inputs = 0..3 |> Enum.map(&(16 * 4 ** &1)) |> Enum.map(&{"size = #{&1}", NxCordic.Util.gen_input(n: &1 + 1)}) |> Enum.map(fn {name, input} -> if System.get_env("EXLA_TARGET") == "cuda" do {name, {input, Nx.backend_transfer(input, {EXLA.Backend, client: :cuda})}} else {name, input} end ...
054512210f3b06b1a47edd0705d8a752df4dd00f
2,000
[ 904269283 ]
[]
defmodule Day5 do def part1 do {links, orders} = input() g = links |> Enum.reduce(Graph.new(), fn [from, to], acc -> Graph.addEdge(acc, from, to)end) IO.inspect(g) # orders # |> Enum.map(&Graph.isTopoOrder?(&1, g)) end def input do {:ok, f} = File.read("a.txt") [l, o] = String.s...
054519b77bee45e030f79940802f8657c9892020
1,914
[ 608509249 ]
[]
defmodule Eyegaze.MixProject do use Mix.Project def project do [ app: :eyegaze, version: "0.1.0", elixir: "~> 1.12", elixirc_paths: elixirc_paths(Mix.env()), compilers: Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps() ] ...
054568ca36893d6383ee616489c3d02d260e3c10
5,681
[ 309051706 ]
[ "phoenix" ]
defmodule ApiWeb.UserController do use ApiWeb, :controller alias Api.Accounts alias Api.Accounts.User alias Api.Repo action_fallback ApiWeb.FallbackController def index(conn, %{"email" => email, "username" => username}) do {:ok, res} = Api.JWTHandle.decodeJWT(get_req_header(conn, "authorization") |>...
0545d2340e55aa3917a39bc8bc878623677a24a3
3,164
[ 84878937 ]
[ "typespec", "documented" ]
defmodule ScoutApm.Plugs.ControllerTimer do alias ScoutApm.Internal.Layer alias ScoutApm.{Context, TrackedRequest} @queue_headers ~w(x-queue-start x-request-start) def init(default), do: default def call(conn, opts) do if !ignore_uri?(conn.request_path) do queue_time = get_queue_time_diff_nanoseco...
054612b64c4be04b83b55a1c81fe34b30594e5ca
5,749
[ 612796230 ]
[ "macro", "liveview", "documented", "phoenix" ]
defmodule PhoenixStorybook.Router do @moduledoc """ Provides LiveView routing for storybook. """ @doc """ Defines a PhoenixStorybook route. It expects the `path` the storybook will be mounted at and a set of options. This will also generate a named helper called `live_storybook_path/2` which you can us...
054650b1600f2b52a165206ad3df79a5b754f081
2,226
[ 822255248 ]
[ "documented" ]
defmodule MusicListings.Parsing.VenueParsers.BaseParsers.ElfsightParser do @moduledoc """ Base parser for elfsite json data """ alias MusicListings.HttpClient alias MusicListings.Parsing.ParseHelpers alias MusicListings.Parsing.Performers alias MusicListings.Parsing.Price alias MusicListingsUtilities.Da...
0546b7e3ef2b4e4e7051f51ead8733a8e2c9640c
3,843
[ 571776611 ]
[ "typespec", "documented" ]
defmodule Pleroma.Web.Federator do alias Pleroma.Activity alias Pleroma.Object.Containment alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Transmogrifier alias Pleroma.Web.ActivityPub.Utils alias Pleroma.Web.Federator.Publisher alias Pleroma.Workers.Pub...
0546d8d50a8f30524ea2aa10515e83e844b3d91a
1,841
[ 433727283 ]
[]
defmodule Aoc2021.Day10 do @opening_delimiters ~w"( [ { <" @closing_delimiters ~w") ] } >" def part1(input) do input |> parse |> Enum.map(&check_line/1) |> Enum.map(&syntax_score/1) |> Enum.sum() end def part2(input) do input |> parse |> Enum.map(&check_line/1) |> Enum.fi...
0546fb37362965e9a58b06be0270d6e02396176a
3,937
[ 202610654 ]
[ "test", "phoenix" ]
defmodule EventValidatorWeb.EventSchemaControllerTest do use EventValidatorWeb.ConnCase alias EventValidator.{Events, Accounts, Projects, JWT} @user_attrs %{ email: "<EMAIL>", password: "some password", name: "some name" } @create_attrs %{ name: "some name", schema: %{}, source_id: ...
05482a6146a9441f454e63d1cd2bc3408ae76040
1,940
[ 613712731 ]
[ "genserver" ]
defmodule Week5.Batcher do require Logger use GenServer @batch_size 30 @time_window 5000 def start_link() do Logger.info("Batcher #{inspect(self())} is running...") GenServer.start_link(__MODULE__, [], name: __MODULE__) end def init(_) do {:ok, %{counter: 0, messages: [], previousTime: Time...
054847b91cbbc3b3113525777241d69072ca6a6d
1,924
[ 135175214 ]
[ "phoenix", "ecto" ]
defmodule BrainfuckServerWeb.ProgramController do use BrainfuckServerWeb, :controller alias BrainfuckServer.Programs alias BrainfuckServer.Programs.Program def index(conn, _params) do programs = Programs.list_programs() render(conn, "index.html", programs: programs) end def new(conn, _params) do ...
054887bc02a38d35e090c83ed497680e64d88c24
1,985
[ 98463877 ]
[ "ecto" ]
defmodule HelpOn.ProviderService do alias HelpOn.Provider import Poison import Ecto.Query def getService(id) do case HelpOn.Repo.get(Provider, id) do nil -> nil request -> request end end def getAllService() do case HelpOn.Repo.all(Provider) do nil -> ni...
0548efd243fb75bc6b1d3909e4afbbd0e549692c
5,970
[ 888766361 ]
[ "test", "ecto" ]
defmodule RacingLeaderboards.CarsTest do use RacingLeaderboards.DataCase alias RacingLeaderboards.Cars describe "cars" do alias RacingLeaderboards.Cars.Car import RacingLeaderboards.CarsFixtures @invalid_attrs %{name: nil, horsepower: nil, weight: nil, powertrain_type: nil, transmision_type: nil, ...
05495e63393fa36fa55b41c9a53105b1cb019050
2,296
[ 780043463 ]
[ "test", "supervisor" ]
defmodule TrickTacToe.GameSupervisorTest do use ExUnit.Case, async: true alias TrickTacToe.{Game, GameServer, GameSupervisor} @timeout 100 @supervisor_name TestGameSupervisor setup do Application.put_env(TrickTacToe, :timeout, @timeout) start_supervised!(%{ id: @supervisor_name, start:...
054a4679d8fc1c6ac1c56e3fba09fcf6b3c0b659
3,558
[ 75329667 ]
[ "ecto" ]
defmodule Thirteen.Maze do alias Thirteen.BFS def test do BFS.init(context: 10, avail_fn: &lazy_avail/2, move_fn: &move_fn/2) |> BFS.new_path({1,1},{7,4}) end def solve do BFS.init(context: 1362, avail_fn: &lazy_avail/2, move_fn: &move_fn/2) |> BFS.new_path({1,1},{31,39}) end def solve2 d...
054a7fe64987cee29b5388bd314ee9288134dbed
2,165
[ 997661524 ]
[ "liveview" ]
defmodule NathanForUsWeb.FeedLive do use NathanForUsWeb, :live_view @impl true def mount(_params, _session, socket) do if Map.has_key?(socket.assigns, :current_user) && socket.assigns.current_user do {:ok, redirect(socket, to: ~p"/stay-tuned")} else {:ok, assign(socket, page_title: "Nathan Fo...
054aa6781f661fc7736b6416d703797014ef0a13
2,286
[ 64178825 ]
[]
%{"decimal": {:hex, :decimal, "1.1.2", "79a769d4657b2d537b51ef3c02d29ab7141d2b486b516c109642d453ee08e00c", [:mix], []}, "ecto": {:hex, :ecto, "2.0.3", "3d416156e0b7578a31b6925ee07de76b53684ffb4f106b863e35b423b1004b08", [:mix], [{:db_connection, "~> 1.0-rc.2", [hex: :db_connection, optional: true]}, {:decimal, "~> 1.0...
054ad10cc5041ef45c0962d6bd1b1fcfdde12d53
7,885
[ 497769481, 575873463, 482720652, 478522297 ]
[ "test", "supervisor" ]
Code.require_file("../../test_helper.exs", __DIR__) defmodule Mix.Tasks.NewTest do use MixTest.Case test "new" do in_tmp("new", fn -> Mix.Tasks.New.run(["hello_world"]) assert_file("hello_world/mix.exs", fn file -> assert file =~ "app: :hello_world" assert file =~ "version: \"0.1....
054ae95a712e818d5af06077f308d15178c9a13f
6,079
[ 531890950, 577740810, 539851478, 540666245 ]
[ "phoenix" ]
defmodule Phoenix.MixProject do use Mix.Project if Mix.env() != :prod do for path <- :code.get_path(), Regex.match?(~r/phx_new\-\d+\.\d+\.\d.*\/ebin$/, List.to_string(path)) do Code.delete_path(path) end end @version "1.6.12" @scm_url "https://github.com/phoenixframework/phoenix" # ...
054b1c637f8d0156f4e5a495075e49e904aedfdb
1,720
[ 86917151 ]
[ "macro", "documented", "ecto", "phoenix" ]
defmodule WeeksOfMaking.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use WeeksOfMaking.Web, :controller use WeeksOfMaking.Web, :view The definitions below will be executed for every view, controller, etc...
054b7d405ca28855d968b6778c87d2f310956b0f
11,420
[ 25726976 ]
[ "test", "documented" ]
defmodule SPFTest do use ExUnit.Case @moduledoc "most of the tests comes directly from rfc7208" setup_all do :code.unstick_dir(:code.lib_dir(:kernel)++'/ebin') previous_compiler_options = Code.compiler_options(ignore_module_conflict: true) defmodule :inet_res do #mock external dns calls to hard defin...
054b9801fb58cb04d5706d1fb4cf3752aa90be49
2,043
[ 413442344 ]
[ "documented", "ecto" ]
defmodule Echipatala.Chat do @moduledoc """ The Chat context. """ import Ecto.Query, warn: false alias Echipatala.Repo alias Echipatala.Chat.ChatDetails @doc """ Returns the list of tbl_chat. ## Examples iex> list_tbl_chat() [%ChatDetails{}, ...] """ def list_tbl_chat do Repo...
054bc87f420eb30f6559b4c79e45aa9689886712
1,910
[ 306868516 ]
[ "documented", "ecto" ]
defmodule CyptoBank.Adjustments do @moduledoc """ The Adjustments context. """ import Ecto.Query, warn: false import CyptoBank.Adjustments.MultiSteps.Approve alias Ecto.Multi alias CyptoBank.Repo alias CyptoBank.Adjustments.Adjustment @doc """ Check existing adjusment that has the same original_l...
054cdac928c3ccdc64e7cac6427c64d5bcf19b98
3,288
[ 206452166, 373975587 ]
[ "test", "phoenix" ]
defmodule InkfishWeb.Ajax.TeamControllerTest do use InkfishWeb.ConnCase import Inkfish.Factory alias Inkfish.Teams.Team setup %{conn: conn} do course = insert(:course) staff = insert(:user) _reg = insert(:reg, course: course, user: staff, is_staff: true) teamset = insert(:teamset, course: cour...
054cf49d34be653b12891e6e941bcd2c5a705242
2,957
[ 319882253 ]
[ "test", "phoenix" ]
defmodule SuretipsApiWeb.TipControllerTest do use SuretipsApiWeb.ConnCase alias SuretipsApi.Bets alias SuretipsApi.Bets.Tip @create_attrs %{ game: "some game", league: "some league", odds: "some odds", pick: "some pick", status: true } @update_attrs %{ game: "some updated game", ...
054d11a16cef677e42f04f84d9b9e7d744011b93
17,179
[ 277006571 ]
[ "test" ]
defmodule Pears.Core.TeamTest do use ExUnit.Case, async: true import TeamAssertions alias Pears.Core.Team setup [:team] test "can add and remove pears from the team", %{team: team} do team |> Team.add_pear("pear1") |> assert_pear_available("pear1") |> Team.remove_pear("pear1") |> refute...
054d29f7bd9b29f7d5ef863b0c1d4591eb51d198
2,411
[ 677931531 ]
[ "liveview", "ecto" ]
defmodule SpotifyWeb.ArtistLive.FormComponent do use SpotifyWeb, :live_component alias Spotify.Artists @impl true def render(assigns) do ~H""" <div> <.header> <%= @title %> <:subtitle>Use this form to manage artist records in your database.</:subtitle> </.header> <.s...
054d604ea8447297e4b1920d93b58fbc53374004
2,721
[ 248702688 ]
[ "test", "ecto" ]
defmodule Core.Landing.FaqTest do use Core.DataCase alias Core.Landing describe "faq" do alias Core.Landing.Faq @valid_attrs %{ content: "some text", title: "some text" } @update_attrs %{ content: "updated text", title: "updated text" } @invalid_attrs %{ ...
054de731eb3ff71602c61f61b0c4d614714eba2c
1,925
[ 36685099 ]
[]
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. use Mix.Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this # file won't be loaded nor affect the paren...
054df52f57a11057f9b47d5c330a8cf161bcbcf2
2,151
[ 51247449 ]
[]
defmodule Letter do # String.strip(' ') # String.length('') @mapping [ { 1, "one" }, { 2, "two" }, { 3, "three" }, { 4, "four" }, { 5, "five" }, { 6, "six" }, { 7, "seven" }, { 8, "eight" }, { 9, "nine" }, { 10, "ten" }, { 11, "eleven" }, { 12, "twelve" }, {...
054e5b05bad73649853a0fd8732a53fd5221dbd2
7,272
[ 284688020 ]
[ "documented" ]
defmodule ExBankID.PayloadHelpers do @moduledoc """ Checkers for Payload options https://www.bankid.com/assets/bankid/rp/bankid-relying-party-guidelines-v3.4.pdf """ @doc """ Returns {:ok, ip_address} or {:error, reason} for IP address validity ## Examples iex> ExBankID.PayloadHelpers.check_ip_ad...
054eb5bc8826993ea5682d6a98d64ec1c55959cc
2,213
[ 970476367 ]
[ "liveview" ]
defmodule FrontWeb.ReservaLive.Show do use Phoenix.LiveView import JSON, only: [decode!: 1] require Logger def mount(%{"id" => reserva_id}, _session, socket) do # Buscando os detalhes da reserva usando o ID reserva = get_reserva(reserva_id) # Atribuindo ao socket a reserva e o estado inicial {...
054f1967a5f13da579a4f07f6a936ee52213b715
5,833
[ 276023881 ]
[]
defmodule Pleroma.Web.ApiSpec.Schemas.Account do alias OpenApiSpex.Schema alias Pleroma.Web.ApiSpec.Schemas.AccountField alias Pleroma.Web.ApiSpec.Schemas.AccountRelationship alias Pleroma.Web.ApiSpec.Schemas.ActorType alias Pleroma.Web.ApiSpec.Schemas.Emoji alias Pleroma.Web.ApiSpec.Schemas.FlakeID alias...
054f25c80ca2956400d9eace62cfcf74cba52cae
1,994
[ 68077818, 163718655 ]
[ "macro", "documented", "ecto" ]
defmodule MoneyBin do @moduledoc false def config_variables do quote do @repo Application.get_env(:money_bin, :settings)[:repo] @tables [ account: "accounts", transaction: "transactions", journal_entry: "journal_entries", ledger: "led...
054f854bbfa601bb11b44a6a291eb6206f74b5ab
2,569
[ 716351052 ]
[ "test", "documented" ]
defmodule VoipstackClassicPanel.SoftswitchTest do @moduledoc false use ExUnit.Case alias VoipstackClassicPanel.Softswitch alias VoipstackClassicPanel.VirtualPBX defmodule SendHandler do def handle_virtual_pbx_event(event, state) do send(state, event) state end end describe "Softswi...
054f9030aaa1f25b6bfd452e0f72e63035421570
17,861
[ 1006778240 ]
[ "documented" ]
defmodule Nx.BinaryBackend.Matrix do @moduledoc false use Complex.Kernel import Kernel, except: [abs: 1] import Complex, only: [abs: 1] import Nx.Shared def ts(a_data, a_type, a_shape, b_data, b_type, b_shape, output_type, input_opts) do # Here's Paulo Valente's proof in the deleted function ts_handle...
054f9255251f3f52e38eb6787f0b202f852ec94b
1,555
[ 419454094 ]
[]
%{ "cloudevents": {:hex, :cloudevents, "0.6.1", "d3f467a615c00712cf3c9632f6d131695fd3e1d29c10477d2d2fbbec06350522", [:mix], [{:avrora, "~> 0.21", [hex: :avrora, repo: "hexpm", optional: true]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:typed_struct, "~> 0.3.0", [hex: :typed_struct, repo: "h...
054fed39e2a94922ccc414150078bda2f9ff18e4
1,507
[ 643142042 ]
[ "liveview" ]
defmodule HabitsWeb.UserForgotPasswordLive do use HabitsWeb, :live_view alias Habits.Accounts def render(assigns) do ~H""" <div class="mx-auto max-w-sm"> <.header class="text-center"> Forgot your password? <:subtitle>We'll send a password reset link to your inbox</:subtitle> ...
05509346a87b67d80da3a78aad39b595ee2542bf
3,841
[ 117112194 ]
[]
defmodule Alice.LevelsHandler do alias Lace.Redis require Logger def process_message(ctx) do # Get guild id guild_id = Alice.Cache.channel_to_guild_id ctx["channel_id"] Logger.debug "[LVL] Found guild: #{inspect guild_id}" # Global chat levels Logger.debug "[LVL] Handling global levels" ...
05509a3bf658965cd83c27be34682d0735f1ef59
1,664
[ 38940578 ]
[]
defmodule Foodbot do def handle(_, nil), do: {400, "Bad request"} def handle(restaurants, "all") do restaurants |> Dict.values |> Stream.map(&struct/1) |> Paratize.Pool.parallel_map(&fetch_restaurant_menu/1) |> Enum.join("\n") |> post_to_slack end def handle(restaurants, comm...
0550c2f3c5f178c5d48699411e5c71ae05cdc85f
3,162
[ 426866266 ]
[ "documented" ]
defmodule Day15 do @moduledoc """ Input is lines defining the x,y position of sensors and their closest beacon. Beacons can be close to more than one sensor. Problem parameters differ for handling example data and actual data. """ import String, only: [to_integer: 1] @huge 10_000_000 @doc "Count posit...
0550f5756a307af9769dcac18206d67365e7e963
1,879
[ 166567072 ]
[]
defmodule Main do def main(args) do numNodes = String.to_integer(Enum.at(args, 0)) if numNodes <= 1 do IO.puts "Invalid. Number of nodes should be greater than 1" exit(:shutdown) end topology = Enum.at(args, 1) algo = Enum.at(args, 2) if topology == "rand2d" || topology ==...
055137b8b023ac06d0a5423cc0f4c63b6c594999
1,840
[ 71222564 ]
[]
defmodule CoapNode.Resources.Switch do use Coap.Resource alias Coap.Storage def start(path, params) do {:ok, port} = Application.fetch_env(:coap_node, :coap_port) {:ok, registry_endpoint} = Application.fetch_env(:coap_node, :registry_endpoint) {:ok, :content, {:coap_content, _etags, _max_age, _format...
0551599c6b2153a161d80f7ce1eb67efe8f708e9
2,222
[ 120151418 ]
[ "documented", "ecto" ]
defmodule Bank.AccountsQueries do import Ecto.Query @moduledoc """ This is the AccountsQueries module. It contains the queries used to access the Accounts table """ alias Bank.{Repo, Accounts} alias Ecto.{Changeset} @doc """ Returns a random account from the database """ def any do Repo.o...
05517fc3ddc8d2179184e1ac1f8a6b1e13ff3bef
2,646
[ 367278931 ]
[ "documented" ]
defmodule Google.Ads.Googleads.V19.Services.MutateCampaignBidModifiersRequest do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3 field :customer_id, 1, type: :string, json_name: "customerId", deprecated: false field :operations, 2, repeated: true, type: Google.Ads....
055184e5383f9b96fb3f6a5fd436e058c375f701
3,081
[ 272059776 ]
[ "documented" ]
defmodule SupaBattleSnake.LegalMoves do alias SupaBattleSnake.GameBoardStruct, as: GameBoard alias SupaBattleSnake.GamePieces @moduledoc """ Determine and remove illegal moves from options, only 1 move ahead, no strategy """ def avoid_self(%GameBoard{} = game_data) do you_head = GamePieces.get_you...
05518f7cd9b59d94e7046b3513e8ed5d6a9bff40
5,196
[ 364990699 ]
[]
%{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hex...
0551ff1ea504d1ae8e4fe42be52e041d3e40f07e
2,590
[ 916215915 ]
[ "phoenix" ]
defmodule RebuWebApiWeb.ProductController do use RebuWebApiWeb, :controller alias RebuWebApi.Accounts.{Affiliate, User} alias RebuWebApi.Marketplace alias RebuWebApi.Uploads alias RebuWebApi.Solana def create(conn, %{"product" => product_params}) do seller = Guardian.Plug.current_resource(conn) dbg...
05521508efc4744e80e7aed2d8ea6ed2456d080e
2,701
[ 107008549 ]
[ "macro", "documented" ]
defmodule Monerox.RPC do @moduledoc false defmacro __using__(opts) do quote do @env_vars unquote(opts) @on_definition {unquote(__MODULE__), :__on_definition__} @before_compile {unquote(__MODULE__), :__before_compile__} use HTTPoison.Base @headers [{"Content-Type", "application/j...
05525f22425ab1bf69aac0f95d6af174ed868477
4,007
[ 122517743 ]
[ "phoenix", "macro", "documented", "liveview" ]
defmodule PhoenixLiveViewIntegration do @moduledoc "Helper functions for LiveView integration tests, inspired by the PhoenixIntegration library." defmacro __using__(_opts) do quote do require Phoenix.LiveViewTest import PhoenixLiveViewIntegration alias PhoenixLiveViewIntegration.State ...
055287a1f5cbf47abccf0ce95334e9b935125a37
1,862
[ 731321874 ]
[ "phoenix" ]
defmodule BezirkeWeb.SubscriberController do use BezirkeWeb, :controller alias Bezirke.Tour alias Bezirke.Tour.Subscriber alias Bezirke.Venues def new(conn, %{"venue_uuid" => venue_uuid, "season_uuid" => season_uuid}) do venue = Venues.get_venue_by_uuid!(venue_uuid) season = Tour.get_season_by_uuid!...
0552bf8cb5e01983d465b2c3d8c144b5f31ec321
4,068
[ 708027947 ]
[ "documented" ]
defmodule Dec03 do @doc """ iex> Dec03.parse_part_locations("467..114..\\n...*......\\n..35..633.\\n......#...\\n617*......\\n.....+.58.\\n..592.....\\n......755.\\n...$.*....\\n.664.598..\\n") %{{3,1} => "*", {6,3} => "#", {3,4} => "*", {5,5} => "+", {3,8} => "$", {5,8} => "*"} """ def parse_part_locations(i...
0552fdfe08f82d20affe65af566ca07b9f165c85
3,874
[ 610398622 ]
[]
defmodule ObanAdmin.MixProject do use Mix.Project def project do [ app: :oban_admin, version: "0.1.0", elixir: "~> 1.12", elixirc_paths: elixirc_paths(Mix.env()), compilers: [] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, test_coverage: [tool: ExCoveralls],...
055309fc20350ec2a1dce510515fdfea3d691ae3
1,987
[ 370847109 ]
[ "typespec", "documented" ]
defmodule BMP3XX.BMP280.Measurement do @moduledoc false alias BMP3XX.BMP280.Calibration @spec from_raw(<<_::48>>, Calibration.t(), number) :: BMP3XX.Measurement.t() def from_raw(raw, calibration, sea_level_pa) do temperature_c = temperature_c_from_raw(raw, calibration) pressure_pa = pressure_pa_from_r...
055398771e6e1da7e70f239fad124453e7cf6b69
5,083
[ 420909875 ]
[ "ecto" ]
defmodule SWGOHCompanion.Hunters.GAC.PrepareWeek do use SWGOHCompanion.SDK alias SWGOHCompanion.Repo alias SDK.Models.PlayerData alias Ecto.Multi import Ecto.Query @rounds 1..3 def prepare_week(week_nr) do %GAC.Bracket{ week: week, gac_nr: gac_nr, ally_codes: ally_codes, star...
05547a67d0e35b602c387a867be059b455d2d1e8
4,898
[ 995944955 ]
[ "liveview", "test" ]
defmodule ShopUxPhoenixWeb.FormStorageLiveTest do use ShopUxPhoenixWeb.ConnCase import Phoenix.LiveViewTest alias ShopUxPhoenixWeb.FormStorage describe "FormBuilder 自动保存 LiveView 集成" do test "表单状态自动保存和恢复", %{conn: conn} do session_id = "test-auto-save-session" form_id = "auto-save-for...
0554bec2e0789ad2220a97659f1bea18fef3338d
3,839
[ 217053523 ]
[ "documented" ]
defmodule O2M.Commands.Tmpl do require Logger import Announcements alias O2M.Config @moduledoc """ An module handle call to an command """ @doc """ Handle Tmpl commands and route to sub commands """ def handle(sub, args, _) do case sub do "add" -> add(args) "list" -> ...
0554eb77cd29d817bbc0a50c357517018d4b9f62
17,661
[ 837319868, 981784524 ]
[ "genserver", "typespec", "documented" ]
defmodule Nebulex.Adapters.Local.Generation do @moduledoc """ Generational garbage collection process. The generational garbage collector manage the heap as several sub-heaps, known as generations, based on age of the objects. An object is allocated in the youngest generation, sometimes called the nursery, a...
0555155884eb09076175162c4b348450ff81a7d7
1,949
[ 521000174 ]
[ "supervisor", "documented" ]
defmodule Oban.Met.Application do @moduledoc false use Application alias Oban.{Config, Registry} require Logger @main_sup Oban.Met.Supervisor @task_sup Oban.Met.TaskSupervisor @handler_id :oban_met_handler @impl Application def start(_type, _args) do :telemetry.attach(@handler_id, [:oban, :su...