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 |
|---|---|---|---|---|
03a3c9d26d090d26d2f17a98a1eae053eeed8629 | 5,592 | [
996920193
] | [
"documented"
] | defmodule DSPEx.QA.Actions.ProcessQuestion do
@moduledoc """
Core action for processing questions with cognitive variable coordination.
This action demonstrates the complete DSPEx pipeline:
1. Get current variable values (e.g., temperature)
2. Validate input against DSPy signature
3. Process using coordi... |
03a42ba15fce882258b56ed3d659c67b0408243b | 2,668 | [
88779733
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
config :krypto_brain, KryptoBrain.Repo,
adapter: Ecto.Adapters.Postgres,
database: "krypto_brain_repo",
username: "master",
password: "secret",
hostname: "localhost"
confi... |
03a4594d7435ab1a03e5a1876bf046be63a75798 | 4,094 | [
934481592
] | [
"macro",
"supervisor"
] | defmodule AlertFunctions do
require Logger
defmacro defwithalert(head, do: body) do
quote do
def unquote(head) do
mod = __MODULE__
{fun, arity} = __ENV__.function
AlertFunctions.alert_manual_command({mod, fun, arity})
unquote(body)
end
end
end
def alert_manu... |
03a49a9567300814170e3c53024f5c1c92c8c3bb | 1,804 | [
226920597
] | [] | defmodule WhereTZ.MixProject do
use Mix.Project
def project do
[
app: :wheretz,
description: "Time zone by geo coordinates lookup",
version: "0.1.17",
elixir: "~> 1.9",
start_permanent: Mix.env() == :prod,
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
... |
03a50c052b2c186cc8d0af4d028229f16608cb1d | 2,793 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Integrations.V1alpha.Model.EnterpriseCrmFrontendsEventbusProtoTaskEntity do
@moduledoc """
Contains a task's metadata and associated information. Next available id: 7
## Attributes
* `disabledForVpcSc` (*type:* `boolean()`, *default:* `nil`) - True if the task has conflict with vpcsc
*... |
03a550689c6a4acef093a91427e8555583c6333d | 2,335 | [
272824219
] | [
"documented"
] | defmodule Nenokit.Surveys.SurveySubscribers do
@moduledoc """
SurveySubscriber context to handle all survey_subscriber data manipulation
"""
import Ecto.Query, only: [from: 2]
alias Nenokit.Repo
alias Nenokit.{Surveys, Surveys.SurveySubscriber}
def list_survey_subscribers() do
Repo.all(from s in Sur... |
03a5ca19cb954c0c48b7ba713dd22c12c5627381 | 1,687 | [
145774355
] | [
"documented"
] | defmodule Ui.ActionAdmin do
@moduledoc false
alias DB.{Repo, Action}
@doc """
Returns the list of actions.
## Examples
iex> list_actions()
[%Action{}, ...]
"""
def list_actions do
Repo.all(Action)
end
@doc """
Gets a single action.
Raises if the Action does not exist.
## ... |
03a5d8ed8fa91c8233e28204ebe261575b8ad7ea | 3,264 | [
738378647
] | [
"liveview",
"documented",
"ecto"
] | defmodule SentinelWeb.IntegrationLive.WebhookFormComponent do
@moduledoc false
use SentinelWeb, :live_component
alias Sentinel.Integrations
alias Sentinel.Integrations.Webhook
@impl Phoenix.LiveComponent
def render(assigns) do
~H"""
<div>
<div class="border-b p-5">
<span class="icon-... |
03a624a20d28b66488c8b040dcae769aeef9b53a | 3,885 | [
347253647
] | [
"test",
"phoenix"
] | defmodule StonepayWeb.TransactionControllerTest do
use StonepayWeb.ConnCase
import Stonepay.AccountsFixtures
import Stonepay.PaymentsFixtures
alias Stonepay.Payment
setup %{conn: conn} do
token =
user_fixture()
|> Stonepay.Accounts.generate_user_api_token()
conn = put_req_header(conn, "... |
03a62e6429b13fe891e51b373112acada0c0f45e | 2,897 | [
227645234,
227639352
] | [
"genserver"
] | defmodule ChirperWeb.UserChannel do
use ChirperWeb, :channel
alias ChirperWeb.MyPresence
alias Chirper.Accounts
def join("user:" <> user_id_str, _params, socket) do
if to_string(socket.assigns.user_id) == user_id_str do
send(self, :after_join)
{:ok, socket}
else
{:error, %{reas... |
03a7142fdb53893b21f39f3884105a701ecad753 | 2,669 | [
492823415
] | [] | defmodule Oceanconnect.Auctions.AuctionEventStore do
alias Oceanconnect.Auctions.{AuctionEvent, AuctionEventStorage}
@event_storage Application.compile_env(:oceanconnect, :event_storage) || AuctionEventStorage
@fixture_events [
:fixture_created,
:fixture_updated,
:fixture_changes_proposed,
:fixt... |
03a75c91a936c2e9a4617ee244da893c93a9a988 | 3,026 | [
211884936
] | [] | defmodule SampleScenicDriverWaveshare.MixProject do
use Mix.Project
@app :sample_scenic_driver_waveshare
@version "0.1.0"
@all_targets [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :rpi4, :bbb, :x86_64]
def project do
[
app: @app,
version: @version,
elixir: "~> 1.9",
archives: [nerves_boot... |
03a7749c6d12c4007e2a546dfb8d958c80eb8742 | 2,215 | [
75265284
] | [
"test"
] | defmodule ShuttleSearch do
def earliest(timestamp, ids) do
ids = Enum.reject(ids, &(&1 == 0))
{id, departure} =
ids
|> Enum.map(fn id -> {id, (div(timestamp, id) + 1) * id - timestamp} end)
|> Enum.min_by(fn {_, departure} -> departure end)
id * departure
end
def earliest_offset(i... |
03a7c20280a7751defc5fb734755c9631f190059 | 2,124 | [
87209162
] | [
"typespec",
"documented",
"ecto"
] | defmodule CanvasAPI.UserService do
@moduledoc """
A service for viewing and manipulating users.
"""
use CanvasAPI.Web, :service
alias CanvasAPI.{Account, Team, User}
@preload [:team]
@doc """
Insert a new user from the given params.
The creator must provide an account and a team.
Options:
- ... |
03a7de59e414c8472fd879b7737e099bad1cbaea | 1,604 | [
128508726
] | [] | defmodule Ord23e do
def solve(input) do
{index, rules} =
input
|> String.split(",")
|> conv()
total_length = total_length(rules)
if total_length < index do
"x"
else
{_, _, direction} =
rules
|> Enum.reduce({index - 1, total_length, 0}, fn rule, {index, l... |
03a7e499ce39be33266d685e0dfe4d8651ec1b5a | 2,128 | [
795278462
] | [] | import Config
# 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.
config :faucet, Faucet.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "f... |
03a8a13a8d94fef018c79c2a94b3479d83f43ca6 | 3,561 | [
318945858
] | [
"documented",
"phoenix"
] | defmodule Pleroma.Web.PleromaAPI.TwoFactorAuthenticationController do
@moduledoc "The module represents actions to manage MFA"
use Pleroma.Web, :controller
import Pleroma.Web.ControllerHelper, only: [json_response: 3]
alias Pleroma.MFA
alias Pleroma.MFA.TOTP
alias Pleroma.Web.CommonAPI.Utils
alias Plero... |
03a8bd4b89b062415306746d1fb773f23c719d30 | 2,342 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1_Track do
@moduledoc """
A track of an object instance.
## Attributes
* `attributes` (*type:* `list(GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1_DetectedAttribute.t)`, *default:* `nil`) - Optional. Attributes... |
03a8c2997177cac929a98c6422e659a9f6da5c3c | 2,059 | [
109631472
] | [
"typespec",
"documented"
] | defmodule NPRx.HTTP do
@moduledoc false
@app_id Application.get_env(:nprx, :npr_app_id)
@app_secret Application.get_env(:nprx, :npr_app_secret)
@base_url "https://api.npr.org"
def get_token() do
HTTPoison.post("#{@base_url}/authorization/v2/token", auth_body(), %{
"Content-type" => "application/x-... |
03a9049d465f5cafbd68d53a7d9c2b9032b791f8 | 2,823 | [
181826654
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Storage.V1.Model.ObjectAccessControl do
@moduledoc """
An access-control entry.
## Attributes
- bucket (String.t): The name of the bucket. Defaults to: `null`.
- domain (String.t): The domain associated with the entity, if any. Defaults to: `null`.
- email (String.t): The email address... |
03a92924e36784b917a498708ffdd7a5cfcc48b4 | 2,949 | [
697235602
] | [
"liveview",
"documented",
"ecto"
] | defmodule SimonWeb.PartyLive.FormComponent do
@moduledoc false
use SimonWeb, :live_component
alias Ecto
alias Simon.Relationship.Party
alias Simon.Relationship.Service.RegisterNewParty
@impl true
def render(assigns) do
~H"""
<div>
<.header>
<%= @title %>
<:subtitle>Use thi... |
03a94a2f474abe9d156538a8d7e3face5bb3c2eb | 2,157 | [
192834211
] | [
"phoenix",
"ecto"
] | defmodule BoatNoodleWeb.CashierSessionController do
use BoatNoodleWeb, :controller
alias BoatNoodle.BN
alias BoatNoodle.BN.CashierSession
def index(conn, _params) do
cashier_session = BN.list_cashier_session()
render(conn, "index.html", cashier_session: cashier_session)
end
def new(conn, _params)... |
03a963fe27eb5b5b2ff8b715db2f399f5fbbd48f | 2,137 | [
99717355
] | [
"test"
] | defmodule GameOfLife.CellTest do
use ExUnit.Case, async: false
alias GameOfLife.{Cell, World}
test "store and retrieve cell state by coordinates" do
Cell.start_link({0, 0}, :live)
assert Cell.get({0, 0}) == :live
Cell.update({0, 0}, :dead)
assert Cell.get({0, 0}) == :dead
end
test "non exis... |
03a96dd82852ba560b7ee7c236fd9b3b933661b9 | 20,303 | [
491961474
] | [
"documented"
] | defmodule Test.EnumTest do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.13.0"
def descriptor do
# credo:disable-for-next-line
%Google.Protobuf.EnumDescriptorProto{
name: "EnumTest",
value: [
%Google.Protobuf.EnumValueDescriptorProto{
... |
03ab19f3cdf9d3e45862f1232809bc532e4d9fae | 2,817 | [
410121215
] | [
"test"
] | defmodule Sig.HR.Payslips.DeleteTest do
use Sig.DataCase, async: true
alias Sig.HR.Payslips.Delete
alias Sig.HR.Payslips.Payslip
alias Sig.HR.Payslips.Groups.Group
describe "call/1" do
test "deletes a payslip" do
%{id: id} = payslip = insert(:payslip)
assert {:ok, %Payslip{id: ^id}} = Delet... |
03abcbdf9c7e71babfc142b056d714a8fe480093 | 3,270 | [
167905959
] | [
"phoenix"
] | defmodule BureauWeb.JobController do
use BureauWeb, :controller
alias Bureau.{Offer, JobOffer}
alias BureauWeb.SearchJob
plug :scrub_params, "job_offer" when action in [:create]
# pattern matching if there are some search params for next/previous page
def index(conn, %{"page" => page, "search_job" => para... |
03abd7efb47b456045d090fbadd0fdb67d48b5bc | 4,414 | [
806532915
] | [
"test",
"ecto"
] | defmodule Plotlix.PlotsTest do
use Plotlix.DataCase
describe "plots" do
import Plotlix.AccountsFixtures
import Plotlix.PlotsFixtures
import Plotlix.PlotSharesFixtures
alias Plotlix.Plots
alias Plotlix.Plots.Plot
@invalid_attrs %{name: nil, dataset_name: nil, expression: nil}
test "li... |
03ac1afb31aefda9d6dfb2d332496865c3adb039 | 1,506 | [
131817053
] | [
"genserver"
] | defmodule MockServer.Servers.RunningServer do
use GenServer
def access_path(server_pid, method, path) do
GenServer.call(server_pid, {:access_path, method, path}, :infinity)
end
def start_link({server, opts}) do
GenServer.start_link(__MODULE__, server, opts)
end
def start_link(server) do
start... |
03ac70a3465c538cb105d8d9ec96b1993417fe97 | 5,413 | [
62673760
] | [
"typespec",
"documented"
] | defmodule JSONRPC2.Clients.TCP do
@moduledoc """
A client for JSON-RPC 2.0 using a line-based TCP transport.
"""
alias JSONRPC2.Clients.TCP.Protocol
@default_timeout 5_000
@type host :: binary | :inet.socket_address() | :inet.hostname()
@type request_id :: any
@type call_option ::
{:strin... |
03accbb47226df0d72548f3fc9c88c760d65f307 | 1,660 | [
47093487,
47211907
] | [
"test"
] | if System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("example.exs")
else
Code.load_file("word_count.exs")
end
ExUnit.start
ExUnit.configure(exclude: :pending)
defmodule WordsTest do
use ExUnit.Case
test "count one word" do
assert Words.count("word") == %{ "word" => 1 }
end
@tag :pending
t... |
03ad6fd4eb896cdfe8f97d292e89b51b119db2d8 | 1,661 | [
809196440
] | [
"typespec"
] | defmodule ExSportsdataio.Betting.Event do
defstruct [
:betting_event_id,
:name,
:season,
:betting_event_type_id,
:betting_event_type,
:start_date,
:created,
:updated,
:game_id,
:global_game_id,
:game_status,
:quarter,
:away_team,
:home_team,
:away_team_id,
... |
03adcaedbed8468536a53754d90a25fcde7490e6 | 2,248 | [
726052325
] | [] | defmodule ListModule do
def sum(numbers) do
do_sum(numbers, 0)
end
def do_sum([], res) do
res
end
def do_sum(numbers, res) do
[h|t] = numbers
do_sum(t, res+h)
end
def len(numbers) do
count(numbers, 0)
end
def count([], res) do
res
end
def count(numbers, res) do
[_|... |
03addb3278d3672abd1733204da8fce16b3f7027 | 3,642 | [
947309000
] | [
"liveview",
"test"
] | defmodule LyshWeb.LinkLiveTest do
use LyshWeb.ConnCase
import Phoenix.LiveViewTest
import Lysh.ShortnerFixtures
@create_attrs %{original_url: "some original_url"}
@update_attrs %{original_url: "some updated original_url"}
@invalid_attrs %{original_url: nil}
defp login(%{conn: conn}) do
user = Lysh.... |
03ae25ebc9161dbac73f67447a90688afc748d5a | 1,882 | [
40064132
] | [
"test"
] | # Since we have used unit tests so far, this time we will take the
# other road and write an integration test. The integration test will
# have a TCP client that sends commands to our server and we will assert
# that we are getting the desired responses.
#
# The downside of integration tests is that they can be much sl... |
03ae273fcf65f19c2cd49f99b2bace597aacde75 | 18,691 | [
192011301
] | [
"typespec",
"documented"
] | defmodule XDR do
@moduledoc """
Basic XDR usage
"""
@typedoc """
Because the protocol function signatures must match for all types,
arguments are sometimes unused. The `ignored()` type is used to annotate them.
"""
@type ignored() :: any()
alias XDR.Type.Const
@doc """
Build a concrete XDR type... |
03ae33e22d001031da03c198a4e9a31cb1fdc31e | 3,103 | [
740688653
] | [
"typespec",
"documented"
] | defmodule Errata do
# Pull in the moduledocs from the demarcated section of the README file
@external_resource Path.expand("./README.md")
@moduledoc File.read!(Path.expand("./README.md"))
|> String.split("<!-- README START -->")
|> Enum.at(1)
|> String.split("<!-- README END... |
03aeab06ceb4702b3faf194603fa7d357aab4199 | 1,970 | [
97162459
] | [] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
config :scraper, Scraper.Repo,
adapter: Ecto.Adapters.Postgres,
database: "scraper_repo",
username: "user",
password: "password",
hostname: "localhost"
config :scraper, ec... |
03aec74d399e1ad639a5a4d9323a01d36723c65a | 3,574 | [
526200954
] | [
"liveview"
] | defmodule SchudeluWeb.Views.CalendarExecution do
use Phoenix.LiveView
@max_timeline_depth 10
def construct_tree(event, _, 0) do
put_in(event, [:event, :on_finish], %{next_events: []})
end
def construct_tree(%{event: %{on_finish: %{next_events: next_events}}} = event, event_map, rem_depth) do
put_in(... |
03aedd3964b210f22bff71093c3d9dd77c314822 | 2,266 | [
915346930
] | [
"test",
"phoenix"
] | defmodule EsteeLauderSitesWeb.ReviewControllerTest do
use EsteeLauderSitesWeb.ConnCase
import EsteeLauderSites.ReviewsFixtures
alias EsteeLauderSites.Reviews.Review
@create_attrs %{
content: "some content",
rating: 4
}
@update_attrs %{
content: "some updated content",
rating: 5
}
@inv... |
03aef6d35a505ddab08e6352c889fda156b42e4b | 10,235 | [
1011458400
] | [
"liveview",
"documented"
] | defmodule McpNotesWeb.Components.Video do
@moduledoc """
A customizable video component for Phoenix applications, designed to simplify the
embedding of HTML5 video elements with support for various configurations.
This module ensures compatibility with web standards, addressing common issues such
as CORS whe... |
03af93b27efd769f54c26f7265cfd902af2252a6 | 2,552 | [
809190887
] | [] | # 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:
#
# Manuscript.Repo.insert!(%Manuscript.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as the... |
03af9a2c36c15882e78cbfc1836d0f68d86d1ec1 | 2,237 | [
636077123
] | [
"test",
"ecto"
] | defmodule PlanningWebpage.PagesTest do
use PlanningWebpage.DataCase
alias PlanningWebpage.Pages
describe "meetings" do
alias PlanningWebpage.Pages.Meeting
import PlanningWebpage.PagesFixtures
@invalid_attrs %{date: nil, project: nil, title: nil}
test "list_meetings/0 returns all meetings" do
... |
03af9aadebd603f90bba9e63dd1500665e3cc9ac | 1,624 | [
384458100
] | [
"documented",
"ecto"
] | defmodule Pento.Questions do
@moduledoc """
The Questions context.
"""
import Ecto.Query, warn: false
alias Pento.Repo
alias Pento.Questions.FAQ
@doc """
Returns the list of faqs.
## Examples
iex> list_faqs()
[%FAQ{}, ...]
"""
def list_faqs do
Repo.all(FAQ)
end
@doc """
... |
03afae738ef06e48c678fafc1610b663ae6ac770 | 1,803 | [
573705506
] | [] | defmodule Day07 do
@input "input-07.txt"
def part1() do
get_sizes_list()
|> Enum.reject(fn x -> x > 100000 end)
|> Enum.sum
end
def part2() do
sizes = Enum.sort(get_sizes_list())
sizes
|> Enum.find(fn x -> x > List.last(sizes, 1) - 40000000 end)
end
def get_sizes_list() do
@i... |
03aff736aabcba752e53ae2de5e5a3c7e2d7c90b | 3,133 | [
449828416
] | [
"phoenix"
] | defmodule TicPhxWeb.CommentsController do
use TicPhxWeb, :controller
alias Phoenix.PubSub
def index(conn, %{"comment" => comment, "nickname" => nickname}) do
# running_status = Room.is_running()
process_comment(conn, comment, nickname)
end
defp process_comment(conn, "join", nickname) do
wit... |
03b05ec78aaaa2253d02b5a5551be07081bcea9b | 2,036 | [
448948658,
459182862
] | [] | defmodule Credo.CLI.Command.Diff.Task.FilterIssues do
use Credo.Execution.Task
alias Credo.Issue
def call(exec, _opts) do
issues = get_old_new_and_fixed_issues(exec)
Execution.put_issues(exec, issues)
end
defp get_old_new_and_fixed_issues(exec) do
current_issues = Execution.get_issues(exec)
... |
03b11564c569a64e4efa72647481c086f7a99ce3 | 1,746 | [
269350232
] | [
"genserver"
] | defmodule HukumSocketsWeb.LobbyChannel do
use HukumSocketsWeb, :channel
alias HukumSocketsWeb.Presence
alias HukumSockets.GameList
@impl true
def join("lobby:lobby", %{"user_name" => user_name}, socket) do
if authorized?(socket, user_name) do
send(self(), :after_join)
{:ok, %{game_list: GameL... |
03b1b594759c289ff2dd16ffae73035f22f0bd58 | 2,757 | [
136642446
] | [
"macro",
"documented"
] | defmodule PinyinUtil.String do
@moduledoc ~S"""
A Pinyin Libary.
"""
@external_resource data_path =
Path.join(:code.priv_dir(:pinyin_util), "/data/pinyin.dat")
|> Path.expand()
file_stream = File.stream!(data_path) |> Stream.with_index()
pinyin_codes =
Enu... |
03b217a9e86e49c453b76a7b7e46692cd28200ad | 1,987 | [
46361434
] | [] | defmodule Piper.Common.Scope do
alias Piper.Common.Bindable
alias Piper.Common.BindError
defstruct [values: %{}, bindings: %{}, parent: nil]
def from_map(values) do
%__MODULE__{values: values}
end
def empty_scope() do
%__MODULE__{}
end
def bind(ast, %__MODULE__{}=scope) do
try do
... |
03b25557cb3dfca8bd1a70aa25b718f880ded544 | 1,811 | [
371812917
] | [
"documented"
] | defmodule HostCore.ControlInterface.ACL do
@moduledoc false
alias HostCore.Actors.ActorModule
alias HostCore.Claims.Manager
alias HostCore.Providers.ProviderModule
def convert_inv_actors(inv, lattice_prefix) do
actors =
for {id, pids} <- inv.actors do
claims = find_claims_for_pk(lattice_pr... |
03b257ab54f6788816b011bf404af2a895b1f644 | 2,621 | [
95911845
] | [
"documented",
"ecto"
] | defmodule Sokrat.Responders.Conflict do
@moduledoc false
alias Sokrat.{Repo, Models.ConflictUser}
use Hedwig.Responder
@usage """
hedwig conf status - Show current status (whether you'd like to receive notifications or not).
"""
respond ~r/conf\sstatus$/i, msg do
case find_user(msg) do
{:ok, u... |
03b2965bf3d692f0cd804096e3b69dd310053ad6 | 4,109 | [
31918746
] | [
"macro",
"test"
] | defmodule Gettext.Interpolation.DefaultTest do
use ExUnit.Case, async: true
doctest Gettext.Interpolation.Default
alias Gettext.Interpolation.Default, as: Interpolation
require Interpolation
test "runtime_interpolate/2" do
interpolatable = Interpolation.to_interpolatable("%{a} %{b} %{c}")
assert ... |
03b2d323693114a2dacf0f750a7d525241eb6a5d | 3,725 | [
115281442
] | [
"macro",
"documented",
"ecto"
] | defmodule Lfc.Accounts.UserAPI do
@moduledoc """
Provides an API for all functions relating to users
"""
defmacro __using__(_) do
quote do
alias Lfc.{Repo}
alias Lfc.Accounts.{User, Role}
alias Ecto.{Changeset}
@doc """
Returns the list of users.
## Examples
... |
03b34a60c0adde43bb5a283a9da4e9785a69e31a | 2,081 | [
677039928
] | [] | # 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 :nimble_blog,
website_name: "Simon Tirant's ... |
03b34becee58c313d63d5047549b65cc91a43ccc | 2,340 | [
47148138
] | [
"phoenix"
] | defmodule TomeStats.SearchKeyValueController do
use TomeStats.Web, :controller
alias TomeStats.SearchKeyValue
plug :scrub_params, "search_key_value" when action in [:create, :update]
def index(conn, _params) do
search_key_values = Repo.all(SearchKeyValue)
render(conn, "index.html", search_key_values: ... |
03b42180bb1cba9f74946646db2ec66f9488ad22 | 5,952 | [
204240417
] | [
"test",
"ecto"
] | defmodule Komesti.SellerTest do
use Komesti.DataCase
alias Komesti.Seller
describe "eateries" do
alias Komesti.Seller.Eatery
@valid_attrs %{name: "some name"}
@update_attrs %{name: "some updated name"}
@invalid_attrs %{name: nil}
def eatery_fixture(attrs \\ %{}) do
{:ok, eatery} =
... |
03b47a92a2ff2eb1b16ed9471b5227297dc1f353 | 4,126 | [
106712767
] | [
"test"
] | defmodule Sanbase.Notifications.NotificationActionsTest do
use Sanbase.DataCase, async: false
import Sanbase.NotificationsFixtures
import Mox
alias Sanbase.Notifications.Handler
setup do
Application.put_env(:sanbase, :mailjet_mocked, true)
on_exit(fn -> Application.put_env(:sanbase, :mailjet_mocked,... |
03b601dd662e4ec85938a610df069663ce9c910f | 3,157 | [
191612022
] | [
"documented",
"ecto"
] | defmodule Core.PRMRepo.Migrations.SetAdditionalInfoSpecialityOfficio do
@moduledoc false
use Ecto.Migration
import Ecto.Query
alias Ecto.Adapters.SQL
alias Ecto.UUID
alias Core.Employees.Employee
alias Core.PRMRepo
def change do
query = """
with t1 as(
select id, additional_info
... |
03b653b226a72e7b3e5260d9ff652d856867efa9 | 2,187 | [
139629312
] | [
"genserver",
"typespec"
] | defmodule MDMMinion.NethogsExecutor do
use GenServer
require Logger
# This needs to be that long because of the way nethogs works.
# It approaches the correct value...
@interval 5 # seconds
def ensure_started do
case __MODULE__ in Process.registered() do
true ->
:ok
false ->
... |
03b689f427ebae3affde3cbee6753314150b728b | 3,071 | [
269234082
] | [
"test",
"ecto"
] | defmodule FindYourHappyHour.CompaniesTest do
use FindYourHappyHour.DataCase
alias FindYourHappyHour.Companies
describe "companies" do
alias FindYourHappyHour.Companies.Company
@valid_attrs %{address: "some address", cover_picture: "some cover_picture", description: "some description", lat_long: "some l... |
03b68c5ad4ff6a51cc1056f1c1f5f9d65e6edce8 | 4,358 | [
121962401
] | [
"test"
] | defmodule JsonSchemaTestSuite.Draft6.PropertiesTest do
use ExUnit.Case
import JsonXema, only: [valid?: 2]
describe ~s|object properties validation| do
setup do
%{
schema:
JsonXema.new(%{
"properties" => %{"bar" => %{"type" => "string"}, "foo" => %{"type" => "integer"}}
... |
03b68cb736b7676f50a6bcb06a9b7f3ac7a507e2 | 3,762 | [
997913144
] | [
"liveview"
] | defmodule TrackWeb.UserLive.Login do
use TrackWeb, :live_view
alias Track.Accounts
def render(assigns) do
~H"""
<Layouts.app flash={@flash} current_scope={@current_scope}>
<div class="mx-auto max-w-sm space-y-4">
<.header class="text-center">
<p>Log in</p>
<:subtitle>
... |
03b7a492440bdbdb837b6f860b1119a9d9e88b67 | 3,021 | [
897858822
] | [] | defmodule AdventOfElixir2024.Day6_2 do
def test() do
{:ok, input} = File.read("6_test_input.txt")
solution(input) |> IO.inspect()
end
def prod() do
{:ok, input} = File.read("6_input.txt")
solution(input) |> IO.inspect()
end
def solution(input) do
matrix =
String.split(input, "\r\n"... |
03b7fd4eb66dbf2cb8746a966364aad784a7f44c | 1,573 | [
169830978
] | [] | # 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:
#
# RxDelivery.Repo.insert!(%RxDelivery.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as the... |
03b895c786ec8ddbc7b849a81625125733069cd9 | 1,525 | [
208457561
] | [
"macro",
"liveview",
"documented"
] | defmodule Phoenix.LiveEditable.ViewUtil do
@moduledoc """
Access methods for the ViewCache.
View-Level LiveEditable Utiltities
defmodule MyView do
use MyAppWeb, :live_view
use Phoenix.LiveEditable.ViewUtil
...
end
Layered configuration:
- hardcoded default -> config ... |
03b8ee47671db1f293d7b089fa5a3d2098d28d23 | 17,915 | [
196200304,
19643959
] | [
"typespec",
"documented"
] | defmodule Mix.Dep do
@moduledoc false
@doc """
The Mix.Dep struct keeps information about your project dependencies.
It contains:
* `scm` - a module representing the source code management tool (SCM)
operations
* `app` - the application name as an atom
* `requirement` - a binary or regula... |
03b90ed0e170fdb2fdc2c050a41f2beb3b67c229 | 1,618 | [
433484844
] | [
"supervisor",
"documented"
] | defmodule ExCubicIngestion.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl Application
def start(_type, _args) do
sys_children = [
{ExCubicIngestion.Repo, []},
{ExCubicIngestion.Repo.Migrator,... |
03b9cb414bf0db1cd23f26078b62de88d4d1acb1 | 1,566 | [
329448569
] | [
"documented",
"ecto"
] | defmodule App.Cards.Card do
use Ecto.Schema
import Ecto.Changeset
alias App.Repo
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "cards" do
field :password, :string
field :code, :integer
field :is_active, :boolean, default: false
belongs_to :bank_acc... |
03b9d108d4c18db8ea15a8d55ce03718c77ef7b5 | 2,409 | [
534260591
] | [
"genserver",
"liveview"
] | defmodule ChatWeb.MessageLive do
use ChatWeb, :live_view
alias Chat.Message
alias Chat.PubSub
alias Chat.Presence
on_mount ChatWeb.AuthController
@presence_topic "liveview_chat_presence"
def mount(_params, _session, socket) do
if connected?(socket) do
Message.subscribe()
{id, name} =
... |
03b9ec2c6da5cc03c25b253847f8ea8b3b07d212 | 1,786 | [
325389457
] | [
"typespec",
"documented"
] | defmodule PassportProcessing.Validation do
@moduledoc """
Validation of passports
"""
@required_keys [:byr, :iyr, :eyr, :hgt, :hcl, :ecl, :pid]
@spec is_valid?(map(), boolean) :: boolean
def is_valid?(passport, false) do
Enum.all?(@required_keys, &Map.has_key?(passport, &1))
end
def is_valid?(%{b... |
03b9f42bf75cb0fa25ea08f76873177246bf3e9f | 2,059 | [
114005633
] | [
"documented"
] | defmodule Acme.OpenSSL do
@moduledoc """
Helper module for generating private keys and CSR by calling out
to OpenSSL
"""
def openssl(args) do
case System.cmd("openssl", args, stderr_to_stdout: true) do
{output, 0} -> {:ok, output}
{error, 1} -> {:error, error}
end
end
@rsa_key_sizes ... |
03ba16827b1772d43d3a4502c1979ceabee7afe6 | 1,817 | [
564863485,
741187755
] | [
"typespec",
"documented"
] | defmodule Evision.Detail.DpSeamFinder do
import Kernel, except: [apply: 2, apply: 3]
@typedoc """
Type that represents an `Evision.Detail.DpSeamFinder` struct.
- **ref**. `reference()`
The underlying erlang resource variable.
"""
@type t :: %__MODULE__{
ref: reference()
}
@enforce_keys [:ref... |
03ba3d60f867ee4fa0bde928a318dfc3cf32742a | 4,127 | [
621798571
] | [
"liveview"
] | defmodule FitnessWeb.WorkoutTemplateLive.CheckBoxesLiveComponent do
use FitnessWeb, :live_component
@impl true
def update(assigns, socket) do
{:ok,
socket
|> assign(:workout_template, assigns.workout_template)
|> assign(:changeset, assigns.changeset)
|> assign(:update_param, %{})
|> ... |
03bb18dcb59ea9b4269f50811882f87450db02bc | 3,520 | [
719565927
] | [
"typespec",
"documented"
] | defmodule Buffer.State do
@moduledoc false
defstruct [
:flush_callback,
:flush_meta,
:max_length,
:max_size,
:partition,
:size_callback,
:timeout,
buffer: [],
length: 0,
size: 0,
timer: nil
]
@type t :: %__MODULE__{}
################################
# Public AP... |
03bb542169720ab2fc19434f8fa137be0528f012 | 4,892 | [
887323924
] | [] | defmodule Kore.Website.UserAgent do
alias Kore.Website
# Based on https://useragent.wcode.net
def categorize(nil), do: nil
def categorize(req) when is_map(req) do
case Website.header(req, "user-agent") do
nil -> nil
ua -> categorize(ua)
end
end
def categorize(ua) when is_binary(ua) do... |
03bbdd06ab7749c3c02f7b83db83e121ad4239e9 | 3,684 | [
573038257
] | [] | defmodule AdventOfCode2022.Seven do
@external_resource "data/seven.txt"
@terminal Regex.split(~r/(^\$ |\n\$ )/, File.read!("data/seven.txt"), trim: true)
|> Enum.map(fn command_block ->
String.split(command_block, "\n", trim: true)
end)
def first do
{_, files} =
En... |
03bc1934c133bcb1cb0c2a5e6e7bdd1bfa4e9256 | 3,009 | [
256005654
] | [
"genserver",
"documented"
] | defmodule Alfred.Track.Metrics do
@moduledoc false
require Logger
use GenServer
defstruct interval_ms: 60_000,
start_at: nil,
last_report_at: Timex.epoch(),
tracked: 0,
released: 0,
timeout: 0,
errors: 0
def count(%Alfred.Track{} = tra... |
03bc5945a4ef318b532227f51a15f13926eedd48 | 1,621 | [
225970993
] | [] | Code.require_file("../util/util.ex", __DIR__)
Code.require_file("../day07/el.ex", __DIR__)
defmodule Day09 do
def parameter_mode_relative(index) do
fn
(%{memory: memory, pc: pointer, rbase: rbase}, :get) ->
addr = :array.get(pointer + index, memory) + rbase
if addr > :array.size(memory), do... |
03bcbacca96d02a124238dd881e2d396a4369fd8 | 1,957 | [
828433960
] | [
"test",
"phoenix"
] | defmodule HelloSocketsWeb.DedupeChannelTest do
use HelloSocketsWeb.ChannelCase
alias HelloSocketsWeb.UserSocket
defp broadcast_number(socket, number) do
assert broadcast_from!(socket, "number", %{number: number}) == :ok
socket
end
defp validate_buffer_contents(socket, expected_contents) do
asser... |
03bcfecc6f30c7d1f0421f41d1d480986f0a9fd8 | 3,142 | [
433924176
] | [
"genserver"
] | defmodule Day6 do
defmodule FishPond do
use GenServer
@default_age 6
@default_new_age 8
@max_fish 10_000
@min_fish 1_000
def new(fish) do
GenServer.start_link(FishPond, fish)
end
def tick(pid) do
GenServer.call(pid, :tick)
end
def population(pid) do
GenSe... |
03bd3c6d132b74021276acb005f0a0780fb20000 | 2,908 | [
978576109
] | [] | defmodule PodcastMcp.MixProject do
use Mix.Project
def project do
[
app: :podcast_mcp,
version: "0.1.0",
elixir: "~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
listeners: [Phoenix.CodeRel... |
03bd58a3488dddb70d02b50a7a3103e84de4bbce | 6,130 | [
853022119
] | [] | defmodule HAL do
@compile {:no_warn_undefined, :esp}
@compile {:no_warn_undefined, :gpio}
@compile {:no_warn_undefined, :spi}
# @platform "linux"
# @platform "esp32-devkit"
# @platform {"m5stack", "faces"}
@platform "t-deck"
def init() do
IO.puts("Platform is: #{inspect(@platform)}")
init(@pla... |
03bd73727f2b32d5daf97713faf3169be16fa261 | 1,614 | [
167880757
] | [
"macro",
"documented",
"phoenix"
] | defmodule WeedChatWeb 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 WeedChatWeb, :controller
use WeedChatWeb, :view
The definitions below will be executed for every view,
controlle... |
03bd999a1b802d2be2eb03682df7008d412d3a4b | 4,171 | [
897003324
] | [] | defmodule DayHelper do
def find_guard(map) do
found_line_index = map
|>
Enum.find_index(fn line -> Enum.any?(line, fn tile -> tile == "^" end) end)
found_tile_index = Enum.at(map, found_line_index)
|> Enum.find_index(fn tile -> tile == "^" end)
{found_line_index, found_tile_index}
end
... |
03be1b8e409f0a28ad967dc5194e45e9093b3331 | 1,697 | [
343549921
] | [] | # 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 :management,
# Name of the entire appli... |
03bf35c07ea1764a6259470d79c974f250bb00d0 | 3,225 | [
184338071
] | [
"test",
"phoenix"
] | defmodule ZooWeb.ConsultasControllerTest do
use ZooWeb.ConnCase
alias Zoo.Accounts
@create_attrs %{codanimal: 42, codconsulta: 42, data: ~D[2010-04-17], diagnosticoconsulta: "some diagnosticoconsulta", matricula: 42}
@update_attrs %{codanimal: 43, codconsulta: 43, data: ~D[2011-05-18], diagnosticoconsulta: "s... |
03bff8e7ab400bf401450787e74fe8c9d9f346d9 | 1,715 | [
685817317
] | [] | # On peut ajouter des conditions après la signature de la fonction:
# test(a, b) when a < b, do: "a est plus petit"
# test(a, b) wehn b < a, do: "b est plus petit"
#
#
# Créer une module Devinette contenant la fonction compare/2 qui a 2 arguments nombre_secret et essai
# doit retourner "Correct!" si les nombres corresp... |
03bffc0de9d8aaf28cf296913c352e7dd4543741 | 6,270 | [
684054190
] | [
"test",
"ecto"
] | defmodule Feelis.PresentationsTest do
use Feelis.DataCase
alias Feelis.Presentations
describe "presentations" do
alias Feelis.Presentations.Presentation
import Feelis.PresentationsFixtures
@invalid_attrs %{title: nil}
test "list_presentations/0 returns all presentations" do
presentation... |
03c0213fb51203d02cb8a536eb683d151972c6f4 | 2,261 | [
132177214
] | [
"test"
] | defmodule AWLWWMapPropertyTest do
alias DeltaCrdt.AWLWWMap
use ExUnit.Case, async: true
use ExUnitProperties
setup do
operation_gen =
ExUnitProperties.gen all op <- StreamData.member_of([:add, :remove]),
node_id <- term(),
key <- term(),
... |
03c02e9a154c538b32c2f38d9935032cefc875b5 | 12,120 | [
359731184
] | [
"test",
"ecto"
] | defmodule Smsrace.SMSRaceTest do
use Smsrace.DataCase
alias Smsrace.SMSRace
describe "races" do
alias Smsrace.SMSRace.Race
@valid_attrs %{name: "some name", start: "2010-04-17T14:00:00Z"}
@update_attrs %{name: "some updated name", start: "2011-05-18T15:01:01Z"}
@invalid_attrs %{name: nil, start... |
03c0398eea0980a34386b20c9aa46047453f2d44 | 7,939 | [
835468606
] | [
"typespec",
"documented",
"ecto"
] | defmodule WomenInTechVic.Accounts.User do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
alias WomenInTechVic.Accounts.{Profile, UserToken}
alias WomenInTechVic.Content.Event
@type t :: %__MODULE__{
id: pos_integer() | nil,
first_name: String.t() | nil,
last_name: Str... |
03c03fe3a5b3499211449c1c4fe1c3554b22e932 | 2,978 | [
131033971
] | [
"test"
] | defmodule Crux.Structs.TemplateTest do
use ExUnit.Case, async: true
doctest Crux.Structs.Template
test "create" do
template =
%{
"code" => "some code",
"name" => "template name",
"description" => "template description",
"usage_count" => 0,
"creator_id" => "218348... |
03c06e20e469abb91b5543ba16f4edf95f09ba99 | 2,600 | [
796331800
] | [
"liveview",
"documented"
] | defmodule PlaygroundWeb.GamesComponents.SuperHangmanComponent.HowToPlay do
@moduledoc """
A how to play component for super hangman
"""
use PlaygroundWeb, :live_component
@impl Phoenix.LiveComponent
def render(assigns) do
~H"""
<div class="flex flex-col gap-4">
<p>
Have you ever play... |
03c0a45f4bddc8b163ed65a5e1b8881bcd463d87 | 2,009 | [
772680231
] | [] | defmodule ExRTCScore.MixProject do
use Mix.Project
@version "0.1.0"
@github_url "https://github.com/jellyfish-dev/ex_rtcscore"
def project do
[
app: :ex_rtcscore,
version: @version,
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :pro... |
03c0b7e8d41cea27e05a5edf9c10c04fc7a5caf4 | 1,801 | [
159773509
] | [
"phoenix",
"ecto"
] | defmodule PlumaWeb.CommentController do
use PlumaWeb, :controller
alias Pluma.Blog
alias Pluma.Blog.Comment
def index(conn, _params) do
comments = Blog.list_comments(1)
render(conn, "index.html", comments: comments)
end
def new(conn, _params) do
changeset = Blog.change_comment(%Comment{})
... |
03c0e1d148a2758ad14422131c759fb8fe7d991f | 1,892 | [
278310574
] | [
"liveview",
"phoenix",
"documented"
] | defmodule CcbApiWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :ccb_api
# 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: "_ccb_api_ke... |
03c0e6e06ecadd64b8e4e738c7eab2cd7533d281 | 6,710 | [
914291896
] | [
"test",
"ecto"
] | defmodule Server.ProductsTest do
use Server.DataCase
alias Server.Products
describe "categories" do
alias Server.Products.Category
import Server.ProductsFixtures
@invalid_attrs %{name: nil}
test "list_categories/0 returns all categories" do
category = category_fixture()
assert Pro... |
03c19fba785dd1d46070222988f9944c68d391be | 7,346 | [
279312839
] | [
"test"
] | defmodule Plumbapius.Request.SchemaTest do
use ExUnit.Case, async: true
alias Plumbapius.Request.Schema, as: RequestSchema
alias Plumbapius.Request.Schema.NotFoundReqestsParametersError
doctest RequestSchema
describe "#new" do
test "when the tomogram is a valid request schema with 1 body option in 'req... |
03c23f17511adf2cf08f2b364532e0911244ee55 | 2,801 | [
124054266
] | [
"test"
] | defmodule CheckpandaServer.UserTest do
use CheckpandaServer.ModelCase
alias CheckpandaServer.{User}
@valid_attrs %{
api_token: "7C2C6218-FB50-4D23-9C6D-37434A4F8921",
line_id: "1234567890",
line_token: "dummy_token_hogehogefugafugafoobar",
name: "Test Taro",
screen_name: "test_taro"
}
d... |
03c29547ae1e76ae1926b6d846d4e47d45d291b9 | 3,243 | [
116864004
] | [
"test"
] | if !System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("list_ops.exs", __DIR__)
end
ExUnit.start
ExUnit.configure trace: true
defmodule ListOpsTest do
alias ListOps, as: L
use ExUnit.Case
defp odd?(n), do: rem(n, 2) == 1
# @tag :pending
test "count of empty list" do
assert L.count([]) == 0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.