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 |
|---|---|---|---|---|
090c3545cfca41a42449dc623a4bf6ab9f44a2f4 | 8,483 | [
83517676
] | [
"genserver",
"documented"
] | defmodule Boo.AS3935 do
@moduledoc """
Interacting with AS3935 lightning sensor from a Raspberry Pi over I2C
"""
@i2c_bus "i2c-1"
@i2c_address 0x03
@poll_time 1000
use GenServer
require Logger
def start_link() do
GenServer.start_link(__MODULE__, [])
end
def init(_) do
{:ok, i2c_pid} = ... |
090d0c251a78b4f331200a3d904744b39e3bc3c3 | 6,086 | [
427344839
] | [
"documented"
] | defmodule ToyRobot do
# max x-coordinate of table top
@table_top_x 5
# max y-coordinate of table top
@table_top_y :e
# mapping of y-coordinates
@robot_map_y_atom_to_num %{:a => 1, :b => 2, :c => 3, :d => 4, :e => 5}
@doc """
Places the robot to the default position of (1, A, North)
Examples:
... |
090d2efa68e27c2f104ece4b677ea246c1dd2fdc | 1,939 | [
208595341
] | [
"genserver",
"documented"
] | defmodule ChatopsRPC.Server do
@moduledoc """
Provides the necessary server components for verifying client signatures
and storing nonces.
"""
use GenServer
def start_link(opts) do
opts = Keyword.put_new(opts, :name, __MODULE__)
GenServer.start_link(__MODULE__, opts, name: opts[:name])
end
def... |
090dc10f4b781bbb4b7e077725fba37db8d0ecea | 3,748 | [
147459481
] | [
"genserver",
"documented"
] | defmodule NewRelic.Transaction.ErlangTrace do
use GenServer, restart: :temporary
alias NewRelic.Transaction
# This GenServer watches Transaction processes for
# :trace messages that signal that a Transaction process has
# spwaned another linked process that we include in the Transaction
@moduledoc false
... |
090e888f565ab522f08454591078220b8aa3f9ae | 1,565 | [
151689608
] | [
"macro",
"documented",
"phoenix"
] | defmodule RobiWeb 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 RobiWeb, :controller
use RobiWeb, :view
The definitions below will be executed for every view,
controller, etc, so k... |
090eebf6fb9873df094cf5b7b30e5d9e6298160d | 6,487 | [
735269764
] | [] | # Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# Tapii.Repo.insert!(%Tapii.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fai... |
090efb278381163aa7b5756012ee08538876be8c | 3,004 | [
171961091
] | [
"test"
] | defmodule ArtemisWeb.JobPageTest do
use ArtemisWeb.ConnCase
use ExUnit.Case
use Hound.Helpers
import Artemis.Factories
import ArtemisWeb.BrowserHelpers
import ArtemisWeb.Router.Helpers
alias Artemis.Job
@moduletag :browser
@url job_url(ArtemisWeb.Endpoint, :index)
hound_session()
setup_all do... |
090efded169dd2e413f461809c4d7f9fa2120388 | 2,381 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.RecommendationEngine.V1beta1.Model.GoogleCloudRecommendationengineV1beta1PurchaseTransaction do
@moduledoc """
A transaction represents the entire purchase transaction.
## Attributes
* `costs` (*type:* `map()`, *default:* `nil`) - Optional. All the costs associated with the product. Thes... |
090f232681c8c1a8be0ebde095cb66c9d17d1314 | 2,664 | [
487952304
] | [
"typespec",
"macro",
"phoenix"
] | # Generated by erl2ex (http://github.com/dazuma/erl2ex)
# From Erlang source: (Unknown source file)
# At: 2022-05-02 12:33:51
defmodule :chumak_bind do
# Begin included file: chumak.hrl
@type transport() :: :tcp
@type socket_type() ::
:req | :rep | :dealer | :router | :pub | :xpub | :sub | :xsub | :p... |
090f584519d342f35dc713497d4350e1038d2375 | 3,048 | [
71945656,
124445152
] | [
"macro",
"ecto"
] | defmodule Xarango.Domain.Document do
alias Xarango.Document
alias Xarango.SimpleQuery
alias Xarango.Query
defmacro __using__(options) do
db = options[:db] && Atom.to_string(options[:db]) || Xarango.Server.server.database
coll = options[:collection] && Atom.to_string(options[:collection])
quote do... |
090f994b5dec70f10276a3c59780ab4cc1dcb3ec | 9,274 | [
523176488
] | [
"test"
] | defmodule Panic.Engine.ArchiverTest do
use ExUnit.Case
alias Panic.Engine.Archiver
describe "convert_file/2" do
test "webp files require no conversion" do
# Create a temporary webp file
temp_file = Path.join(System.tmp_dir(), "test_#{System.unique_integer()}.webp")
File.write!(temp_file, "... |
090fa764019ab6d873ebbc5f59a6027496b49490 | 9,832 | [
343959665
] | [
"documented"
] | defmodule GodwokenExplorer.Token.InstanceMetadataRetriever do
@moduledoc """
Fetches ERC721 token instance metadata.
"""
require Logger
alias GodwokenExplorer.SmartContract.Reader
alias HTTPoison.{Error, Response}
@token_uri "c87b56dd"
@abi [
%{
"type" => "function",
"stateMutability... |
090fe881b20893300110c3c05d18f716b165204c | 5,114 | [
603581781
] | [
"genserver"
] | defmodule SerialKodiRemote.Delegator do
use GenServer
use SerialKodiRemote.TaggedLogger
@registered_name __MODULE__
alias SerialKodiRemote.Kodi
alias SerialKodiRemote.Serial
alias SerialKodiRemote.KodiRPC
alias SerialKodiRemote.Transmission
def start_link(_) do
GenServer.start_link(__MODULE__, %{p... |
090fefd50f7490a3ccf61ff0b6fd11db16cc64e0 | 2,476 | [
749804898
] | [
"liveview",
"ecto"
] | defmodule TodoLvWeb.TodoLive.FormComponent do
use TodoLvWeb, :live_component
alias TodoLv.Todos
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage todo records in your database.</:subtitle>
</.header>
<.simple_for... |
0910e6195f0ca536ebafadc434cda5ff2ad74ca5 | 2,564 | [
458011729
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule DictionaryGameWeb 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 DictionaryGameWeb, :controller
use DictionaryGameWeb, :view
The definitions below will be executed for every... |
09110c5437ba8b849fe0abaf214dc04d54e8834f | 4,108 | [
632356214
] | [
"typespec",
"documented"
] | defmodule Decibel.Registry do
@moduledoc false
@handshakes %{
# One way patterns
"N" => [
rsp: [:s],
...: [],
ini: [:e, :es]
],
"K" => [
ini: [:s],
rsp: [:s],
...: [],
ini: [:e, :es, :ss]
],
"X" => [
rsp: [:s],
...: [],
ini: [:e, :... |
09118afa488aecf4aed9282b35b7b833ee56e3d8 | 2,417 | [
969999971
] | [
"documented"
] | defmodule DeeperHub.Core.Data.Migrations.BxAlbumsFiles2albums do
@moduledoc """
Migration para criar e remover a tabela bx_albums_files2albums.
"""
alias DeeperHub.Core.Data.Repo
alias DeeperHub.Core.Logger
require DeeperHub.Core.Logger
@doc """
Cria a tabela de bx_albums_files2albums.
"""
def up ... |
0911ad259170be402173e8cf17c5be603b6be8be | 1,609 | [
873878210
] | [
"genserver"
] | defmodule Day6.Lightsfield do
use GenServer
# API
def start_link(_args, _opts) do
GenServer.start_link(__MODULE__, :ok, [])
end
def switch_on(server, from, to) do
GenServer.call(server, {:switch_on, from, to})
end
def switch_off(server, from, to) do
GenServer.call(server, {:switch_off, from... |
0911ceacb14183fa17d38e096bdd30d84fb3c4f6 | 1,842 | [
739214021
] | [
"test"
] | defmodule ExMon.GameTest do
use ExUnit.Case
alias ExMon.Game
alias ExMon.Player
describe "start/2" do
test "starts the game state" do
player = Player.build("Raul", :kick, :cure, :punch)
computer = Player.build("Robotinik", :kick, :cure, :punch)
assert {:ok, _} = Game.start(computer, pla... |
0911e39b94cbe4a4443217beb4c2a95c46413438 | 5,706 | [
880631197,
80118943
] | [
"test"
] | defmodule SSHKit.SSHTest do
use ExUnit.Case, async: true
import Mox
import SSHKit.SSH
alias SSHKit.SSH.Channel
alias SSHKit.SSH.Connection
@host "test.io"
@user "me"
setup do
Mox.verify_on_exit!()
end
describe "connect/2" do
setup do
{:ok, impl: Connection.ImplMock}
end
t... |
0911f8c4c8f01c348f3483f781d6701b7103d8c8 | 1,678 | [
226167518
] | [
"macro",
"documented",
"phoenix"
] | defmodule TodobackendWeb 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 TodobackendWeb, :controller
use TodobackendWeb, :view
The definitions below will be executed for every view,
... |
09129866eaeaf1924e290953298dd1d7ecd6a728 | 7,818 | [
635794595
] | [
"test"
] | defmodule TrickTakingTest do
use ExUnit.Case
alias Pinochle.{TrickTaking, Card, Trick}
alias Pinochle.TrickTakingTestHelpers, as: Helpers
test "A new game has current player" do
0..3 |> Enum.each(fn n -> assert TrickTaking.new(n, :hearts) |> TrickTaking.current_player() == n end)
end
test "A new gam... |
09130026f85a59e734909b36c2ec47cf7aa3aedb | 1,550 | [
91799891
] | [] | defmodule BrettProjekt.Game.RoundStateTransformation do
alias BrettProjekt.Game.Round, as: Round
alias BrettProjekt.Game.RoundEvaluation, as: RoundEval
alias BrettProjekt.Question, as: Question
def transform(%Round{} = state, questions) do
teams =
for {team_id, team} <- state.teams, into: %{} do
... |
09130e8a42a296346912d8b1bfbfb08f6d35c174 | 6,376 | [
584079022
] | [
"documented",
"ecto"
] | defmodule SpurCrossPlayers.Accounts.AccountToken do
use Ecto.Schema
import Ecto.Query
alias SpurCrossPlayers.Accounts.AccountToken
@hash_algorithm :sha256
@rand_size 32
# It is very important to keep the reset password token expiry short,
# since someone with access to the email may take over the accoun... |
091331dd28b93f6b532480d60b6f1ec7aef1f846 | 4,230 | [
295290852
] | [] | defmodule Console.GraphQl.Observability do
use Console.GraphQl.Schema.Base
alias Console.GraphQl.Resolvers.Observability
alias Console.Middleware.ObservabilityClient
enum :autoscaling_target do
value :statefulset
value :deployment
end
input_object :label_input do
field :name, :string
fiel... |
09137e8c90cb3e5ec8a67274691c26a433b46f1b | 5,268 | [
720969243
] | [
"ecto"
] | defmodule EscapeDisaster.CivilDefenseWaterSource do
alias EscapeDisaster.CivilDefenseWaterSource
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query, only: [from: 2]
import Geo.PostGIS
import EscapeDisaster.Proj
# 전국민방위대피시설표준데이터
# https://www.data.go.kr/data/15021098/standard.do
# 번호 개방서비스명 개방서비... |
09139fbacffaa490d5ecd8ab17f3b412d2ba2cae | 11,525 | [
53535974
] | [
"typespec",
"macro",
"documented"
] | defmodule Record do
@moduledoc """
Module to work with, define and import records.
Records are simply tuples where the first element is an atom:
iex> Record.is_record {User, "john", 27}
true
This module provides conveniences for working with records at
compilation time, where compile-time field... |
0913ba0dc476cda14df04592ec8f3d9314f45eb6 | 2,507 | [
200545844
] | [
"test",
"ecto"
] | defmodule Hubub.UsersTest do
use Hubub.DataCase
alias Hubub.Users
describe "users" do
alias Hubub.Users.User
@valid_attrs %{email: "some email", name_first: "some name_first", name_last: "some name_last", phone: "some phone", title: "some title"}
@update_attrs %{email: "some updated email", name_fi... |
09151249589185340223e6f88b8c86ab88f9df06 | 2,766 | [
70693454,
142597493
] | [
"typespec",
"documented"
] | defmodule Agala.BotParams do
@moduledoc """
This module specified generic system for configuration all the variety of `Agala` bots.
It helps to keep types of the params in consistence.
Every `Agala` bot requires some common params, and also requires some specific params
for only that bot type. Both of them c... |
0915442773fb15e52581a46732fccebfd84e2569 | 1,630 | [
536209529
] | [
"liveview",
"documented"
] | defmodule TrWeb.AdsComponent do
@moduledoc """
Comment dumb component
"""
use TrWeb, :html
def render_large_ad(assigns) do
~H"""
<%= unless @current_user do %>
<div class="flex">
<div id="ignored-ad-1" phx-update="ignore" class="m-auto gap-2 space-y-2 py-2">
<script type="text... |
0915c8472fc34a82d0505911759d94c1edeae76c | 1,850 | [
777972862,
788400716
] | [
"ecto"
] |
# Pengfei Xiao (px23) and Qiancheng Fan (qf23)
# distributed algorithms, n.dulay, 14 jan 2024
# coursework, raft consensus, v2
defmodule Log do
# implemented as a Map indexed from 1.
def new() do Map.new() end # used when process state is initialised
def new(server) ... |
0915ce07558a3a0846d3ecbbb2fa4ff5476acea5 | 3,488 | [
947913497
] | [
"documented"
] | defmodule SolanaBubblegum.NFT do
@moduledoc """
Functions for interacting with compressed NFTs.
This module provides functions for:
- Minting compressed NFTs
- Getting information about compressed NFTs
- Verifying leaf nodes
"""
@doc """
Mints a compressed NFT.
## Parameters
* `connecti... |
0915d74a54047b815c82c6f43b49c237729b5c7f | 3,752 | [
505932696
] | [
"documented",
"ecto"
] | defmodule Teacher.Recordings do
@moduledoc """
The Recordings context.
"""
import Ecto.Query, warn: false
alias Teacher.Repo
alias Teacher.Recordings.{Album, Genre}
def albums_for_genre(genre) do
qry =
from album in Album,
join: genre in assoc(album, :genres),
where: genre.name ==... |
0916042daa6d69e08f97e59b59b4dfd9ad09d466 | 7,006 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Jobs.V2.Model.Company do
@moduledoc """
A Company resource represents a company in the service. A company is the
entity that owns job listings, that is, the hiring entity responsible for
employing applicants for the job position.
## Attributes
* `careerPageLink` (*type:* `String.t`, ... |
091618e41cb71c52c5157d389b87ee11d6a2363e | 3,531 | [
793080795
] | [
"documented"
] | defmodule Flyteidl.Admin.State do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
field :RETRYABLE_FAILURE, 0
field :PERMANENT_FAILURE, 1
field :PENDING, 2
field :RUNNING, 3
field :SUCCEEDED, 4
end
defmodule Flyteidl.Admin.TaskExecutionMetadata.LabelsEntr... |
09173a8c43a3c744b529250d0e291cb175975f33 | 7,776 | [
571776611
] | [
"documented"
] | defmodule Pleroma.Web.Plugs.RateLimiter do
@moduledoc """
## Configuration
A keyword list of rate limiters where a key is a limiter name and value is the limiter configuration.
The basic configuration is a tuple where:
* The first element: `scale` (Integer). The time scale in milliseconds.
* The... |
09183eeed0878e43723eae45a355c813879db8c6 | 1,890 | [
78598551
] | [
"test"
] | ExUnit.start
defmodule TestStruct do
defstruct x: 0, y: 0
end
defmodule ClosestPointTest do
use ExUnit.Case, async: true
test "creates coordinate at origin" do
result = %Coord{}
assert result.x == 0 && result.y == 0
end
test "creates coordinate at specified point" do
result = %Coord{x: 21.2, y... |
0918670f0f76250f6be44a6283390be79b62f73c | 2,338 | [
521753149
] | [
"liveview"
] | defmodule PetalComponents.Progress do
use Phoenix.Component
import PetalComponents.Helpers
# prop size, :string, options: ["xs", "sm", "md", "lg", "xl"]
# prop color, :string, options: ["primary", "secondary", "info", "success", "warning", "danger"]
# prop class, :string
# prop value, :integer
# prop max... |
091877c5384b6a9dc8a8ee3260b806abdd75d647 | 1,777 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NasTrial do
@moduledoc """
Represents a uCAIP NasJob trial.
## Attributes
* `endTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time when the NasTrial's status changed to `SUCCEEDED` or `INFEASIBLE`.
* `finalMeasurement` (*type... |
0918a7a07a7a70c91b1d4513ab3e126155060d31 | 7,695 | [
901686755
] | [] | defmodule PhoenixBankingApp.Services.BankService do
alias PhoenixBankingApp.Utils.DateUtil
alias PhoenixBankingApp.Services.TransactionService
alias PhoenixBankingApp.Dwolla.Transfer
alias PhoenixBankingApp.Plaid.Transactions
# alias PhoenixBankingApp.Plaid.Investments.Transactions.Transaction
alias Phoenix... |
0918c65769057901c08eee5c238ffcdbb71226d6 | 2,497 | [
260338688
] | [
"test",
"ecto"
] | defmodule Tunedin.AccountsTest do
use Tunedin.DataCase
alias Tunedin.Accounts
describe "users" do
alias Tunedin.Accounts.User
@valid_attrs %{access_token: "some access_token", expiry: "some expiry", refresh_token: "some refresh_token", username: "some username"}
@update_attrs %{access_token: "some ... |
091a1eba05944abf72d5556f407a426270d11425 | 2,228 | [
43247111,
995397072,
1008054178,
1018310553,
951535898
] | [
"macro",
"documented"
] | defmodule Credo.Code.Parameters do
@moduledoc """
This module provides helper functions to analyse the parameters taken by a
function.
"""
@def_ops [:def, :defp, :defmacro]
@doc "Returns the parameter count for the given function's AST"
def count(nil), do: 0
for op <- @def_ops do
def count({unquo... |
091a8ac8a21e3ed4a7450c81e88c5d42b468afb2 | 3,820 | [
253039235
] | [
"phoenix",
"ecto"
] | defmodule TechInterviewWeb.QuestionController do
use TechInterviewWeb, :controller
plug TechInterviewWeb.Plugs.AuthenticateUser when action in [
:new,
:create,
:edit,
:update
]
plug TechInterviewWeb.Plugs.AuthorizeUser when action in [
:edit,
:update
]
alias TechInterview.Repo
... |
091b3adb253761ffdfe8f97010d78c188f86bd86 | 1,503 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1CreateNotebookExecutionJobOperationMetadata do
@moduledoc """
Metadata information for NotebookService.CreateNotebookExecutionJob.
## Attributes
* `genericMetadata` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1GenericOperationM... |
091b862a9ad681b7a7d493eedc220aa8b4421292 | 2,647 | [
232959397
] | [
"test"
] | defmodule ITKCommon.Utils.MapTest do
use ExUnit.Case, async: true
alias ITKCommon.Utils
describe "stringify_keys/1" do
test "stringifies keys" do
map = %{
key1: "value1",
key2: 2,
key3: ["1"],
key4: true
}
assert %{
"key1" => "value1",
... |
091b9d40effed0ba9adfa173fe47c3fd97626618 | 4,227 | [
667408219
] | [
"typespec",
"documented"
] | defmodule Core.Structure do
@typep error_reason :: String.t()
@typep error_type :: atom()
@typedoc """
Define error type which is a tuple of atom :error
and error message
"""
@type error :: {:error, {error_type(), error_reason()}}
@typedoc """
Define success value type which is a tuple of atom :ok
... |
091bd31a8d0727bba0bfbbcb91c4fdece341c6fe | 3,922 | [
655979037
] | [
"genserver",
"liveview",
"documented",
"ecto"
] | defmodule CruftyCraftsWeb.LiveGame do
@moduledoc """
liveview representation of a specific game
"""
use Phoenix.LiveView
use Phoenix.HTML
alias CruftyCraftsWeb.GameComponent
@hammer_retroazimuthal "hammer-retroazimuthal"
@azimuthal_equidistant "azimuthal-equidistant"
@cassini "cassini"
@equirectan... |
091c522df979abdcd9fbad547744e6de9509d4cd | 2,335 | [
160186508
] | [
"test",
"documented"
] | defmodule RigApi.MessageControllerTest do
@moduledoc false
use RigApi.ConnCase, async: true
alias Plug.Conn.Status
import Mox
setup :verify_on_exit!
@cloud_event_json ~s({"cloudEventsVersion":"0.1","source":"test","eventType":"test.event","eventID":"1"})
@cloud_event_urlencoded "cloudEventsVersion=0.1&... |
091c53cab81cdf612ca9f1e9e3c18b8922a1eca1 | 1,671 | [
49390588
] | [
"ecto"
] | defmodule Apiv4.User do
use Apiv4.Web, :model
import Autox.User
schema "users" do
field :email, :string
field :password, :string, virtual: true
field :password_hash, :string
field :recovery_hash, :string
field :remember_token, :string
field :stripe_customer_id, :string
field :forget_at... |
091d34a44dcbcf2e8967ffe5bf54f4d66613c02c | 3,081 | [
454233979
] | [
"test",
"phoenix"
] | defmodule PodsecWeb.UsuarioControllerTest do
use PodsecWeb.ConnCase
import Podsec.AuthenticationFixtures
@create_attrs %{ativo: true, email: "some email", nomecompleto: "some nomecompleto", recebenewsletter: true, senha: "some senha", usuario: "some usuario"}
@update_attrs %{ativo: false, email: "some updated... |
091d89e7243c34840e9955a2d3bd2aebe6ebcf3c | 3,381 | [
810146441
] | [
"documented"
] | defmodule ChinaAdminDivisions.Gen.Lv4xg.M3305 do
@moduledoc false
def name("330523206000"), do: "山川乡"
def name("330523205000"), do: "上墅乡"
def name("330523201000"), do: "溪龙乡"
def name("330523111000"), do: "天子湖镇"
def name("330523110000"), do: "梅溪镇"
def name("330523108000"), do: "天荒坪镇"
def name("330523107... |
091db41ee8054bf6b313d6274e6e8d3da1c50a13 | 6,504 | [
236852798
] | [
"documented"
] | defmodule Mix.Tasks.Compile.Erlang do
use Mix.Task.Compiler
alias Mix.Compilers.Erlang
@recursive true
@manifest "compile.erlang"
@switches [force: :boolean, all_warnings: :boolean]
@moduledoc """
Compiles Erlang source files.
When this task runs, it will first check the modification times of
all f... |
091e8be9053aa7855cfca2dbeb51d4a793d41346 | 8,392 | [
643456947
] | [
"typespec"
] | defmodule MSP430 do
@type word :: integer()
end
defmodule MSP430.Memory do
require Logger
import Bitwise
alias MSP430
defstruct [
:pc,
:sp,
:sr,
:r4,
:r5,
:r6,
:r7,
:r8,
:r9,
:r10,
:r11,
:r12,
:r13,
:r14,
:r15,
:rom,
:ram
]
@type t :: ... |
091e9e138fe91c149ae5537cb719941bceb446f0 | 4,278 | [
897469861
] | [
"typespec"
] |
defmodule Sol do
@type rules :: %{} | %{key: integer() , set: MapSet.t(integer())}
def part1 do
{rules, updates} = parseInput()
proc1(rules, updates, 0)
end
def part2 do
{rules, updates} = parseInput()
invalidUpdates = Enum.filter(updates, fn update->
medianIndex = div(length(update), 2... |
091ec8e3f009caef40c7a30a5a19b3d17814fa99 | 6,016 | [
976008806
] | [
"genserver",
"typespec"
] | defmodule Qwhiplash.Boundary.GameServer do
require Logger
alias Phoenix.PubSub
alias Qwhiplash.Core.Player
alias Qwhiplash.Core.Game
use GenServer
@spec start_link({pid(), list(String.t())}) :: {:ok, pid()} | {:error, term()}
def start_link({host_pid, prompts}) do
GenServer.start_link(__MODULE__, {ho... |
091ee9e927c40bd0b6e317795764c8817e446f04 | 3,104 | [
285927651
] | [
"liveview"
] | defmodule JaangWeb.Admin.Components.FunctionComponents.AddressComponent do
use JaangWeb, :live_component
def address(assigns) do
~H"""
<div class="bg-white px-4 py-5 shadow sm:rounded-lg sm:px-4">
<h2 id="timeline-title" class="text-lg font-medium text-gray-900 mb-4"><%= @title %></h2>
<%= if @... |
091ef82f754d74148965a4c1fd2f9f1ee3dfe261 | 2,887 | [
1010011901
] | [
"documented"
] | defmodule Sui.Rpc.V2alpha.Package do
@moduledoc """
A Move Package
"""
use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
def descriptor do
# credo:disable-for-next-line
%Google.Protobuf.DescriptorProto{
name: "Package",
field: [
%Google.Protobuf.FieldDescriptorPr... |
091f6cfc9843a91f44d05e64f64197ac30892f3e | 2,076 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.CloudRun.V1alpha1.Model.SecretKeySelector do
@moduledoc """
SecretKeySelector selects a key of a Secret.
## Attributes
* `key` (*type:* `String.t`, *default:* `nil`) - A Cloud Secret Manager secret version. Must be 'latest' for the latest version or an integer for a specific version. The... |
091f7341f796d04b2f82cd4122c21af707157665 | 3,830 | [
229193972
] | [
"typespec",
"documented"
] | defmodule ExOpenTravel.Composers.OtaHotelRateAmountNotif.Request do
alias ExOpenTravel.Meta
alias ExOpenTravel.Request
alias ExOpenTravel.Request.{Document, Helpers}
@action "OTA_HotelRateAmountNotif"
@type options :: keyword() | any()
@type credentials :: %{user: String.t(), password: String.t(), endpoin... |
091f8580578ea167cc316590a3ec2e21390d6179 | 2,097 | [
123485192
] | [
"test",
"ecto"
] | defmodule NewBlog.PostsTest do
use NewBlog.DataCase
alias NewBlog.Posts
describe "posts" do
alias NewBlog.Posts.Post
@valid_attrs %{body: "some body", title: "some title", user_id: 42}
@update_attrs %{body: "some updated body", title: "some updated title", user_id: 43}
@invalid_attrs %{body: ni... |
092008a34eca956ffb8beb102b8acc7646981465 | 7,588 | [
374626000
] | [
"documented"
] | defmodule Media.Context do
@moduledoc """
The context module defines the functions that should be invoked in the parent app.
Consider this as the API of Media APP.
"""
alias Media.Helpers
@doc """
Inserts a `media`
Usage:
You can insert `media` by calling the following function
```elixir
M... |
092030791e5fb04f7995d2106e59c511e1838cc7 | 1,651 | [
696285456
] | [
"supervisor",
"documented"
] | defmodule RickTacMorty.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl true
def start(_type, _args) do
topologies = Application.get_env(:libcluster, :topologies) || []
children = [
# Start the T... |
092053132de3099c06b1fe3667b99a5be1735359 | 1,817 | [
83226398
] | [] | # Import all plugins from `rel/plugins`
# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
Path.join(["rel", "plugins", "*.exs"])
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))
use Mix.Releases.Config,
# T... |
09210368dc1b4d7cd2a6129b0cc4de0569bfa0e5 | 11,193 | [
803502084
] | [
"typespec",
"documented"
] | defmodule Nerves.Runtime.Heart do
@moduledoc """
Functions for querying Nerves Heart and the device's watchdog
Nerves Heart integrates Erlang's
[heart](https://www.erlang.org/doc/man/heart.html) process with a hardware
watchdog. This makes it possible for a device to recover from a hang. The
way it works ... |
0921835c93c50f5af5e0469429c2e4f6333a0041 | 4,626 | [
429858963
] | [
"macro",
"documented"
] | defmodule Lector.Template do
@moduledoc """
Defines helper functions for rendering Templates.
What this allows is a naive re-implementation of how Phoenix handles views/templates.
When 'using' `Lector.Template`, files sharing the same module name as the view being used get pre-compiled
into named render fu... |
092210ea437e04c63f8c050fc9baa89b8de234f0 | 1,593 | [
104382237
] | [
"phoenix",
"ecto"
] | defmodule MicroWeb.UserController do
use MicroWeb, :controller
alias Micro.Accounts
alias Micro.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{})
render(c... |
092224d88bf7e7d6b9b19cc20aaf5b6277fb391c | 1,674 | [
880367612
] | [
"phoenix"
] | defmodule TimeManagerWeb.FlexibleWorkingTimeController do
use TimeManagerWeb, :controller
alias TimeManager.Times
alias TimeManager.Times.FlexibleWorkingTime
action_fallback TimeManagerWeb.FallbackController
def index(conn, _params) do
flexible_working_times = Times.list_flexible_working_times()
re... |
09223a1c19441dab3da5854b887a2926fde235be | 2,797 | [
273357249
] | [
"typespec"
] | defmodule NewsAggregator.HackerNews.FetchBot do
require Logger
use Task
alias Toolkit.DataStore
@config NewsAggregator.HackerNews.config()
@http_client @config[:http_client]
@interval_between_requests @config[:interval_between_requests]
@yield_tasks_timeout @config[:yield_tasks_timeout]
@fetch_inter... |
092288e0a9ed16f1a88922d3af569be204101b19 | 2,237 | [
861432872
] | [] |
# distributed algorithms, n.dulay, 3 jan 23
# basic flooding, v1
defmodule Peer do
@message_timeout 1000
def start(my_index) do
log(:startup, my_index)
receive do
{:neighbours, peers} ->
log(:receive_neighbours, {my_index, peers})
messages_received = 0
next(my_index, peers, ... |
0922975d1258f3e559df8938e251ef0b5b0e47a8 | 7,166 | [
1002981833
] | [
"liveview"
] | defmodule FaceCheckinWeb.StatusLive do
use Phoenix.LiveView
alias FaceCheckin.Profiles
def mount(_params, _session, socket) do
profiles = Profiles.list_profiles()
{:ok,
socket
|> allow_upload(:avatar, accept: ~w(.jpg .jpeg .png), max_entries: 1)
|> assign(
profiles: profiles,
... |
0922c15b61a24d498f2cb36c91199bbe429ce85d | 1,765 | [
878400170
] | [] | defmodule SorteiosApi.MixProject do
use Mix.Project
def project do
[
app: :sorteios_api,
version: "0.1.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end
# Configuration f... |
0923096986674d535a1b2aafbf28480c669473da | 6,715 | [
471617373
] | [
"typespec",
"macro",
"documented"
] | defmodule Trogon.TypeProvider do
@moduledoc """
Provides a type mapping system for converting between string type names and Elixir struct modules.
"""
alias Trogon.TypeProvider
alias Trogon.TypeProvider.UnregisteredMappingError
defmacro __using__(opts \\ []) do
quote bind_quoted: [opts: opts] do
... |
092337783bf72dda5280d88d86cc0abd472cac1b | 10,550 | [
126747237
] | [
"test"
] | defmodule ElixirSense.Core.TypeInference.GuardTest do
use ExUnit.Case, async: true
alias ElixirSense.Core.TypeInference.Guard
defp wrap(guard) do
{_ast, vars} =
Macro.prewalk(guard, [], fn
{atom, _meta, var_context} = node, acc when is_atom(atom) and is_atom(var_context) ->
{node, [no... |
09238c1f45acf7a493096085deaa059e42f2b7dd | 20,934 | [
750475301
] | [
"genserver",
"typespec",
"documented"
] | defmodule VintageNetWiFi.WPASupplicant do
@moduledoc """
Control a wpa_supplicant instance for an interface.
"""
use GenServer
alias VintageNet.Interface.EAPStatus
alias VintageNetWiFi.{BSSIDRequester, WPASupplicantDecoder, WPASupplicantLL}
require Logger
@doc """
Start a GenServer to manage commun... |
0923a02f3f08932441cd4a84140816d87cc2e638 | 2,402 | [
140772017
] | [] | %{
"amqp": {:hex, :amqp, "1.0.3", "06a6d909abc71d82b7c3133ca491899ca18fce857d0697dd060c29de1ef498d8", [:mix], [{:amqp_client, "~> 3.7.3", [hex: :amqp_client, repo: "hexpm", optional: false]}, {:goldrush, "~> 0.1.0", [hex: :goldrush, repo: "hexpm", optional: false]}, {:jsx, "~> 2.8", [hex: :jsx, repo: "hexpm", optiona... |
0923a84d6d8fa5d0a9c3ff69222358f64c8c3482 | 3,395 | [
866622929
] | [
"documented"
] | defmodule Evefitdepot.EFTParser do
@moduledoc """
Parses EFT fitting text into a structured format.
"""
@t3_ships ["Legion", "Tengu", "Proteus", "Loki"]
def parse(eft_text) do
# Split the text into lines
lines = String.split(eft_text, ~r/\r?\n/, trim: false)
[header_line | rest_lines] = lines
... |
0924628b28aa32b5a17ffb50dd8d32885fb4d7e0 | 2,831 | [
549467606,
741187755
] | [
"genserver",
"documented"
] | defmodule Nx.Defn.Stream do
# Default implementation for Nx.Stream
@moduledoc false
use GenServer
@doc false
@enforce_keys [:pid, :input, :output]
defstruct [:pid, :input, :output]
@doc false
def start_link(input, acc, fun) do
{backend, backend_options} = Nx.default_backend()
{:ok, pid} = GenS... |
092551fa2382fec8249cb7ecc33c56cfe0584ce7 | 2,847 | [
857752031
] | [] | defmodule TheRedisOne.RedisDecoder do
def bitstring_to_string(bits) do
Enum.join(for <<c::utf8 <- bits>>, do: <<c::utf8>>)
end
def read_value_encoding(value_flag, bits) do
case value_flag do
0 ->
{value, rest} = read_len_encoded_bits(bits)
{"string", value, rest}
13 ->
... |
0925da56a40c3d91265e0989d47f1b2da8e72862 | 3,489 | [
725942960
] | [
"documented"
] | defmodule Day10 do
def start(map) do
map |> Enum.filter(&(&1 |> elem(1) == "S")) |> hd
end
def main() do
map = File.read!("inputs/day10.txt") |> AOC.parse_grid()
starting_point = map |> start
map
|> part1(starting_point)
|> IO.inspect(label: "part 1")
map
|> part2(starting_poin... |
09263d1349e922d3c570f5440ec1f7632c5f661d | 4,183 | [
370813738,
450993182
] | [
"test"
] | defmodule StellarBase.XDR.AssetTest do
use ExUnit.Case
alias StellarBase.XDR.{
AccountID,
AlphaNum4,
AlphaNum12,
Asset,
AssetCode4,
AssetCode12,
AssetType,
PublicKey,
PublicKeyType,
UInt256
}
alias StellarBase.StrKey
setup_all do
key_type = PublicKeyType.new(:PUB... |
092651655392af2e7fb5ece8426ab42266b7fed7 | 2,687 | [
114570472
] | [] | defmodule AoC.Year2020.Day23 do
def import(file) do
{:ok, content} = File.read(file)
content
|> String.trim()
|> String.graphemes()
|> Enum.map(&String.to_integer/1)
end
defp new(), do: %{}
defp new(list) when is_list(list) do
add_many(new(), list, nil)
end
defp add_many(map, enu... |
09265dedc9af0ada1af3d2e51ec7dc7652333c02 | 6,627 | [
636479354
] | [
"liveview",
"phoenix"
] | defmodule RwxWeb.Components.Partials do
use Phoenix.Component
use RwxWeb, :verified_routes
def rwx_logo(assigns) do
~H"""
<a href="#" class="flex items-center">
<img class="h-6 mr-3 sm:h-9" alt="RWX Logo" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2Zy... |
0926880066c87aaad3d8a994cc8b66778ce9c535 | 7,461 | [
310116785
] | [
"liveview",
"documented"
] | defmodule TwitchDiscordConnector.Event.TwitchUser do
alias TwitchDiscordConnector.JsonDB.TwitchUserDB
alias TwitchDiscordConnector.Twitch
# alias TwitchDiscordConnector.Util.H
alias TwitchDiscordConnector.Util.L
alias TwitchDiscordConnector.Util.Live
# alias TwitchDiscordConnector.Twitch.Bot
alias Twitch... |
09269502cf3a51a063021ddfc7cf1ebab88e8842 | 5,650 | [
691572783
] | [] | %{
"benchee": {:hex, :benchee, "1.1.0", "f3a43817209a92a1fade36ef36b86e1052627fd8934a8b937ac9ab3a76c43062", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}], "hexpm", "7da57d545003165a012b587077f6ba90b89210... |
0926adac2eae6e575086bd924904e9ed9b42dad3 | 6,046 | [
130748338
] | [] | defmodule Pleroma.Web.CommonAPI.ActivityDraft do
alias Pleroma.Activity
alias Pleroma.Conversation.Participation
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.CommonAPI.Utils
import Pleroma.Web.Gettext
defstruct valid?: true,
errors: [],
user: nil,
params: %{},
... |
0926c18c4c35e6336d699d799c1cbb6f3ef2595e | 5,592 | [
318978512
] | [
"typespec"
] | defmodule Day17_list do
def file do
Parser.read_file(17)
end
@cycle_number 1_000_000_000_000
# @cycle_number 20000
def test do
"test" |> Parser.read_file()
end
@spec rocks :: list | {:error, atom}
def rocks do
"rocks" |> Parser.read_file()
end
def part_two() do
file()
|> forma... |
0926d82e28269b134f3caf28ab30ed62a438ab1e | 6,316 | [
403439198,
226476902
] | [
"test"
] | defmodule Livebook.Runtime.ErlDist.RuntimeServerTest do
use ExUnit.Case, async: false
alias Livebook.Runtime.ErlDist.{NodeManager, RuntimeServer}
setup do
{:ok, manager_pid} =
start_supervised({NodeManager, [unload_modules_on_termination: false, anonymous: true]})
runtime_server_pid = NodeManager... |
0926dcaae503ab3e008565721a8d597072844903 | 3,836 | [
97959122
] | [] | %{"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [], [], "hexpm"},
"certifi": {:hex, :certifi, "1.2.1", "c3904f192bd5284e5b13f20db3ceac9626e14eeacfbb492e19583cf0e37b22be", [], [], "hexpm"},
"chatterbox": {:git, "https://github.com/tony612/chatterbox.git", "f94ad17... |
09277a57ad07071fc839a942de312d25328de256 | 2,693 | [
206191101
] | [
"typespec",
"macro",
"documented"
] | if Matcha.Helpers.application_loaded?(:mnesia) do
defmodule Matcha.Table.Mnesia do
@moduledoc """
High-level macros for querying [`:mnesia`](https://www.erlang.org/doc/man/mnesia).
The macros in this module build and execute match patterns/specs
against [`:mnesia`](https://www.erlang.org/doc/man/mnes... |
0927e7d885f346afa7ecfc2ef2a778f6891bd029 | 2,662 | [
117277589
] | [
"test"
] | defmodule Tasks3Web.TaskControllerTest do
use Tasks3Web.ConnCase
alias Tasks3.Todo
alias Tasks3.Todo.Task
@create_attrs %{completed: true, description: "some description", progress: 42, title: "some title"}
@update_attrs %{completed: false, description: "some updated description", progress: 43, title: "some... |
0928212965144e7a4f9662d496f983d080f23256 | 2,383 | [
624054242
] | [
"typespec",
"documented"
] | # Code generated by protox. Don't edit.
# credo:disable-for-this-file
defmodule PgQuery.JoinType do
@moduledoc false
@type t :: %__MODULE__{}
defstruct []
(
@spec default() :: :JOIN_TYPE_UNDEFINED
def default() do
:JOIN_TYPE_UNDEFINED
end
)
@spec encode(atom() | String.t()) :: integer() ... |
09284c166a270e97cfb515b8ab92d71b53b30021 | 1,559 | [
443112184
] | [
"ecto"
] | defmodule AuthManager.Accounts.Projectors.Profile do
use Commanded.Projections.Ecto,
application: AuthManager.App,
name: "Accounts.Projectors.Profile",
consistency: :strong
alias AuthManager.Accounts.Events.{
ProfileFullAddressChanged,
ProfileIsAdminChanged,
ProfilePhoneChanged,
Profile... |
09288e1612c765c572ed963d0183f2f308a074b5 | 1,746 | [
604636879
] | [
"macro",
"test",
"documented",
"phoenix"
] | defmodule OrangeCmsWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build common data structures and query the data layer.
Finally, if ... |
0928a717c2a7c09fdd8154cb59507b34809eb82e | 1,919 | [
579908068
] | [
"test"
] | defmodule Chessh.Auth.UserRegistrationTest do
use Chessh.RepoCase
use ExUnit.Case
alias Chessh.{Player, Repo}
@valid_user %{username: "lizzy#0003", password: "password", discord_id: "4"}
@invalid_username %{username: "a", password: "password", discord_id: "7"}
@invalid_password %{username: "bruh#0003", pas... |
0928bbf4b1105cf572d8a0f2f47751122fcdca81 | 1,691 | [
170449521
] | [] | # Yoon Kim (jyk416), Wenquan Zou (wz1816)
defmodule EagerReliableBroadcast do
def main do
no_peers = hd(DAC.int_args())
max_broadcasts = 1000
timeout = 3000
IO.puts ["EagerReliableBroadcast at ", DAC.self_string()]
# Create peers
peers = for (i <- 0..(no_peers - 1)), do:
DAC.node_spawn... |
0929230234e9cfe4be56148cb15a44ce30aa5a34 | 3,345 | [
217541373
] | [
"typespec",
"documented"
] | defmodule Cloister.Options do
@moduledoc false
@spec sentry(any()) :: {:ok, [atom()] | atom()} | {:error, binary()}
@doc false
def sentry(value) do
case value do
[_ | _] = _nodes ->
{:ok, value}
service when is_atom(service) ->
{:ok, value}
_other ->
{:error,
... |
09295b3fa1b49a6897886d902d87aa0336b456ce | 1,886 | [
741183345
] | [
"typespec",
"documented",
"ecto"
] | defmodule Needlist.Repo.Pagination.PageInfo do
@moduledoc """
Info about the pagination of a query result.
"""
use Ecto.Schema
alias Ecto.Changeset
alias Needlist.Repo.Pagination.Urls
@required_fields [:page, :pages, :per_page, :items]
@optional_fields []
@embedded_fields [:urls]
@fields @requi... |
092994cb895728146f36fa5eab65736179ae4be1 | 5,112 | [
252891432
] | [] | %{
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"credo": {:hex, :credo, "1.7.4", "68ca5cf89071511c12fd9919eb84e388d231121988f6932756596195ccf7fd35", [:mix], [{:bunt, "~> 0.... |
0929d45692bcddf4d1c3365e5e9a499489c9bb25 | 3,375 | [
148671840
] | [
"test"
] | defmodule RentApiWeb.ItemControllerTest do
use RentApiWeb.ConnCase
import RentApi.Factory
alias RentApi.Rent.Item
alias RentApi.Repo
describe "index/2" do
test "Responds with paginated Items", %{conn: conn} do
items = insert_list(13, :item) |> Enum.slice(0, 10)
expected_output = %{items: item... |
092a11521bf56c9a0dba5b35bc8ff3d27f59992e | 12,042 | [
720998803
] | [
"documented"
] | defmodule ETEProtobufIds do
@moduledoc false
use Protobuf, enum: true, syntax: :proto2, protoc_gen_elixir_version: "0.12.0"
field :TE_EffectDispatchId, 400
field :TE_ArmorRicochetId, 401
field :TE_BeamEntPointId, 402
field :TE_BeamEntsId, 403
field :TE_BeamPointsId, 404
field :TE_BeamRingId, 405
fie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.