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 |
|---|---|---|---|---|
05b3ec183bbdf27725e4d7cb356a06d3046f2f53 | 5,361 | [
419435907,
376959663
] | [
"test",
"phoenix"
] | defmodule OliWeb.DeploymentControllerTest do
use OliWeb.ConnCase
alias Oli.Repo
alias Oli.Accounts.SystemRole
alias Oli.Accounts.Author
alias Oli.Institutions
@create_attrs %{deployment_id: "some deployment_id", registration_id: 1}
@update_attrs %{deployment_id: "some updated deployment_id"}
@invalid_... |
05b3facdfa84d6c41c48b3f5cf1eef2d68694138 | 3,253 | [
10395784,
248113444
] | [
"test"
] | defmodule Poxa.EventHandlerTest do
use ExUnit.Case
alias Poxa.PusherEvent
alias Poxa.Authentication
alias Poxa.Event
use Mimic
import Poxa.EventHandler
setup do
stub(:cowboy_req)
stub(Jason)
stub(PusherEvent)
:ok
end
describe "malformed_request/2" do
test "valid data" do
ev... |
05b40e1acb340958cd75be04601b92a1a97522bd | 9,349 | [
628025157
] | [
"typespec",
"documented"
] | defmodule ExTournaments.Utils.PairingHelpers do
@moduledoc """
Collection of helpers to use in pairings algorithms
"""
require Integer
alias ExTournaments.Match
@doc """
Takes list of players IDs and according to the passed flag it will shuffle it.
"""
@spec prepare_players_list(list(integer()), boo... |
05b46da898b6e9dfecb0033413f53d9c7099c5e6 | 1,937 | [
103798463
] | [] | defmodule Vex.Message.Error do
@error_bad_req_id 0x01
@error_bad_topic 0x02
@error_bad_subtopic 0x03
@error_sub_max 0x04
alias __MODULE__, as: Error
def decode(%Vex.Frame.DATA{ req_id: req_id, topic: topic, subtopic: subtopic, flag: flag = %{ error: true }, ticks: ticks, value: << value >> }) do
with... |
05b48766a2f7bf50b1e04372397667a831dfcde2 | 4,389 | [
602352536
] | [
"genserver",
"documented"
] | defmodule Cosmos.Entity.Server do
@moduledoc """
Uses the transient restart option so that this server/worker
will be restarted when there is an abnormal exit reason.
This way we can retire servers when we don't need to update
an entity or that entity has faded from existence.
"""
use GenServer, restart: ... |
05b4f792f45da62479671df06b4b419794de1a91 | 2,160 | [
234687498
] | [
"genserver",
"documented"
] | defmodule Layton.System.LobbyServer do
@moduledoc """
Server that keeps track on list of lobbies (including on-going ones.)
"""
use GenServer
alias __MODULE__
defstruct lobby_map: %{}
#
# Client Functions
#
def create_lobby(player_info, lobby) do
GenServer.call(__MODULE__, {:create_lobby, pla... |
05b58b4639cb8c2af7869522f4f78c03c924b090 | 1,542 | [
158877773,
161405636
] | [
"documented"
] | defmodule SB.Block do
@moduledoc false
require Logger
# Setting target nBits to 4, can be configured to other values
defstruct block_header: %SB.BlockHeader{},
timestamp: :os.system_time(:millisecond),
target: 4,
tx: [],
block_id: 0,
prev_block: nil
... |
05b5c4af6e16bf923e7d71c09857e6218e390121 | 3,809 | [
831995252
] | [
"test"
] | defmodule ColouredFlow.Definition.ColourSet.ValueTest do
use ExUnit.Case, async: true
doctest ColouredFlow.Definition.ColourSet.Value, import: true
alias ColouredFlow.Definition.ColourSet.Value
describe "valid?/1" do
test "works" do
assert Value.valid?(1)
assert Value.valid?(1.0)
assert ... |
05b5d8e17d577c58fd09a4e343f45fc31a577dff | 4,796 | [
162384511
] | [
"test"
] | defmodule ProviderLinkWeb.Api.V1.SessionControllerTest do
use ProviderLinkWeb.ConnCase
# use ProviderLinkWeb.SchemaCase
import ProviderLinkWeb.TestHelper
alias ProviderLinkWeb.Api.V1.ErrorView
alias Data.Schemas.{
User,
Provider,
Agent
}
setup do
conn = build_conn()
params = %{
... |
05b72039dc312e809ca8bf8e3edff81b75017257 | 2,595 | [
729196048
] | [] | # Advent of Code 2023 Day 7 - Camel Cards
# https://adventofcode.com/2023/day/7
defmodule Aoc2023.Day7 do
@dir "input/2023/"
@card_priority_q1 %{"A" => 14, "K" => 13, "Q" => 12, "J" => 11, "T" => 10}
@card_priority_q2 %{"A" => 14, "K" => 13, "Q" => 12, "J" => 1, "T" => 10}
def q1(file_name \\ "day7.txt") do
... |
05b7cbb8164f68c8a7738947f81503dee7874963 | 5,064 | [
96084324
] | [
"documented"
] | defmodule VendingMachine do
defmodule Prefix do
@moduledoc """
1.1.1 Prefix
"""
@doc """
A simple vending machine which consumes one coin before breaking.
"""
def x1 do
receive do
{:coin, cust} ->
send(cust, :stop)
exit(:stop)
end
end
@doc... |
05b88b5380af90fc4d2f7bc98adf51b57570cd13 | 5,432 | [
559744925,
815757756,
43247111,
995397072,
1008054178,
884066936,
1018310553,
951535898
] | [
"documented"
] | defmodule Credo.CLI.Command.Diff.DiffSummary do
@moduledoc false
# This module is responsible for printing the summary at the end of the analysis.
@category_wording [
{:consistency, "consistency issue", "consistency issues"},
{:warning, "warning", "warnings"},
{:refactor, "refactoring opportunity", ... |
05b8e4cd893dba47e35e7f908396a4b0e6b0d627 | 8,559 | [
669180629
] | [
"liveview"
] | defmodule SpeedswappWeb.UserSettingsLive do
alias Speedswapp.Uploader
use SpeedswappWeb, :live_view
alias Speedswapp.Accounts
def render(%{loading: true} = assigns) do
~H"""
Loading Speedswapp...
"""
end
def render(%{loading: false} = assigns) do
~H"""
<div class="mb-20 max-w-full">
... |
05b9004a763fbbf7a22c6589db3b97db63815ac7 | 3,667 | [
85784773
] | [
"ecto"
] | defmodule Multas.Helpers.AI do
require Logger
alias Multas.{Repo}
@regex_plate_ABC1234 ~r/\b([A-Z])\W*([A-Z])\W*([A-Z])\W*(\d)\W*(\d)\W*(\d)\W*(\d)\W*\b/
@regex_plate_ABC123 ~r/\b([A-Z])\W*([A-Z])\W*([A-Z])\W*(\d)\W*(\d)\W*(\d)\W*\b/
@regex_plate_B123456 ~r/\b(B)\W*(\d)\W*(\d)\W*(\d)\W*(\d)\W*(\d)\W*(\d... |
05b9156b251f4cfef036d4ab6c35a3cbc7099827 | 2,130 | [
819144358
] | [
"documented"
] | defmodule SybanPnx.EventosFixtures do
@moduledoc """
This module defines test helpers for creating
entities via the `SybanPnx.Eventos` context.
"""
@doc """
Generate a evento.
"""
def evento_fixture(attrs \\ %{}) do
{:ok, evento} =
attrs
|> Enum.into(%{
memRamUsada: "some memRam... |
05b921fe175e8034c7da8d542f43f08d0d4a8cdc | 2,348 | [
263446289
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule TaskManagerWeb 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 TaskManagerWeb, :controller
use TaskManagerWeb, :view
The definitions below will be executed for every view,
... |
05b92deedd9447a499a32c213b523077343b5e9d | 3,968 | [
269962761
] | [
"test",
"liveview"
] | defmodule EventDashboard.SocketsLiveTest do
use ExUnit.Case, async: false
import Phoenix.ConnTest
import Phoenix.LiveViewTest
@endpoint EventDashboardTest.Endpoint
test "search" do
%{formatted_address: first_address, port: first_socket_port} = open_socket()
%{formatted_address: second_address} = ope... |
05b98291747f96e0daebad8a48b085834305efae | 3,154 | [
50469288
] | [] | # 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:
#
# KaifaLi.Repo.insert!(%SomeModel{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if ... |
05bb23ef58f5d663220eb0fe4ce18a075a169d7f | 1,758 | [
50867882
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule TodoPhoenix_2.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use TodoPhoenix_2.Web, :controller
use TodoPhoenix_2.Web, :view
The definitions below will be executed for every view,
controller, etc... |
05bcc89b72284bf9ab188f592b76103459b506b0 | 2,563 | [
612062134
] | [
"test",
"ecto"
] | defmodule Thamani.DevicesTest do
use Thamani.DataCase
alias Thamani.Devices
describe "device" do
alias Thamani.Devices.Device
@valid_attrs %{
active: "some active",
description: "some description",
imei: "some imei",
name: "some name"
}
@update_attrs %{
active: "so... |
05bce71484bd92fc8d772a8f7ec3163dcf3e5376 | 9,471 | [
927234821
] | [
"liveview"
] | defmodule LivebookWeb.SessionLive.InsertButtonsComponent do
use LivebookWeb, :live_component
import LivebookWeb.NotebookComponents
defguardp is_many(list) when tl(list) != []
def render(assigns) do
~H"""
<div
class="relative top-0.5 m-0 flex justify-center"
role="toolbar"
aria-label... |
05bd17225d472fac203d8e8b80901b1e3b37a26e | 2,304 | [
966100517
] | [
"documented",
"ecto"
] | defmodule CommerceFront.Settings.Sale do
use Ecto.Schema
import Ecto.Changeset
import EctoEnum
defenum(
StatusEnum,
~w(
processing
pending_confirmation
preparing
pending_delivery
already_pickup
pending_payment
paid
complete
sent
refund
c... |
05bd3276f07a6c63bd629cf02a7a58383aa15f25 | 2,626 | [
275466745,
657799110,
43247111,
679652486,
343276976
] | [
"test",
"documented"
] | defmodule Credo.Check.Design.TagHelperTest do
use Credo.Test.Case
alias Credo.Check.Design.TagHelper
test "it should NOT report expected code" do
tags =
"""
defmodule CredoSampleModule do
use ExUnit.Case
def some_fun do
assert x == x + 2
end
end
"""... |
05bd8cc991ee6876ef42b9812799efe85f3da357 | 2,244 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Analytics.V3.Model.GaDataQuery do
@moduledoc """
Analytics data request query parameters.
## Attributes
* `dimensions` (*type:* `String.t`, *default:* `nil`) - List of analytics dimensions.
* `end-date` (*type:* `String.t`, *default:* `nil`) - End date.
* `filters` (*type:* `Stri... |
05bdb47625d06ae2f7def7de905565079da03c88 | 6,994 | [
582985463
] | [
"phoenix",
"documented"
] | defmodule ApiWeb.UserAuth do
import Plug.Conn
import Phoenix.Controller
alias Api.Accounts
alias Api.Accounts.User
alias ApiWeb.Router.Helpers, as: Routes
@pubsub_topic "user_updates"
# Make the remember me cookie valid for 60 days.
# If you want bump or reduce this value, also change
# the token e... |
05bdb92662aa3376a2d75caffd91613463e652dc | 9,772 | [
429229122
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hex... |
05bdfcf4471f49df1ae3d438f094949f5807de21 | 2,126 | [
665512526
] | [
"documented"
] | defmodule ElixirExtensions.Core.StringExt do
@moduledoc """
Functions to string truncate
"""
@doc """
Returns `string` as a slug or `nil` if it failed.
## Options
* `:separator` - Replace whitespaces with this string. Leading, trailing or
repeated whitespaces are trimmed. Defaults to `-`.
* `... |
05be4a1f9c4a5217fdd684eae6a6b4a7c7983639 | 2,539 | [
580019114
] | [
"liveview"
] | defmodule KidsMathWeb.HomeLive do
use KidsMathWeb, :live_view
require Logger
import KidsMathWeb.Components.{Question, Answer}
@max_addend 9
@max_answer @max_addend + @max_addend
@impl true
def mount(_params, _session, socket) do
{
:ok,
socket
|> create_addends()
|> add_empt... |
05be892b46c0e3778aaef0468dd2cd5f237d7cbe | 2,903 | [
104015562
] | [
"test"
] | defmodule EventsToolsWeb.Hall_Room_PlanControllerTest do
use EventsToolsWeb.ConnCase
alias EventsTools.Venues
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
def fixture(:hall__room__plan) do
{:ok, hall__room__plan} = Venues.create_hall__room_... |
05bee953497455a8d77d922bae9ba7bae8cb3541 | 2,055 | [
373999572
] | [
"documented"
] | defmodule Noizu.DomainObject.CacheHandler do
@moduledoc """
CacheHandler Behaviour
========
The CacheHandler Behavior defines how to check, update and clear cached DomainObject values to a specific cache mechanisms.
The DomainObject.Repo uses a module providing this behavior to implement it's `cache/... |
05befee5acd5b08cee23140c177d38c8f2155bee | 1,731 | [
393323303
] | [] | defmodule Jsonrpc.MixProject do
use Mix.Project
@version "0.2.0"
@repo_url "https://github.com/redmaner/finch_jsonrpc"
def project do
[
app: :jsonrpc,
version: @version,
elixir: "~> 1.10",
description: "An HTTP JSON-RPC 2.0 client focused on performance, built on Finch.",
eli... |
05bf0b5847c471156bbd0b7b6dc5eef05ba8bf3c | 2,321 | [
314886001
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule FreexitWeb 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 FreexitWeb, :controller
use FreexitWeb, :view
The definitions below will be executed for every view,
controller, ... |
05bf54ed8a754fe36500c27d609bd7b7257f8161 | 6,029 | [
104968072
] | [] | require IEx;
require Logger;
defmodule CncfDashboardApi.YmlReader.GitlabCi do
use Retry
def get do
Application.ensure_all_started :inets
retry with: exp_backoff |> randomize |> cap(1_000) |> expiry(8_000), rescue_only: [MatchError] do
{:ok, resp} = :httpc.request(:get, {System.get_env("GITLAB_CI_YML") |... |
05c066687c5fc621d9231b7c0f685eb4e33222cb | 3,776 | [
971618269,
880459008
] | [
"test",
"phoenix"
] | defmodule OcularWeb.PlayerResetPasswordControllerTest do
use OcularWeb.ConnCase, async: true
alias Ocular.Accounts
alias Ocular.Repo
import Ocular.AccountsFixtures
setup do
%{player: player_fixture()}
end
describe "GET /players/reset_password" do
test "renders the reset password page", %{conn: ... |
05c085e68a039dbdbcd10f79d6f1e871efeae6fa | 3,783 | [
979643501
] | [
"genserver"
] | defmodule A2aAgentWeb.Agents.ProtocolAgent do
use GenServer
alias A2aAgentWebWeb.EventBus
require Logger
def start_link(_opts) do
GenServer.start_link(__MODULE__, :ok, name: __MODULE__)
end
@impl true
def init(:ok) do
subject = "ctaas.v1.protocol.draft.request"
Logger.info("[ProtocolAgent] I... |
05c0a0b4f39e02f36a7980b1bef12f932cfe5143 | 1,973 | [
650698680
] | [
"documented",
"ecto"
] | defmodule Core.Repo.Migrations.CreateCMRSubscriptionRules do
@moduledoc false
use Ecto.Migration
def change do
create table(:subscription_cmr_rules) do
add :package_id, :string
add :package_name, :string
add :package_monthly_price, :float
add :package_annual_price, :float
add :p... |
05c0b8c0eaa2cd4911ee2cd8825350bb96b6315a | 1,921 | [
948227802
] | [] | defmodule Counter.MixProject do
use Mix.Project
def project do
[
app: :counter,
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 OT... |
05c0db350f5ef9b4ae3b1377ca578ef41b925bc4 | 1,572 | [
291319263
] | [
"genserver"
] |
defmodule Sneakers23.Inventory.Server do
use GenServer
alias Sneakers23.Inventory.{Inventory, ItemAvailability}
def start_link(opts) do
name = Keyword.fetch!(opts, :name)
GenServer.start_link(__MODULE__, opts, name: name)
end
def get_inventory(pid) do
GenServer.call(pid, :get_inventory)
end
... |
05c10a4237e5b7dfb6c19cff521f0773e8d314c9 | 4,572 | [
114442646
] | [
"test"
] | defmodule Ticker.Quote.Processor.HTTP.Test do
use ExUnit.Case, async: false
import Mock
@good_body_200 {:ok, [%Ticker.Quote{symbol: "GOOG", marketPercent: 0.03406, bidSize: 0,
bidPrice: 0, askSize: 200, askPrice: 983.98, volume: 27292,
... |
05c15258e93e27bb48d5092169947ca025685afb | 1,606 | [
171747751
] | [
"documented"
] | defmodule Cards do
@moduledoc """
Provides functions for creating & handling a deck of cards
"""
@doc """
Returns a list of strings representing a list of playing cards
"""
def create_deck do
values = ["Ace", "Two", "Three","Four", "Five", "Six","Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "Kin... |
05c16726a4090c8e5cbf41fcb9b78a0942de4ed8 | 2,073 | [
649778617
] | [
"documented",
"ecto"
] | defmodule FoodTruckCSV do
@moduledoc """
Schema for mobile food facility permits.
"""
use Csv.Schema, separator: ?,
import Csv.Schema.Parser
@derive {Jason.Encoder,
only: [
:location_id,
:applicant,
:facility_type,
:location_desc,
... |
05c1c78128463cbbcf33189d0fcc97b688ef5dab | 3,215 | [
591814328
] | [
"liveview",
"test"
] | defmodule PsWeb.LinkLiveTest do
use PsWeb.ConnCase
import Phoenix.LiveViewTest
import Ps.LinksFixtures
@create_attrs %{click_count: 42, href: "some href", name: "some name"}
@update_attrs %{click_count: 43, href: "some updated href", name: "some updated name"}
@invalid_attrs %{click_count: nil, href: nil,... |
05c26d36d307f7a55f3e81435440dff852bc200c | 9,504 | [
130087996
] | [
"typespec",
"documented"
] | defmodule Kryptonite.AES do
alias Kryptonite.Random
@moduledoc """
This module allows to easily perform AES related operations, such as generating
keys, encrypting and decripting.
## Examples
A successful flow of key / iv generation, encryption and decryption can be
illustrated such as:
iex> {ke... |
05c27f715da70fd01cc9b0fa98cb2b1d9751b720 | 4,143 | [
91991086
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
"certifi": {:hex, :certifi, "2.3.1", "d0f424232390bf47d82da8478022301c561cf6445b5b5fb6a84d49a9e76d2639", [:rebar3], [{:parse_trans, "3.2.0", [hex: :parse_trans, repo: "hexpm", optional: false]... |
05c2d051d4f2dd7be5a7218de6b8520c3c95cd69 | 4,050 | [
491172215
] | [
"documented",
"ecto"
] | defmodule Mazaryn.Schema.Post do
@moduledoc """
Embedded schema to represent Mazaryn.Schema.Post
"""
use Ecto.Schema
alias Timex
import Ecto.Changeset
alias Mazaryn.Schema.Comment
alias Account.Users
alias Core.PostClient
@optional_fields ~w(
id
ai_post_id
user_id
business_id
m... |
05c335a72c0212b8bb4efd4f7daa5b523e492c75 | 1,740 | [
226701232
] | [
"macro",
"documented"
] | defmodule Chunky.CacheAgent do
@moduledoc """
The CacheAgent is a dead simple wrapper of an atom named Agent around a Map.
Start an agent for a particular function cache within the current BEAM instance with:
```elixir
iex> CacheAgent.start_link(:function_name)
```
Check for values with `has?/2`:
``... |
05c335d46478e5131f613a1b3bbf9385c96633fa | 2,115 | [
91023384
] | [
"test"
] | defmodule Keryx.Web.AdminControllerTest do
use Keryx.Web.ConnCase
alias Keryx.Staff
alias Keryx.Staff.Admin
@create_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
def fixture(:admin) do
{:ok, admin} = Staff.create_admin(@create_attrs)
admin
e... |
05c3ab07ecd26256aa7d0ec5da10779946f1f11e | 2,758 | [
95393380
] | [
"test"
] | defmodule TheBestory.API.TopicControllerTest do
use TheBestory.API.ConnCase
alias TheBestory.Schema.Topic
@create_attrs %{description: "some description", icon: "some icon", is_active: true, slug: "some slug", posts_count: 42, title: "some title"}
@update_attrs %{description: "some updated description", icon:... |
05c40ac525a1ad2c946cf45a8928c8e9db5c2b6d | 2,234 | [
112897995
] | [
"supervisor",
"documented"
] | defmodule Day8 do
@moduledoc """
--- Day 8: I Heard You Like Registers ---
https://adventofcode.com/2017/day/8
"""
use Application
defmodule Instruction, do: defstruct register: nil, mutation: nil, condition: nil
defmodule Condition, do: defstruct register: nil, comparison: nil, value: nil
defp mut_o... |
05c46f27b3da7e146d6c683fc73a0b4f6e5de671 | 1,642 | [
169990120
] | [
"macro",
"documented",
"phoenix"
] | defmodule Web2bookWeb 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 Web2bookWeb, :controller
use Web2bookWeb, :view
The definitions below will be executed for every view,
controlle... |
05c49e60c7b81cd121ccdea6e5e7ba7410096d8b | 7,222 | [
123950289,
128071537,
117378187,
136527959,
123640456,
118097475,
128722197,
217440284,
224061120,
117024338,
128142024,
128466115,
137103031,
117171030
] | [
"typespec",
"documented"
] | defmodule Mix.Tasks.Compile.ElixirMake do
use Mix.Task
@recursive true
@moduledoc """
Runs `make` in the current project.
This task runs `make` in the current project; any output coming from `make` is
printed in real-time on stdout.
## Configuration
This compiler can be configured through the retur... |
05c5177163b9c875dd4cb5ef22262c0787165403 | 7,114 | [
608463495
] | [] | %{
"certifi": {:hex, :certifi, "2.10.0", "a4ab316320bfca83bd0b57fd022d091555d42a30eefabb38063887158294773a", [:rebar3], [], "hexpm", "e87a9dd6e7fe9c5804887850d4cdbcd83db4da7a27f928174f11e4e06fb7902e"},
"chacha20": {:hex, :chacha20, "1.0.4", "0359d8f9a32269271044c1b471d5cf69660c362a7c61a98f73a05ef0b5d9eb9e", [:mix],... |
05c542925b28ef021061526fcbed16d1cc03ff4d | 2,167 | [
88607489
] | [
"documented"
] | defmodule Igc.TrackPoint.Parser do
@moduledoc false
alias Igc.TrackPoint
# Parses an IGC B-Record. For details, see
# http://carrier.csi.cam.ac.uk/forsterlewis/soaring/igc_file_format/
def parse(data) do
with << "B",
hour::bytes-size(2),
minute::bytes-size(2),
second:... |
05c5c7eaa56571c7acbd0771b0cf7eb37e42d5a6 | 3,254 | [
225127760
] | [
"test"
] | defmodule ComputerTest do
use ExUnit.Case
test "instruction with opcode add", do: assert(Instruction.opcode([1]) == :add)
test "instruction with opcode multiply", do: assert(Instruction.opcode([2]) == :multiply)
test "instruction with opcode halt", do: assert(Instruction.opcode([9, 9]) == :halt)
test "instr... |
05c5d90165af4cca8da24b4530b4d95a7c7aefd0 | 1,793 | [
104813427
] | [
"phoenix",
"ecto"
] | defmodule MicroblogWeb.TagpostController do
use MicroblogWeb, :controller
alias Microblog.Blog
alias Microblog.Blog.Tagpost
def index(conn, _params) do
tagposts = Blog.list_tagposts()
render(conn, "index.html", tagposts: tagposts)
end
def new(conn, _params) do
changeset = Blog.change_tagpost(... |
05c5efd6f8112bff1cb3e6d0859b12058f36078f | 5,456 | [
324642972
] | [
"typespec",
"documented"
] | defmodule Mazes.Grid do
@moduledoc """
A struct representing a maze grid, with functions to operate on it.
Fields:
* rows: the number of rows in the grid
* columns: the number of columns in the grid
* cells: a list of `{row, column}` tuples representing the cells in the
grid
* links: a map... |
05c6263179908a3e494a5a21769c4184284bab87 | 6,389 | [
904399333
] | [
"test",
"documented"
] | # credo:disable-for-this-file Credo.Check.Readability.LargeNumbers
# credo:disable-for-this-file Credo.Check.Readability.StringSigils
defmodule JSV.Generated.Draft7.BinaryKeys.PropertyNamesTest do
alias JSV.Test.JsonSchemaSuite
use ExUnit.Case, async: true
@moduledoc """
Test generated from deps/json_schema_t... |
05c64fa64340458eb89dc2725bed533424b7afd7 | 1,630 | [
220269085
] | [
"macro",
"documented",
"phoenix"
] | defmodule QuizzerWeb 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 QuizzerWeb, :controller
use QuizzerWeb, :view
The definitions below will be executed for every view,
controller, ... |
05c6c38853f997b26db9b6216f082985f7274b6d | 4,194 | [
845568614
] | [
"liveview"
] | defmodule AppWeb.CalendarComponent do
use AppWeb, :live_component
@impl true
def render(assigns) do
~H"""
<div class="relative">
<.action class="-left-1.5" target={@myself} click="previous-month">←</.action>
<.action class="-right-1.5" target={@myself} click="next-month">→</.action>... |
05c70c10e41c8e6ada54c19e21b2112bac9787a1 | 2,048 | [
897103635
] | [] | defmodule AdventOfCode.Solution.Year2024.Day19 do
def part1(input) do
# init_cache()
spec = parse(input)
# Enum.count(spec.patterns, fn pattern -> ways_to_arrange(pattern, spec.towels) > 0 end)
spec.patterns
|> run(spec.towels)
|> Enum.count(&(&1 > 0))
end
def part2(input) do
# ini... |
05c75702fe8fab7fade8d8e2f49087e85ad32c41 | 3,231 | [
646929800
] | [
"genserver",
"liveview",
"documented"
] | defmodule TcWeb.HomeLive do
use TcWeb, :live_view
alias TcWeb.HomeLive
alias Tc.Network
alias TcWeb.Endpoint
alias Phoenix.PubSub
alias Tc.Activity
import TcWeb.HomeLive.Component
@moduledoc """
The home page one accesses when logged in.
"""
def render(assigns) do
~H"""
<div class="fle... |
05c7e075f7c38711c0d44fd744e07eb137f92d3a | 5,568 | [
150831204
] | [
"test"
] | defmodule PVAData.DataTest do
use ExUnit.Case, async: true
alias PVAData.{
Data,
Division,
Team,
Match
}
setup do
%{server: start_supervised!(Data)}
end
describe "update_divisions/2" do
test "replaces existing divisions with list of divisions given", %{server: server} do
old... |
05c8afbe4d7ec422cae0606d7557ce103857add2 | 4,536 | [
753856770
] | [
"documented"
] | defmodule EctoFoundationDB.Layer.PrimaryKVCodec.StreamDecoder do
@moduledoc false
alias EctoFoundationDB.Layer.DecodedKV
alias EctoFoundationDB.Layer.InternalMetadata
alias EctoFoundationDB.Layer.Pack
alias EctoFoundationDB.Layer.PrimaryKVCodec
alias EctoFoundationDB.Tenant
alias EctoFoundationDB.Versions... |
05ca1b295c8b8defa28ef87f2ecdb71d504d2b35 | 2,344 | [
312058739
] | [
"typespec"
] | defmodule COSE.Messages.Encrypt do
defstruct [:phdr, :uhdr, :ciphertext, :recipients, :payload, :aad]
@spec build(binary, map, map) :: map
def build(payload, recipient \\ %{}, phdr \\ %{}, uhdr \\ %{}) do
%__MODULE__{
phdr: phdr,
uhdr: uhdr,
payload: payload,
aad: COSE.tag_as_byte(<<>... |
05cac40f72d0c9adafc57a020202e6a62bc90a6b | 4,566 | [
170266716
] | [
"test"
] | defmodule PropertyTest do
use ExUnit.Case
use ExUnitProperties
require ExUnitProperties
@string_like [:string, :binary]
@int_like [:byte, :i8, :i16, :i32, :i64]
@bool_like [:bool]
@float_like [:double]
@id_like [:id, :Id, :iD, :ID]
@scalars @string_like ++ @int_like ++ @float_like ++ @bool_like
@re... |
05caed5b6ce07f9d28492fe4f5a9a668ca7e60af | 1,532 | [
37175029,
41246370,
36728941
] | [] | defmodule Phoenix.Mixfile do
use Mix.Project
@version "0.13.1"
def project do
[app: :phoenix,
version: @version,
elixir: "~> 1.0.2 or ~> 1.1-dev",
deps: deps,
package: package,
docs: [source_ref: "v#{@version}", main: "overview"],
name: "Phoenix",
source_url: "https://gith... |
05cba9416153bb046766c66678655c5c25e4f05c | 4,187 | [
896993983
] | [
"typespec"
] | defmodule Aoc.Y2024.Day6.Cell do
defstruct visited: [], content: :free, guard_dir: :none
@type content_type :: :free | :obstructed
@type guard_dir :: :none | :north | :east | :south | :west
@type t :: %__MODULE__{
visited: [guard_dir()],
content: content_type(),
guard_dir: guard_... |
05cc43afaed66e3a0c45708745926bd170b63bda | 4,066 | [
164786032
] | [] | %{
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"},
"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: fal... |
05cc573f7df23d2ee2b35baf32f1f500b1479337 | 2,824 | [
973283649
] | [] | import Config
# Configure your database
config :image_tag, ImageTag.Repo,
username: System.get_env("POSTGRES_USER"),
password: System.get_env("POSTGRES_PASSWORD"),
hostname: System.get_env("POSTGRES_HOST"),
database: "image_tag_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_s... |
05ccd35ed7b4f95d4a2c26411e90885f5ed2f19a | 9,294 | [
904841321
] | [
"documented"
] | defmodule Jido.AI.Provider.Anthropic do
@moduledoc """
Adapter for the Anthropic AI provider.
Implements the ProviderBehavior for Anthropic's specific API.
"""
@behaviour Jido.AI.Model.Provider.Adapter
alias Jido.AI.Provider
alias Jido.AI.Provider.Helpers
alias Jido.AI.Model
@base_url "https://api.a... |
05cd2e47e2b635e5af991348bbef45cfc875ff38 | 1,893 | [
607729034,
803809623
] | [
"test"
] | defmodule Operately.Data.Change015CreateCompaniesAccessGroupTest do
use Operately.DataCase
alias Operately.Access
alias Operately.Access.Binding
alias Operately.People.Person
alias Operately.Companies.Company
test "creates access groups, bindings and memberships" do
companies = Enum.map(1..3, fn _ ->
... |
05cd5190b056da05aa37e7235d55a3c244d9c380 | 2,781 | [
221833499
] | [
"test"
] | defmodule JfWeb.CartControllerTest do
use JfWeb.ConnCase
alias Jf.Vendas
@create_attrs %{id_produto: 42, nome_produto: "some nome_produto", preco_unitario: "120.5", quantidade: 42, total: "120.5"}
@update_attrs %{id_produto: 43, nome_produto: "some updated nome_produto", preco_unitario: "456.7", quantidade: 4... |
05cd742831c1b5a4689bf5fa2dbf542e9c588c2b | 1,708 | [
343815590
] | [
"typespec",
"documented"
] | defmodule MerchantCodes do
@moduledoc """
'MerchantCodes' lets you find Merchant Category Code (MCC) info and categories based on a code.
"""
@doc """
Get MCC information by a code.
## Examples
iex> MerchantCodes.get("0763")
%{
combined_description: "Agricultural Co-operatives",
... |
05ce45d266110b9a2877733a633f8d39c633a61f | 1,736 | [
153016200
] | [
"macro",
"documented",
"phoenix"
] | defmodule MagiratorAppGuiVueWeb 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 MagiratorAppGuiVueWeb, :controller
use MagiratorAppGuiVueWeb, :view
The definitions below will be execut... |
05ce47890e9794d14f0b0571b777da1d34ceca61 | 1,618 | [
99180505
] | [
"documented"
] | defmodule InfinityAPS do
@moduledoc """
Functions used throughout `aps`.
"""
@doc """
Returns the environment variable of the loop directory,
where oref0 can find and save the json files needed to loop.
"""
def loop_directory do
Application.get_env(:aps, :loop_directory)
end
@doc """
Returns... |
05ce712e9938238cef6b389d1c5642e1ed46ab62 | 2,038 | [
176176547
] | [
"typespec",
"documented"
] | defmodule Nostrum.Struct.WSState do
@moduledoc """
Struct representing the current WS state.
"""
defstruct [
:shard_num,
:seq,
:session,
:shard_pid,
:conn,
:conn_pid,
:gateway,
:last_heartbeat_send,
:last_heartbeat_ack,
:heartbeat_ack,
:heartbeat_interval,
:heart... |
05cf29f0b1ea2c709f7c5787424e96b2358f9175 | 1,686 | [
942276709
] | [
"typespec",
"documented"
] | defprotocol Funx.Monoid do
@moduledoc """
A protocol defining the Monoid algebraic structure, which consists of
an identity element and an associative binary operation for combining values.
This protocol provides four key functions:
- `empty/1`: Returns the identity element for the given monoid.
- `append... |
05cf442d43bb467435ec80da8c2abf0955a3fdf7 | 1,704 | [
204612705
] | [
"macro",
"documented",
"phoenix"
] | defmodule PhxExampleAppWeb 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 PhxExampleAppWeb, :controller
use PhxExampleAppWeb, :view
The definitions below will be executed for every vi... |
05cf7475874c13e332f3ea960f2b7cf53cac4b81 | 2,189 | [
709737047
] | [] | defmodule SoonReady.SurveyManagement.V1.DomainEvents.SurveyPublished do
use Ash.Resource,
domain: SoonReady.SurveyManagement,
extensions: [SoonReady.Ash.Extensions.JsonEncoder]
alias SoonReady.SurveyManagement.V1.DomainConcepts.{SurveyPage, Trigger}
alias SoonReady.SurveyManagement.V1.DomainEvents.Helper... |
05cfafe62c53e9e83c040aef9da412d72d0fefcc | 4,307 | [
134994865
] | [] | defmodule Waveform.Synth.Def.Ugens.Deterministic do
@ugens %{
Blip: %{
defaults: %{rate: 2, special: 0, outputs: [2]},
arguments: [freq: 440, numharm: 200]
},
BlitB3: %{
defaults: %{rate: 2, special: 0, outputs: [2]},
arguments: [freq: 440]
},
BlitB3Saw: %{
defaults: ... |
05d053eec03077a745867e3ffdfaa04106b10e10 | 2,524 | [
240295335
] | [
"test"
] | defmodule Test.MissionControllerTest do
use Test.ConnCase
alias Test.Mission
@valid_attrs %{budget: "120.5", date_demarrage: %{day: 17, month: 4, year: 2010}, description: "some content", titre: "some content"}
@invalid_attrs %{}
test "lists all entries on index", %{conn: conn} do
conn = get conn, missi... |
05d08db27e7238a3021273f03d7b98447828f8fc | 1,537 | [
572867525
] | [] | initial_crates = {
["Z", "P", "B", "Q", "M", "D", "N"],
["V", "H", "D", "M", "Q", "Z", "L", "C"],
["G", "Z", "F", "V", "D", "R", "H", "Q"],
["N", "F", "D", "G", "H"],
["Q", "F", "N"],
["T", "B", "F", "Z", "V", "Q", "D"],
["H", "S", "V", "D", "Z", "T", "M", "Q"],
["Q", "N", "P", "F", "G", "M"],
["M", "... |
05d0974fc980025014dfb2dc5bc19b6cecff4b51 | 2,129 | [
677687005
] | [] | defmodule EctoSQLite3.MixProject do
use Mix.Project
@version "0.10.3"
def project do
[
app: :ecto_sqlite3,
version: @version,
elixir: "~> 1.11",
start_permanent: Mix.env() == :prod,
source_url: "https://github.com/elixir-sqlite/ecto_sqlite3",
homepage_url: "https://github... |
05d1a0c176c8d75ef2e52e6e88109fc543e0daf2 | 6,563 | [
406372221
] | [
"typespec",
"documented"
] | defmodule Kuddle.Path do
@moduledoc """
Utility module for looking up nodes in a document.
Usage:
nodes = Kuddle.select(document, path)
[{:node, "node", attrs, children}] = Kuddle.select(document, ["node"])
"""
alias Kuddle.Value
alias Kuddle.Node
@typedoc """
A Kuddle document is a lis... |
05d207edae2220fbe6aeba323f476315945d27d4 | 2,982 | [
937135118
] | [] | defmodule LivePicture.MixProject do
use Mix.Project
def project do
[
app: :live_picture,
version: "0.1.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
dialyzer: [
plt_a... |
05d24413903406f8e5e5a86818a7b15fed02998b | 2,295 | [
372013703
] | [
"liveview",
"documented"
] | defmodule Cizen.Effects.Race do
@moduledoc """
An effect to run a race for the given effects.
## Anonymous race
perform %Race{
effects: [
effect1,
effect2
]
}
# If effect2 resolves faster than effect1 with :somevalue,
# the race returns the :somevalue
... |
05d2855a6d33f867712452d53a4c6fe203e9e520 | 1,821 | [
664585009
] | [
"test",
"phoenix"
] | defmodule NanoPlannerWeb.PlanItemControllerTest do
use NanoPlannerWeb.ConnCase
import NanoPlanner.ScheduleFixtures
import NanoPlanner.AccountsFixtures
alias NanoPlanner.Repo
alias NanoPlanner.Schedule.PlanItem
describe "GET /plan_items" do
setup context do
plan_item_fixture(owner: context[:user])... |
05d3b431235cfdbbba3491434f0f2ae69c176377 | 4,371 | [
115630901
] | [
"macro"
] | defmodule Inject.InitialState do
defstruct []
end
defmodule Inject do
defmacro __using__(_) do
quote do
import Kernel, except: [def: 2]
import Inject
# FIXME rm attribute
Module.register_attribute __MODULE__, :main, persist: true
@main :main
Module.register_attribute __MO... |
05d44872b331f6eed0812ff9d54b600fc7211e17 | 5,053 | [
206297200
] | [
"typespec",
"documented"
] | defmodule Google.Ads.Googleads.V8Availabilities.Services.UploadConversionAdjustmentsRequest do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
customer_id: String.t(),
conversion_adjustments: [Google.Ads.Googleads.V8Availabilities.Services.ConversionAdjustment.t()],
... |
05d49729216121908e92990734d447809ff9a1ec | 1,601 | [
102111526
] | [
"macro",
"documented",
"phoenix"
] | defmodule EvendorWeb 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 EvendorWeb, :controller
use EvendorWeb, :view
The definitions below will be executed for every view,
controller, ... |
05d49779cf17a70b29e9536cc3f3663cbb880fb9 | 1,948 | [
59624786
] | [
"phoenix",
"ecto"
] | defmodule Elyxel.InviteController do
use Elyxel.Web, :controller
import Elyxel.Authorize
import Ecto.Changeset
alias Elyxel.{Mailer, User, Invite}
plug :scrub_params, "invite" when action in [:create]
def action(conn, _), do: auth_action_role conn, ["admin"], __MODULE__
def new(conn, _params, _user) d... |
05d51c1f749cb1a6dc540851edbf6a60ede4d59f | 2,196 | [
156756697
] | [] | defmodule Shurl.API do
require Logger
use Maru.Router
use Plug.ErrorHandler
alias Shurl.API
### Routing
plug Plug.Parsers,
pass: ["*/*"],
json_decoder: Poison,
parsers: [:urlencoded, :json, :multipart]
mount API.Link
mount API.Analytics
mount API.Redirect
### Error processing
resc... |
05d540199687bc9c157899aec5189963405f7539 | 1,589 | [
786798945
] | [
"liveview",
"phoenix"
] | defmodule EnverseWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :enverse
# 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: "_enverse_k... |
05d549b5dc56a734559611eb0f14f058a688d20c | 2,943 | [
696436511
] | [
"phoenix",
"ecto"
] | defmodule ChatApiWeb.ProfileController do
use ChatApiWeb, :controller
alias ChatApiWeb.AuthController
alias ChatApi.Account
action_fallback(ChatApiWeb.FallbackController)
def update_password(
%Plug.Conn{assigns: %{user_id: user_id}} = conn,
%{
"password" => password,
"ne... |
05d5722b0852333d5f7ed96ec9ae4e2a728df910 | 10,469 | [
294868597,
323203037
] | [
"ecto"
] | defmodule Angio.Caths.Cor_diagram_calcs do
use Ecto.Schema
# import Ecto.Query
# alias Angio.Persons.Patient
# alias Angio.Caths.Cath_procedure
# alias Angio.Caths.Info_coronary
def get_info_coronary_data(_patient_id, id) do
response =
"""
query GetInfoCoronary($id: ID) {
getInfoCorona... |
05d59686d99c81bffe41a06ee11b935770e8bc2f | 2,131 | [
135300536
] | [] | defmodule Mandelbrot do
def mandelbrotPixel(line, xf, yf) do
line = hd(String.split(line, "\n"))
[x_s, y_s] = String.split(line, " ")
{px, py} = {String.to_integer(x_s), String.to_integer(y_s)}
hx = 3.5/xf
hy = 2/yf
x0 = px * hx - 2.5
y0 = py * hy - 1
x = 0.0
y = 0.0
iter = 0
... |
05d5a7b319dc9802a4a9262f7b006193e2fac0d2 | 3,093 | [
78030894
] | [
"documented"
] | defmodule Quantum.Executor do
@moduledoc false
import Quantum.Matcher
def convert_to_timezone(s, tz) do
dt = {s.d, {s.h, s.m, 0}} # erlang datetime
tz_final = case tz do
:utc -> "Etc/UTC"
:local -> raise "error - local timezone not allowed"
tz0 -> tz0
end
case Applicat... |
05d60bed6e089ab6dad26c9a8a47aa526e43c3ad | 2,164 | [
153673371
] | [
"macro",
"documented"
] | defmodule Graphqx.Schema do
@moduledoc """
Load a schema into Graphqx. You can only load one schema for a whole application instance.
"""
@default_scalar_resolver %{default: Graphqx.DefaultScalarResolver}
@default_resolver %{default: Graphqx.ObjectResolver}
@default_object_resolvers %{
default: Graphqx... |
05d6960780969fec54cc9db1aff20e078d55cd45 | 19,834 | [
948731437
] | [] | %{
"bandit": {:hex, :bandit, "1.7.0", "d1564f30553c97d3e25f9623144bb8df11f3787a26733f00b21699a128105c0c", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.18", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", option... |
05d6a7ed2a81de72063d6cdb6138532dede8e580 | 3,009 | [
100994521
] | [] | # https://www.youtube.com/watch?v=XPlXNUXmcgE
# jose valim lambda days talk
# poem.txt
# "roses are red/n
# violets are blue/n"
# we tend to program solutions as eager, lazy, concurrent and distributed
#----------------------------
# EAGER (Enum)
#----------------------------
File.read!("poem.txt")
|> S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.