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 |
|---|---|---|---|---|
0a09cba9bcee9f253782c74f7d421eaecec5f4c7 | 1,631 | [
259956889
] | [
"phoenix"
] | defmodule HomeDash.Component.Navigation do
use Scenic.Component
alias Scenic.ViewPort
alias Scenic.Graph
import Scenic.Primitives
import Scenic.Components
import HomeDash.Util, only: [neighbours: 2]
import HomeDash.Util.Constants, only: [dark_button_theme: 0, col_3: 0]
def init({current_scene, title... |
0a0a5e2ca324b4ae32f5481a01c2f8c1de432b9b | 5,291 | [
650701811
] | [] | defmodule MainWeb.Helper.Formatters do
alias Calendar.Strftime
require Logger
alias Data.{MemberChannel,User}
alias Data.Schema.MemberChannel, as: Channel
def format_role("admin") do
"Super Admin"
end
def format_role(role) do
role
|> String.split("-")
|> Enum.map(&String.capitalize/1)
... |
0a0a724c361e3ec8baa9c9d16fc0a29a03c61c3e | 6,987 | [
262599401
] | [] | %{
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"},
"combine": {:hex, :combine, "0.10.0", "... |
0a0abbaaa1daf2564dcfa54782205ee898588573 | 2,560 | [
92873441
] | [] | defmodule TodoServer do
def start do
Process.register(spawn(fn -> loop(TodoList.new) end), :todo_server)
end
def add_entry(new_entry) do
send(:todo_server, {:add_entry, new_entry})
end
def entries(date) do
send(:todo_server, {:entries, self(), date})
receive do
{:todo_entries, entrie... |
0a0b52df30932e6719139ef54669a3fbb03ccda3 | 14,468 | [
154659583
] | [
"documented"
] | defmodule Ibanity.PontoConnect.Sandbox.FinancialInstitutionTransaction do
@moduledoc """
[Sandbox Financial Institution Transaction](https://documentation.ibanity.com/ponto-connect/api#financial-institution-transaction) API wrapper
"""
use Ibanity.Resource
@api_schema_path [
"ponto-connect",
"sandbo... |
0a0b563ceb69b1313a6db761fdcb775258eda81a | 1,737 | [
993445037
] | [
"documented"
] | defmodule SNMPSimEx.TestHelpers.PortHelper do
@moduledoc """
Simple helper functions for port allocation in tests.
"""
alias SNMPSimEx.TestHelpers.PortAllocator
@doc """
Get a port for testing, ensuring PortAllocator is started.
Falls back to server port range if PortAllocator fails.
"""
def get_p... |
0a0c1da61b48cd5780c9cd9a1b6a98ba436cbc53 | 1,871 | [
105443673
] | [
"phoenix",
"ecto"
] | defmodule StoreWeb.MerchantController do
use StoreWeb, :controller
alias Store.Accounts
alias Store.Accounts.Merchant
def index(conn, _params) do
merchants = Accounts.list_merchants()
render(conn, "index.html", merchants: merchants)
end
def new(conn, _params) do
changeset = Accounts.change_me... |
0a0c4bb1c9da9998cff8585a987b24fb179db8f4 | 3,290 | [
917123261
] | [
"test",
"ecto"
] | defmodule LevelWeb.PasswordResetControllerTest do
use LevelWeb.ConnCase, async: true
alias Level.Repo
alias Level.Users
describe "GET /reset-password" do
test "includes the correct heading", %{conn: conn} do
conn =
conn
|> get("/reset-password")
assert html_response(conn, 200)... |
0a0cc299c3908a66351fcf2bddf33a6846fca60a | 1,748 | [
285857453
] | [
"genserver"
] | defmodule KvStoreWeb.Benchmark.Worker do
use GenServer
alias KvStoreWeb.Benchmark.ClientManager
def start(arg), do: GenServer.start(__MODULE__, arg)
def state(pid), do: GenServer.call(pid, :state)
def prepare(pid, scenario), do: GenServer.cast(pid, {:start, scenario})
def init(arg) do
{:ok, pid} = ... |
0a0d0f1a8b5ff53740f4e03d70c1a3ab6d65e861 | 6,775 | [
635277371
] | [
"typespec",
"test",
"documented"
] | defmodule BetUnfair.Controllers.Bet do
@type bet_id() :: String.t()
@type market_id() :: String.t()
@type user_id() :: String.t()
@doc """
Creates a new backing bet by a user and in a market
## Examples
assert {:ok, 1} = BetUnfair.bet_back("user", 1, 25, 1.5)
"""
@spec bet_back(
user_i... |
0a0d5fd388d3c35517344423d734f2e0f7829446 | 2,295 | [
1005858907
] | [
"genserver"
] | defmodule Untether.Communicator.Client do
use GenServer
require Logger
alias Untether.Communicator.Router
def start_link(args) do
GenServer.start_link(__MODULE__, args, name: args[:name])
end
def child_spec(opts) do
%{
id: {:client, opts[:id]},
start: {__MODULE__, :start_link, [opts]}... |
0a0d95746aeff31ca1a68d71e74d0d28a1d21e46 | 2,308 | [
49404027
] | [] | # 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:
#
# BuckcalcApi.Repo.insert!(%BuckcalcApi.SomeModel{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as th... |
0a0dfac68d666692f361dc0eab77629b47156989 | 2,367 | [
573307344
] | [] | defmodule Twelve do
def part_one(input) do
{map, start, dest} = parse(input)
path(map, start, dest)
end
def part_two(input) do
{map, _, dest} = parse(input)
reverse_path(map, dest)
end
defp parse(text) do
map =
text
|> String.trim()
|> String.split(~r/\R/)
|> En... |
0a0dffd03f07d40def6d021a1e5fbd875814e1de | 1,600 | [
28176790
] | [
"test"
] | defmodule PlayerTest do
use ExUnit.Case
setup do
value = TableSoccer.Db.Repo.delete_all(Models.Player)
{:ok, val: value}
end
test "add palyers" do
def_options = %{status: :waiting, player_l: nil, player_r: nil}
attrs_1 = %{first_name: "first_name", last_name: "last_name",email: "<EMAIL>", rfi... |
0a0e0c8e015dc6ea3e3874674ec037e53a43df02 | 9,837 | [
507349355
] | [
"documented",
"ecto"
] | defmodule OmegaBravera.Fundraisers.NGO do
use Ecto.Schema
import Ecto.Changeset
import OmegaBravera.Fundraisers.NgoOptions
alias OmegaBravera.Accounts.User
alias OmegaBravera.Challenges.NGOChal
alias OmegaBravera.Money.Donation
@derive {Phoenix.Param, key: :slug}
schema "ngos" do
field(:desc, :str... |
0a0eb0f2850a1467d270ea91b97daedbd35e2382 | 5,575 | [
874035002
] | [
"documented"
] | defmodule BinStruct.Macro.TypeConverterToUnmanaged do
@moduledoc false
alias BinStruct.Macro.TypeConverters.FlagsTypeConverter
alias BinStruct.Macro.TypeConverters.EnumTypeConverter
alias BinStruct.Macro.TypeConverters.ListOfTypeConverter
alias BinStruct.Macro.TypeConverters.StaticValueTypeConverter
alias... |
0a0f8c42c134a3566d8214a72dbaccc538183672 | 6,281 | [
970817672
] | [
"documented"
] | # lib/frestyl/stories/visual_ai_generator.ex
defmodule Frestyl.Stories.VisualAIGenerator do
@moduledoc """
AI-powered visual content generation for storyboards and comics
"""
alias Frestyl.Stories.AIGeneration
def generate_storyboard_image(story_id, shot_data, user) do
prompt = build_storyboard_prompt(s... |
0a0fb51701a66c6977f9ddb3514e8131173230e1 | 2,131 | [
79679697
] | [] | %{"certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0df0979153cbafcd853ababaf", [:rebar3], []},
"earmark": {:hex, :earmark, "1.0.3", "89bdbaf2aca8bbb5c97d8b3b55c5dd0cff517ecc78d417e87f1d0982e514557b", [:mix], []},
"ex_doc": {:hex, :ex_doc, "0.14.5", "c0433c8117e948404d93ca69411dd575ec6be3... |
0a0ff29b2e2e7d51340bfda28dd797fabc3ec655 | 2,124 | [
48792958
] | [
"genserver"
] | defmodule ExParticle.Events.Listener do
use GenServer
alias HTTPoison.Error
alias HTTPoison.AsyncChunk
alias HTTPoison.AsyncEnd
alias ExParticle.Events.Handler
alias ExParticle.Model.SseEvent
@default_recv_timeout 10000
def start_link do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
end... |
0a10ac05b89131a7b85999e5059d369323889f94 | 1,589 | [
59836675
] | [
"documented"
] | defmodule Mach.Add do
defstruct [left: nil, right: nil, _reducible?: true]
alias Mach.Number
@doc """
reduce an add operation to a number summing the values
from the left side to the right side
iex(1)> Mach.Add.reduce(%{}, %Mach.Add{
iex(1)> left: %Mach.Number{value: 2},
iex(1)> right: %Mac... |
0a1149f80325993ea7c67325d55bce451bc24ce8 | 4,322 | [
50067457
] | [
"phoenix",
"ecto"
] | defmodule KrishedgesSpace.PostController do
use KrishedgesSpace.Web, :controller
use Guardian.Phoenix.Controller
alias KrishedgesSpace.Post
alias KrishedgesSpace.PostCategory
plug :scrub_params, "post" when action in [:create, :update]
plug Guardian.Plug.EnsureAuthenticated, %{ handler: { KrishedgesSpace.... |
0a11b47b17921ed291db37c68f95c695b90c664c | 2,363 | [
227936444
] | [] | defmodule VintageNetMobile.MixProject do
use Mix.Project
@version "0.11.5"
@source_url "https://github.com/nerves-networking/vintage_net_mobile"
def project do
[
app: :vintage_net_mobile,
version: @version,
elixir: "~> 1.9",
elixirc_paths: elixirc_paths(Mix.env()),
start_perm... |
0a1234de05c0c9d2694878c24af2ac9089f262b3 | 1,589 | [
160999208
] | [
"macro",
"documented",
"phoenix"
] | defmodule BotoServerWeb 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 BotoServerWeb, :controller
use BotoServerWeb, :view
The definitions below will be executed for every view,
con... |
0a12574850aaa84fe678d8073a3a37eb5d0e596d | 2,829 | [
697848022
] | [
"documented",
"ecto"
] | defmodule AuditorActivity.Generic.Project do
use Ecto.Schema
import Ecto.Changeset
alias AuditorActivity.Generic.{ProjectType, User, Equipment, WorkOrder, TeamTemplate}
schema "projects" do
field(:name, :string)
field(:schedule_type, :string)
field(:type, :string)
field(:start_hour, :time)
... |
0a1386bb66c2af8cb557748bd72dadf23d3e73ea | 1,551 | [
442308300,
456011627
] | [
"typespec",
"documented"
] | defmodule SSAuction.Cldr do
@default_locale "en"
@default_timezone "UTC"
@default_format :long
use Cldr,
locales: ["en", "ja"],
default_locale: @default_locale,
providers: [Cldr.Number, Cldr.Calendar, Cldr.DateTime]
@doc """
Formats datatime based on specified options.
## Examples
ie... |
0a13911e148db403e2795ed868ec43acdcbcfd5a | 7,680 | [
537401866
] | [
"typespec",
"documented"
] | defmodule GuildHall.PTODays.PTOBackendGoogleCalendar do
@moduledoc """
The PTODays Google Calendar backend.
"""
alias GuildHall.PTODays.Backend
@behaviour Backend
defp get_and_validate_config!(filters) do
(filters[:config] || get_config_from_application_env())
|> validate_config!()
end
defp ... |
0a13b82215c80b43bf3eab394dc9ec760ec3c6bc | 6,067 | [
149044137
] | [
"typespec"
] | defmodule Broadside.Games.Game do
alias __MODULE__
alias Broadside.Games.Action
alias Broadside.Games.Bullet
alias Broadside.Games.Constants
alias Broadside.Games.Position
alias Broadside.Games.Ship
alias Broadside.Games.UserState
alias Broadside.Id
@fps Constants.get(:fps)
@bullet_speed Constants.... |
0a13cbc7b789ce7cadc7b0c17bc2d3cf828110bb | 3,577 | [
742782212
] | [
"phoenix"
] | defmodule InvoiceAppWeb.Router do
use InvoiceAppWeb, :router
import InvoiceAppWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {InvoiceAppWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_brows... |
0a145790b3c67a0dcdf74cfff45d7f09e498ba0a | 9,683 | [
258629216
] | [
"typespec",
"documented",
"ecto"
] | defmodule Newton.Problem do
@moduledoc """
The Problem context.
"""
import Ecto.Query, warn: false
import Ecto.Query.API, only: [fragment: 1], warn: false
alias Newton.Repo
alias Newton.Problem.Tag
alias __MODULE__
alias Newton.Problem.Question
alias Newton.QuestionPage
def preload_assocs(%Ques... |
0a1457f99289acfcad26cbccb84c9e7969539ec5 | 2,559 | [
350571359
] | [
"test",
"phoenix"
] | defmodule ServersideWeb.CommentControllerTest do
use ServersideWeb.ConnCase
alias Serverside.Comments
alias Serverside.Comments.Comment
@create_attrs %{
body: "some body"
}
@update_attrs %{
body: "some updated body"
}
@invalid_attrs %{body: nil}
def fixture(:comment) do
{:ok, comment} =... |
0a14aa6ede59c93be893ac6715942bf05a70f260 | 1,639 | [
60525944
] | [
"ecto"
] | defmodule CameraActivity do
use EvercamMedia.Web, :model
import Ecto.Changeset
import Ecto.Query
alias EvercamMedia.Repo
@required_fields ~w(camera_id)
@optional_fields ~w(action done_at)
schema "camera_activities" do
belongs_to :camera, Camera
belongs_to :access_token, AccessToken
field :a... |
0a14ea8d769d13d18e90c9669d42cb0200b5ae3b | 1,528 | [
744509236
] | [
"typespec"
] | defmodule EnvTree do
@type c_node :: {:node, atom(), number(), left(), right()}
@type left :: c_node() | nil
@type right :: c_node() | nil
def new do nil end
def add(nil, key, value) do {:node, key, value, nil, nil} end
def add({:node, key, _, left, right}, key, value) do {:node, key, value, left, right}... |
0a1649f303a799b43769c36012085c6e99c4ebe2 | 3,874 | [
948652737
] | [] | defmodule Storybook.Polaris.Card do
use OctantisWeb.Storybook.Story, :component
def imports,
do: [
{OctantisWeb.Components.Polaris.BlockStack, block_stack: 1},
{OctantisWeb.Components.Polaris.Box, box: 1},
{OctantisWeb.Components.Polaris.Divider, divider: 1},
{OctantisWeb.Components.Pol... |
0a1703c2d550cb3cdcde5c78d2a8319f98769c06 | 4,481 | [
957237791
] | [
"typespec",
"liveview",
"documented"
] | defmodule DbkWeb.Components.Overlay do
@moduledoc """
The `DbkWeb.Components.Overlay` module provides a versatile overlay component for
Phoenix LiveView applications, allowing developers to create layered content effects.
It supports various customization options, including color themes, opacity levels,
and b... |
0a171c1d71ba6b829ebfe848d36ce654e85f27b8 | 11,701 | [
232959397
] | [] | %{
"amqp": {:hex, :amqp, "1.5.0", "91572d74e3569fa1bd9bab1ce8b161fe959574a1407a34f8046a0e64f3e83e95", [:mix], [{:amqp_client, "~> 3.8.0", [hex: :amqp_client, repo: "hexpm", optional: false]}], "hexpm", "b569cffcbc6e1c5d26bcb4e39168a9dd986e85b20c633e710d27d19d9a2e33de"},
"amqp_client": {:hex, :amqp_client, "3.8.7", ... |
0a178ab13fb6070623688b8923f05182080ee08f | 2,170 | [
840401112
] | [
"documented",
"ecto"
] | defmodule Shared.ProductInventory do
use Ecto.Schema
import Ecto.Changeset
alias Shared.Repo
require Logger
schema "product_inventories" do
field :quantity_reserved, :integer
field :quantity_onhand, :integer
belongs_to :product, Shared.Product
timestamps()
end
@doc false
def changese... |
0a17cf6749095f2258c49d7c5c734bf210720cd0 | 1,613 | [
130649041
] | [
"macro",
"documented",
"phoenix"
] | defmodule ConsumerWeb 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 ConsumerWeb, :controller
use ConsumerWeb, :view
The definitions below will be executed for every view,
controlle... |
0a17fb78882f29e4df0c31d0ad4a0ee4fe9caf2d | 5,406 | [
192755285
] | [
"test"
] | defmodule MixpanelPlugTest do
use ExUnit.Case
use Plug.Test
describe "call" do
test "assigns 'do not track' flag" do
conn = conn(:get, "/")
conn =
conn
|> put_req_header("dnt", "1")
|> MixpanelPlug.call(%{})
assert %{assigns: %{do_not_track: true}} = conn
end
... |
0a182de89795025e047a0d617ad56672bd627cb7 | 5,320 | [
370375497,
371738743
] | [
"typespec",
"documented",
"ecto"
] | defmodule Waffle.Message do
use Ecto.Schema
alias Ecto.Changeset
import Changeset
@primary_key false
embedded_schema do
field(:operator, Waffle.Message.Types.Operator, null: false)
field(:payload, :map)
field(:reference, :binary_id)
field(:inbound_operator, :string)
... |
0a1833610b2cf2149955bd1eb4e4ac2ffd92a092 | 1,616 | [
913957583
] | [] | alias Octos.Accounts.User
alias Octos.Cameras.Camera
alias Octos.Repo
if Mix.env() != :dev do
exit(:shutdown)
end
previous_log_level = Logger.level()
Logger.configure(level: :info)
parse_opts = [batch_size: :integer]
{opts, _args} = OptionParser.parse!(System.argv(), strict: parse_opts)
batch_size = opts[:batch_si... |
0a1834a0db4f1528ad6f72755dc664fb0d0aed5f | 1,571 | [
792855708
] | [
"phoenix"
] | defmodule Web.AuthController do
use Web, :controller
alias Web.Messages
def register(conn, %{"user" => params}) do
case BusinessLogic.create_user(params) do
{:ok, user} ->
conn
|> put_session(:user, user)
|> put_flash(:info, Messages.user_registration_success())
|> redir... |
0a192fcfb66a2d3de9a0a5d1d77dbe56a6ef3d6c | 3,583 | [
392225877
] | [
"supervisor",
"documented"
] | defmodule Realtime.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
require Logger, warn: false
defmodule JwtSecretError, do: defexception([:message])
defmodule JwtClaimValidatorsError, do: defexception([:message]... |
0a197f792c499a78d86670c95c3d64b03811f599 | 2,150 | [
558924542
] | [
"documented"
] | defmodule Polyn.Migration.Bucket do
# Functions for working with a JetStream KV bucket for keeping track of
# which migrations we've already run
@moduledoc false
alias Jetstream.API.KV
alias Polyn.Connection
@bucket_name "POLYN_MIGRATIONS"
@no_key_found_code 10_037
def create(bucket_name \\ @bucket_n... |
0a19cbcb8fa346abcf8f3b9d13e3f56c8ff46cf5 | 2,215 | [
48802393
] | [] | defmodule Day6 do
def part_one do
input = read_file()
x_max = Enum.max_by(input, &List.first/1) |> List.first
y_max = Enum.max_by(input, &List.last/1) |> List.last
Enum.reduce(0..x_max, %{}, fn x_val, x_acc ->
Enum.reduce(0..y_max, x_acc, fn y_val, y_acc ->
cur_point = [x_va... |
0a19e2b17c077da3e593d17bcbd834f661fdfe99 | 4,155 | [
958231508
] | [
"ecto"
] | defmodule Elixir.Conduit.Sage.Object.Customerrefund do
use Ecto.Schema
import Ecto.Changeset
@field_names "RECORDNO PRBATCHKEY PRBATCH RECORDTYPE FINANCIALENTITY STATE RAWSTATE PAYMENTMETHODKEY PAYMENTMETHOD CUSTOMERKEY CUSTOMERID CUSTOMERNAME ENTITY BILLTOPAYTONAME BILLTOPAYTOKEY RECORDID DOCNUMBER DESCRIPTION ... |
0a1a6ae2e6085c54f345a6f887d2f8e6b24e9de9 | 8,140 | [
771712436
] | [
"documented"
] | defmodule Team do
@moduledoc """
Module contains various modules on various formats of international cricket of BCC
"""
defmodule Odi do
@moduledoc """
Module contains various modules on batters, bowlers, all-rounders in ODI format
"""
defmodule Batters do
@moduledoc """
Contains bat... |
0a1a8ea671f9c838261d296c73132e14282e9c64 | 2,011 | [
381779633
] | [
"test",
"ecto"
] | defmodule AttendenceService.SchoolsTest do
use AttendenceService.DataCase
alias AttendenceService.Schools
describe "schools" do
alias AttendenceService.Schools.School
@valid_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
def school_fixture... |
0a1ad0bf368eb43214670855dc8803a7163daf2e | 2,817 | [
976231330
] | [
"typespec",
"documented"
] | defmodule Orig do
@moduledoc """
This has an embedded module `m:Orig.Orig2`?
"""
import Imported
# import Kernel, except: [or: 2]
defmodule Orig2 do
@moduledoc """
An embedded module
"""
end
@typedoc """
Not really used, but still defined here
"""
@type special_values :: :none | :... |
0a1b55e064aba38429830b07a1971b31948ebb48 | 18,944 | [
884344453,
510809929
] | [
"typespec",
"documented"
] | defmodule Faker.Vehicle.En do
import Faker, only: [sampler: 2]
alias Faker.Util
@moduledoc """
Functions for generating Vehicle related data in English
"""
@makes [
"BMW",
"Audi",
"Toyota",
"Chevrolet",
"Ford",
"Dodge",
"Lincoln",
"Buick",
"Honda",
"Nissan",
"Me... |
0a1b7985bc6cc200eb83b3b8b6701b52b132c024 | 2,106 | [
937889389
] | [
"test"
] | ExUnit.start()
defmodule LeftistMinHeap do
def new(), do: nil
def empty(nil), do: true
def empty(_), do: false
defp rank(nil), do: 0
defp rank({r, _, _, _}), do: r
defp make_node(value, a, b) do
if rank(a) >= rank(b) do
{rank(b) + 1, value, a, b}
else
{rank(a) + 1, value, b, a}
e... |
0a1b871b6047c0c9069aca73d3602593ccce266e | 3,572 | [
328272011
] | [
"macro",
"test"
] | defmodule MixTestInteractive.PortRunnerTest do
use ExUnit.Case, async: true
import ExUnit.CaptureIO
alias MixTestInteractive.Config
alias MixTestInteractive.PortRunner
@unix {:unix, :darwin}
@windows {:win32, :nt}
defp config(overrides \\ []) do
[ansi_enabled?: false]
|> Keyword.merge(override... |
0a1bce19a12abcda9805ce390c50397b461c71d4 | 5,936 | [
184366155
] | [
"test",
"ecto"
] | defmodule GoChampsApi.OrganizationsTest do
use GoChampsApi.DataCase
alias GoChampsApi.Organizations
alias GoChampsApi.Tournaments
describe "organizations" do
alias GoChampsApi.Organizations.Organization
alias GoChampsApi.Tournaments.Tournament
@valid_attrs %{
slug: "some-slug",
name: ... |
0a1bd4298da314d648dd9b820e9c149e680288e0 | 4,704 | [
521076444
] | [
"documented"
] | defmodule MeowNx.Selection do
@moduledoc """
Numerical implementations of common selection operations.
Selection is a genetic operation that picks a number
of individuals out of a population. Oftentimes those
individuals are then used for breeding (crossover).
All of the selection functions require select... |
0a1bd804789ef6efcda5f092d871ddd8e109f038 | 10,104 | [
456307159
] | [] | %{
"bonny": {:hex, :bonny, "0.4.4", "eb9d49973696131ef85ffaf375924f3f56c9d266c393d7cd23252195f8e64ce5", [:make, :mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:k8s, "~> 0.4.0", [hex: :k8s, repo: "hexpm", optional: false]}, {:notion, "~> 0.2", [hex: :notion, repo: "hexpm", optional: false]... |
0a1c1445ef713416c09108432a412c4502638f79 | 6,492 | [
48760938
] | [
"test"
] | defmodule BoxChar.CLITest do
use ExUnit.Case
doctest BoxChar.CLI
alias IO.ANSI
alias BoxChar.CLI
alias CLI.UsageError
alias CLI.ArgVError
import ExUnit.CaptureIO
@usage Application.get_env(:box_char, :usage)
@root_path Application.get_env(:box_char, :root_path)
@usage_errors Applicat... |
0a1c2e020489b19427356debc277f6823fb1d1df | 7,352 | [
23447390
] | [
"test"
] | defmodule ExDateTest do
use ExUnit.Case
import ExDate
@date {{2001,3,10}, {17,16,17}}
test "Basic parser" do
assert {{2008,8,22}, {17,16,17}} ==
parse("22nd of August 2008", @date)
assert {{2008,8,22}, {6,0,0}} ==
parse("22-Aug-2008 6 AM", @date)
assert {{2008,8,22}, {6,35,0}... |
0a1cd1fd325b42bdc72679bdab460e019d985a79 | 1,779 | [
94670820
] | [] | defmodule Orders do
defp orders do
[[ id: 123, ship_to: :NC, net_amount: 100.00 ],
[ id: 124, ship_to: :OK, net_amount: 35.50 ],
[ id: 125, ship_to: :TX, net_amount: 24.00 ],
[ id: 126, ship_to: :TX, net_amount: 44.80 ],
[ id: 127, ship_to: :NC, net_amount: 25.00 ],
[ id: 128, ship_to: :MA... |
0a1d05652c2398fbb06719e638d0e4d910279a0d | 1,777 | [
411443756
] | [
"documented"
] | defmodule Cards do
@moduledoc """
Provides methods for creating and handling a deck of cards
"""
@doc """
Return a list of cards
"""
def create_deck do
values = ["Ace", "Two", "Three", "Four", "Five"]
suits = ["Spades", "Clubs", "Hearts", "Diamonds"]
# cards =
# for value <- values d... |
0a1d443be47f50de88a32dfabfc99550d78cb55c | 20,230 | [
514485705
] | [
"macro",
"test"
] | defmodule NextLS.CompletionsTest do
use ExUnit.Case, async: true
import GenLSP.Test
import NextLS.Support.Utils
@moduletag init_options: %{"experimental" => %{"completions" => %{"enable" => true}}}
defmacrop assert_match({:in, _, [left, right]}) do
quote do
assert Enum.any?(unquote(right), fn x -... |
0a1d6a2d6f5628ba8d2f8088f658c9187386c9cb | 3,743 | [
732545913,
740885881,
521141613,
459699346,
461084124,
673306104,
762541145,
422015308,
521750420,
865067234,
413846949,
553236310,
666326648,
791013482
] | [
"test",
"ecto"
] | defmodule Discuss.DiscussionsTest do
use Discuss.DataCase
alias Discuss.Discussions
describe "topics" do
alias Discuss.Discussions.Topic
import Discuss.DiscussionsFixtures
@invalid_attrs %{title: nil}
test "list_topics/0 returns all topics" do
topic = topic_fixture()
assert Discus... |
0a1dae3a7ffb14bf67365a51d5b84033f50473a6 | 2,434 | [
600231456
] | [
"liveview",
"ecto"
] | defmodule HandleCommerceWeb.ProductLive.FormComponent do
use HandleCommerceWeb, :live_component
alias HandleCommerce.Catalog
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use this form to manage product records in your database.</:subtitle>
... |
0a1dc0aa6931936c7a0a568a3996aa3b69675ef2 | 1,560 | [
636946685
] | [
"documented"
] | defmodule Storyblok do
@moduledoc """
Documentation for `Storyblok`.
"""
alias Storyblok.Operation
alias Storyblok.Client
alias Storyblok.Cache
def request(operation, opts \\ []) do
token = opts[:token] || Application.get_env(:storyblok, :token)
unless token, do: raise(ArgumentError, "Missing t... |
0a1f15005a241b4c79a82f717182d6ef6e0ef97f | 2,092 | [
756827050
] | [] | defmodule AiQuizz.Games.GameQuestions do
alias AiQuizz.Games.GameQuestion
def generate(params) do
%{topic: topic, difficulty: difficulty, nb_questions: nb_questions} = params
{:ok, res} =
OpenAI.chat_completion(
model: "gpt-3.5-turbo-1106",
response_format: %{type: "json_object"},
... |
0a1f49964d95f28d4d72c5fc91a6d0706228639f | 3,624 | [
225235894
] | [
"documented"
] | defmodule Day3.Part2 do
@doc """
Take an instruction and turn it into a coordinate using the first element in the
accumulator as a reference. Also store the step distance to the coordinate.
"""
def segmentify(instruction, accumulator) do
{ x, y, d } = accumulator |> List.first
[ direction | dista... |
0a1f741782a42db13737590f3391fc0f981b7715 | 1,926 | [
744281225,
116826798,
313251367
] | [
"test"
] | defmodule EWallet.UUIDFetcherTest do
use EWallet.DBCase, async: true
import EWalletDB.Factory
alias EWallet.UUIDFetcher
alias EWalletDB.{Account, User}
describe "replace_external_ids/1" do
test "turns multiple external IDs into internal UUIDs" do
user = insert(:user)
account = insert(:account... |
0a1f9f7f4390628e182c25d571a83c2aa54d9e58 | 4,333 | [
160398653
] | [
"documented"
] | defmodule Day7 do
@moduledoc """
Documentation for Day7.
"""
def part_1(input) do
input
|> parse_and_map()
|> sort()
|> execute_instructions()
end
def part_2(input, no_workers \\ 5) do
input
|> parse_and_map()
|> sort()
|> workers_execute_instructions([], 0, no_workers)
en... |
0a1fd5fa6321c3f1a503c62434d4f652a009870a | 2,275 | [
474773815
] | [
"test"
] | defmodule Teller.Sandbox.Generator.TransactionTest do
use ExUnit.Case
alias Teller.Sandbox.Generator.Transaction
describe "generate/1" do
test "ok: creates an transaction" do
txn_id = Transaction.generate_id("seed1")
acct_id = "acc_xxxxx"
assert %{
id: ^txn_id,
... |
0a1ff3a986577c7f71b8d66741bf6f386c7116b9 | 3,671 | [
102262876
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Couchdb.Design do
@moduledoc ~S"""
Couchdb.Design provides macros to declare the mappings of elements of couchdb design documents
inside an `Ecto.Schema`.
It provides the `designs` macro inside of which multiple `design` blocks can exists (one per
design document that needs to be mapped). Each of t... |
0a2005ab26df22ee1a3bf02ab48b812ec6ef9697 | 6,553 | [
271578985
] | [
"typespec",
"macro",
"documented"
] | defmodule Attrition do
@moduledoc """
Attrition provides the ability to display specific data HTML attributes
based on the configuration of your mix environment.
For example, testing and QA can be performed using the `data-qa` or `data-test` attribute,
while these attributes are effectively removed from your... |
0a20397ee95b13ae542064b2f976264ff6cb3010 | 2,080 | [
618485650
] | [
"documented",
"ecto"
] | defmodule TodosApp.Todos do
@moduledoc """
The Todos context.
"""
import Ecto.Query, warn: false
alias TodosApp.Repo
alias TodosApp.Todos.Task
alias TodosApp.Accounts.User
@doc """
Returns the list of tasks.
## Examples
iex> list_tasks()
[%Task{}, ...]
"""
def list_tasks(user ... |
0a206bfd13782bbae4401c2c078f5bcd14dbe768 | 4,056 | [
476843035
] | [
"liveview",
"test"
] | defmodule ArslaneToNarniaWeb.ProjectLiveTest do
use ArslaneToNarniaWeb.ConnCase
import Phoenix.LiveViewTest
import ArslaneToNarnia.ProjectsFixtures
@create_attrs %{description: "some description", picture: "some picture", title: "some title", when: %{day: 17, hour: 14, minute: 26, month: 3, year: 2022}, where... |
0a20df8edc8ed6f5e7a2ba66a4e4baac26860f0d | 7,293 | [
236852798,
792241208,
75767893,
196200304,
567653956,
497769481,
366872029,
575873463,
279715065,
211097139,
125843928,
501627518,
939353141,
482720652,
780334795,
437906643,
569522840,
19643959,
478522297,
180274417,
493863264
] | [
"typespec",
"macro",
"documented"
] | defmodule HashSet do
@moduledoc """
Tuple-based HashSet implementation.
This module is deprecated. Use the `MapSet` module instead.
"""
@moduledoc deprecated: "Use MapSet instead"
@node_bitmap 0b111
@node_shift 3
@node_size 8
@node_template :erlang.make_tuple(@node_size, [])
message = "Use the M... |
0a2171f36b6ae6f4b147cee78c0f1a8f244e6321 | 2,609 | [
395289414
] | [
"documented"
] | defmodule ParseComparison do
@moduledoc """
Comparison benchmark for parse function optimizations
Run with: mix run bench/parse_comparison.exs
"""
def run_comparison do
# Create various test packets
simple_packet = %DNSpacket{
id: 0x1234,
qr: 0,
opcode: 0,
rd: 1,
ques... |
0a21c0c7b003689928d9d3efa73698fb3ee82959 | 7,304 | [
59744094
] | [] | defmodule BotEngine.Responder do
alias BotEngine.FullStackFest
alias BotEngine.Similarity
alias BotEngine.Utils.Sentence
defmodule Query do
defstruct [:intent, :text, :action, :params]
end
@wats [
"Can you rephrase? I'm not sure what you mean.",
"Uhm what's that again?",
"No idea what you ... |
0a23150c70f7dacb7cb7c45afb99102b6e6f8a68 | 5,894 | [
690805471
] | [] | defmodule GameSteps do
def stepMount(params, pid_user) do
user_names = params["path"]
optional_selections = %OptionalSelections{}
seq_match_choices = %MatchChosens{}
html_data = %HtmlData{}
if length(user_names) == 1 do
[game_name | _] = user_names
live_user = %LiveUser{
user... |
0a23373ddd05497b68a02156537883cb1dcf63d4 | 4,944 | [
200961099
] | [
"test"
] | defmodule Sneex.Ops.IncrementTest do
use ExUnit.Case
alias Sneex.Address.{Absolute, CycleCalculator, DirectPage, Indexed, Register, Static}
alias Sneex.{Cpu, Memory}
alias Sneex.Ops.{Increment, Opcode}
setup do
cpu =
<<0x00, 0x00, 0x00, 0x00>>
|> Memory.new()
|> Cpu.new()
|> Cpu.e... |
0a237a0a204ad58613abd212f70e102081f902f9 | 1,512 | [
52017211
] | [
"phoenix"
] | defmodule SpeakEasyApi.LocationController do
use SpeakEasyApi.Web, :controller
alias SpeakEasyApi.Location
plug :scrub_params, "location" when action in [:create, :update]
plug :load_resource, model: Location, only: [:index, :show, :update, :delete]
plug :authorize_resource, model: Location, only: [:create,... |
0a2469acab85c98d804993ecbe716c907edb963e | 1,544 | [
345867748
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
# General application configuration
use Mix.Config
config :codex,
ecto_repos: [Codex.Repo]
# Con... |
0a2493bcda00d4a41b6fa5f218194abf86f40b06 | 5,920 | [
103105109,
103459096,
102010291
] | [
"typespec",
"documented",
"ecto"
] | defmodule Ecto.Embedded do
@moduledoc false
alias __MODULE__
alias Ecto.Changeset
@type t :: %Embedded{cardinality: :one | :many,
on_replace: :raise | :mark_as_invalid | :delete,
field: atom,
owner: atom,
on_cast: nil |... |
0a252173655063f316bf31ec0b2ba50d85f3b7d4 | 2,679 | [
889763095
] | [
"documented"
] | defmodule Bib do
import Bib.Macros
alias Bib.{Bencode, MetaInfo, TorrentServer}
# big stuff to do:
# - [ ] seeding
# - [ ] actual peer choke/unchoke/upload algorithm
# - [ ] tracking of upload/download stats per peer
# - [ ] configurability (connection limits, etc.)
# - [ ] mutliple files in a single t... |
0a2585bdd57940f442d0faf390fa28c542a6dc26 | 10,029 | [
92773474
] | [
"genserver",
"ecto"
] | defmodule Gt.DataSourceWorker do
use GenServer
alias Gt.DataSource
alias Gt.DataSourceRegistry
alias Gt.Repo
use Timex
require Logger
def send_socket(data_source) do
processed = DataSourceRegistry.find(data_source.id, :processed)
total = DataSourceRegistry.find(data_source.id, :total)
Gt.Endp... |
0a2628eb13f7d902bb86778439caff54ef89ea99 | 5,224 | [
850784756
] | [] | defmodule Sudoku.Brain.Board do
defstruct game: %{}, known_count: 0
# def update_known(%Sudoku_Game{} = g)
def new() do
coordinates = all_coordinates()
game =
Enum.reduce(coordinates, %{}, fn coordinates, g ->
Map.put(g, coordinates, Sudoku.Brain.Square.new())
end)
board = %Sud... |
0a26a4379ca51658c08b491b05e8018aed170641 | 2,090 | [
221696173
] | [] | defmodule AwesomeNerves.Led.SevenSeg do
@a_led_pin Application.compile_env(:hello_nerves, :a_led_pin, 26)
@b_led_pin Application.compile_env(:hello_nerves, :b_led_pin, 6)
@c_led_pin Application.compile_env(:hello_nerves, :c_led_pin, 5)
@d_led_pin Application.compile_env(:hello_nerves, :d_led_pin, 16)
@e_led_p... |
0a2775354290514303750370201fb535dd4fee5d | 5,404 | [
296546527
] | [
"typespec",
"documented"
] | defmodule Clickhousex.HTTPClient do
require Logger
alias Clickhousex.Query
alias Clickhousex.Response
@moduledoc false
@req_headers [{"Content-Type", "text/plain"}]
@spec connect(Mint.Types.scheme(), Mint.Types.address(), pos_integer()) ::
{:ok, Mint.HTTP.t()} | {:error, Clickhousex.Error.t()}
... |
0a27af466f7e1582f197a205fd1e262360f7e938 | 16,378 | [
259755939
] | [
"typespec",
"documented"
] | defmodule Elidactyl do
@moduledoc """
API for Pterodactyl panel
"""
alias Elidactyl.Application.Nodes
alias Elidactyl.Application.Servers
alias Elidactyl.Client
alias Elidactyl.Application.Users
alias Elidactyl.Error
alias Elidactyl.Schemas.Node
alias Elidactyl.Schemas.Node.Allocation
alias Elidac... |
0a27c626a521cc5598dd41212329c832c260d8bf | 5,655 | [
738602073
] | [
"typespec",
"documented"
] | defmodule ExPression.Interpreter do
@moduledoc """
Evaluating AST
"""
alias ExPression.StandardLib
# Python boolean sematics
@empty_values [0, [], %{}, ""]
@spec eval(ast :: any(), bindings :: map(), functions_module :: atom()) ::
{:ok, res :: any()} | {:error, any()}
def eval(ast, bindings ... |
0a27fef2abcd58081c54ec4bad074cae33ca9a02 | 5,554 | [
612233696
] | [
"phoenix"
] | defmodule LitcoversWeb.Router do
use LitcoversWeb, :router
import LitcoversWeb.UserAuth
import Phoenix.LiveDashboard.Router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {LitcoversWeb.Layouts, :root}
plug :protect_from_forgery... |
0a28326aa6fe37eb3a79108b82471724357e2895 | 4,390 | [
450577444
] | [
"documented",
"ecto"
] | defmodule Exercise.Countries do
@moduledoc """
The Countries context which implement a set of helper
functions used to interface to the attached database
using the Repo module.
This module also includes the Currencies context as
both contexts are tightly coupled. This context provides
a sim... |
0a284f0a1faa30041c93993396f9931604b0f420 | 1,578 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1betaListEvaluationsResponse do
@moduledoc """
Response message for EvaluationService.ListEvaluations method.
## Attributes
* `evaluations` (*type:* `list(GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1betaEvalua... |
0a28e2d30004db46482491a82b575eb08a315239 | 1,861 | [
328194918
] | [] | defmodule Lemonade.Organizations do
import Ecto.Query, warn: false
alias Lemonade.Repo
alias Lemonade.Accounts
alias Lemonade.Organizations.{Organization, OrganizationMember}
def get_organization_by_organization_member(%OrganizationMember{} = organization_member) do
Repo.one(from Organization, where: [i... |
0a290cc4ff1ac7baaa4fa4a6281883eb7df71415 | 1,554 | [
315477257
] | [
"liveview",
"phoenix"
] | defmodule ExsemanticaWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :exsemantica
# 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: "_e... |
0a291be123fb6184d656e2b861bc3b84199aac4a | 2,572 | [
425955021
] | [
"test",
"liveview"
] | defmodule ALF.TelemetryBroadcasterTest do
use ExUnit.Case, async: false
alias ALF.{Manager, TelemetryBroadcaster}
defmodule SimplePipeline do
use ALF.DSL
@components [
stage(:add_one)
]
def add_one(event, _) do
%{event | number: event.number + 1}
end
end
defmodule Telemetr... |
0a29890274abbed33f28870ade2fcce61c363ad7 | 3,733 | [
1009104879
] | [
"liveview"
] | defmodule InvoiceGeneratorWeb.Password.Validation.Component do
use InvoiceGeneratorWeb, :live_component
@impl true
def render(assigns) do
~H"""
<div>
<Layout.flex flex_direction="col" align_items="start" class="gap-4 border border-red-400">
<Text.text class="my-4">
Password must ... |
0a29d7079e753f60e98e54061a29a65141e87546 | 1,857 | [
212018748
] | [
"documented"
] | defmodule SfdcAuthJwt.Core do
@moduledoc false
def establish_config(config_path, instance_name) do
full_path = config_path
|> Path.expand(__DIR__)
full_path <> "/config/#{instance_name}_config.json"
|> File.read!
|> Poison.decode!
|> Map.put("full_path", full_path)
|> get_s... |
0a2a632037933c4653b3a2260e6d9b58055777b3 | 2,979 | [
39093815
] | [
"documented"
] | defmodule Ecto.Adapters.Poolboy do
@moduledoc """
Start a pool of connections using `poolboy`.
### Options
* `:size` - The number of connections to keep in the pool (default: 10)
* `:lazy` - When true, connections to the repo are lazily started (default: true)
* `:max_overflow` - The maximum overflo... |
0a2b0d1f9c4c31f1eb65b2c100efc5778397d2da | 2,187 | [
253283791
] | [
"phoenix",
"ecto"
] | defmodule FoodGeekWeb.My.RecipeController do
use FoodGeekWeb, :controller
alias FoodGeek.Cookbook
alias FoodGeek.Cookbook.Recipe
def index(conn, _params, current_user) do
recipes = Cookbook.list_chef_recipes(current_user)
render(conn, "index.html", recipes: recipes)
end
def new(conn, _params, _cu... |
0a2b8537c70e176041c9214c17acf09dfff86ead | 23,617 | [
367278931
] | [
"documented"
] | defmodule Google.Cloud.Discoveryengine.V1.AnswerQueryRequest.SafetySpec.SafetySetting.HarmBlockThreshold do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :HARM_BLOCK_THRESHOLD_UNSPECIFIED, 0
field :BLOCK_LOW_AND_ABOVE, 1
field :BLOCK_MEDIUM_AND_ABOVE, ... |
0a2bacbc74a10290e7e32257a57a003772f8b67c | 4,824 | [
976808468
] | [
"test"
] | ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter])
{:ok, _} = Application.ensure_all_started(:ex_machina)
ExUnit.start(timeout: :infinity)
Ecto.Adapters.SQL.Sandbox.mode(Basenji.Repo, :manual)
defmodule TestHelper do
def get_tmp_dir, do: Path.join(System.tmp_dir!(), "basenji")
def drain_queue(que... |
0a2bb1e29da792226dc1789fa09693d5b78f24e6 | 24,744 | [
79471584
] | [
"typespec",
"documented"
] | defmodule Keyword do
@moduledoc """
A set of functions for working with keywords.
A keyword is a list of two-element tuples where the first
element of the tuple is an atom and the second element
can be any value.
A keyword may have duplicated keys so it is not strictly
a key-value store. However most of... |
0a2bc20fadcd051797f4882c02adc3a974af7965 | 1,779 | [
463909124
] | [] | defmodule Exmatch.MixProject do
use Mix.Project
def project do
check_version!(
app: :exmatch,
description: description(),
version: "0.17.0",
elixir: "~> 1.12",
elixirc_options: [warnings_as_errors: true],
elixirc_paths: ["lib"] ++ if(Mix.env() in [:test], do: ["test/support"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.