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 |
|---|---|---|---|---|
00a3b46ed336182c17f2da131bdb393cd8825eef | 1,758 | [
52277462
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule HandlebarsBug.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use HandlebarsBug.Web, :controller
use HandlebarsBug.Web, :view
The definitions below will be executed for every view,
controller, etc... |
00a3f43794842151633fc4e8005cb4a2260d7566 | 1,913 | [
175506384
] | [] | defmodule RiakEcto3.MixProject do
use Mix.Project
def project do
[
app: :riak_ecto3,
version: "0.5.0",
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
deps: deps(),
elixirc_paths: elixirc_paths(Mix.env),
aliases: aliases(),
description: description(),
... |
00a40002a1f70343ea3e67e744ade51f636b160d | 9,172 | [
382920816
] | [
"test",
"ecto"
] | defmodule HubPayments.WalletsTest do
use HubPayments.DataCase
alias HubPayments.Wallets
describe "list_wallets/0" do
test "returns all wallets" do
new_wallet = insert(:wallet)
[wallet] = Wallets.list_wallets()
assert new_wallet == wallet
end
end
describe "get_wallet/1" do
tes... |
00a454b0dab373bf47d61f35a3c8296b2049b9f4 | 4,121 | [
142783344
] | [
"typespec",
"documented"
] | defmodule PlugWebhook do
@moduledoc """
Simple tool for building plugs that handle wehbooks and verify signature.
As a design decision, this library, similar to Plug itself, does not
store the request body for a long time - the whole body is stored only
for the signature verification and parsing.
## Examp... |
00a4551cd86c847582704acf6282b2ea1d9fa4a2 | 5,302 | [
192407200
] | [
"test"
] | defmodule Andi.ReportsControllerTest do
use ExUnit.Case
use Andi.DataCase
use Placebo
use AndiWeb.Test.AuthConnCase.IntegrationCase
alias Andi.InputSchemas.Datasets.Dataset
alias Andi.InputSchemas.Datasets.Business
alias Andi.InputSchemas.Datasets.Technical
alias Andi.InputSchemas.AccessGroup
alias An... |
00a46984ba249259fdb3d2910e49891e7c662ade | 2,439 | [
228098731
] | [
"genserver"
] | defmodule TodoServer2 do
def start(callback_module) do
initial_state = callback_module.new
spawn(fn -> loop(initial_state, callback_module) end)
end
defp loop(current_state, callback_module) do
receive do
{:call, request, caller} ->
{response, new_state} = callback_module.handle_c... |
00a4c555273b797ae4a453ec2d339cf32a7c5a56 | 23,102 | [
816930067
] | [] | %{
"argon2_elixir": {:hex, :argon2_elixir, "4.0.0", "7f6cd2e4a93a37f61d58a367d82f830ad9527082ff3c820b8197a8a736648941", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "f9da27cf060c9ea61b1... |
00a4e3df5e79c08eb918be750ad55858d9ef087a | 10,336 | [
74674500
] | [
"test"
] | defmodule Cotoami.Neo4jServiceTest do
use ExUnit.Case
import ShorterMaps
alias Cotoami.Neo4jService
alias Bolt.Sips.Types.Node
alias Bolt.Sips.Types.Relationship
setup do
%{conn: Bolt.Sips.conn()}
end
describe "when there is a node" do
setup ~M{conn} do
uuid = UUID.uuid4()
node = N... |
00a513d224780ad0ae67546c5f1c51bc2fb03e64 | 13,209 | [
542291437
] | [
"test",
"documented",
"ecto"
] | defmodule AshAuthentication.Plug.HelpersTest do
@moduledoc false
use DataCase, async: true
alias AshAuthentication.{Info, Jwt, Plug.Helpers, Strategy.Password, TokenResource}
import Plug.Test, only: [conn: 3]
alias Plug.Conn
setup do
conn =
:get
|> conn("/", %{})
|> SessionPipeline.ca... |
00a5485222e073a0f864aca76722ab0d49a459cf | 1,678 | [
369243543
] | [
"macro",
"documented",
"phoenix"
] | defmodule PruebaparksWeb 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 PruebaparksWeb, :controller
use PruebaparksWeb, :view
The definitions below will be executed for every view,
... |
00a549c8e259fb217a6f229c74334f11ca933cd9 | 3,002 | [
849937955
] | [
"documented",
"phoenix"
] | defmodule Sector7g.PromEx do
@moduledoc """
Be sure to add the following to finish setting up PromEx:
1. Update your configuration (config.exs, dev.exs, prod.exs, releases.exs, etc) to
configure the necessary bit of PromEx. Be sure to check out `PromEx.Config` for
more details regarding configuring Pro... |
00a55cb9fa010f6fdb79d7a1d3daa078faf18690 | 9,596 | [
152694265,
157324093
] | [
"genserver"
] | defmodule ChordNode do
use GenServer
def start_link(name \\ nil) do
GenServer.start_link(__MODULE__, nil, [name: name])
end
def init(_) do
IO.puts "ChordNode is starting"
state = %{:keys => [], :successor => nil, :predecessor => nil, :fingertable => %{}}
{:ok, state}
end
def handle_call(:get_finger... |
00a5b8f6af9d1ba75467aa53569e4217f5dd62f7 | 5,226 | [
352217160
] | [] | defmodule CAIBot.Commands.PlanetSide.Weapon do
@behaviour Nosedrum.Command
require Logger
alias Nostrum.Api
alias Nostrum.Struct.Embed
alias PS2.API.{Query, Join, QueryResult}
import Predicates
import PS2.API.QueryBuilder
@excluded_item_categories [
99,
103,
105,
106,
107,
10... |
00a62474a5db6924ee955daf091f50ae0005ed94 | 3,250 | [
159866229,
486531069,
948973699,
589535814,
520217048,
598050696,
616127556,
651606171,
612868361
] | [
"documented"
] | defmodule Ockam.Protocol.Stream.Index do
@moduledoc false
@behaviour Ockam.Protocol
@impl true
def protocol() do
%Ockam.Protocol{
name: "stream_index",
## type Request (IndexGet | IndexSave)
request: [get: index_get_schema(), save: index_save_schema()],
response: index_schema()
... |
00a6d8c8db656d332afe477d4e0d71e4d1617237 | 1,730 | [
302208050
] | [
"phoenix",
"ecto"
] | defmodule ElixircrudWeb.UserController do
use ElixircrudWeb, :controller
alias Elixircrud.Accounts
alias Elixircrud.Accounts.User
def index(conn, _params) do
users = Accounts.list_users()
render(conn, "index.html", users: users)
end
def new(conn, _params) do
changeset = Accounts.change_user(%... |
00a77ffa8af8f269126ebb2efe8a6a20b4eb8017 | 2,224 | [
70379197
] | [
"typespec",
"documented"
] | defmodule KafkaHandlers.Account.RequestCreate do
@moduledoc """
KafkaHandlers for account controller
Publishes to kafka topic using worker defined by `@worker_id`
a random partition is selected per message
TODO: include pattern matching for versioned topics
"""
alias Kafka.Helpers, as: Helper
@worker_... |
00a794f9b81d6766963d5188f942bf4878974ebb | 3,427 | [
767008025
] | [
"liveview",
"test"
] | defmodule LiveViewTodoWeb.PageLiveTest do
use LiveViewTodoWeb.ConnCase
import Phoenix.LiveViewTest
alias LiveViewTodo.Item #importing Items to test them
test "disconnected and connected mount", %{conn: conn} do
{:ok, page_live, disconnected_html} = live(conn, "/")
assert disconnected_html =~ "Todo"
... |
00a7b187c40087281bb97c7323a00ac7470c12e7 | 17,483 | [
1002252639
] | [] | %{
"ash": {:hex, :ash, "3.5.21", "389303c193962d67fd59da18a3557f5015fdfdaeddaa77150db539bc7203d1a1", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:igniter... |
00a81abd67342becb25f5e37f3ee66151454b712 | 2,985 | [
193244709
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Dataproc.V1.Model.DiskConfig do
@moduledoc """
Specifies the config of disk options for a group of VM instances.
## Attributes
* `bootDiskProvisionedIops` (*type:* `String.t`, *default:* `nil`) - Optional. Indicates how many IOPS to provision for the disk. This sets the number of I/O ope... |
00a83122b15c7896f1d0f27c58eaf61366a98a7b | 2,408 | [
91512926
] | [
"phoenix"
] | defmodule OrgtoolDb.ShipModelController do
use OrgtoolDb.Web, :controller
alias OrgtoolDb.ShipModel
if System.get_env("NO_AUTH") != "true" do
plug Guardian.Plug.EnsureAuthenticated, handler: OrgtoolDb.SessionController, typ: "access"
plug EnsurePermissions, default: [:active], handler: OrgtoolDb.Session... |
00a83c2a2286405387a2c7842d8e8a0487e4d2f1 | 1,975 | [
411722524
] | [
"typespec",
"documented"
] | defmodule Envoy.Config.Filter.Network.DubboProxy.V2alpha1.ProtocolType do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t :: integer | :Dubbo
field(:Dubbo, 0)
end
defmodule Envoy.Config.Filter.Network.DubboProxy.V2alpha1.SerializationType do
@moduledoc false
use Protobuf, enum: true, s... |
00a8a5f6e40d4c73e4761de8baeff6113b70428b | 3,399 | [
983205296
] | [
"genserver",
"documented"
] | defmodule ChatDistribuido.Sala do
@moduledoc """
Módulo que representa una sala de chat.
"""
use GenServer
alias ChatDistribuido.{Usuario, Mensaje}
defstruct [:nombre, :usuarios, :mensajes]
# API Cliente
def start_link(nombre) do
GenServer.start_link(__MODULE__, nombre, name: via_tuple(nombre))
... |
00a8af29c32dfde1b5b0ba60a4c06e647d4d4763 | 1,561 | [
949664843
] | [
"documented"
] | defmodule Raxol.Core.Runtime.Plugins.PluginUnloader do
@moduledoc """
Handles unloading of plugins, including command and state cleanup.
"""
alias Raxol.Core.Runtime.Plugins.CommandRegistry
require Raxol.Core.Runtime.Log
@doc """
Unloads a plugin, cleaning up commands and state.
"""
def unload_plugi... |
00a94b3ada4be6d9443e195c40ebcb8e8fa8b477 | 5,251 | [
236177202
] | [
"macro"
] | defmodule WhatIsBetterToPay.Commander do
# @bot_name Application.get_env(:what_is_better_to_pay, :bot_name)
# Code injectors
defmacro __using__(_opts) do
quote do
require Logger
import WhatIsBetterToPay.Commander
alias Nadia.Model
alias Nadia.Model.InlineQueryResult
end
end
... |
00a9bcc470971653d1c13419d81399ca26461dde | 2,584 | [
568866463,
593957691,
628753189
] | [
"test",
"phoenix"
] | defmodule ReactTodoListWeb.Api.TaskControllerTest do
use ReactTodoListWeb.ConnCase
import ReactTodoList.TodoFixtures
alias ReactTodoList.Todo.Task
@create_attrs %{
completed: true,
description: "some description"
}
@update_attrs %{
completed: false,
description: "some updated description"... |
00aa0199e0a9d6701a250ce4256cf68da2e15dae | 2,097 | [
295003766
] | [
"documented",
"ecto"
] | defmodule Invaders.Scoreboard do
@moduledoc """
The Scoreboard context.
"""
import Ecto.Query, warn: false
alias Invaders.Repo
alias Invaders.Scoreboard.Score
@doc """
Returns the list of scores.
## Examples
iex> list_scores()
[%Score{}, ...]
"""
def list_scores do
Score
... |
00aa1259dd103345e953bf8a1b07ebe5dec422a9 | 4,159 | [
452993774
] | [
"genserver"
] | defmodule Worker.Controller do
import Destructure
use GenServer
require Logger
def start_link(args, opts \\ []) do
GenServer.start_link(__MODULE__, args, opts)
end
## Privates
defp send_next_event(topic, subscriber) do
case Agent.Events.get_subscriber_next_message(topic, subscriber) do
{... |
00aa2705d87b237f39fe5edddc4fea9ff69014fe | 1,672 | [
157746283
] | [
"typespec",
"documented"
] | defmodule ProteinTranslation do
@doc """
Given an RNA string, return a list of proteins specified by codons, in order.
"""
@spec of_rna(String.t()) :: {atom, list(String.t())}
def of_rna(rna) do
rna
|> String.graphemes
|> Enum.chunk_every(3)
|> Enum.map(fn chars -> Enum.join(chars, "") e... |
00aa294f08fe64814377d57bf4e2a4e6d86836f1 | 4,490 | [
890088886
] | [] | defmodule AdventOfCode.Day12 do
defp get_parsed_input() do
input = AdventOfCode.Input.get!(12, 2023)
# input = "???.### 1,1,3
# .??..??...?##. 1,1,3
# ?#?#?#?#?#?#?#? 1,3,1,6
# ????.#...#... 4,1,1
# ????.######..#####. 1,6,5
# ?###???????? 3,2,1"
# input = "????.#...#... 4,1,1"
input
|> Stri... |
00aaca07543276e8a9b76fada50fd491ad646ddc | 3,734 | [
289522129
] | [
"documented"
] | defmodule Mazes.CircularMaze do
@behaviour Mazes.Maze
alias Mazes.Maze
@doc "Returns a circular maze with given size, either with all walls or no walls"
@impl true
def new(opts) do
radius = Keyword.get(opts, :radius, 10)
first_ring_vertex_count = 8
all_vertices_adjacent? = Keyword.get(opts, :all... |
00aaec3e56338a0487d4df40f5d7993d7260b5f3 | 7,559 | [
169148031
] | [
"typespec",
"documented"
] | defmodule Lens do
@moduledoc """
A simple Lens library.
This lens library is a simple wrapper around `Kernel.get_and_update_in/3` and
related functions. By augmenting the meaning of the "path" that those functions
take, this Lens library provides an easier and more featureful than the
default.
This lens... |
00ab174e30d7ce4512b57289f5fd04e00b9648cd | 4,010 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.AccessContextManager.V1.Model.GcpUserAccessBinding do
@moduledoc """
Restricts access to Cloud Console and Google Cloud APIs for a set of users using Context-Aware Access.
## Attributes
* `accessLevels` (*type:* `list(String.t)`, *default:* `nil`) - Optional. Access level that a user mus... |
00ab626615a38cfc9349bca1e98d735c72955664 | 2,082 | [
969999971
] | [
"documented"
] | defmodule DeeperHub.Core.Data.Migrations.BxWorkspacesScoresTrack do
@moduledoc """
Migration para criar e remover a tabela bx_workspaces_scores_track.
"""
alias DeeperHub.Core.Data.Repo
alias DeeperHub.Core.Logger
require DeeperHub.Core.Logger
@doc """
Cria a tabela de bx_workspaces_scores_track.
""... |
00ab832106f8e82e2ac78f7d4c67cb19e8c1e04f | 2,410 | [
231467977
] | [
"documented",
"ecto"
] | defmodule Rumbl.Multimedia do
@moduledoc """
The Multimedia context.
"""
import Ecto.Query, warn: false
alias Rumbl.Repo
alias Rumbl.Accounts
alias Rumbl.Multimedia.Video
alias Rumbl.Multimedia.Category
@doc """
Returns the list of videos.
## Examples
iex> list_videos()
[%Video{}, ... |
00aba5fe912a3bc1c8613da4f65104ce0dbdc660 | 11,041 | [
920667249
] | [
"macro",
"documented"
] | defmodule QuickSnmp do
@moduledoc """
For using on a module just add:
use QuickSnmp
Functions availables:
- get/5
- get2/5
- get/1
- set/5
- set2/5
- set/1
- getnext/5
- getnext2/5
- getnext/1
- walk/5
- walk2/5
- walk/1
- settings
This library support o... |
00ac40db864c54d773775b3882d3a521fce468ca | 9,198 | [
319448136,
603438628
] | [
"typespec",
"documented"
] | defmodule ExUnit.Filters do
@moduledoc """
Conveniences for parsing and evaluating filters.
"""
alias ExUnit.FailuresManifest
@type t :: list({atom, Regex.t() | String.Chars.t()} | atom)
@type location :: {:location, {String.t(), pos_integer | [pos_integer, ...]}}
@type ex_unit_opts :: [exclude: [:test],... |
00ac5fa640590eface635ad843fd9f62133ffdd7 | 2,699 | [
441809309
] | [
"typespec",
"documented"
] | defmodule Infer.Audio do
@moduledoc """
Audio type matchers based on the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming))
"""
@doc """
Takes the binary file contents as arguments. Returns `true` if it's a midi.
"""
@spec midi?(binary()) :: boolean()
def midi?(<<0x4D, 0x54, 0x68,... |
00ac78e35955a6469acc6a609902882050d87c08 | 3,312 | [
29853903
] | [] | defmodule Docker.Container do
alias Docker.Container
alias Docker.Request
defstruct id: "", server: nil
def list(srv) do
req = Request.get "/containers/json"
case GenServer.call(srv, req) do
{:ok, list} ->
{:ok, Enum.map(list, &(from_json(srv,&1))) }
{:error, err} ->
{:erro... |
00ac953b24ea66a7169085583c4304e5bfc93e9c | 4,063 | [
714401006
] | [
"typespec",
"documented"
] | defmodule Noxir.Store.Filter do
@moduledoc false
use __MODULE__.Tags, [:ids, :authors, :kinds, :since, :until, :limit]
alias Noxir.Store
alias Store.Event
@type memento_query :: [tuple()]
@type query_opts :: Memento.Query.options()
@type query :: {memento_query(), query_opts()}
@spec from_map(map())... |
00ac9b15c37730ee41abce74192dcf2e31830f1b | 2,731 | [
441600743
] | [
"test",
"phoenix"
] | defmodule MsWeb.OrderControllerTest do
use MsWeb.ConnCase
import Ms.OrderManagementFixtures
alias Ms.OrderManagement.Order
@create_attrs %{
creationDate: ~U[2022-01-12 04:35:00Z],
details: %{},
message: "some message"
}
@update_attrs %{
creationDate: ~U[2022-01-13 04:35:00Z],
details:... |
00aca167e6b1ea874ed4aa6ca7b844be30ca7e10 | 2,042 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DFAReporting.V33.Model.UserProfile do
@moduledoc """
A UserProfile resource lets you list all DFA user profiles that are associated with a Google user account. The profile_id needs to be specified in other API requests.
## Attributes
* `accountId` (*type:* `String.t`, *default:* `nil`) ... |
00ad01a53c2016e9a2e3217672432590ce7914fa | 2,951 | [
919198267
] | [
"genserver",
"phoenix"
] | defmodule ChatAppWeb.ChatChannel do
use Phoenix.Channel
alias ChatApp.Chat
alias ChatAppWeb.Presence
@impl true
def join("chat:" <> room_id, _payload, socket) do
send(self(), :after_join)
{:ok, assign(socket, :room_id, room_id)}
end
@impl true
def handle_in("new_message", %{"content" => conte... |
00ad60b0eaa1bd47230815a08a90ce01ec982b09 | 1,761 | [
665004223
] | [
"documented"
] | defmodule AshRbacTest.RootResource do
@moduledoc false
use Ash.Resource,
domain: AshRbacTest.Domain,
data_layer: Ash.DataLayer.Ets,
authorizers: [Ash.Policy.Authorizer],
extensions: [AshRbac]
alias AshRbacTest.Calculation
alias AshRbacTest.ChildResource
ets do
private?(true)
end
rba... |
00ad751930fa5111f12e78e0e467ace2c0c79d4d | 7,384 | [
367278931
] | [
"documented"
] | defmodule Google.Cloud.Retail.V2beta.ImportProductsRequest.ReconciliationMode do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :RECONCILIATION_MODE_UNSPECIFIED, 0
field :INCREMENTAL, 1
field :FULL, 2
end
defmodule Google.Cloud.Retail.V2beta.GcsSource ... |
00ada12280cb467890e22cd24f1bf73969ced416 | 4,681 | [
264449938
] | [
"documented"
] | defmodule LucumaWeb.FormHelpers do
@moduledoc """
Conveniences for working with forms.
http://blog.plataformatec.com.br/2016/09/dynamic-forms-with-phoenix/
"""
import Phoenix.HTML.Form
import Phoenix.HTML.Tag
import LucumaWeb.ErrorHelpers
@doc """
Generates a form group div for forms.
"""
def ... |
00adf9a1b194b01b45562f5585e1cfa3e436df11 | 4,535 | [
61494195
] | [
"typespec",
"documented",
"ecto"
] | defmodule PaperTrail.VersionQueries do
import Ecto.Query
alias PaperTrail.Version
@doc """
Gets all the versions of a record.
A list of options is optional, so you can set for example the :prefix of the query,
wich allows you to change between different tenants.
# Usage examples:
iex(1)> PaperTrai... |
00ae15a48efef92d3c8248a72dc116aefbd5b1d7 | 1,763 | [
919065026
] | [
"typespec",
"documented"
] | defmodule Durandal.Settings.UserSettingType do
@moduledoc """
# UserSettingType
A user setting type is a structure for user settings to reference. The setting types are created at node startup and though the values can be changed at runtime the types are not intended to be changed at runtime.
### Attributes
... |
00ae92fd2788f377544dce744a1929eb1c117548 | 14,059 | [
411501067
] | [] | %{
"bamboo": {:hex, :bamboo, "2.2.0", "f10a406d2b7f5123eb1f02edfa043c259db04b47ab956041f279eaac776ef5ce", [:mix], [{:hackney, ">= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.4", [hex: :mime, repo: "hexpm", optional: false]}... |
00af35d680bc4365f6c4ee3f9321532bd877b0ca | 2,580 | [
224080790
] | [
"phoenix",
"ecto"
] | defmodule SmsSchedulerWeb.UserController do
use SmsSchedulerWeb, :controller
alias SmsScheduler.Users
def new(conn, _params) do
user = Users.new_user()
render(conn, "new.html", user: user)
end
def create(conn, %{"user" => user_params}) do
available_phone_numbers = Ex... |
00af42982205ca6308d67c730279a59dc43cbfcc | 5,492 | [
113310148
] | [] | defmodule Mix.Tasks.Decompile do
use Mix.Task
def run(args) do
{opts, modules} = OptionParser.parse!(args, strict: [to: :string])
Mix.Task.run("loadpaths")
modules
|> Enum.map(&get_beam!/1)
|> Enum.each(&decompile(&1, opts))
end
defp get_beam!(module_or_path) do
with :non_existing <-... |
00afbbb506b5cc01c44b88ec97865715c51e96b6 | 3,217 | [
111432830
] | [
"test",
"ecto"
] | defmodule Erlnote.AccountsTest do
use Erlnote.DataCase
alias Erlnote.Accounts
describe "users" do
alias Erlnote.Accounts.User
@valid_attrs %{
name: "function2source",
username: "f2src",
credentials: [
%{
email: "<EMAIL>",
password: "supersecretoyultraseguro... |
00b01a20eb10af066448aaf7fb833b994873e331 | 2,582 | [
319477072
] | [] | defmodule Search do
def run(pos, map, seen, n_steps, dir, best) do
cond do
Map.get(map, pos) == "E" ->
n_steps
n_steps >= best ->
best
true ->
cs = candidates(pos, map, seen)
cs
|> Enum.reduce(best, fn new_pos, current_best ->
{cost, new_dir}... |
00b02affbf11dc9bf6cf63391a50e39d02d1c220 | 3,394 | [
160426785
] | [
"documented"
] | defmodule Assign10 do
@moduledoc false
defmodule Point do
defstruct x: 0, y: 0
def new(x, y) do
%__MODULE__{x: x, y: y}
end
end
defmodule Star do
defstruct position: nil, velocity: nil
def new(%Point{} = position, %Point{} = velocity) do
%__MODULE__{position: position, veloci... |
00b0502184c573fb4b142186b18d050d31fafced | 4,333 | [
899500022
] | [
"liveview"
] | defmodule MyappWeb.Upload.LongLive do
use MyappWeb, :live_view
def mount(_params, _session, socket) do
{:ok,
socket
|> assign(:page_title, "Upload Long Video")
|> allow_upload(:video, accept: ~w(.mp4 .mov .avi), max_entries: 1, max_file_size: 500_000_000)}
end
def render(assigns) do
~H"... |
00b0b8ca15c5c6525bbb4505ab9bd4aa7c177a1d | 2,079 | [
707563944
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
# General application configuration
import Config
config :ex_crap,
namespace: Core,
ecto_repos: [Co... |
00b0c77df5067d07dab5fc900db292a85086f138 | 4,720 | [
250568707
] | [
"documented"
] | defmodule Mix.Tasks.MinioServer.Download do
require Logger
@moduledoc """
Mix task for downloading minio binaries.
## Command line options
* `-f`, `--force` - Replace any existing binary
* `--version <version>` - Preselect a version
* `--arch <architecture>` - Preselect an architecture
"""
@shortd... |
00b1274765bc61841b6dafae2e750b43fb3611a1 | 4,447 | [
374647107
] | [
"documented"
] | defmodule PlugEarlyHints do
defmodule BadArityError do
defexception [:function, :arity, :key]
@impl true
def message(exception) do
{:arity, arity} = Function.info(exception.function, :arity)
"Function passed to #{exception.key} has arity #{arity} while expected" <>
"arity is #{except... |
00b17fa92f8375f75d31299b1ed19ac4cb36974a | 2,404 | [
744979184
] | [
"test",
"phoenix"
] | defmodule CrudWeb.TaskControllerTest do
use CrudWeb.ConnCase
import Crud.TodoFixtures
@create_attrs %{description: "some description", title: "some title"}
@update_attrs %{description: "some updated description", title: "some updated title"}
@invalid_attrs %{description: nil, title: nil}
describe "index"... |
00b215f151e434a6a605b06018c6cef4c1bf050e | 3,782 | [
318256012
] | [
"typespec",
"documented",
"ecto",
"phoenix"
] | defmodule BytepackWeb.Webhooks.HTTPSignature do
@moduledoc """
Verifies the request body in order to ensure that its signature is valid.
This verification can avoid someone to send a request on behalf of our client.
So the client must send a header with the following structure:
t=timestamp-in-seconds,
... |
00b2bb01d79c2c1b224e7124665e45d30e25807f | 2,417 | [
506465304
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule SmalcwWeb 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 SmalcwWeb, :controller
use SmalcwWeb, :view
The definitions below will be executed for every view,
controller, etc... |
00b2dede5273a3d803293e50cd57533f2c627476 | 8,802 | [
810146441
] | [
"documented"
] | defmodule ChinaAdminDivisions.Gen.Lv4xg.M3203 do
@moduledoc false
def name("320382403000"), do: "江苏邳州经济开发区"
def name("320382402000"), do: "张楼农场"
def name("320382401000"), do: "邳城农场"
def name("320382124000"), do: "议堂镇"
def name("320382123000"), do: "赵墩镇"
def name("320382122000"), do: "燕子埠镇"
def name("32... |
00b307c12b9e349d95d06c4415f3339e1fee2cb4 | 5,825 | [
563322590
] | [
"test",
"documented"
] | defmodule GroupherServer.Test.Mutation.CMS.ArticleArticleTags.ChangelogTagCRUD do
@moduledoc false
use GroupherServer.TestTools
alias GroupherServer.CMS
alias CMS.Model.ArticleTag
alias Helper.ORM
setup do
{:ok, community} = db_insert(:community)
{:ok, thread} = db_insert(:thread)
{:ok, user... |
00b325a1866388dac80b242a054758b9ca1b17a7 | 4,037 | [
309012602
] | [
"genserver",
"documented"
] | ###-------------------------------------------------------------------
## A fake implementation of web crawler using shared queue
###-------------------------------------------------------------------
defmodule Crawler do
@max_depth 4
@moduledoc """
Documentation for Crawler.
"""
## Client API
def start_... |
00b376a53bca19cf2dc321b044475098eb4fb191 | 4,247 | [
189251630
] | [
"typespec",
"documented"
] | defmodule Predictions.Parser do
@moduledoc """
Functions for parsing predictions from their JSON:API format.
"""
alias JsonApi.Item
alias Predictions.Prediction
@type record :: {
Prediction.id_t() | nil,
Schedules.Trip.id_t() | nil,
Stops.Stop.id_t(),
Routes.Route.i... |
00b3ed34222fa15b7e96198cd3a40126c0692959 | 6,149 | [
248702688
] | [
"documented"
] | defmodule ServerWeb.GraphQL.Schemas.Products.BusinessNumberEmployeeTypes do
@moduledoc """
The BusinessNumberEmployee GraphQL interface.
"""
use Absinthe.Schema.Notation
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
alias ServerWeb.GraphQL.{
Data,
Resolvers.Products.BusinessNumberEmpl... |
00b40c3de657d1788164662f13eae01884328e7f | 1,932 | [
294510885
] | [
"test"
] | defmodule SpiderSense.DGraphTest do
use ExUnit.Case
alias SpiderSense.DGraph
import SpiderSense.Factory
test "&put_node/1" do
state = %DGraph{}
state = DGraph.put_node(state, "node_name1", :meta1)
state = DGraph.put_node(state, "node_name2", :meta2)
assert [
%{name: "node_name1"... |
00b426c28a1eb914d9a20369c5ebaf56c3c37a87 | 3,749 | [
903999320
] | [
"test"
] | defmodule JidoTest.Exec.ClosureTest do
use JidoTest.Case, async: false
import ExUnit.CaptureLog
import Mock
alias Jido.Error
alias Jido.Exec
alias Jido.Exec.Closure
alias JidoTest.TestActions.BasicAction
alias JidoTest.TestActions.ContextAction
alias JidoTest.TestActions.ErrorAction
describe "clo... |
00b43382bddf8dbc0b2ece174388f330f644f629 | 1,643 | [
847818002
] | [
"phoenix",
"ecto"
] | defmodule RambleWeb.UserController do
use RambleWeb, :controller
alias Ramble.Accounts
alias Ramble.Accounts.User
def index(conn, _params) do
users = Accounts.list_users()
render(conn, "index.html", users: users)
end
def new(conn, _params) do
changeset = Accounts.change_user(%User{})
rend... |
00b479fa4f6c595844fd37b93697855b9e4b8d20 | 2,016 | [
381779633
] | [
"documented",
"ecto"
] | defmodule AttendenceService.Attendances do
@moduledoc """
The Attendances context.
"""
import Ecto.Query, warn: false
alias AttendenceService.Repo
alias AttendenceService.Attendances.Attendance
@doc """
Returns the list of attendances.
## Examples
iex> list_attendances()
[%Attendance{... |
00b50acb59167ed389d0305b5876f9d3523c51cc | 1,882 | [
785759766
] | [
"test"
] | defmodule DDogZip.TracesTest do
use ExUnit.Case
alias DDogZip.Traces
describe "dd_decode/1" do
test "decodes encoded data successfully" do
dd_data = [
[
%{
"span_id" => "1",
"trace_id" => "2",
"parent_id" => "0",
"name" => "test",
... |
00b54cbe75b1c0b6dbb84769d6ec59ea238e3e2b | 4,068 | [
65258839
] | [
"phoenix"
] | defmodule CentralGPSWebAPI.Controllers.Checkpoint.VenueType do
use CentralGPSWebAPI.Web, :controller
import CentralGPS.Repo.Checkpoint.VenueType.Functions
import CentralGPS.Repo.Utilities
def create(conn, params) do
try do
keys = [ :configuration_id, :description, :image_path, :image_bin ]
{_, ... |
00b59268b5f60dd06a6b0ecf17cadbec8e2dc6e7 | 1,505 | [
181020668
] | [
"documented"
] | defmodule Cards do
@moduledoc """
Provides methods for creating handling a deck of cards
"""
@doc """
Returns a list of strings representing a dec of playing cards
"""
def create_deck do
values = ["Ace", "Two", "Three", "Four", "Five"]
suits = ["Spades", "Clubs", "Hearts", "Diamonds"]
for ... |
00b59aef121b3f65c62854e98bf6c14565dfd911 | 2,286 | [
96579946
] | [
"test"
] | defmodule TwittrWeb.UserControllerTest do
use TwittrWeb.ConnCase
alias Twittr
alias Twittr.User
@create_attrs %{username: "some username"}
@update_attrs %{username: "some updated username"}
@invalid_attrs %{username: nil}
def fixture(:user) do
{:ok, user} = Twittr.create_user(@create_attrs)
use... |
00b62882e3ec9d54efd64d27c4076dfaac784a04 | 2,048 | [
943176297
] | [
"phoenix"
] | defmodule FrixelIntranetWeb.Router do
use FrixelIntranetWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {FrixelIntranetWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
end
p... |
00b65705027ce36e04cad75d86ba346523d2134e | 8,936 | [
931652055
] | [
"genserver",
"liveview",
"documented"
] | defmodule BlogWeb.TicTacToeLive do
use BlogWeb, :live_view
alias Blog.Game.TicTacToeBoard
alias Blog.Game.TicTacToeGame
alias BlogWeb.Presence
@moduledoc """
LiveView implementation of a Tic-Tac-Toe game with multiplayer using Phoenix Presence.
"""
@presence_topic "tictactoe:presence"
@impl true
... |
00b65eddcab14fb677850285985885093dae69f7 | 5,417 | [
686191063,
675066430
] | [
"typespec",
"documented"
] | defmodule Livebook.Runtime.Attached do
@moduledoc false
# A runtime backed by an Elixir node managed externally.
#
# Such node must be already started and available, Livebook doesn't
# manage its lifetime in any way and only loads/unloads the
# necessary elements. The node can be an ordinary Elixir runtime... |
00b6b47b338be7cb5b2804d2c94562046feb93d7 | 3,412 | [
51291223,
3126245
] | [
"test"
] | defmodule Binary.DictTest do
use ExUnit.Case, async: true
test :new_with_pairs do
dict = Binary.Dict.new [foo: "bar"]
assert Binary.Dict.to_list(dict) == [{ "foo", "bar" }]
end
test :new_with_pairs_and_transformation do
dict = Binary.Dict.new [foo: "bar"], fn({ k, v }) -> { k, atom_to_binary(k) <>... |
00b755fda42b75f3ca2b0d04c1e3c28f5abf166f | 2,167 | [
927316659
] | [
"genserver",
"macro",
"liveview"
] | defmodule PortfolioWeb.BaseLive do
defmacro __using__(_opts) do
quote do
use PortfolioWeb, :live_view
import PortfolioWeb.NavComponent
import PortfolioWeb.HeaderComponent
def mount_common(socket, page_name) do
# Get theme from session if available, or use default
theme = c... |
00b75ee02f70d14422f88a9118d049965d54766a | 1,718 | [
902804057
] | [
"typespec",
"supervisor",
"documented"
] | defmodule K8sBroadcaster.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@version Mix.Project.config()[:version]
@spec version() :: String.t()
def version(), do: @version
@spec cluster(:c0 | :c1 | :c2 | :c3) ... |
00b766b5268cab83cfda13652e6e2d344d48b230 | 10,783 | [
54967115
] | [
"typespec",
"macro",
"documented"
] | defmodule Mix.Tasks.Profile.Fprof do
use Mix.Task
@shortdoc "Profiles the given file or expression with fprof"
@moduledoc """
Profiles the given file or expression using Erlang's `fprof` tool.
`fprof` can be useful when you want to discover the bottlenecks of a
sequential code.
Before running the code... |
00b81971aaf49a04f8d6e86007850551e6c1d486 | 2,128 | [
387892054
] | [
"typespec",
"liveview",
"ecto"
] | defmodule KamanskyWeb.PurchaseLive.FormComponent do
use KamanskyWeb, :live_component
use KamanskyWeb.Modal
alias Kamansky.Operations.Purchases
alias Kamansky.Operations.Purchases.Purchase
@impl true
@spec handle_event(String.t, %{required(String.t) => any}, Phoenix.LiveView.Socket.t) :: {:noreply, Phoenix... |
00b827c6d042112d5699d5c44c33e838346a231b | 1,651 | [
159026413
] | [
"test"
] | defmodule Fetcher.ParserTest do
use ExUnit.Case, async: true
doctest Fetcher.Parser
describe "when valid data" do
setup do
{:ok, expected_result: [%{"flight" => "abcdef", "timestamp" => "1234"}]}
end
test "encodes and decorates the data", %{expected_result: expected_result} do
json = '{\... |
00b856684bb9d018db45dcb147af7011e022da65 | 2,798 | [
659066708
] | [
"phoenix"
] | defmodule ChiyaWeb.PageController do
use ChiyaWeb, :controller
alias Chiya.Channels
plug :put_layout, html: {ChiyaWeb.Layouts, :public}
plug :put_assigns
def home(conn, params) do
if id = conn.assigns.settings.home_channel_id do
channel = Channels.get_channel!(id)
{:ok, {notes, meta}} = Chiy... |
00b89a1bff3bf6368b9bd8222f133973ff63dcde | 1,827 | [
561928871
] | [
"documented",
"ecto"
] | defmodule Knowbot.Keywords do
@moduledoc """
The Keywords context.
"""
import Ecto.Query, warn: false
alias Knowbot.Repo
alias Knowbot.Keywords.Keyword
@doc """
Returns the list of keywords.
## Examples
iex> list_keywords()
[%Keyword{}, ...]
"""
def list_keywords do
Repo.all(... |
00b8b72ad1eb0778977d8f61f97fa569c3f04bb7 | 7,056 | [
607205597
] | [
"typespec",
"documented",
"ecto"
] | defmodule Instacamp.Accounts.User do
@moduledoc """
User Ecto schema
"""
use Ecto.Schema
import Ecto.Changeset
alias Instacamp.Accounts.Follower
alias Instacamp.Notifications.Notification
alias Instacamp.Posts.Bookmark
alias Instacamp.Posts.Comment
alias Instacamp.Posts.Like
alias Instacamp.Pos... |
00b8dd6da1b6a09aa128490b53261c363b5f8c94 | 4,237 | [
656442318
] | [
"liveview"
] | defmodule ScaffoldSuiBasedOnAIWeb.DataPanelLive do
use ScaffoldSuiBasedOnAIWeb, :live_view
alias ScaffoldSuiBasedOnAI.{App, ProjectAnalyzer}
@impl true
def mount(_params, _session, socket) do
movedid=
{:ok,
assign(
socket,
modal: false,
form: to_form(%{}, as: :f),
movedid_... |
00b8e6671b2076e166e848e8e9ef694826684ccf | 2,935 | [
184352040
] | [
"test"
] | defmodule ExVatcheckTest do
use ExUnit.Case
alias ExVatcheck
alias ExVatcheck.VAT
alias Fixtures.VIESResponses
import Mimic
@valid_vat_response %{
country_code: "GB",
vat_number: "333289454",
request_date: "2016-01-16",
valid: true,
name: "BRITISH BROADCASTING CORPORATION",
addres... |
00b918237f017136f6df551894ff5a418c37ccac | 7,397 | [
374000566
] | [] | # This file contains the configuration for Credo and you are probably reading
# this after creating it with `mix credo.gen.config`.
#
# If you find anything wrong or unclear in this file, please report an
# issue on GitHub: https://github.com/rrrene/credo/issues
#
%{
#
# You can have as many configs as you like in ... |
00b96d59abb8ef3005574a2905d1e7861803a51d | 4,432 | [
135463122
] | [
"typespec",
"documented",
"phoenix"
] | defmodule VintageNet.Interface.Udhcpc do
@moduledoc false
@behaviour VintageNet.OSEventDispatcher.UdhcpcHandler
alias VintageNet.Command
alias VintageNet.DHCP.Options
alias VintageNet.InterfacesMonitor
alias VintageNet.IP
alias VintageNet.NameResolver
alias VintageNet.RouteManager
require Logger
... |
00ba078d7750629484d0a5c85286df45fa4badec | 1,568 | [
954151104
] | [] | defmodule Copilot.MixProject do
use Mix.Project
def project do
[
app: :copilot,
version: "0.1.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.14",
elixirc_paths: elixirc_pa... |
00ba2ca32f4e00dd9b12440e0538dae080ee1e8b | 1,514 | [
215939679
] | [
"macro",
"documented",
"phoenix"
] | defmodule CymWeb 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 CymWeb, :controller
use CymWeb, :view
The definitions below will be executed for every view,
controller, etc, so keep... |
00ba68e2020c3fbf5c8ad9c40709d11d0b1fa701 | 1,845 | [
307793699
] | [
"documented",
"ecto"
] | defmodule Tenancy.TenantManagement do
@moduledoc """
The TenantManagement context.
"""
import Ecto.Query, warn: false
alias Tenancy.Repo
alias Tenancy.TenantManagement.Tenant
@doc """
Returns the list of tenants.
## Examples
iex> list_tenants()
[%Tenant{}, ...]
"""
def list_tenan... |
00bb00e92f6033d7fd6086ddff1df19147b6ef83 | 1,536 | [
205302020
] | [
"typespec",
"documented"
] | defmodule BinarySearchTree do
@type bst_node :: %{data: any, left: bst_node | nil, right: bst_node | nil}
@doc """
Create a new Binary Search Tree with root's value as the given 'data'
"""
@spec new(any) :: bst_node
def new(data) do
%{data: data, left: nil, right: nil}
end
@doc """
Creates and i... |
00bbc2209dca4cd50886992516235c2b427b8bc1 | 2,187 | [
726285448
] | [] | defmodule Springs do
def possibilities(spring, groups, cached \\ %{})
def possibilities([], [], cached), do: {1, cached}
def possibilities(springs, [], cached) do
if Enum.all?(springs, &(&1 != :damaged)), do: {1, cached}, else: {0, cached}
end
def possibilities([:operational | springs], groups, cached)... |
00bc63a4e8febd9034f43c04e6f5040873b62930 | 3,645 | [
116522306
] | [
"documented"
] | defmodule DemoInfoGo do
@moduledoc """
Documentation for DemoInfoGo.
This module is an interface for parsing the demos using demoinfogo.exe
"""
def run() do
arg = "faze-vs-sk-m1-inferno"
ResultsParser.DumpParser.parse_game_events(arg, "")
end
# parse resulting csv
# parse resulting dump file
... |
00bced3e39088f76442624c5604a219da78e82e4 | 11,844 | [
104223581
] | [] | defmodule IcdCode.ICDCode.Codes_O9A do
alias IcdCode.ICDCode
def _O9A111 do
%ICDCode{full_code: "O9A111",
category_code: "O9A",
short_code: "111",
full_name: "Malignant neoplasm complicating pregnancy, first trimester",
short_name: "Malignant neoplasm complicating pregnanc... |
00bd09bc2adeeb7e73c3c52cadcfdfee7943a46e | 2,331 | [
345176968
] | [
"liveview",
"phoenix",
"documented"
] | defmodule NervesHubWWWWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :nerves_hub_www
@session_options [
store: :cookie,
key: "_nerves_hub_key",
signing_salt: "1CPjriVa"
]
socket("/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]])
socket("/socket", NervesHub... |
00bd740d814d3d931fb7b5d1b05143103bc22652 | 3,058 | [
266840309,
266894454
] | [] | use Croma
defmodule AntikytheraCore.Handler.ExecutorPoolHelper do
alias Croma.Result, as: R
alias Antikythera.{GearName, Conn, Context}
alias Antikythera.ExecutorPool.Id, as: EPoolId
alias Antikythera.ExecutorPool.BadIdReason
alias AntikytheraCore.MetricsUploader
alias AntikytheraCore.Handler.{GearError, H... |
00bda92434a7fdfd15bfe66a2c075773972a4b21 | 2,508 | [
109419208
] | [
"typespec",
"documented"
] | defmodule Interlayer.Pending.Consumer do
use GenStage
alias Interlayer.Pending.Consumer, as: Consumer
alias Utils.Message, as: Message
alias Utils.Routing.Info, as: RoutingInfo
defstruct [
terminated: false
]
### CLIENT API
@doc """
"""
#@spec start_link :: any
def start_link() do
G... |
00be0d82f4b34f898f36206df869da7f78050fef | 7,653 | [
337393312
] | [
"test"
] | defmodule CryptoApis.IndependentReserveTest do
use ExUnit.Case
import Mock
alias CryptoApis.IndependentReserve
import CryptoApis.Fixtures
describe "order_book" do
test "order_book/1 responds ok" do
with_mock HTTPoison,
get: fn url, _headers, options ->
{:ok, successful_response(ur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.