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 |
|---|---|---|---|---|
0be260e1ef061f9a03fb989731f6bca963effead | 1,610 | [
86777108
] | [
"phoenix"
] | # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
Application.put_env(:future_advisor_messaging, :twilio_sid, System.get_env("TWILIO_ACCOUNT_SID"))
Application.put_env(:future_advisor_messaging, :twilio_token, System.get_env("TWILIO... |
0be2bf3e3c4e16f71622971d4bc374e28d2ee7b1 | 2,227 | [
504597551
] | [
"test"
] | defmodule Oban.Plugins.LifelineTest do
use Oban.Case
alias Oban.Plugins.Lifeline
alias Oban.PluginTelemetryHandler
describe "validate/1" do
test "validating interval options" do
assert {:error, _} = Lifeline.validate(interval: 0)
assert {:error, _} = Lifeline.validate(rescue_after: 0)
a... |
0be2f5248a581fd10702f4949b1bc27772a298b9 | 12,341 | [
422428800
] | [
"liveview",
"documented"
] | defmodule CargoShippingWeb.SharedComponents.Datepicker do
@moduledoc """
Pure Phoenix Datepicker component, adapted from https://github.com/aej/liveview_datepicker
Required parameters:
* :id - The unique id, from `input_id(f, :field)`.
* :target_name - The name of the field, from `input_name(f, :field)`.
... |
0be33c727e0d1cd67d88b700c63faa7b8a3cfa42 | 1,740 | [
127781753,
917123261
] | [
"ecto"
] | defmodule Level.Repo.Migrations.AddSearchVectorsToPostsAndReplies do
use Ecto.Migration
def up do
alter table(:posts) do
add :search_vector, :tsvector
end
alter table(:replies) do
add :search_vector, :tsvector
end
execute """
CREATE FUNCTION posts_search_vector_trigger() RETUR... |
0be346acfa5e81368c1d9492116133c36be947a5 | 2,244 | [
60273136
] | [
"documented"
] | defmodule Soapex.Plugs.Soap do
alias Plug.Conn
@behaviour Plug
require Record
Record.defrecordp :wsdl,
Record.extract(:"wsdl", from_lib: "detergent/include/detergent.hrl")
Record.defrecordp :soapEnvelope, :"soap:Envelope",
Record.extract(:"soap:Envelope", from_lib: "detergent/include/deterg... |
0be360d3ca6407513a74c105ac62e8c3b905a62b | 4,796 | [
262660832
] | [
"test"
] | defmodule GreenPayments.Users.RepositoryTest do
use GreenPayments.DataCase
alias GreenPayments.Users.{Repository, User}
doctest GreenPayments.Users.Repository
describe "users repository signup/1" do
@pwd Faker.String.base64(8)
@valid_parameters %{
first_name: Faker.Name.first_name(),
last... |
0be3fb76ecd6e746739b65e7931d683fbd2bc284 | 2,350 | [
423592981
] | [
"liveview"
] | defmodule RaspboardWeb.LightComponents do
use Phoenix.Component
import RaspboardWeb.Components.Expander
def light_switch(assigns) do
~H"""
<div
id={"light-switch-#{@id}"}
class={"
w-32
border border-gray-600 border-opacity-20 rounded-lg
bg-opacity-75
shadow-md... |
0be4ed6d4aacf6cd113b9f98eec17df375ecff53 | 5,492 | [
474495437,
514687923
] | [
"typespec",
"documented"
] | defmodule Stripe.Identity.VerificationSession do
@moduledoc """
Work with Stripe Identity VerificationSession objects.
You can:
- Create a Verification Session.
- List all Verification Sessions.
- Retrieve a verification session with a specified `id`.
- Update a Verification Session.
- Cancel... |
0be59ec016d2d8efe4d579584d52ecb93f223cfb | 2,483 | [
343959665
] | [
"test"
] | defmodule GodwokenIndexer.Block.GlobalStateWorkerTest do
use GodwokenExplorer.DataCase
import Mock
setup do
block = insert(:block)
meta = insert(:meta_contract)
withdrawal_history = insert(:withdrawal_history)
%{block: block, meta: meta, withdrawal_history: withdrawal_history}
end
test "fet... |
0be5c80b3c1e7c034186afce1b5bc364ccc01892 | 1,672 | [
107313437
] | [] | %{"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], []},
"hackney": {:hex, :hackney, "1.9.0", "51c506afc0a365868469dcfc79a9d0b94d896ec741cfd5bd338f49a5ec515bfe", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, optional: false]}, {:idna, "5.1.0", [hex: ... |
0be6283de5f95445871f4fc652a319eaa4087ab8 | 1,978 | [
112758368
] | [
"test"
] | defmodule Day12Test do
use ExUnit.Case, async: false
def instructions do
{:ok, lines} = File.open("aoc/day_12_input.txt", [:read], fn(file) ->
IO.stream(file, :line) |> Enum.map(&String.split/1) |> Enum.map(&parse_line/1) |> Enum.into([])
end)
lines
end
def parse_line([process, "<->" | other... |
0be653b448366170c586b7b6e1560dc0e8696668 | 2,758 | [
448123415
] | [
"typespec",
"documented"
] | defmodule Seurat.WhitePoint do
@moduledoc """
Representation of a white point for a CIE standard illuminant.
A standard illuminant represents a theoretical source of light that can be
used for reliably comparing colors recorded under different lighting
conditions. Each illuminant defines a white point which ... |
0be669571491230868aa0799e86539fe2d85a22b | 6,404 | [
206417,
118678239
] | [
"test",
"phoenix",
"documented"
] | defmodule ViewPaginationTest do
use CouchTestCase
@moduletag :view_pagination
@moduledoc """
Integration tests for pagination.
This is a port of the view_pagination.js test suite.
"""
@tag :with_db
test "basic view pagination", context do
db_name = context[:db_name]
docs = make_docs(0..99)
... |
0be6eb0b817d4894f0c12a378d43e8fc493baccc | 5,101 | [
137688039
] | [
"phoenix",
"ecto"
] | defmodule PresencyWeb.Admin.PostController do
use PresencyWeb, :controller
import PhoenixGon.Controller
alias Presency.CMS
alias Presency.CMS.Post
import Helpers.String, only: [separate_words: 2]
require IEx
def index(conn, params) do
categories = CMS.list_categories()
page = CMS.list_paginated_... |
0be700d16a2e1e7d44a3d5edc0f8b2a9cf426107 | 7,760 | [
137721007
] | [
"documented",
"ecto"
] | defmodule ChatApi.API do
@moduledoc """
The API context.
"""
import Ecto.Query, warn: false
alias Comeonin.Bcrypt
alias ChatApi.Repo
alias ChatApi.API.User
alias ChatApi.API.Chat
alias ChatApi.API.ChatUser
alias ChatApi.API.ChatMessage
@doc """
Returns the list of users.
## Examples
... |
0be717d779b5229481fdd3ac6215f81aef79cf83 | 1,763 | [
160069062
] | [
"test"
] | defmodule History.PriorityQueueTest do
use ExUnit.Case
doctest History.PriorityQueue
import History.PriorityQueue
def test_queue() do
queue = new()
[{{:e, :r}, 5}, {{:h, :i}, 1}, {{:t, :h}, 3}, {{:e, :.}, 8}]
|> Enum.reduce(queue, fn ({el, pri}, q) ->
put(q, el, pri)
end)
end
test "... |
0be71b2830bf9d547687bd20df4cc1ff30661304 | 10,505 | [
198920939
] | [
"test"
] | defmodule Interpreter.ParserTest do
use ExUnit.Case, async: true
doctest Interpreter.Parser
test "parse arithmetic op outside actions and conditions" do
code = "2+2"
assert {:error, :syntax} == Interpreter.Parser.parse(code)
code = "2-2"
assert {:error, :syntax} == Interpreter.Parser.parse(code)... |
0be71eef89afde148b1b95fdbbb67d34fc0b6f08 | 1,692 | [
60999125
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Shipbit.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Shipbit.Web, :controller
use Shipbit.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep them sho... |
0be7e7063f1de4d5bc5182cc08307a46068862ec | 2,006 | [
669180629
] | [
"documented"
] | defmodule Speedswapp.Groups do
@moduledoc false
import Ecto.Query
alias Speedswapp.Accounts.User
alias Speedswapp.Groups.Group
alias Speedswapp.Groups.GroupMembership
alias Speedswapp.Repo
def list(%User{id: user_id}) do
query =
from g in Group,
select: g,
order_by: [asc: :nam... |
0be7f7ef98d7964becd577b9cb6dc6eba00f9e23 | 2,202 | [
416816631
] | [] | defmodule JiraTracker.StoryMapper do
use OpenTelemetryDecorator
alias JiraTracker.Persistence
@story_point_field "customfield_10008"
@decorate trace("JiraTracker.StoryMapper.issue_to_story", include: [:team_id, :jira_key])
def issue_to_story(%{id: team_id}, issue_json) do
fields = Map.get(issue_json, "... |
0be88d2dc4c88e9eb3f6f9771d80f132e707b56b | 9,147 | [
887377354
] | [
"typespec",
"supervisor"
] | defmodule Pleroma.Application do
use Application
import Cachex.Spec
alias Pleroma.Config
require Logger
@name Mix.Project.config()[:name]
@version Mix.Project.config()[:version]
@repository Mix.Project.config()[:source_url]
def name, do: @name
def version, do: @version
def named_version, do: @n... |
0be8b70b939f12c7d99415206ddd570215647c97 | 2,942 | [
249279012
] | [
"typespec",
"documented"
] | defmodule Cryppo.EncryptedData do
@moduledoc """
A struct for encrypted data and encryption artefacts
An `Cryppo.EncryptedData` struct may be marked as belonging to a certain encryption strategy
using field `encryption_strategy_module` containing the module of the encryption strategy.
Can also contain encry... |
0be950f01c7e012c4e22eb8dfa1a394b9c8da347 | 1,556 | [
396147041
] | [
"liveview",
"ecto"
] | defmodule TailwindgenWeb.Pasta5Live.FormComponent do
use TailwindgenWeb, :live_component
alias Tailwindgen.Tcsat5
@impl true
def update(%{pasta5: pasta5} = assigns, socket) do
changeset = Tcsat5.change_pasta5(pasta5)
{:ok,
socket
|> assign(assigns)
|> assign(:changeset, changeset)}
e... |
0be95f32679b1bc8b2dae026aa6f54ad734ef45b | 1,839 | [
454930988
] | [
"macro",
"documented",
"phoenix"
] | defmodule DevCiladaWeb 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 DevCiladaWeb, :controller
use DevCiladaWeb, :view
The definitions below will be executed for every view,
contro... |
0be9b9315cc4536377a1a413ba36b3477653e4c0 | 1,695 | [
746447880
] | [
"ecto"
] | defmodule Lunaris.Orders.NewOrderRequest do
use Ecto.Schema
import Ecto.Changeset
@primary_key false
embedded_schema do
field :id, :string
field :paid, :decimal
field :currency, :string, default: "jpy"
field :point_percentage, :decimal, default: Decimal.new("0.01")
end
def changeset(%Lunar... |
0be9c281c70f9b4a6dca026272b25961e9624927 | 5,123 | [
728762449
] | [] | defmodule GruppieWeb.Repo.SuggestionBoxRepo do
@conn :mongo
@group_team_member_col "group_team_members"
@student_database_col "student_database"
@post_col "posts"
@staff_database_col "staff_database"
@subject_post_coll "subject_posts"
@home_work_post_coll "school_assignment"
@users_col "users"
... |
0be9e85555e0dacbc504fe562a185507f4cd0463 | 3,188 | [
138331536
] | [
"phoenix"
] | defmodule SMSRestWeb.MessageController do
use SMSRestWeb, :controller
require Logger
alias SMSRestWeb.RequestParams
alias SMSRest.SMSCore
action_fallback(SMSRestWeb.FallbackController)
plug(:validate_input when action in [:sendMessage])
def sendMessage(conn, %{"phoneNumber" => number} = params) do
r... |
0bea02dc234af5c26dd9f56346dd7460acf9829e | 4,323 | [
354961891
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hex... |
0bea255c0d2f462b135ec860b8ea0d68b2a20a77 | 5,103 | [
212256983
] | [] | defmodule Brave.Equiptment do
@armor [
%{name: "No Armor", defense: 11, bonus: 1, slots: 0, quality: 7},
%{name: "Gambeson", defense: 12, bonus: 2, slots: 1, quality: 3},
%{name: "Brigandine", defense: 13, bonus: 3, slots: 1, quality: 4},
%{name: "Chain", defense: 14, bonus: 4, slots: 3, quality: 5},
... |
0bea7a7415e856a23bc53900cddc2f38cea1c080 | 2,812 | [
81689125
] | [
"test"
] | defmodule Toolbelt.GitTest do
use ExUnit.Case, async: false
alias Toolbelt.Git
doctest Git
describe "changed_files/0" do
setup [:emulate_git_repo]
test "lists changed files", context do
File.rm("first_file")
File.write("second_file", "update")
File.touch("third_file")
assert Gi... |
0bea8a47294fe388290028c50959d4eae627316a | 2,070 | [
149497682
] | [
"phoenix"
] | defmodule LrElixirDemoServerWeb.CustomObjectController do
use LrElixirDemoServerWeb, :controller
def create_custom_object_by_access_token(conn, params) do
obj_name = params
|> Map.fetch!("object_name")
body = params
|> Map.delete("object_name")
|> Map.delete("auth")
response = params
... |
0beb49baa83b5a1f580e746bfb60036cc31b003a | 2,020 | [
177258301
] | [
"test",
"ecto"
] | defmodule TwitterZPhx.TweetsTest do
use TwitterZPhx.DataCase
alias TwitterZPhx.Tweets
describe "tweets" do
alias TwitterZPhx.Tweets.Tweet
@valid_attrs %{body: "some body", user_id: 42}
@update_attrs %{body: "some updated body", user_id: 43}
@invalid_attrs %{body: nil, user_id: nil}
def twe... |
0beb8230f434db93dcea39b26f3dff5fcc178981 | 7,399 | [
376959663
] | [
"test",
"ecto"
] | defmodule Oli.Resources.NumberingTest do
use Oli.DataCase
alias Oli.Resources.Numbering
alias Oli.Publishing.AuthoringResolver
alias Oli.Delivery.Sections
alias Oli.Publishing
alias Oli.Publishing.DeliveryResolver
alias Oli.Delivery.Hierarchy
describe "container numbering" do
setup do
Seeder... |
0beb94793f61973b43ba3fbb30f86be813a0d36d | 3,280 | [
444023460
] | [
"liveview",
"ecto"
] | defmodule MatchmakerWeb.Components do
use Phoenix.Component
import Phoenix.HTML.Form
import MatchmakerWeb.ErrorHelpers
alias Phoenix.LiveView.JS
def modal(assigns) do
assigns =
assigns
|> assign_new(:header, fn -> [] end)
|> assign_new(:footer, fn -> [] end)
~H"""
<dialog
... |
0beb984be40504c113e87ab59e519ce207a0ee45 | 1,532 | [
693421712
] | [] | defmodule Day9 do
def run(input) do
input
|> parse()
|> Enum.scan(List.duplicate({0, 0}, 10), &step/2)
|> Enum.map(&List.last/1)
|> Enum.uniq()
|> Enum.count()
end
def parse(input) do
input
|> String.split("\n")
|> Enum.flat_map(&parse_line/1)
end
def parse_line(line) do
... |
0bebc9426f14e7a21d81f5a9e5f14533bace6b88 | 2,512 | [
602211247
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Monitoring.V3.Model.MonitoringQueryLanguageCondition do
@moduledoc """
A condition type that allows alert policies to be defined using Monitoring Query Language (https://cloud.google.com/monitoring/mql).
## Attributes
* `duration` (*type:* `String.t`, *default:* `nil`) - The amount of ti... |
0bebdae166b8b1e1e0129861995868850296d947 | 3,143 | [
963846938
] | [
"liveview",
"documented"
] | defmodule Elemental.DataDisplay.Accordion do
@moduledoc """
Implements a vertical stacking accordion component, allowing the display of
content in a stack where only one is showing at a given time.
This is internally build (inline with Daisy) on top of `Elemental.DataDisplay.Collapse`
component using the col... |
0bec311ebece16a0da5e0162396ac2241ed618ef | 6,350 | [
1008964180
] | [
"supervisor",
"documented"
] | defmodule RubberDuckEngines.EngineSupervisor do
@moduledoc """
Dynamic supervisor for managing analysis engine processes.
Handles starting, stopping, and restarting engine processes
with proper isolation and fault tolerance.
"""
use DynamicSupervisor
alias RubberDuckShared.SupervisorStrategy
@doc ""... |
0bec660af9419ec28b993c083f52cb234871df73 | 4,946 | [
1001303514
] | [
"documented"
] | defmodule JumpstartAi.Workers.EmailMarkdownCatchup do
@moduledoc """
One-time worker to generate markdown content for all existing emails in the database
that don't already have markdown content.
This worker should be run once to catch up on historical data. After this initial
run, all new emails will have t... |
0bece4f01987a72cf91cbc322a1b7edc7764b590 | 5,831 | [
373411342
] | [
"typespec",
"documented"
] | defmodule DeepThought.Slack.API.Message do
@moduledoc """
Struct used to represent a message to be sent through Slack API.
"""
alias DeepThought.Slack
alias DeepThought.Slack.{API, User}
alias DeepThought.Slack.API.Message
@derive {Jason.Encoder, only: [:channel, :text, :blocks, :thread_ts, :user]}
@t... |
0bed0db8d2ca6c4245f9ac74100581ca32140bc0 | 3,435 | [
820192032
] | [
"documented"
] | defmodule Sequin.Sinks.Nats.Client do
@moduledoc false
@behaviour Sequin.Sinks.Nats
alias Sequin.Consumers.NatsSink
alias Sequin.Consumers.SinkConsumer
alias Sequin.Error
alias Sequin.NetworkUtils
alias Sequin.Runtime.Routing.RoutedMessage
alias Sequin.Sinks.Nats
alias Sequin.Sinks.Nats.ConnectionCac... |
0bed6fd6f02bcdbf194458edf1351994665118a1 | 1,767 | [
827712858
] | [] | defmodule DcaPhx.MixProject do
use Mix.Project
def project do
[
app: :dca_phx,
version: "0.1.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.17",
elixirc_paths: elixirc_pat... |
0bede6c13d76cd71d8760408f22be2f9e071b2d4 | 3,411 | [
146090693
] | [
"typespec",
"documented"
] | defmodule PBFParser do
@moduledoc """
Elixir parser and decoder for OpenStreetMap PBF format described in [PBF file specification](https://wiki.openstreetmap.org/wiki/PBF_Format#Encoding_OSM_entities_into_fileblocks). This library provides a collection of functions that one can use to build their own decoder flow o... |
0bee1c8540112c90afe97451fed6cb3b87a162ad | 1,955 | [
241737061
] | [
"test"
] | defmodule MindTheGapp.ImportScheduledArrivalTimeTest do
use MindTheGapp.DataCase, async: true
alias MindTheGapp.Mta.ImportScheduledArrivalTime
alias MindTheGapp.Repo
alias MindTheGapp.ScheduledArrivalTime, as: ScheduledArrivalTimeSchema
setup do
stop_time_data_file_name = "fake_time.txt"
FakeSchedule... |
0bee40e6da1e0399fc89a2a512681d85b09db27b | 3,743 | [
638004661
] | [
"liveview"
] | defmodule YeehaaWeb.BlobComponents do
use YeehaaWeb, :html
import YeehaaWeb.HomepageHelperComponents
attr(:shape, :integer, default: 1)
attr(:id, :string, default: nil)
attr(:class, :string, default: nil)
attr(:bg_color, :string, default: "sun")
slot :inner_block
def blob(assigns) when assigns.shape =... |
0bee42bcb68bad7c6834719eca59fad123208954 | 2,290 | [
472853012
] | [
"documented"
] | defmodule WebhookProcessor.Endpoint do
@moduledoc """
A Plug responsible for logging request info, parsing request body's as JSON,
matching routes, and dispatching responses.
"""
alias WebhookProcessor.Person
use Plug.Router
# This module is a Plug, that also implements it's own plug pipeline, below:
... |
0bee4db6ecb7acb1e6bf8e2d9fe4c20ef281a5c5 | 2,043 | [
338131945
] | [
"genserver",
"documented"
] | defmodule NoozoWeb.Admin.Page.IndexView do
@moduledoc """
Admin pages index live view
"""
use NoozoWeb, :surface_view
alias Noozo.Core
alias Noozo.Pagination
alias NoozoWeb.Admin.Page.CreateView
alias NoozoWeb.Admin.Page.EditView
data loading, :boolean, default: true
@impl true
def render(assi... |
0beec9152d37b7961b537ddd79f5cc25458a1198 | 4,441 | [
342369232
] | [
"typespec",
"documented"
] | defmodule Score.Statistics do
@moduledoc """
This module contains statistic functions from players
"""
@file_path "./assets/static/json/rushing.json"
@external_resource @file_path
@json_data @file_path
|> File.read!()
|> Jason.decode!()
|> Stream.with_index()
... |
0beee37b2f975a9ec0ca61fb9fbd038e3ea485f1 | 3,722 | [
461459764,
358055624
] | [] | import Config
# Enable the Nerves integration with Mix
Application.start(:nerves_bootstrap)
# Customize non-Elixir parts of the firmware. See
# https://hexdocs.pm/nerves/advanced-configuration.html for details.
config :nerves, :firmware,
rootfs_overlay: "rootfs_overlay",
provisioning: "config/provisioning.conf"
... |
0bef8699639de89e8d48c17bd64053c3315814ae | 1,559 | [
880249218
] | [
"liveview",
"phoenix"
] | defmodule PhoenixElixirWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :phoenixElixir
# 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:... |
0befb11a015a5330d1e4703d01d319e9b5a143dc | 1,854 | [
281521103
] | [
"typespec",
"documented"
] | defmodule Training.Turnstile do
use GenStateMachine, callback_mode: :state_functions
# This allows our graphviz directed graph to be rendered
# as an image in the documentation
import Training.Util.Graphviz
@fsm_diagram """
digraph {
rankdir=LR
node [shape=doublecircle]
locked
node [shape=... |
0befb53c41f9941e4b5dfeca07058a87c0ebf435 | 2,553 | [
29137919
] | [
"test"
] | defmodule UserTest do
use ExUnit.Case
setup do
Mix.Tasks.Ecto.Migrate.run(["--all", "LambdaDays.Repo"])
on_exit fn ->
Mix.Tasks.Ecto.Rollback.run(["--all", "LambdaDays.Repo"])
end
end
def email do
"<EMAIL>"
end
def username do
"pawel"
end
def valid_user do
%LambdaDays.... |
0befcd09413a3fd192062e6b125abac502c46561 | 1,630 | [
247452761,
258780517
] | [
"macro",
"documented",
"phoenix"
] | defmodule PhxchatWeb 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 PhxchatWeb, :controller
use PhxchatWeb, :view
The definitions below will be executed for every view,
controller, ... |
0befdc164ebe2e999aa8fa0f73595ac4ef96365e | 2,868 | [
171891748
] | [] | defmodule MoodleLib.Client.Cohorts do
import MoodleLib.Client.Common, only: [process_request: 2]
def get_cohort(id) do
%{"cohortids[0]" => id}
|> process_request(:core_cohort_get_cohorts)
|> handle_got_cohort()
end
def create_cohort(params) do
params
|> Map.put("categorytype][type", "syste... |
0bf02c88d91342be96fa9e2908d0b5ed1813a934 | 6,959 | [
891236060
] | [] | defmodule DbApi.Db do
def run_command(command, client_name) do
with {:ok, [db_path, transactions_list_path, transactions_data_path]} <- ensure_database_files_created(),
{:ok, [validated_command, key, value]} <- validate_command(command) do
file_paths = [db_path, transactions_list_path, transactio... |
0bf0b07c44097c2ce12f09974201c2fb4f01540f | 5,671 | [
75755038
] | [
"documented"
] | defmodule Mangoex.Behaviour do
@moduledoc """
Public API for MangoEx
"""
@doc """
Authorises Mangoex to use MangoPay
## Examples
iex> Mangoex.Client.auth("CLIENT_ID", "PASSPHRASE")
{:ok,
%{"access_token" => "99999999999999999999", "expires_in" => 1199, "token_type" => "bearer"}
"""
@... |
0bf0c63d0bc5f2b561fae73f7853f5373ec17be9 | 1,767 | [
462090220
] | [
"typespec",
"documented"
] | defmodule Smt.Interpreter.ExileZ3 do
@moduledoc """
Z3 interaction through `Exile`.
"""
@behaviour Smt.Interpreter.Instance
@opaque t() :: %__MODULE__{
pid_consumer: pid(),
pid_producer: pid()
}
defstruct [:pid_consumer, :pid_producer]
@impl Smt.Interpreter.Instance
@spec w... |
0bf0d61897c4e8b9586d1e7e558ae5a6417afb11 | 14,982 | [
248702688
] | [
"typespec",
"documented",
"ecto"
] | defmodule Core.Media do
@moduledoc """
The Media context.
"""
use Core.Context
import Ecto.Query, warn: false
alias Ecto.Multi
alias Core.{
Media.File,
Media.Picture,
Media.ProDoc,
Media.Signature,
Media.TpDoc,
Repo,
Upload
}
@bucket Application.compile_env(:core, Core... |
0bf17bd67236f3b5ef73612597feeaebcef1e65f | 2,970 | [
582071131
] | [
"phoenix"
] | defmodule TrelloCloneWeb.Router do
use TrelloCloneWeb, :router
import TrelloCloneWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {TrelloCloneWeb.LayoutView, :root}
plug :protect_from_forgery
plug :put_secure_brow... |
0bf20aa3819b4607ac5b955faa29b2a8455bf56d | 2,717 | [
866877427
] | [
"liveview"
] | defmodule PhotoTaggerWeb.GalleryLive.GalleryPhoto do
use PhotoTaggerWeb, :live_component
alias PhotoTagger.Uploaders.ImageUploader
attr(:photo_id, :string, required: true)
attr(:photo_group, :string, default: nil)
attr(:photo_name, :string, required: true)
attr(:photo_image, :string, required: true)
attr... |
0bf27c87b7719cb56e9e7bac820e31859c04c15d | 2,401 | [
260795184
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule LiveViewScratchWeb 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 LiveViewScratchWeb, :controller
use LiveViewScratchWeb, :view
The definitions below will be executed for ev... |
0bf29a0383a1edc6105755029499eceab8c24093 | 14,685 | [
717039945,
717831055
] | [
"test",
"phoenix",
"ecto"
] | defmodule Web.AreaNotificationChannelTest do
use Web.ChannelCase
import Ecto.Query
alias BillBored.Notifications.AreaNotification
alias BillBored.Notifications.AreaNotificationReception
alias BillBored.Notifications.AreaNotifications.MatchData
setup do
user = insert(:user, sex: "M")
%{key: token}... |
0bf32278413452bcde3ddcbbe96383d3d9344741 | 5,482 | [
165997818
] | [] | alias Risteys.FGEndpoint
alias Risteys.Phenocode
alias Risteys.Repo
require Logger
Logger.configure(level: :info)
[pheno_geno_corr_filepath, geno_variants_filepath | _] = System.argv()
endpoints =
Repo.all(Phenocode)
|> Enum.reduce(%{}, fn endpoint, acc ->
Map.put_new(acc, endpoint.name, endpoint)
end)
Logge... |
0bf34e2dc709c313b4024c09cb621dd6d1be5bbd | 1,500 | [
882014996
] | [] | import Config
config :mbta_metro, MbtaMetroWeb.Endpoint,
adapter: Bandit.PhoenixAdapter,
check_origin: false,
code_reloader: true,
debug_errors: true,
http: [ip: {127, 0, 0, 1}, port: 4000],
live_view: [signing_salt: "F_IrwXSetja22gAl"],
pubsub_server: MbtaMetro.PubSub,
secret_key_base: "TcvJhq/n8JgjzZ... |
0bf3f1cc3d73bfb9a3c5ec4828a99e0239885a04 | 2,253 | [
342484186
] | [
"typespec",
"documented"
] | defmodule MBS.Cache.File do
@moduledoc false
alias MBS.CLI.Reporter
alias MBS.{Config, Const}
require MBS.CLI.Reporter.Status
@spec put(Config.Data.t(), String.t(), String.t(), String.t()) :: :ok
def put(%Config.Data{remote_cache: %Config.Data.RemoteCache{push: push}}, name, checksum, target) do
loca... |
0bf40c34f891dc6fd383834b967dd311a5349192 | 1,915 | [
411780014
] | [
"liveview"
] | defmodule ChirpWeb.PostLive.PostComponent do
use ChirpWeb, :live_component
def render(assigns) do
~L"""
<script src="https://kit.fontawesome.com/d07169d6d4.js" crossorigin="anonymous"></script>
<style>
.post {
width: 768px;
border: 0.5px solid DarkCyan;
border-style: inset;
... |
0bf418700aefc4cea792da2d462c55e6b6e4d975 | 18,758 | [
739262096,
223255738,
1234714,
742840268,
139261729
] | [
"test"
] | Code.require_file("test_helper.exs", __DIR__)
defmodule CalendarTest do
use ExUnit.Case, async: true
doctest Calendar
describe "strftime/3" do
test "returns received string if there is no datetime formatting to be found in it" do
assert Calendar.strftime(~N[2019-08-20 15:47:34.001], "same string") == ... |
0bf5907e4c10ced86a3bd1b5b26d0ebcbc96a2fe | 1,837 | [
29372051
] | [
"genserver"
] | defmodule TcpClient do
use GenServer
require Logger
# TCP Client. Runs as a separate independent process. It talks to TCPServer and forwards
# any messages from Server back to the 'callback'. In our case that's the WS Server.
# State
defmodule SocketState do
defstruct sock: nil, callback: nil
end... |
0bf5dd8174e6863d2f10c0400eb572905e5fa1b4 | 1,844 | [
677880414
] | [
"test",
"ecto"
] | defmodule Conduit.AuthorsTest do
use Conduit.DataCase
alias Conduit.Authors
describe "authors" do
alias Conduit.Authors.Author
import Conduit.AuthorsFixtures
@invalid_attrs %{name: nil}
test "list_authors/0 returns all authors" do
author = author_fixture()
assert Authors.list_auth... |
0bf6030716b84920fab5df1e00a28c8a67e3dbc0 | 1,832 | [
717039945,
717831055
] | [
"typespec",
"ecto"
] | defmodule BillBored.Post.Comment do
use BillBored, :schema
use Arbor.Tree
use BillBored.User.Blockable, foreign_key: :author_id
alias BillBored.{Post, User, Interest, Upload}
import Ecto.Changeset
import BillBored.Helpers, only: [media_files_from_keys: 1]
@type t :: %__MODULE__{}
schema "posts_comme... |
0bf61b40759ceea2fd3d2def39aff229972b44fe | 8,124 | [
571776611
] | [] | defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
alias Pleroma.Config
import Plug.Conn
require Logger
def init(opts), do: opts
def call(conn, _options) do
if Config.get([:http_security, :enabled]) do
conn
|> merge_resp_headers(headers())
|> maybe_send_sts_header(Config.get(... |
0bf6c7eb50fb4c4771ee31af8ec57e9eea48c140 | 2,444 | [
485454109
] | [
"liveview",
"macro",
"documented",
"phoenix"
] | defmodule PipaBankWeb 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 PipaBankWeb, :controller
use PipaBankWeb, :view
The definitions below will be executed for every view,
controlle... |
0bf702cd3b7a42cfd9a558f6cfe53e2ff3d06545 | 2,037 | [
218414575
] | [
"test",
"ecto"
] | defmodule Time1.SheetsTest do
use Time1.DataCase
alias Time1.Sheets
describe "sheets" do
alias Time1.Sheets.Sheet
@valid_attrs %{approve_status: true, date: ~D[2010-04-17]}
@update_attrs %{approve_status: false, date: ~D[2011-05-18]}
@invalid_attrs %{approve_status: nil, date: nil}
def she... |
0bf72fed149fb4d57c04dd2044851585c1ee7479 | 2,180 | [
550956505
] | [
"test"
] | defmodule BitpandaApi.Api.Public.AssetsTest do
use ExUnit.Case
doctest BitpandaApi
alias BitpandaApi.Api.Public.Assets
alias BitpandaApi.Entity.Asset, as: AssetEntity
test "should collect assets by class type stock" do
{:ok, assets} = Assets.get_by_class(:stock)
assert length(assets) > 2000
ass... |
0bf795a7cbc9c39f3740116f859f924dac010efc | 11,651 | [
993009676
] | [
"genserver",
"typespec",
"documented"
] | defmodule ElixirScope.Foundation.Infrastructure.CircuitBreaker do
@moduledoc """
Circuit Breaker GenServer implementation for Foundation service protection.
Provides automatic failure detection and recovery with graceful degradation.
Establishes resilience patterns for higher layers (AST, etc.).
## States
... |
0bf796f74ff1d4e2513b1f1b73b173ec66b412c9 | 1,684 | [
162291991
] | [
"phoenix"
] | defmodule PhxApiWeb.ReleaseHistoryController do
use PhxApiWeb, :controller
alias PhxApi.Histories
alias PhxApi.Histories.ReleaseHistory
action_fallback PhxApiWeb.FallbackController
def index(conn, _params) do
release_history = Histories.list_release_history()
render(conn, "index.json", release_hist... |
0bf80a8a57bc89597ad5dd65e5ee7b1d52a1b5ef | 3,474 | [
695318649,
224534171
] | [
"test"
] | defmodule Phoenix.LiveDashboard.HelpersTest do
use ExUnit.Case, async: true
import Phoenix.LiveDashboard.Helpers
alias Phoenix.LiveDashboard.SystemInfo
test "format_value/1" do
# This exists to appease the `live_patch` with a basic value which works, but
# we don't need to return anything else because... |
0bf845e2ffffc01da13ab03f64bd381f8076b160 | 2,146 | [
614957742
] | [] | defmodule ZaqueuWeb.CreditCardLive.Show do
use ZaqueuWeb, :live_logged_in
import ZaqueuWeb.DisplayHelpers
alias Zaqueu.Financial.Queries.CreditCardQueries
alias Zaqueu.Financial.Queries.InvoiceQueries
@impl true
def mount(_params, _session, socket), do: {:ok, socket}
@impl true
def handle_params(
... |
0bf863254dabfa2249108f527e3cf9a401be1617 | 9,636 | [
166803803
] | [
"typespec",
"documented"
] | defmodule WebInspector do
@moduledoc """
Documentation for WebInspector.
"""
# pretend to be a Firefox but add Unfurl component for semi-good citizenship
@user_agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:73.0) Gecko/20100101 Firefox/73.0 Unfurl/1.0"
require Logger
alias WebInspector.Adapter... |
0bf870f8a38220723f7fae0f04a07b66b44fe59f | 3,926 | [
930600936
] | [
"test",
"ecto"
] | defmodule TriviaAdvisor.Events.EventTest do
use TriviaAdvisor.DataCase
use ExUnit.Case
alias TriviaAdvisor.Events.Event
alias TriviaAdvisor.Locations.{Country, City, Venue}
# ✅ Keep all currency parsing tests
describe "currency parsing" do
setup do
# Set up test data
{:ok, country} = Repo.... |
0bf8d2ecb0597a93be48dc60d8526cb54fc72657 | 16,464 | [
168752200
] | [] | %{
"artificery": {:hex, :artificery, "0.4.2", "3ded6e29e13113af52811c72f414d1e88f711410cac1b619ab3a2666bbd7efd4", [:mix], [], "hexpm", "514586f4312ef3709a3ccbd8e55f69455add235c1729656687bb781d10d0afdb"},
"bcrypt_elixir": {:hex, :bcrypt_elixir, "2.2.0", "3df902b81ce7fa8867a2ae30d20a1da6877a2c056bfb116fd0bc8a5f0190ce... |
0bf93fb92a45b0c70509af6d2437d05f7a55ce95 | 16,361 | [
1019126840
] | [
"test"
] | defmodule DSPex.Adapters.TypeConverterTest do
use ExUnit.Case, async: true
alias DSPex.Adapters.TypeConverter
doctest TypeConverter
@moduletag :layer_1
describe "dspy_to_elixir/1" do
test "converts basic DSPy types to Elixir types" do
assert TypeConverter.dspy_to_elixir("str") == :string
a... |
0bfa19034c3d8832392c6388f47a9fe04c500dbc | 16,725 | [
248702688
] | [
"test"
] | defmodule ServerWeb.GraphQL.Integration.Landing.PressArticleIntegrationTest do
use ServerWeb.ConnCase
alias Server.AbsintheHelpers
alias ServerWeb.GraphQL.Schema
describe "#list" do
it "returns press articles - `AbsintheHelpers`" do
struct_a = insert(:press_article)
struct_b = insert(:press_ar... |
0bfa291b1bee085644674206d7574c0456441e2b | 2,146 | [
821952200
] | [] | # 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 :brbackend, Brbackend.Redix,
host: "redis-16... |
0bfa6581df857bc92a4d30ce1c7e1226f553a45d | 3,404 | [
27677912
] | [
"phoenix"
] | defmodule Abutment.TaskController do
use Phoenix.Controller
alias Abutment.TaskModel
alias Abutment.Repo
alias Abutment.Router
import Ecto.Query
plug Abutment.Authenticate
plug :action
# GET /tasks
def index(conn, params) do
params = clean_params(params)
query = TaskModel.list(params)
q... |
0bfae67ee6c0c8ff9b6998d2d15a964b38732759 | 5,785 | [
810146441
] | [
"documented"
] | defmodule ChinaAdminDivisions.Gen.Lv4xg.M4408 do
@moduledoc false
def name("440883111000"), do: "兰石镇"
def name("440883109000"), do: "黄坡镇"
def name("440883107000"), do: "塘㙍镇"
def name("440883106000"), do: "吴阳镇"
def name("440883105000"), do: "樟铺镇"
def name("440883104000"), do: "振文镇"
def name("44088310300... |
0bfb4ac6a8c7a341da4bd69ab11756bf968a32d8 | 2,440 | [
290058119
] | [] | defmodule TicTacToe.Board do
def new() do
[[:empty, :empty, :empty], [:empty, :empty, :empty], [:empty, :empty, :empty]]
end
defp string_of_piece(:empty), do: " "
defp string_of_piece(:x), do: "X"
defp string_of_piece(:o), do: "O"
def pretty_print_row(row) do
Enum.map(row, fn slot -> " #{string_of... |
0bfc551fad81a99b1ffd90399c35a20e6b49b2bd | 2,356 | [
733038279
] | [
"documented"
] | defmodule DbService do
@moduledoc false
alias DbService.Cache
require Logger
@threads 150
@doc false
def drop_table_test do
MyXQL.query!(:myxql, "DROP TABLE IF EXISTS `hsa1016`.`test`;")
end
@doc false
def create_test_table do
MyXQL.query!(:myxql, "
CREATE TABLE IF NOT EXISTS `hsa101... |
0bfc6fcf20da0dfe9d96cba8ba35edeadc1edbb8 | 6,155 | [
157626295
] | [] | # This file contains the configuration for Credo and you are probably reading
# this after creating it with `mix credo.gen.config`.
#
# If you find anything wrong or unclear in this file, please report an
# issue on GitHub: https://github.com/rrrene/credo/issues
#
%{
#
# You can have as many configs as you like in ... |
0bfce9a0d61f5f7843337665ad1244aebb426265 | 1,977 | [
213455869
] | [
"test",
"phoenix"
] | defmodule CrawlerChallengeWeb.SearchControllerTest do
use CrawlerChallengeWeb.ConnCase, async: false
alias CrawlerChallengeWeb.SearchController
describe "index/2" do
test "returns {:valid, process} and render a json", %{conn: conn} do
court = insert(:courts)
process = insert(:another_process, co... |
0bfd56a1d7760bcd1b7079e89638b45882e3aaaf | 1,542 | [
849500017,
803850460
] | [] | import Config
~w(config config_helper.exs)
|> Path.join()
|> Code.eval_file()
hackney_opts = ConfigHelper.hackney_options()
timeout = ConfigHelper.timeout(1)
config :indexer,
block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"),
json_rpc_named_arguments: [
transport:
... |
0bfdd478bf1710152c6432a75bd4749ea8e3300e | 6,588 | [
166803803
] | [] | %{
"bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: f... |
0bfe5ee69bd28ee1065194420994d177b9f0dab0 | 1,743 | [
186985013
] | [
"test"
] | defmodule Metric.Measurements.ValidatorTest do
use Metric.DataCase
alias Metric.Measurements.Validator
alias Metric.Measurements.{Pulse, Pressure, Temperature}
import Metric.Factory
describe "create_changeset/2" do
setup do
{:ok, user: insert(:user)}
end
test "when all params are valid", %... |
0bfe9d21f2fd485c3823cec9ece791441c2a9dc5 | 3,625 | [
650889764
] | [
"documented",
"ecto"
] | defmodule BnApis.Stories.StoryLegalEntityMapping do
use Ecto.Schema
import Ecto.Query
import Ecto.Changeset
alias BnApis.Repo
alias BnApis.Stories.Story
alias BnApis.Stories.LegalEntity
alias BnApis.Stories.StoryLegalEntityMapping
schema "story_legal_entity_mappings" do
belongs_to(:story, Story)
... |
0bfea0574d930ae688782c09e84ddda99c01394d | 1,989 | [
992898427
] | [
"documented",
"ecto"
] | defmodule TronTetris.Game.ScoreService do
@moduledoc """
Service module for managing high scores and saved games.
"""
import Ecto.Query
alias TronTetris.Repo
alias TronTetris.Game.{HighScore, SavedGame}
alias TronTetris.Accounts.Player
@doc """
Saves a high score.
"""
def save_high_score(
... |
0bfea5c94b1aa3e8611426d1956f35be63e83d79 | 19,128 | [
742555614
] | [
"typespec",
"documented",
"ecto"
] | defmodule FruitPicker.Accounts do
@moduledoc """
The Accounts context.
"""
import Ecto.Query, warn: false
import Argon2, only: [check_pass: 2, no_user_verify: 0]
alias FruitPicker.{Mailer, Mapbox, Repo, Mailchimp}
alias FruitPicker.Accounts.{
MembershipPayment,
PasswordResetToken,
Person,
... |
0bfead7f16c5ecefc4c132e8e29e269007ac7766 | 1,888 | [
584923183
] | [] | defmodule Identicon do
def main(input) do
input
|> hash_input()
|> pick_color()
|> build_grid()
|> filter_odd_squares()
|> build_pixel_map()
|> draw_image()
|> save_image(input)
end
def save_image(image, filename) do
File.write!("#{filename}.png", image)
end
def draw_imag... |
0bff965380e597423be6c1f0a17198473a24de7a | 3,491 | [
726654702
] | [
"liveview",
"phoenix"
] | defmodule Web.TeamDashboardLive do
use Web, :live_view_app_layout
alias App.Adapter.D4H
alias App.Operation.RefreshD4HData
alias App.ViewData.TeamDashboardViewData
def mount(_params, _session, socket) do
current_team = socket.assigns.current_team
view_data = TeamDashboardViewData.build(current_team)... |
0bff9deab346c53867b6d11a153e3dee61f886e8 | 2,234 | [
82465175
] | [] | defmodule Paraaz.NotificationService do
alias Paraaz.Domain.Notification
alias Paraaz.Domain.User
alias Riak.CRDT.Map
alias Ghuguti
def bucket_type do
Application.get_env(:paraaz, :bucket_type)
end
def bucket_name do
Application.get_env(:paraaz, :bucket_name)
end
def save(user_id, category_... |
0c0057a8b753cfaa937608571b7ab94c07d35390 | 7,751 | [
492752264,
327711808,
554455380
] | [
"typespec",
"documented"
] | defmodule Livebook.Runtime.Evaluator.Formatter do
require Logger
@compile {:no_warn_undefined, {Kino.Render, :to_livebook, 1}}
@compile {:no_warn_undefined, {Kino.Render, :impl_for, 1}}
@compile {:no_warn_undefined, {Pythonx, :eval, 2}}
@compile {:no_warn_undefined, {Pythonx, :decode, 1}}
@doc """
Forma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.