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 |
|---|---|---|---|---|
0aaf971ea6bec960ab35304289a44ce3290cd716 | 2,219 | [
86244081
] | [
"documented"
] | defmodule TL do
@moduledoc """
This library allows you to serialize and deserialize elements of the
[TL Language](https://core.telegram.org/mtproto/TL). It was originally
designed to be used by
[telegram-mt-elixir](https://github.com/Fnux/telegram-mt-elixir).
"""
@doc """
Build a TL object. See
[core... |
0aafb7e2efdeddcbc59776a97130032d5effd530 | 2,111 | [
314622035
] | [
"documented"
] | defmodule Ueberauth.Strategy.Twitch.OAuth do
@moduledoc """
OAuth2 for Twitch.
Add `client_id` and `client_secret` to your configuration:
config :ueberauth, Ueberauth.Strategy.Twitch.OAuth,
client_id: System.get_env("TWITCH_APP_ID"),
client_secret: System.get_env("TWITCH_APP_SECRET")
"""
use OAuth... |
0ab08156d38682b0e83d2c25fbb1dfc90e2fbca9 | 2,907 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.GKEHub.V1.Model.Fleet do
@moduledoc """
Fleet contains the Fleet-wide metadata and configuration.
## Attributes
* `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. When the Fleet was created.
* `defaultClusterConfig` (*type:* `GoogleApi.GKEHub.V1.Model.DefaultClust... |
0ab08373fd42a8e4e84f5fe46527e164f2ff862a | 3,576 | [
148754572
] | [] | defmodule Identicon do
def main(input) do
input
|> hash_input
|> pick_color
|> build_grid
|> filter_odd_squares
|> build_pixel_map
|> draw_image
|> save_image(input)
end
def hash_input(input) do
hex =
:crypto.hash(:md5, input)
|> :binary.bin_to_list()
%Identic... |
0ab1159b89f88d65d47055489b47de9225f16d6d | 3,404 | [
86610609
] | [
"genserver",
"typespec",
"documented"
] | defmodule AlertProcessor.SmsOptOutWorker do
@moduledoc """
Periodically fetches the list of opted-out phone numbers (those that sent a "STOP" message to
the number that sends alerts), and disables alerts for the corresponding user accounts.
"""
import Ecto.Query
use GenServer
require Logger
alias Alert... |
0ab11e3884e1aec5f71b5303f0c4e828ffd85f15 | 1,588 | [
726175656
] | [
"test"
] | defmodule AdventOfCode.Day10Test do
use ExUnit.Case
import AdventOfCode.Day10
test "part1" do
input = """
.....
.S-7.
.|.|.
.L-J.
.....
"""
result = part1(input)
assert result == 4
input = """
7-F7-
.FJ|7
SJLL7
|F--J
LJ.LJ
"""
result = part... |
0ab1c3d02b8aeea51d4cd96ece5981a44b1645ed | 1,847 | [
95154875
] | [
"documented"
] | defmodule TheElixir.Logic.NewGame do
@moduledoc """
Module that handles the new game option in the main menu.
Includes:
1. Prompt to enter name
2. Prompt to enter history ( or not )
3. List of available rooms to enter
4. Create a player for the game
"""
alias TheElixir.Components.World
alias TheEli... |
0ab215a216cefa621e7b31133550ac4a05ff7125 | 1,727 | [
449969557
] | [
"phoenix"
] | defmodule ElixirQuestWeb.AccountConfirmationController do
use ElixirQuestWeb, :controller
alias ElixirQuest.Accounts
def new(conn, _params) do
render(conn, "new.html")
end
def create(conn, %{"account" => %{"email" => email}}) do
if account = Accounts.get_account_by_email(email) do
Accounts.de... |
0ab292b312381e95524956a4c16a7a45f64c9eb1 | 4,880 | [
628788122
] | [] | %{
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"cors_plug": {:hex, :cors_plug, "3.0.3", "7c3ac52b39624bc616db2e937c282f3f623f25f8d550068b6710e58d04a0e330", [:mix], [{:plug... |
0ab2a1ecfefe1b78d30079c4a21931d5df6d02b9 | 3,263 | [
435629100
] | [
"genserver",
"supervisor",
"documented"
] | defmodule Reservation.EventBooker do
@moduledoc """
Manages available tickets and purchase orders.
"""
use GenServer
require Logger
alias Reservation.{Order, OrderSupervisor}
alias Reservation.Repo
def start_link(opts) do
opts = Keyword.put_new(opts, :name, __MODULE__)
GenServer.start_link(_... |
0ab2e01d0699296cfc17c40798b8c33b524715db | 2,832 | [
945227450
] | [
"genserver",
"liveview"
] | defmodule MyappWeb.Home do
use MyappWeb, :live_view
alias Myapp.Presence
@presence_topic "home_presence"
def mount(_params, _session, socket) do
answers = [
"YES!",
"No :/",
"Maybe?",
"You deserve it",
"Treat yourself!",
"Chipotleeeee",
"Late night Taco Bell run.... |
0ab32c5bb29a1ee10620a7056820110a7a1fedaa | 4,099 | [
415991146
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hex... |
0ab3700f77273540c77da7e36f604459b7c1bf14 | 6,623 | [
699751114
] | [
"typespec",
"documented"
] | defmodule CRDT.DotKernel do
@moduledoc """
A DotKernel is a data structure that contains a DotContext and a map of dots to values.
The DotContext is a data structure that contains a version vector and a dot cloud.
The version vector is a map from actors to the maximum version of a dot that has been added to
... |
0ab3e284797dc685cef9aa1a50baa1aaebe30792 | 2,512 | [
942811655,
920024200
] | [
"documented"
] | defmodule Auth.Cli do
@doc """
Helpers for verifying and rejecting calls if the CLI client is deprecated.
Example usage:
if is_call_from_deprecated_cli?(conn) do
reject_cli_client(conn)
end
"""
@min_cli_version %{
major: 0,
minor: 30,
patch: 0
}
def reject_cli_client(conn) do... |
0ab4327a36b5a7e305db78a03126526bda7dd624 | 2,152 | [
722138565
] | [
"test",
"ecto"
] | defmodule BoardWise.LanguagesTest do
use BoardWise.DataCase
alias BoardWise.Languages
describe "languages" do
alias BoardWise.Languages.Language
import BoardWise.LanguagesFixtures
@invalid_attrs %{code: nil, name: nil}
test "list_languages/0 returns all languages" do
language = language... |
0ab4d514c6c33cf9b7e25403ec5c82b1963c96be | 3,590 | [
246423252
] | [
"test",
"documented"
] | defmodule Engine.DB.Transaction.PaymentV1.ValidatorTest do
@moduledoc """
This test module contains minimal testing of the Validator. Most of the logic is tested in nested validators.
"""
use Engine.DB.DataCase, async: true
alias Engine.DB.Transaction
alias Engine.DB.Transaction.PaymentV1.Validator
alias... |
0ab51b8f3e7222d39fbbd320973e1061dcc06866 | 1,867 | [
618378010
] | [
"genserver",
"ecto"
] | defmodule Boom.Smtp.Mail do
use GenServer
import Swoosh.Email
@from_str "<EMAIL>"
def start_link(state) do
GenServer.start_link(__MODULE__, nil, name: __MODULE__)
end
@impl true
def init(state) do
{:ok, state}
end
# [email], [login], [uuid], [rundom_number],
def send(map) do
GenServer.... |
0ab5399aeb7d0f6a349388f32404af6415dbc649 | 1,960 | [
45792629
] | [
"documented"
] | defmodule StrBin do
@moduledoc """
Contains functions implementing strings and binaries.
"""
def ascii?([bin | _t]), do: bin in ?\s..?~
def anagram?(w1, w2) do
if length(w1) == length(w2) and Enum.empty?(w2 -- w1), do: true, else: false
end
defp _parse_num(num) do
import List, only: [to_float: 1... |
0ab5a82ec6905cdb3131ac74fa7b0c117468219f | 3,024 | [
269189815
] | [
"documented"
] | defmodule Okta do
@moduledoc File.read!("#{__DIR__}/../README.md")
alias Okta.{
Jwk,
Token
}
@doc """
Verify an okta token
## Examples
iex> Okta.verify_token(my_token, %{issuer: my_issuer, audience: "api://default", client_id: my_client_id)
{:error, :invalid_issuer}
iex> Okta.... |
0ab60d637da8722ae18f4e52ec762aaded78b752 | 2,456 | [
21394593
] | [
"test"
] | defmodule NegamaxTest do
use ExUnit.Case
test "#get_score: returns a 1 if the current player wins" do
current_board = ["X", "X", "X",
"", "", "",
"", "", ""]
assert Negamax.get_score(current_board, "X") == 100
end
test "#get_score: returns a -1 if the current ... |
0ab6c3412d219c2a0236300c6d3a32538a42d602 | 2,039 | [
62237113
] | [
"genserver",
"documented"
] | defmodule Serverboards.Auth.Reauth do
@moduledoc ~S"""
Reauth server that stores request by clients and controls the cancelation or
authorization of them.
Reauths are per client, so that when client dies, the reauths are all
automatically cancelled.
Also this ensures that the original calling client is th... |
0ab73ed71a7c7e7e3f385330e597f249bcc6ae2b | 4,257 | [
111264111
] | [
"documented",
"ecto"
] | defmodule Coinwatch.Assets do
@moduledoc """
The Assets context.
"""
import Ecto.Query, warn: false
alias Coinwatch.Repo
alias Coinwatch.Assets.Market
#Returns the current price for all supported markets in JSON.
#Some values may be out of date by a few seconds.
#### Data is in the form "EXCHANGE:... |
0ab74480ce0cbedb5745ab6e0a6a7b511834c828 | 5,098 | [
833891200
] | [
"test"
] | defmodule TodosTest do
use Todos.DataCase, async: false
describe "list_lists/0" do
test "returns all lists" do
list = insert!(:list, name: "test list 1")
list2 = insert!(:list, name: "test list 2")
result = Todos.list_lists()
assert list in result
assert list2 in result
end
... |
0ab7466c3437b1fc27b0dc2b1dc8ee2874baea5d | 2,241 | [
535166114
] | [] | %{
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.... |
0ab767a9019c96f35273cdb4dff3168a90713b5e | 1,756 | [
294647496
] | [
"genserver",
"supervisor"
] | defmodule SimpleQueue.SimpleQueueSupervisor do
use DynamicSupervisor
import SimpleQueue.Worker
def start_link(init_arg) do
IO.inspect("SimpleQueueSupervisor: start_link")
DynamicSupervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
end
# @impl DynamicSupervisor
@impl true
def init(_init... |
0ab76bba26ee376d8d29b8b625ccff18973c1b1c | 2,925 | [
444767321
] | [
"test"
] | defmodule Chargebeex.Builder.CustomerTest do
use ExUnit.Case, async: true
alias Chargebeex.Builder
alias Chargebeex.Customer
alias Chargebeex.Fixtures.Customer, as: CustomerFixture
describe "build/1" do
test "should build an customer" do
builded =
CustomerFixture.retrieve()
|> Jaso... |
0ab785617ec0599eb47457134ad880cdac98001f | 4,164 | [
686191063,
675066430
] | [
"typespec",
"documented",
"ecto"
] | defmodule Livebook.Notebook.AppSettings do
@moduledoc false
# Data structure configuring how notebook gets deployed as an app.
use Ecto.Schema
import Ecto.Changeset, except: [change: 1, change: 2]
@type t :: %__MODULE__{
slug: String.t() | nil,
multi_session: boolean(),
zero_... |
0ab7caa1d0de58df1fb5c55c214d5b94a2f856fc | 6,519 | [
334387837
] | [
"test"
] | defmodule TeiserverWeb.Battle.MatchLive.ShowTest do
alias TeiserverWeb.Battle.MatchLive.Show
use Teiserver.DataCase, async: true
@player_stats %{
team1_player1: %{
"damageDealt" => 100,
"damageReceived" => 50,
"metalProduced" => 200,
"metalUsed" => 150,
"energyProduced" => 300,
... |
0ab83572f1423f41ce307c0d5f0e9f260a2f3151 | 5,809 | [
134580831
] | [
"test"
] | defmodule Owaygo.User.UpdateEmailTest do
use Owaygo.DataCase
alias Owaygo.User.Create
alias Owaygo.User.UpdateEmail
@valid_username "nkaffine"
@valid_fname "Nick"
@valid_lname "Kaffine"
@valid_email1 "<EMAIL>"
@valid_email2 "<EMAIL>"
@valid_gender "male"
@valid_birthday "1997-09-21"
@invalid_ema... |
0ab8665420ecd73c68f470e58d1a19bc6df5197b | 2,448 | [
756071488
] | [
"genserver",
"liveview"
] | defmodule UnderstandingWeb.UserLive.Index do
use UnderstandingWeb, :live_view
alias Understanding.Accounts
alias Understanding.Accounts.User
def render(assigns) do
~H"""
<.header>
Listing Users
<:actions>
<.link patch={~p"/users/new"}>
<.button>New User</.button>
... |
0ab8f711b69167fce329b3979dc0c5b21e71478f | 2,897 | [
98130905,
87848208
] | [
"test"
] | defmodule Functions do
use Koans
@intro "Functions"
def greet(name) do
"Hello, #{name}!"
end
koan "Functions map arguments to outputs" do
assert greet("World") == ___
end
def multiply(a, b), do: a * b
koan "Single line functions are cool, but mind the comma and the colon!" do
assert 6 ==... |
0ab98540e58c2228bfcd17a7a3df8477e7910b54 | 4,326 | [
84685920
] | [] | %{"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, optional: false]}]},
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7... |
0ab9960b1ec4c53a4af406cf742984e77b1fd876 | 2,102 | [
603191773
] | [
"genserver"
] | defmodule MessageQueue do
use GenServer
def start_link(queue) do
GenServer.start_link(__MODULE__, queue, name: via_tuple(queue))
end
def init(queue_name) do
{:ok, %{queue_name: queue_name, messages: [], last_processed: :os.system_time(:millisecond)}}
end
def via_tuple(queue_name) do
{:global,... |
0aba628924623b83749c4adb113afd6f29cd718a | 2,155 | [
15848380
] | [] | defmodule FarmbotOS.Firmware.UARTDetector do
alias FarmbotOS.Firmware.UARTCoreSupport, as: Support
alias FarmbotOS.Asset
require FarmbotOS.Logger
@failure "UNABLE TO SELECT FARMDUINO! Please connect farmduino or set a valid firmware path."
@third_guess %{
"arduino" => "ttyACM0",
"express_k10" => "tt... |
0abac48ac22f0ce2c18108efc66e5b916c6897ca | 1,940 | [
770354813
] | [
"test"
] | defmodule BookshelfEx.TradesTest do
use BookshelfEx.DataCase
import BookshelfEx.Factory
import Swoosh.TestAssertions
alias BookshelfEx.{Trades, Trades.Trade}
describe "create_trade/1" do
setup do
user = insert(:account)
reservation = insert(:reservation, user: user.account)
user2 = ins... |
0abae30f240db4b1fef3b19ecf8516fbf3fd8449 | 2,879 | [
428428430
] | [
"test",
"ecto"
] | defmodule BbApi.EpisodesTest do
use BbApi.DataCase
alias BbApi.Episodes
describe "episodes" do
alias BbApi.Episodes.Episode
@valid_attrs %{air_date: "some air_date", name: "some name", season: "some season", season_episode: "some season_episode", series_episode: "some series_episode"}
@update_attrs... |
0abaf180f82983e958dc39e5c08c3257bc03a2d8 | 2,665 | [
639033514
] | [
"liveview"
] | defmodule SupLiveWeb.Components.CreateWorkersLiveComponent do
use SupLiveWeb, :live_component
alias SupLiveWeb.FormChangeset.ProcessPicker
@example_workers [
SupLive.ExampleWorkers.Count,
SupLive.ExampleWorkers.CountFaulty,
SupLive.ExampleWorkers.State,
SupLive.ExampleWorkers.StateFaulty
]
@... |
0abb5bd1c63b4bd8b6c1f0ca6ca6dac683fee8f3 | 3,417 | [
481076687
] | [
"test",
"phoenix"
] | defmodule MelpWeb.RestaurantControllerTest do
use MelpWeb.ConnCase
import Melp.ApimelpFixtures
@create_attrs %{city: "some city", code: "some code", email: "some email", lat: 120.5, lng: 120.5, name: "some name", phone: "some phone", rating: 42, site: "some site", state: "some state", street: "some street"}
@... |
0abb9d0c61a1e6749aac422af12ead6c31c12b1d | 22,100 | [
487952304
] | [
"typespec",
"macro",
"phoenix"
] | # Generated by erl2ex (http://github.com/dazuma/erl2ex)
# From Erlang source: (Unknown source file)
# At: 2022-05-02 12:33:55
defmodule :chumak_protocol do
require Record
# Begin included file: chumak.hrl
@type transport() :: :tcp
@type socket_type() ::
:req | :rep | :dealer | :router | :pub | :xp... |
0abbbb47e6a17899f13483d8e643d50698887df2 | 3,677 | [
202846144
] | [
"genserver",
"documented"
] | defmodule RemoteChain.WSConn do
@moduledoc """
Manage websocket connections to the given chain rpc node
"""
use WebSockex
alias RemoteChain.WSConn
require Logger
defstruct [
:owner,
:chain,
:ws_url,
:conn,
:lastblock_at,
:subscription_id,
lastblock_number: 0
]
def start(o... |
0abc1eecc17fdcf85fade87982d5536de7549fb2 | 1,803 | [
663120382
] | [
"documented"
] | defmodule DidServer.AccountsFixtures do
@moduledoc """
This module defines test helpers for creating
entities via the `DidServer.Accounts` context.
"""
alias CryptoUtils.Keys.Keypair
@example_domain "example.com"
def unique_account_email, do: "#{unique_account_username()}@#{@example_domain}"
def uniq... |
0abc53596436d1be9f79213f98934d8a7c20bf09 | 3,208 | [
542274222
] | [
"test"
] | defmodule Satie.PitchClassTest do
use ExUnit.Case, async: true
import Satie.RegressionDataStreamer
alias Satie.{Accidental, PitchClass}
describe inspect(&PitchClass.new/1) do
test "returns an error when the input is invalid" do
assert PitchClass.new("qqs") == {:error, :pitch_class_new, "qqs"}
... |
0abc8c73594847f02ab1cfb52025ee156dbbee26 | 2,337 | [
77131803
] | [
"test"
] | defmodule Jerboa.Format.Body.Attribute.ChannelNumberTest do
use ExUnit.Case
use Quixir
alias Jerboa.Format.Body.Attribute.ChannelNumber
alias Jerboa.Format.Meta
describe "encode/1" do
test "CHANNEL-NUMBER attribute with a valid number" do
min = ChannelNumber.min_number()
max = ChannelNumber... |
0abcbfaa495db4d98ce119fe7b19e59bbd6ae003 | 1,699 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.BigQuery.V2.Model.BigLakeConfiguration do
@moduledoc """
Configuration for BigLake managed tables.
## Attributes
* `connectionId` (*type:* `String.t`, *default:* `nil`) - Optional. The connection specifying the credentials to be used to read and write to external storage, such as Cloud S... |
0abce5f06db9c2c51d0e9b5b4954960f8e16429e | 2,246 | [
839757318
] | [
"genserver",
"typespec",
"documented"
] | defmodule CarRental.Clients.Processor do
@moduledoc """
This module is responsible for processing clients in bulk to avoid hitting into rate limit.
It processes clients in bulk and calculates trust score for each client and saves it.
"""
alias CarRental.TrustScore
alias CarRental.Clients
use GenServer
... |
0abd80f23396a76fa95e9976b18f85349bfe59e7 | 8,312 | [
75155398
] | [
"macro"
] | defmodule App.Commander do
@bot_name Application.get_env(:app, :bot_name)
# Code injectors
defmacro __using__(_opts) do
quote do
require Logger
import App.Commander
alias Nadia.Model
alias Nadia.Model.InlineQueryResult
def match_message(message) do
try do
app... |
0abdc231f85ee0251794f79f8a33a2157f0023bd | 2,034 | [
687703952
] | [] | defmodule InsigniaNotify.Html.Parse do
def parse_games_row(row) do
{_, _, tds} = row
game_name =
tds
|> Floki.find("a:nth-child(2)")
|> Floki.text()
game_url =
tds
|> Floki.find("a:nth-child(2)")
|> Floki.attribute("href")
|> Enum.at(0)
{serial, code} =
... |
0abe056a9c07211dae4455356516497330445ca6 | 3,229 | [
97388394
] | [
"test"
] | defmodule ClientWeb.SoapOrdersFeatureTests do
use ClientWeb.FeatureCase, async: true
test "can create a order", %{session: session} do
user = insert(:user)
session
|> visit(Routes.soap_order_path(@endpoint, :index, as: user.id))
|> click(role("create-soap-order"))
|> fill_in(role("soap-order-n... |
0abe1f39a1add97a9ef023d396baca7e2090076c | 1,614 | [
125803198,
131532323
] | [
"macro",
"documented",
"phoenix"
] | defmodule WalletMsWeb 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 WalletMsWeb, :controller
use WalletMsWeb, :view
The definitions below will be executed for every view,
controlle... |
0abe7314756ade4f842739c91ecf7b64d2f8676a | 2,167 | [
820616596
] | [] | defmodule Aos.MixProject do
use Mix.Project
def project do
[
app: :aos,
version: "0.1.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end
# Configuration for the OTP applic... |
0abf4833c460560cbecf5befaa6beb749226c91e | 1,676 | [
131985283
] | [
"typespec",
"documented"
] | defmodule Hobot.Plugin.Adapter.SlackRTM.SlackAPI do
@moduledoc """
A module handles about interacting with slack through [RTM](https://api.slack.com/rtm) API.
"""
@type access_token :: String.t() | nonempty_charlist
@type rtm_connect_response :: map
@doc """
Gets a Real Time Messaging API session and re... |
0abf48e9f21c75c8279dec9a71a0ddaac148572a | 1,930 | [
476742399
] | [
"genserver",
"documented"
] | defmodule StatePartitioner.State do
@moduledoc """
Module to keep the state, currently it is a gen server, maybe we should do something smarter in the future.
"""
use GenServer
alias StatePartitioner.State.Item
def start_link(_) do
GenServer.start_link(__MODULE__, nil, name: __MODULE__)
end
def p... |
0ac00cf3b302bb08faff90bd96ced359e6a774d4 | 5,357 | [
239822890,
459291087
] | [
"documented",
"ecto"
] | defmodule Oli.Analytics.Datasets.Utils do
alias Oli.Repo
import Ecto.Query
alias Lti_1p3.Roles.ContextRoles
@student_role ContextRoles.get_role(:context_learner).id
@doc """
Determines the chunk size for a dataset job based on the fields that are excluded from the dataset.
The rationale here is that we ... |
0ac08853a06203878cf01523f47b3e70759c9222 | 1,641 | [
331245151
] | [
"test"
] | defmodule TestChampions do
use ExUnit.Case
import Champions, only: [count_wins: 2]
@winner_list [
%{season: "1996–97", team: "Borussia Dortmund", country: "Germany"},
%{season: "1997–98", team: "Real Madrid", country: "Spain"},
%{season: "1998–99", team: "Manchester United", country: "England"},
... |
0ac09524d7daed8118f57d4127d32456a4381742 | 1,614 | [
226221565
] | [] | defmodule Day03 do
def part_one(file_reader \\ InputFile) do
file_reader.contents_of(3)
|> String.split("", trim: true)
|> move()
|> MapSet.size()
end
def part_two(file_reader \\ InputFile) do
file_reader.contents_of(3)
|> String.split("", trim: true)
|> move2()
|> MapSet.size()
... |
0ac0d84b7be5c7338b63693844ed4f5ca2c385b8 | 1,865 | [
158100912
] | [
"typespec"
] | defmodule Solution do
# 2ms
@spec has_increasing_subarrays(nums :: [integer], k :: integer) :: boolean
def has_increasing_subarrays(nums, k) do
count_increasing_subarrays(nums |> tl, nums |> hd, 1, 0, 0) >= k
end
@spec count_increasing_subarrays(nums :: [integer], prev :: integer, cnt :: integer, pre_max... |
0ac0dc4a0def8ba49d58fa044d79ebd1a7c304ab | 4,235 | [
196528207
] | [
"documented",
"ecto"
] | defmodule ApiGateway.Models.ArchivedWorkspaceSubdomain do
require Ecto.Query
use Ecto.Schema
use ApiGateway.Models.SchemaBase
import Ecto.Changeset
alias ApiGateway.Repo
alias ApiGateway.Ecto.CommonFilterHelpers
alias __MODULE__
schema "archived_workspace_subdomains" do
field :subdomain, :string
... |
0ac0f3c31bfcd14d856ffcee17e8170b7da26aab | 3,289 | [
192653852
] | [] | defmodule OOTPUtilityWeb.Components.Scoreboard.Game do
use Surface.LiveComponent
alias OOTPUtility.{Games, Players, Repo, Standings, Teams}
alias OOTPUtilityWeb.Router.Helpers, as: Routes
prop game, :struct, required: true
def render(assigns) do
~F"""
<div class="flex flex-col flex-none bg-white bo... |
0ac0f73ae91f6e5c6d4949be8e5fa47fada16e45 | 2,074 | [
124810538
] | [] | # 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.
~w(rel plugins *.exs)
|> Path.join()
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))
use Mix.Releases.Config,
# Thi... |
0ac16b8bcf0a15deaf8f7121cf524616f7b99816 | 4,820 | [
145728382
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
"credo": {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}], "hexpm"},
"... |
0ac177fbe15b2a1cbc690455ef1f3767d9dc1ace | 1,918 | [
927234821,
492752264,
554455380
] | [
"liveview"
] | defmodule LivebookWeb.ErrorHTML do
use LivebookWeb, :html
def render("404.html", assigns) do
~H"""
<.error_page status={@status} title="No Numbats here!" />
"""
end
def render("403.html", assigns) do
~H"""
<.error_page status={@status} title="No Numbats allowed here!" />
"""
end
d... |
0ac21197e5a4881c23d7c8046008b0d34d5ec2ba | 3,947 | [
140890391,
140879657
] | [
"test"
] | defmodule DatabaseWeb.EventControllerTest do
use DatabaseWeb.ConnCase
alias Database.Events
alias Database.Events.Event
@create_attrs %{category: "some category", description: "some description", end_time: "2010-04-17 14:00:00.000000Z", start_time: "2010-04-17 14:00:00.000000Z", title: "some title", title_ful... |
0ac25625cb630044dc57e9ddda3d71258f04ff12 | 1,942 | [
46915993
] | [
"documented"
] | defmodule UnitFun.UnitTypes do
@moduledoc """
Provides functions for applying units on top of bare values. Normally imported
import UnitFun.UnitTypes
ten_pence = 10 |> with_units(Pence)
# or
twenty_pence = 20 <~ Pence
"""
alias UnitFun.Conversion.ConversionHelper
alias UnitFun.Errors.M... |
0ac31b6e17470014eb3e0e520bb42dde6a5c4e33 | 2,066 | [
309091982
] | [] | %{
"castore": {:hex, :castore, "0.1.10", "b01a007416a0ae4188e70b3b306236021b16c11474038ead7aff79dd75538c23", [:mix], [], "hexpm", "a48314e0cb45682db2ea27b8ebfa11bd6fa0a6e21a65e5772ad83ca136ff2665"},
"finch": {:hex, :finch, "0.3.2", "993dddb23cd9b50ad395ed994b317c7ce2c095e6017ffd5a5b65abdb5b7e5d1c", [:mix], [{:casto... |
0ac35594205d55c9c86df50a407be6f113f7ff5c | 1,699 | [
217930962
] | [
"documented",
"ecto"
] | defmodule Boldly.MessageInfo do
alias Boldly.Messages.Message
alias Boldly.Repo
import Ecto.Query, warn: false
@doc """
Returns the list of all Messages.
## Examples
iex> list_messages()
[%Message{}, ...]
"""
def list_messages() do
Repo.all(Message)
end
@doc """
Gets a single messa... |
0ac3acb510d2fcbc7638a05ff56b3adccf5982b7 | 2,301 | [
138225519
] | [
"documented"
] | defmodule Kiq.Reporter.Retryer do
@moduledoc false
use Kiq.Reporter
alias Kiq.{Job, Pool, Reporter, Timestamp}
alias Kiq.Client.{Cleanup, Queueing}
@default_max 25
defmodule State do
@moduledoc false
defstruct [:dead_limit, :dead_timeout, :identity, :pool]
end
# Callbacks
@impl GenStage... |
0ac3bd20ee0d7acde088e1a7dacac3921be1cb41 | 2,779 | [
487015363
] | [
"documented"
] | defmodule MyMapSet do
@moduledoc """
A MapSet is the implementation of a set —
a store of unique values, where a value can be of any type.
"""
def main do
days = MapSet.new([:monday, :tuesday, :wednesday])
MapSet.member?(days, :monday) # |> IO.inspect # true
MapSet.member?(days, :thursday) # |> IO... |
0ac41a087e6fead34a7c5beea3db844b3c788a44 | 8,299 | [
737827999
] | [
"documented",
"ecto"
] | defmodule AppAnimal.ClusterBuilders do
@moduledoc """
All the predefined cluster types.
"""
use AppAnimal
use KeyConceptAliases
use MoveableAliases
alias Cluster.Circular
section "the two core functions: `circular` and `linear`" do
@doc """
Construct a circular cluster.
The basic f... |
0ac42add4f1593884bb464ebd024a3c7b53a7f63 | 1,565 | [
103705718
] | [
"macro",
"documented",
"phoenix"
] | defmodule KiltWeb 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 KiltWeb, :controller
use KiltWeb, :view
The definitions below will be executed for every view,
controller, etc, so k... |
0ac4b246a872cd23d688ad3b576d88173a3418cf | 3,493 | [
674504588
] | [
"test",
"ecto"
] | defmodule Kazip.ArticlesTest do
use Kazip.DataCase
alias Kazip.Articles
import Kazip.ArticlesFixtures
import Kazip.AccountsFixtures
alias Kazip.Articles.Article
setup do
account = account_fixture()
%{
account: account,
draft_article: draft_article_fixture(%{account_id: account.id, ca... |
0ac4ed4c2473c53f9aadf021e5b72372ca5ea9bd | 1,629 | [
894846031
] | [] | defmodule Day08 do
import Common
import Combinatorics, only: [n_combinations: 2]
def part1(args) do
%{grid: grid} = args
%{args | grid: reject_from_grid(grid, ".")}
|> build_antinodes(&part_1_antinodes/5)
|> length()
end
def part2(args) do
%{grid: grid} = args
%{args | grid: reject... |
0ac577771cdc09e7d9ab6c957856497c3ac3f07d | 5,124 | [
787905131
] | [] | defmodule Dispatcher do
use Matcher
define_accept_types [
html: [ "text/html", "application/xhtml+html" ],
json: [ "application/json", "application/vnd.api+json", "application/sparql-results+json" ],
text_event_stream: [ "text/event-stream" ],
sparql: [ "application/sparql-results+json" ],
]
@a... |
0ac6e02504a7eeb7fb2e1a8878d9d5e05bb92fd7 | 11,907 | [
1010403460
] | [
"typespec",
"documented"
] | defmodule ClaudeCodeSDK.Step do
@moduledoc """
Represents a logical step in Claude's processing workflow.
A step groups related messages and tool uses into a cohesive unit that can be
reviewed, paused, or controlled as a single operation. Steps provide structure
to Claude's output stream, enabling better obs... |
0ac714d60429f88f0cd9bcfeaac512b372b99f30 | 14,371 | [
108715208
] | [
"documented",
"ecto"
] | defmodule Logger.Translator do
@moduledoc """
Default translation for Erlang log messages.
Logger allows developers to rewrite log messages provided by
Erlang applications into a format more compatible with Elixir
log messages by providing a translator.
A translator is simply a tuple containing a module a... |
0ac7f2f2929b6a1cb11dc0a23717dec056ec1cc4 | 4,008 | [
15482672
] | [
"documented"
] | defmodule HTTParrot.PHandler do
@moduledoc """
This REST handler will respond to POST, PATCH and PUT requests.
"""
alias HTTParrot.GeneralRequestInfo
def init(req, state) do
{:cowboy_rest, req, state}
end
@doc """
When a request is made to /post, allowed_methods will return POST for example
"""
... |
0ac819f985ccf97f1d174faef3aa6a5691369fb8 | 2,122 | [
680481530
] | [
"documented",
"ecto"
] | defmodule AllThingsSocial.Payments do
@moduledoc """
The Payments context.
"""
import Ecto.Query, warn: false
alias AllThingsSocial.Repo
alias AllThingsSocial.Payments.Payment
@doc """
Returns the list of payments.
## Examples
iex> list_payments()
[%Payment{}, ...]
"""
def list_p... |
0ac872e3b836c7dab68d90f2503218aca0559f0f | 7,312 | [
84110649
] | [
"typespec",
"documented"
] | defmodule Giphy.GIF do
@moduledoc """
Represents a GIF in Giphy's library.
%Giphy.GIF{
bitly_gif_url: "http://gph.is/2cREAmR",
bitly_url: "http://gph.is/2cREAmR",
caption: nil,
content_url: "",
embed_url: "http://giphy.com/embed/kj8RVuDxh4x7W",
id: "kj8RVuDx... |
0ac8b6c2cf5e951cb909214fd4ca699c6817df1e | 3,131 | [
688984095
] | [
"test"
] | defmodule MemorySizeTest do
use ExUnit.Case
def test_value_list_exact_match(values) do
Enum.each(
values,
fn value -> assert MemorySize.term(value) == :erts_debug.flat_size(value) end
)
end
describe "term/2" do
test "consistent with erts_debug for simple values" do
test_value_lis... |
0ac9aba795c26bae70144db3e653b0b387413b42 | 3,947 | [
681306558
] | [
"test",
"phoenix"
] | defmodule CumbucaWeb.SchemaTest do
use CumbucaWeb.ConnCase, async: true
import Cumbuca.AccountsFixtures
import Cumbuca.TransactionsFixtures
describe "login mutation" do
@mutation """
mutation Login($cpf: String!, $identifier: String!) {
login(input: { cpf: $cpf, account_identifier: $identifier }... |
0ac9ad6c062aef47b5e235781c48471ca796ac96 | 1,635 | [
774661810
] | [] | import Config
# Only in tests, remove the complexity from the password hashing algorithm
config :bcrypt_elixir, :log_rounds, 1
# Configure your database
#
# The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
#... |
0ac9b5295f7d51c886f7abdb13c4309798318241 | 1,510 | [
343600659
] | [
"liveview",
"phoenix"
] | defmodule AlgapayWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :algapay
# 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: "_algapay_k... |
0ac9cbb4420c1281fbe5cc8ec00a9ec41763f368 | 11,765 | [
770027387
] | [] | defmodule Minesweeper do
# PRIMEIRA PARTE - FUNÇÕES PARA MANIPULAR OS TABULEIROS DO JOGO (MATRIZES)
# A ideia das próximas funções é permitir que a gente acesse uma lista usando um indice,
# como se fosse um vetor
# get_arr/2 (get array): recebe uma lista (vetor) e uma posicao (p) e devolve o elemento
# na... |
0ac9ebe0ee648381f2aae723c56a0e20202cb3ec | 2,254 | [
73354218
] | [
"documented"
] | defmodule Dataflow.Utils.PipelineVisualiser do
@moduledoc """
Contains functionality to visualise a pipeline's state, for debugging only. Currently outputs DOT code.
"""
alias Dataflow.Pipeline
alias Dataflow.Pipeline.State
alias Dataflow.Pipeline.AppliedTransform
alias Dataflow.PValue
import Dataflow.U... |
0aca3855d7765c2c6fedc6fcc0eef71d676d043b | 6,688 | [
204620266
] | [
"documented",
"ecto"
] | defmodule ProjectManagementApi.Management do
@moduledoc """
The Management context.
"""
import Ecto.Query, warn: false
alias ProjectManagementApi.Repo
alias ProjectManagementApi.Management.Project
@doc """
Returns the list of projects.
## Examples
iex> list_projects()
[%Project{}, ...... |
0acad6f85dc5653bd577dadef83c22b7705c9af1 | 1,834 | [
198474363
] | [
"test"
] | defmodule OcwWebpage.Model.PersonTest do
use OcwWebpage.DataCase
alias OcwWebpage.Model.{Country, Person}
describe "new/3" do
test "returns Person.t()" do
continent_name = "Europe"
country_name = "Poland"
country_iso2 = "pl"
continent = %{name: continent_name}
country = %{contin... |
0acae9eedf1ea4aafad968a6908b3f20bd784afd | 1,847 | [
150831204
] | [
"genserver"
] | defmodule PVAData.DataManager do
use GenServer
require Logger
alias PVAData.{
Data,
Scraper
}
@initial_update_delay_ms 10
@update_interval_ms 30 * 60 * 1_000
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, :ok, opts)
end
def init(:ok) do
Data.load_state()
schedu... |
0acb39f91916d9ac0cf60dd7cb9168a7662ace25 | 5,140 | [
254217221
] | [
"test"
] | defmodule HandlerTest do
use ExUnit.Case, async: true
import Servy.Handler, only: [handle: 1]
test "GET /wildthings" do
request = """
GET /wildthings HTTP/1.1\r
Host: example.com\r
User-Agent: ExampleBrowser/1.0\r
Accept: */*\r
\r
"""
response = handle(request)
assert respo... |
0acb4d6d84e653a72917f141d7a2009eec5e41b2 | 1,502 | [
981984330
] | [] | # 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 :simple_saml_example,
generators: [timestamp... |
0acb525d9bd6d08d7302d7efa840a68f4303d27a | 1,617 | [
789802355
] | [
"liveview",
"phoenix"
] | defmodule CampaignhubWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :campaignhub
# 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: "_c... |
0acb57ab9906407903396f9bc8a3d2c442a6f39d | 3,946 | [
28950895
] | [] | defmodule Durga.Handler do
defstruct reqs: %{}
require Logger
alias Durga.Transport
def init(_, req, opts) do
case :cowboy_req.header("upgrade", req) do
{upgrade, _} when upgrade in ["Websocket", "websocket"] ->
{:upgrade, :protocol, :cowboy_websocket}
_ ->
{:ok, req, opts}
... |
0acbaeb7472bfe7f42a7d9ddcc92537cf791c2d0 | 12,266 | [
423848082
] | [
"liveview"
] | defmodule KefisWeb.Admin.ShellDashboardLive do
use KefisWeb, :live_component
def update(assigns, socket) do
{:ok,
socket
|> assign(assigns)}
end
def handle_event("test_target", _value, socket) do
IO.inspect("socket")
{:noreply, socket}
end
def render(assigns) do
~H"""
<div>
... |
0acbb0cb4b42807efb01eb783d2d3a6cfa5ac643 | 6,640 | [
140165187
] | [
"test"
] | defmodule Tus.PostTest do
use ExUnit.Case, async: true
use Plug.Test
doctest Tus.Post
import Plug.Conn.Status, only: [code: 1]
import Tus.TestHelpers, only: [test_conn: 2, get_config: 0]
alias Tus.TestController
setup_all do
%{config: get_config()}
end
test "`HTTP 413 Request Entity Too Large` ... |
0acbd2bd9f198a1bf7bc0f31edf259229afb3300 | 5,202 | [
799618467
] | [] | %{
"cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911... |
0acc045b78880554b9d74984f696259a808e2359 | 12,414 | [
434898411
] | [] | import Config
# config/runtime.exs is executed for all environments, including
# during releases. It is executed after compilation and before the
# system starts, so it is typically used to load production configuration
# and secrets from environment variables or elsewhere. Do not define
# any compile-time configurati... |
0acc0709dba025bfb11b46e9924eab8d33d898b4 | 6,050 | [
335243209
] | [
"typespec",
"test",
"documented"
] | defmodule Anoma.Node.Examples.EGRPC do
@moduledoc """
I contain examples to test the GRPC endpoint of the node.
"""
alias Anoma.Node.Examples.EGRPC
alias Anoma.Node.Examples.ENode
alias Anoma.Proto.Intentpool.Add
alias Anoma.Proto.Intentpool.Intent
alias Anoma.Proto.Intentpool.List
alias Anoma.Proto.... |
0acd6f06ad6139c18c9fe11dda28feaaddae55f0 | 24,490 | [
239822890,
459291087
] | [
"test",
"liveview"
] | defmodule OliWeb.Delivery.Student.ScheduleLiveTest do
use ExUnit.Case, async: true
use OliWeb.ConnCase
import Phoenix.LiveViewTest
import Oli.Factory
import Ecto.Query, warn: false
alias Lti_1p3.Roles.ContextRoles
alias Oli.Delivery.Sections
alias Oli.Resources.ResourceType
alias Oli.Delivery.Attemp... |
0acdd941db7b1103718f09dfcb572dd85bc7a4ef | 2,422 | [
785796433
] | [] | %{
"castore": {:hex, :castore, "1.0.6", "ffc42f110ebfdafab0ea159cd43d31365fa0af0ce4a02ecebf1707ae619ee727", [:mix], [], "hexpm", "374c6e7ca752296be3d6780a6d5b922854ffcc74123da90f2f328996b962d33a"},
"finch": {:hex, :finch, "0.18.0", "944ac7d34d0bd2ac8998f79f7a811b21d87d911e77a786bc5810adb75632ada4", [:mix], [{:casto... |
0ace112425de7dedf1981e1eeb9125555dbffb99 | 1,649 | [
572272324
] | [
"genserver",
"documented"
] | defmodule BlockClock.Match do
use GenServer
@doc"""
`Store` is a stateful process (GenServer) allowing us to store and retrieve
data of the current block time.
Client API:
- `start_link/1` starts the GenServer. Any options provided are ignored.
- `get/0` returns the current stored state.
- `set_lat... |
0acf2195576f8f416897949dcec4776f49d3a439 | 2,692 | [
101403759
] | [] | defmodule RedditApi do
require Logger
@base "https://www.reddit.com/api/v1"
@oauthbase "https://oauth.reddit.com"
# @redirect_uri "http://127.0.0.1:8080/authorize_callback"
# @redirect_uri "http://web.neurotiko.com/redirectmereddit"
def clean_path(path), do: if String.starts_with?(path, "/"), do: path, e... |
0acff4fe2aeaec0573a0943032ac5c02c0382a49 | 13,263 | [
403563809
] | [] | %{
"atecc508a": {:hex, :atecc508a, "0.3.0", "794e2470302d101005b2b9f85d13d0a188675a84f13e668e446cd318b7679f6f", [:mix], [{:circuits_i2c, "~> 0.2", [hex: :circuits_i2c, repo: "hexpm", optional: false]}, {:x509, "~> 0.5.1 or ~> 0.6", [hex: :x509, repo: "hexpm", optional: false]}], "hexpm", "e7041edeab56d0fd8773f46b5dec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.