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 |
|---|---|---|---|---|
08ce4504688761d334eedf2562e1c7394bdd5142 | 1,824 | [
380275382
] | [
"liveview",
"phoenix"
] | defmodule TorchDemoWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :torch_demo
# 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: "_torc... |
08ce85c5070f17990b1df35df72bbe2f7f32cc0c | 1,869 | [
198882690
] | [
"typespec",
"documented",
"ecto"
] | defmodule Drama.EventStore.InMemoryAdapter do
@moduledoc """
Implements an in-memory Event Store using Agents.
"""
@behaviour Drama.EventStore.Adapter
use Agent
alias Drama.Event.PersistedEvent
@spec start_link(keyword) :: GenServer.on_start()
def start_link(opts \\ []) do
initial_state = Keywor... |
08ce9ef9b8a45b8752ffec335998009930606a7f | 7,549 | [
102094797
] | [
"test",
"phoenix"
] | defmodule CgratesWebJsonapi.TariffPlans.TpSharedGroupControllerTest do
use CgratesWebJsonapi.ConnCase
alias CgratesWebJsonapi.TariffPlans.TpSharedGroup
alias CgratesWebJsonapi.Repo
import CgratesWebJsonapi.Factory
import CgratesWebJsonapi.Guardian
setup do
user = insert(:user)
{:ok, token, _} = e... |
08cee4d8fe1326b4d0543a6cd6b910eae1fa389f | 5,241 | [
75827326
] | [
"documented"
] | defmodule Tsp.Island do
require Logger
@moduledoc """
The main module for the Island model algorithm
Each island process works on its own population to find the solution specified by
the minimum distance value. Occasionally (see Migration Gap) an island's best candidates
are migrated between neighbouring ... |
08cee6780a8e81ac73c70712b9ee011fb4bc2e13 | 2,438 | [
193244709,
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.Admin.Directory_v1.Model.UserPhoto do
@moduledoc """
## Attributes
* `etag` (*type:* `String.t`, *default:* `nil`) - ETag of the resource.
* `height` (*type:* `integer()`, *default:* `nil`) - Height of the photo in pixels.
* `id` (*type:* `String.t`, *default:* `nil`) - The ID the... |
08cefed3df895a9a37fcc06a3a1b193f9314574c | 15,949 | [
725613728
] | [] | defmodule Mix.Tasks.D08.P1 do
use Mix.Task
import AdventOfCode.Day08
@shortdoc "Day 08 Part 1"
def run(args) do
input = """
LLRRRLRLLRRLLRLRLRLRRLRRRLRRRLRLRRLLRLLRRRLRRLRRRLRLRRRLRRLRLRRRLRRRLRRLRLRRRLRRLRRLRRRLRLRLLRLLRLLRLRRRLRRLRRLRRRLRLRRRLRLRLRLRRRLRRRLRLRLRLRRRLRLLRRLLRLLRRLRRRLLRRRLLRRLRLRRLRL... |
08cfc737cbc70b0b30da487135360f2feeaff306 | 1,551 | [
84312659,
88693118,
104878440,
84948074,
96578220,
87634870,
724434898
] | [
"macro",
"documented",
"phoenix"
] | defmodule Messengyr.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Messengyr.Web, :controller
use Messengyr.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep th... |
08cfca69edf79169a7c4c494f89d29e48684f3b3 | 7,069 | [
247818678
] | [
"documented",
"ecto",
"phoenix"
] | defmodule Toast.Services.Toast do
@moduledoc """
Documentation for `PhxIzitoast` - Phoenix Notification Package.

## Configuration
Add the below config to `config/config.exs`. This includes the default configurations. ... |
08d044672dccc6825327aadd6630790a4e7cd05c | 8,720 | [
216331270
] | [
"genserver",
"documented"
] | defmodule Sonox.Discovery do
@moduledoc """
Module to run the discovery of the speaker inside the current network
"""
use GenServer
@playersearch ~S"""
M-SEARCH * HTTP/1.1
HOST: <IP_ADDRESS>:1900
MAN: "ssdp:discover"
MX: 1
ST: urn:schemas-upnp-org:device:ZonePlayer:1
"""
@multicastaddr {239, 25... |
08d0da96d38039ad63c4a153d74e03bf24c01255 | 2,029 | [
428815090
] | [
"documented"
] | defmodule Polaris.OptionList do
@moduledoc """
The option list component lets you create a list of grouped items that merchants can pick from. This can include single selection or multiple selection of options. Option list usually appears in a popover, and sometimes in a modal or a sidebar. Option lists are styled ... |
08d117eb6a6a626f75625d323ebc5d76a15e61d8 | 2,665 | [
447849026
] | [
"test",
"documented"
] | defmodule Chrello.ModelAssignImplementationTest do
@moduledoc """
Tests of Assign behaviour implementations for Task and Checklist
"""
use ExUnit.Case, async: true
alias Chrello.Model.{Task, Checklist}
setup do
tasks = Chrello.TestData.Load.tasks()
tasks = Task.get_tasks_from_task_list(Jason.decod... |
08d1e4eb71f1aefa75af4f975b05c9c0663ca0a8 | 5,819 | [
823529769
] | [
"typespec",
"macro",
"documented",
"phoenix"
] | defmodule ShopifyTools.AuthController do
@moduledoc """
You can use this module inside of another controller to handle initial iFrame load and shop installation
Example:
```elixir
defmodule MyAppWeb.AuthController do
use MyAppWeb, :controller
use ShopifyTools.AuthController
# Thats it! Validati... |
08d2fd50d9162a79fccdcd997edf24cd3a699615 | 3,767 | [
90283938
] | [
"documented"
] | defmodule GenMetricsBench.Pipeline do
alias GenMetrics.GenStage.Pipeline
alias GenMetricsBench.GenStage.Producer
alias GenMetricsBench.GenStage.ProducerConsumer
alias GenMetricsBench.GenStage.Consumer
alias GenMetricsBench.Utils.Runtime
@moduledoc """
GenMetricsBench harness for GenStage Pipelines.
T... |
08d314337b73337652d9352d6cec298f53585846 | 1,775 | [
708077969
] | [] | defmodule Day10 do
def run do
input = File.read!("inputs/day10.txt")
part1(input) |> IO.puts()
part2(input) |> IO.puts()
end
def part1(input) do
input
|> parse_instr()
|> build_pipeline()
|> run_pipeline()
|> then(&elem(&1, 2))
|> Enum.sum()
end
def part2(input) do
in... |
08d34496baa9912bffe9d0ac0644606761745bda | 1,629 | [
848694898
] | [
"genserver"
] | defmodule EjabberdRcp.ReactionStreamer do
use GenServer
def start_link({message_id, conn}) do
user_reactions = EjabberdRcp.ReactionsRepo.get_message_user_reaction(message_id)
GenServer.start_link(__MODULE__, {user_reactions, conn}, name: __MODULE__)
end
# for sending messages to db
def reactions_to_... |
08d35bc43419bd277d7d5c8d87bed2d0538bebdc | 1,550 | [
55327297
] | [
"documented",
"ecto"
] | defmodule Trucksu.Score do
use Trucksu.Web, :model
@derive {Poison.Encoder, only: [
:id,
:score,
:max_combo,
:full_combo,
:mods,
:count_300,
:count_100,
:count_50,
:katu_count,
:geki_count,
:miss_count,
:time,
:game_mode,
:accuracy,
:pass,
:beatmap,
... |
08d36153a1c4dd6e56ba1a2fe910335722d31f74 | 1,598 | [
72841254,
80811189
] | [
"test"
] | defmodule Playdays.Services.Consumer.PrivateEvent.AcceptPrivateEventInvitationTest do
use Playdays.ModelCase, async: false
alias Playdays.Repo
alias Playdays.Consumer
alias Playdays.PrivateEvent
alias Playdays.Services.Consumer.PrivateEventInvitation.AcceptPrivateEventInvitation
setup do
place = creat... |
08d39b5a89cbe3a430fc9261825025e4e24e16bc | 5,300 | [
229897765
] | [
"macro",
"documented"
] | defmodule QasMicro.Config.ConfigFetcher do
require Logger
def config(_app) do
raise("you should set your own config_fetcher module to get the config from application")
end
def handle_sync_log(_app, _log) do
end
end
defmodule QasMicro.Config do
@moduledoc """
Config for qas
"""
@doc false
def... |
08d3ed20e0b97c5519664e26109361f0b16f3dbc | 9,589 | [
121962401
] | [
"test"
] | defmodule JsonSchemaTestSuite.Draft4.TypeTest do
use ExUnit.Case
import JsonXema, only: [valid?: 2]
describe ~s|integer type matches integers| do
setup do
%{schema: JsonXema.new(%{"type" => "integer"})}
end
test ~s|an integer is an integer|, %{schema: schema} do
assert valid?(schema, 1)... |
08d44df067640adf4dc88e4b6cd9f247cbba5eae | 3,085 | [
165997818
] | [] | # Import Cox regression data
#
# Usage:
# mix run import_coxhr.exs <csv-file-cox>
#
# where <csv-file-cox> is a CSV file with data for many pairs of
# endpoints, with the following header columns:
# - prior
# - outcome
# - lag_hr
# - nindivs_prior_outcome
# - prior_hr
# - prior_ci_lower
# - prior_ci_upper
# - prior_p... |
08d44e9f64e2cc84886a43174ebf57b618bc8a37 | 4,924 | [
305378615,
614036462
] | [
"liveview",
"test"
] | defmodule WatwitterWeb.ComposeLiveTest do
use WatwitterWeb.ConnCase, async: false
import Phoenix.LiveViewTest
alias Watwitter.CloudinaryUpload
setup :register_and_log_in_user
setup do
on_exit(fn ->
File.rm_rf!(uploads_dir())
File.mkdir!(uploads_dir())
end)
end
test "user can creat... |
08d494abfe32b746cabc79e496063180f320a095 | 3,131 | [
911412968
] | [] | defmodule Assistify.MixProject do
use Mix.Project
def project do
[
app: :assistify,
version: "0.1.0",
elixir: "~> 1.18.1",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
test_coverage: [tool: ExCove... |
08d49aebb983c08cf0d0b78b6ba433d849d2aec4 | 2,412 | [
76412658
] | [
"genserver",
"macro"
] | defmodule Dolphin.Worker do
defstruct [
name: nil,
]
defmacro __using__(opts) do
quote do
alias Dolphin.Worker
opts = unquote(opts)
@manager_module opts |> Keyword.get(:manager_module)
if !@manager_module do
raise "Dolphin.Worker requires a :manager_module"
end
... |
08d4d79aec76c68ba7bb218b5b4ac55fea00dd5f | 2,484 | [
97551428
] | [
"genserver"
] | defmodule BucketIsland.Services.TeamSelectionCache do
use GenServer
def start_link() do
IO.puts("TeamSelectionCache: start_link")
GenServer.start_link(__MODULE__, {})
end
def init(_) do
IO.puts("TeamSelectionCache: init")
Registry.register(:bucket_island_r... |
08d4f096e5bcfae71454029ed636548c8848996e | 1,518 | [
649439520
] | [
"phoenix"
] | defmodule GameplatformWeb.GameController do
use GameplatformWeb, :controller
import OpenApiSpex.Operation, only: [response: 3]
alias Gameplatform.Game
alias Gameplatform.ApiSpec.Schema
alias GameplatformWeb.Utils
alias OpenApiSpex.Operation
plug OpenApiSpex.Plug.CastAndValidate, json_render_error_v2: t... |
08d57faaa60d5b7a7bc90e113a3987449bdccd4c | 14,744 | [
994481392
] | [] | #!/usr/bin/env elixir
# Live demonstration of the complete evolution system in action
# This will show real-time evolution, code generation, and persistence
Mix.install([])
# Helper module for demo functions
defmodule DemoHelpers do
# Helper functions
def generate_insight_for_topic(topic, grid_name) do
insig... |
08d5bb8f1d77bb4391d11d3ec96994c292df6082 | 2,050 | [
378250684
] | [
"phoenix"
] | defmodule BlogWeb.PostController do
use BlogWeb, :controller
alias Blog.{Posts, Posts.Post}
plug BlogWeb.Plug.RequireAuth when action in [:create, :new, :edit, :delete, :update]
plug :check_owner when action in [:edit, :delete, :update]
def index(conn, _params) do
posts = Posts.list_posts()
render... |
08d627decdcc9c8e34417fdb8ed7c9b1e3bbeb99 | 12,684 | [
927234821,
492752264,
327711808,
554455380
] | [
"liveview"
] | defmodule LivebookWeb.Output.InputComponent do
use LivebookWeb, :live_component
@impl true
def mount(socket) do
{:ok, assign(socket, local: false, counter: 0)}
end
@impl true
def update(%{event: :change, value: value}, socket) do
{:ok, handle_change(socket, value)}
end
def update(assigns, soc... |
08d64a2cc8634ec01a923d928a0efac38013414f | 2,044 | [
970554674
] | [] | import Config
if System.get_env("PHX_SERVER") do
config :app, AppWeb.Endpoint, server: true
end
if config_env() == :prod do
database_url =
System.get_env("DATABASE_URL") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
"""
maybe_... |
08d6e0915eef6b7f0f6f2ae54ffa91df06c1742b | 10,440 | [
99077905
] | [
"typespec",
"documented"
] | defmodule EVM.Debugger.Breakpoint do
@moduledoc """
Breakpoints allow us to break execution of a given
contract based on a set of conditions.
"""
@table __MODULE__
@type id :: integer()
@type conditions :: [
# only triggers when contract executes at given address
:address
]
... |
08d79fd6600281b414bfcdf90bac5c82a51f73e2 | 2,835 | [
230108336
] | [] | defmodule Day14 do
@behaviour Runner.Day
use Bitwise
def read(file) do
File.stream!(file)
|> Enum.map(fn
"mask" <> rest ->
mask = rest |> String.trim() |> String.split("= ") |> Enum.at(1)
# M1: all 1's should be ignored
# M0: all 0's should be ignored
ignore =
... |
08d7a42eb739f022b769022efb128cf3e2c8e227 | 1,852 | [
896840491
] | [] | defmodule Day18 do
use Bitwise
def part1(input, steps \\ 100) do
parse(input)
|> Stream.iterate(&next_state_part1/1)
|> Stream.drop(steps)
|> Enum.take(1)
|> hd
|> count_lights
end
def part2(input, steps \\ 100) do
parse(input)
|> stick_lights
|> Stream.iterate(&next_state_... |
08d7d67eb3479886c630d9482ad1ec71ea5cad50 | 13,198 | [
199387419
] | [
"genserver"
] | defmodule ConsciousPhoenix.GameServer do
require Logger
use GenServer
alias ConsciousPhoenix.Deck
alias ConsciousPhoenix.Game
alias ConsciousPhoenix.Player
alias ConsciousPhoenixWeb.Endpoint
defmodule WorldState do
defstruct(
games: %{ },
updated_games: MapSet.new()
)
end
#API
... |
08d7f3f9270b2fa44a0ebcc970d2d54992d9c065 | 2,849 | [
273417117
] | [
"documented",
"ecto"
] | defmodule Inkfish.DockerTags do
@moduledoc """
The DockerTags context.
"""
import Ecto.Query, warn: false
alias Inkfish.Repo
alias Inkfish.DockerTags.DockerTag
@doc """
Returns the list of docker_tags.
## Examples
iex> list_docker_tags()
[%DockerTag{}, ...]
"""
def list_docker_ta... |
08d84a1a0dd820d367acad582805cfbde18625d4 | 1,598 | [
117112194
] | [] | defmodule Alice.Cmd.Emote do
use Annotatable, [:command]
import Alice.Util
import Emily.Embed
@command [
%{name: "bap", desc: "command.desc.emote.bap"},
%{name: "chew", desc: "command.desc.emote.chew"},
%{name: "cookie", desc: "command.desc.emote.cookie"},
%{name: "hug", desc: "command.desc.em... |
08d9272ecc9c5229a41b550d74031c0c8c832885 | 2,702 | [
101434552,
198908023
] | [
"typespec",
"documented"
] | defmodule GoogleApi.DiscoveryEngine.V1beta.Model.GoogleCloudDiscoveryengineV1alphaControlBoostActionInterpolationBoostSpec do
@moduledoc """
Specification for custom ranking based on customer specified attribute value. It provides more controls for customized ranking than the simple (condition, boost) combination a... |
08d937f63b771a1d1a8ffafc9538062e5cd38393 | 1,548 | [
15270935
] | [
"ecto"
] | defmodule ApathyDrive.LootPity do
use ApathyDriveWeb, :model
alias ApathyDrive.{Character, MonsterItem}
require Logger
schema "characters_monsters_items" do
field(:pity, :integer, default: 0)
belongs_to(:character, Character)
belongs_to(:monsters_items, MonsterItem)
end
def increase_pity(%Cha... |
08d953439fcc32831772e399b48f7de2829a8296 | 2,960 | [
149124184
] | [
"test",
"phoenix"
] | defmodule DockupDemoWeb.ProductControllerTest do
use DockupDemoWeb.ConnCase
alias DockupDemo.Products
@create_attrs %{category: "some category", name: "some name", price: 120.5}
@update_attrs %{category: "some updated category", name: "some updated name", price: 456.7}
@invalid_attrs %{category: nil, name: ... |
08d99da3e6da3f38f236e10a9c12e6571b27d900 | 1,662 | [
256927601
] | [
"macro",
"documented",
"phoenix"
] | defmodule ApiFolhaDirigidaWeb 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 ApiFolhaDirigidaWeb, :controller
use ApiFolhaDirigidaWeb, :view
The definitions below will be executed for... |
08d9a09eb1c44a18c311a81ab4eed33e346c8136 | 6,674 | [
245726816
] | [] | %{
"cowboy": {:hex, :cowboy, "2.7.0", "91ed100138a764355f43316b1d23d7ff6bdb0de4ea618cb5d8677c93a7a2f115", [:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "04fd8c6a39edc6aaa9c26123009200fc61f92a3a94f3178c5... |
08d9f9317539d084c067c28b59a2622782194452 | 2,227 | [
925070763
] | [
"typespec",
"documented"
] | defmodule Transpiler.CodeGenerator do
@moduledoc """
The `Transpiler.CodeGenerator` module is responsible for generating C code from
the structured internal representation defined by `Transpiler.Tree.MainBlock`.
The `Transpiler.Tree.MainBlock` struct represents the main block of code.
This module defines a ... |
08d9fbbec4e76a784d2e1b00c8d1e9ace914b44b | 7,187 | [
226522323
] | [
"typespec"
] | defmodule GridMap do
@type coords :: {x :: integer, y :: integer}
@start_y 0
@start_x 0
def parse_map(str, read_fn \\ &default_read/2) do
str
|> String.trim()
|> to_charlist
|> parse_chars(%{}, @start_x, @start_y, read_fn)
end
def default_read(_, x), do: x
defp parse_chars([?\n | chars... |
08dac1fb157b577483e15b93b2dbda09b0007442 | 1,952 | [
979082439
] | [
"documented",
"ecto"
] | defmodule ServerElixir.Activities do
@moduledoc """
The Activities context.
"""
import Ecto.Query, warn: false
alias ServerElixir.Repo
alias ServerElixir.Activities.Activity
@doc """
Returns the list of activities.
## Examples
iex> list_activities()
[%Activity{}, ...]
"""
def lis... |
08db172d9a1675847fb0f9f8f3bec129cf18121e | 13,530 | [
338118832
] | [
"liveview"
] | defmodule EpiViewpointWeb.Presenters.CaseInvestigationPresenter do
import PhoenixHTMLHelpers.Tag
use EpiViewpointWeb, :presenter
alias EpiViewpoint.Cases
alias EpiViewpoint.Cases.CaseInvestigation
alias EpiViewpoint.ContactInvestigations.ContactInvestigation
alias EpiViewpoint.Cases.Person
alias EpiViewp... |
08db29c235e19520b76a2b8ba1f6b13822c87e8c | 1,566 | [
919065026
] | [
"test",
"documented"
] | defmodule Durandal.UserSettingQueriesTest do
@moduledoc false
use Durandal.DataCase, async: true
alias Durandal.Settings.UserSettingQueries
describe "queries" do
@empty_query UserSettingQueries.user_setting_query([])
test "clauses" do
# Null values, shouldn't error but shouldn't generate a quer... |
08db3d9b3b404bddb4c3b0d32904f1ee2700a35e | 7,649 | [
138562706,
136571370,
786846015
] | [
"documented"
] | defmodule Credo.Check.Design.DuplicatedCode do
@moduledoc """
Code should not be copy-pasted in a codebase when there is room to abstract
the copied functionality in a meaningful way.
That said, you should by no means "ABSTRACT ALL THE THINGS!".
Sometimes it can serve a purpose to have code be explicit in t... |
08db42f424bd18368fef540f0285541bde77f641 | 1,589 | [
135499917,
101295910
] | [
"macro",
"documented",
"phoenix"
] | defmodule EventsWeb 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 EventsWeb, :controller
use EventsWeb, :view
The definitions below will be executed for every view,
controller, etc... |
08db55644636b103999b8d94db757c7210687662 | 3,941 | [
435576281
] | [] | defmodule AdventOfCode.Y2022.Day17 do
@line_h [String.graphemes("..@@@@.")]
@cross ["...@...", "..@@@..", "...@..."] |> Enum.map(&String.graphemes/1)
@el ["....@..", "....@..", "..@@@.."] |> Enum.map(&String.graphemes/1)
@line_v ["..@....", "..@....", "..@....", "..@...."] |> Enum.map(&String.graphemes/1)
@sq... |
08db986d5abf68bcdbcc11f5a3377163a1ddc6fd | 1,715 | [
873687831
] | [
"liveview",
"phoenix"
] | defmodule TpooWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :tpoo
plug CORSPlug, origin: ["*"], methods: ["GET", "POST", "PUT", "DELETE"]
# 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 encryp... |
08dbfb470d58d1e6d52803f9482d596a4f2021db | 4,568 | [
610952058
] | [
"documented"
] | defmodule Realtime.OidDatabase do
require Logger
defmodule(DataTypes,
do:
defstruct(
types: %{
16 => "bool",
17 => "bytea",
18 => "char",
19 => "name",
20 => "int8",
21 => "int2",
22 => "int2vector",
23 => "int4",
... |
08dc27a90e6605c15de5cd78cae33a2141ca4f33 | 2,131 | [
119747156
] | [
"typespec",
"documented"
] | defmodule NervesHub.AuditLogs.DeploymentGroupTemplates do
@moduledoc """
Templates for and handling of audit logging for deployment operations.
"""
alias NervesHub.Accounts.User
alias NervesHub.AuditLogs
alias NervesHub.Devices.Device
alias NervesHub.ManagedDeployments.DeploymentGroup
@spec audit_deplo... |
08dc67a29741933ca6e7381f1ce38da4513c0944 | 3,494 | [
897775320
] | [
"documented"
] | defmodule Aoc17 do
defmodule VM do
defstruct a: 0, b: 0, c: 0, prog: []
end
def example() do
"""
Register A: 729
Register B: 0
Register C: 0
Program: 0,1,5,4,3,0
"""
end
def example2() do
"""
Register A: 2024
Register B: 0
Register C: 0
Program: 0,3,5,4,3,0
... |
08dd48cba81a9d636b26d612ca7e08c3c92e6a61 | 3,108 | [
359466259
] | [
"documented"
] | defmodule EasyXML.Backend.Xmerl do
@moduledoc """
A backend based on [`:xmerl`](`:xmerl`).
"""
@behaviour EasyXML.Backend
@impl true
def parse!(xml, opts) do
xml = :erlang.binary_to_list(xml)
# TODO: fix encoding
opts = Keyword.merge([space: :normalize, comments: false, encoding: :latin1], opt... |
08de29d030a626e0e5ba855b2ab693b2d5469ba6 | 1,941 | [
239929724
] | [
"test",
"ecto"
] | defmodule Todos.TodoTest do
use Todos.DataCase
alias Todos.Todo
describe "itens" do
alias Todos.Todo.Item
@valid_attrs %{is_checked: true, title: "some title"}
@update_attrs %{is_checked: false, title: "some updated title"}
@invalid_attrs %{is_checked: nil, title: nil}
def item_fixture(att... |
08de4616a624254d155f23646f6c70fbbd7e3d1a | 3,008 | [
92991405
] | [
"typespec",
"documented"
] | defmodule Numero do
@moduledoc """
Numero cat either normalize non-english digits in strings,
or convert english digits to non-english digits of your choice.
"""
alias Numero.Numbers, as: N
@doc """
Converts a string number to its standard english format
## Examples
iex> Numero.normalize("1۲3")... |
08de8e0bb215ebe7d7c0067e266fbf063716fea6 | 2,105 | [
135372171
] | [] | defmodule GatherContext.Types.Config.OtherOptionSpec do
use ESpec
describe "encode" do
alias GatherContext.Types.Config.OtherOption
let name: "op1"
let label: "Other"
let selected: true
let value: "Something"
let element: %OtherOption{name: name(), label: label(), selected: selected(), va... |
08dec9053a44ef6593c132f8371d3e5de492b455 | 6,376 | [
617202542
] | [
"documented",
"ecto"
] | defmodule Protectora.Padrinamentos do
@moduledoc """
The Padrinamentos context.
"""
import Ecto.Query, warn: false
alias Protectora.Colaboradores
alias Protectora.Repo
import Ecto.Changeset
alias Protectora.Padrinamentos.Padrinamento
@doc """
Returns the list of padrinamento.
## Examples
... |
08dee39cc9dfa317a56db63643ff73788c4e5361 | 5,154 | [
967119405
] | [
"test"
] | defmodule Adk.JsonProcessorTest do
use ExUnit.Case
alias Adk.JsonProcessor
# Sample schema for testing
defmodule TestSchema do
@enforce_keys [:response]
defstruct [:response, :details, is_complete: false, items: []]
end
describe "encode/1" do
test "encodes map to JSON string" do
map = %... |
08df57583941994b4ffcf3cf527e4d0a0a1f19cf | 1,873 | [
913346171
] | [
"phoenix"
] | defmodule DeepWorkWeb.FocusSessionsController do
use DeepWorkWeb, :controller
alias DeepWork.Limelight
alias DeepWork.Limelight.FocusSessions
action_fallback DeepWorkWeb.FallbackController
def index(conn, _params) do
focus_sessions = Limelight.list_focus_sessions(conn.assigns.current_user, conn.query_p... |
08df775ed892f661d4a0a2b2c217b2495c191021 | 1,645 | [
612062134
] | [
"genserver",
"documented"
] | defmodule Cachex.Hook.Stats do
@moduledoc false
# A simple statistics container, used to keep track of various operations on
# a given cache. This is used as a post hook for a cache and provides an example
# of what a hook can look like. This container has no knowledge of the cache
# it belongs to, it on... |
08dfc1451bdb4272559d1c1970bc42a3a5f65d33 | 9,732 | [
621411440
] | [
"typespec",
"test",
"macro",
"supervisor",
"documented"
] | defmodule Styler.Style.ModuleDirectives.AliasLiftingTest do
@moduledoc false
use Styler.StyleCase, async: true
test "lifts aliases in snippets" do
assert_style(
"""
A.B.C
# z
A.B.C
""",
"""
alias A.B.C
C
# z
C
"""
)
end
test "snippet... |
08dfc8d6d4ecb8d0c527f1dd0ee3642bf5ea44d2 | 2,270 | [
527549683
] | [
"typespec",
"documented"
] | defmodule Exrows.Exyxorp.RoundRobin.Find do
Module.register_attribute(__MODULE__, :moduledoc, persist: true)
@moduledoc """
To query services by Round-Robin, then get results.
"""
@wait_ms 2000
alias Exrows.Channel
alias Exrows.Exyxorp.Action
alias Exrows.QueryStatement
@spec approach(query :: Que... |
08e0082dd2de56927256cfbcb5e431e0279a7847 | 7,427 | [
63643631,
63304973,
63885140,
67626331,
63335915
] | [
"documented",
"ecto"
] | defimpl Inspect, for: Ecto.Query do
import Inspect.Algebra
import Kernel, except: [to_string: 1]
alias Ecto.Query.JoinExpr
@doc false
def inspect(query, opts) do
list = Enum.map(to_list(query), fn
{key, string} ->
concat(Atom.to_string(key) <> ": ", string)
string ->
string
... |
08e04d37084d202a774c9894c0e86428a8b0e2c8 | 3,596 | [
535807100
] | [] | defmodule NervesMetalDetector.Vendors.RapidUk do
alias NervesMetalDetector.Vendors.Vendor
@behaviour Vendor
@impl Vendor
def vendor_info() do
%Vendor{
id: "rapiduk",
name: "Rapid",
country: :uk,
homepage: "https://www.rapidonline.com"
}
end
defmodule ProductUpdate do
@... |
08e15183c0c3b2d035bfaa707cf5ba512b2468fb | 3,159 | [
980529497
] | [] | alias Supavisor.Tenants
alias Supavisor.Repo
import Ecto.Adapters.SQL, only: [query: 3]
db_conf = Application.get_env(:supavisor, Repo)
tenant_name = "dev_tenant"
if Tenants.get_tenant_by_external_id(tenant_name) do
Tenants.delete_tenant_by_external_id(tenant_name)
end
if !Tenants.get_tenant_by_external_id("is_ma... |
08e18c761d741802973b7c99d130b10c1249b4fb | 7,758 | [
317645426
] | [
"documented"
] | #! /usr/bin/env elixir
defmodule Day11 do
@moduledoc """
--- Day 11: Seating System ---
Your plane lands with plenty of time to spare. The final leg of your journey is a ferry that goes directly to the
tropical island where you can finally start your vacation. As you reach the waiting area to board the ferry, ... |
08e1da9a384cedc8fb4d5832849fce0217e3e4a7 | 13,842 | [
572983850
] | [
"documented"
] | defmodule AdventOfCode2022Elixir.Day11MonkeyInTheMiddle do
@moduledoc """
--- Day 11: Monkey in the Middle ---
As you finally start making your way upriver, you realize your pack is much lighter than you remember. Just then, one of the items from your pack goes flying overhead. Monkeys are playing Keep Away with... |
08e249598a7df1c0115764952e889e18577ef34f | 4,468 | [
82238227
] | [
"test"
] | defmodule Teaminterface.UploadController.CbBadFilesTest do
use Teaminterface.ConnCase
import Teaminterface.ConnCase.Fixture
alias Teaminterface.ChallengeBinary
setup do
current_round = build(:round) |> make_current |> insert
enablement = insert(:enablement, round: current_round)
enabled_cset = en... |
08e2985bdc164b093e8fb160b43c8ed802c3de9d | 8,985 | [
151474067
] | [
"test"
] | defmodule ExTimezoneDbTest do
use ExUnit.Case, async: false
doctest ExTimezoneDB
alias ExTimezoneDB.Timezone
@valid_zone_name "America/New_York"
@america_new_york_valid_response %{
"countryCode" => "US",
"countryName" => "United States",
"zoneName" => "America/New_York",
"abbreviation" => "E... |
08e2c83c0a4e68814aff95a57fdea0969f099821 | 3,065 | [
275762620
] | [
"typespec",
"documented"
] | defmodule EarmarkParser.Block do
@moduledoc false
@type t ::
%__MODULE__.BlockQuote{}
| %__MODULE__.Code{}
| %__MODULE__.FnDef{}
| %__MODULE__.FnList{}
| %__MODULE__.Heading{}
| %__MODULE__.Html{}
| %__MODULE__.HtmlComment{}
| %__MODUL... |
08e323f2bf10232428d4aa22e0528698a8d7c0df | 1,746 | [
51449545
] | [
"phoenix"
] | defmodule Editor.UserSocket do
use Phoenix.Socket
## Channels
# channel "rooms:*", Editor.RoomChannel
# TODO: rename to more appropiate
# BLOG POST FODDER
# everytime there is a message for a topic with any id
# handle that in RoomChannel code
# here we can throw in rules around authentication
chan... |
08e35085ca69df09c7f00950c87eafc1d576219d | 4,587 | [
370813738,
450993182
] | [
"test"
] | defmodule StellarBase.XDR.HashIDPreimageTest do
use ExUnit.Case
import StellarBase.Test.Utils
alias StellarBase.XDR.{
EnvelopeType,
HashIDPreimage,
HashIDPreimageOperationID,
PoolID,
HashIDPreimageRevokeID,
SequenceNumber,
UInt32
}
setup do
account_id = create_account_id("GC... |
08e3c7e2da9871f33c85d0f487f4f9bef52d4480 | 4,030 | [
198015453,
382585848
] | [
"genserver"
] | defmodule OgSniper.Ninja do
defstruct desired_name: nil,
access_token: nil,
snipe_at_timestamp: nil,
minecraft_email: nil,
minecraft_password: nil,
captcha_token: nil,
captcha_id: nil
use GenServer
def start_lin... |
08e423fab5beb5c6fe45a92422e9bbb0dafe7436 | 12,630 | [
100650062
] | [
"typespec",
"macro",
"documented"
] | defmodule Cldr.List.Backend do
def define_list_module(config) do
module = inspect(__MODULE__)
backend = config.backend
config = Macro.escape(config)
quote location: :keep, bind_quoted: [module: module, backend: backend, config: config] do
defmodule List do
@moduledoc false
if Cl... |
08e45bf6cf89854e44bff78063d7a354dd1d651b | 6,754 | [
628025157
] | [
"typespec",
"documented"
] | defmodule ExTournaments.Pairings.Swiss do
@moduledoc """
Module for creation of a Swiss format round
"""
require Logger
alias ExTournaments.Utils.MaximumWeightedMatching
alias ExTournaments.Utils.MaximumWeightedMatching.Edge
alias ExTournaments.Pairings.Swiss.Weight
alias ExTournaments.Utils.PairingH... |
08e49f7e88e36f92c89fcf020fe16c1c201a5c54 | 3,798 | [
378744379
] | [
"liveview",
"documented"
] | defmodule BanchanWeb.CommissionLive.Components.CommissionWork do
@moduledoc """
Component for creating and seeing the work connected to a commission.
"""
use BanchanWeb, :live_component
alias Banchan.Works
alias Banchan.Works.Work
alias Banchan.Works.WorkUpload
alias Surface.Components.{Form, LiveRedi... |
08e5268319df6d67860ca2935a466d3c2ee7c9e2 | 2,868 | [
766668850
] | [] | %{
"earmark_parser": {:hex, :earmark_parser, "1.4.43", "34b2f401fe473080e39ff2b90feb8ddfeef7639f8ee0bbf71bb41911831d77c5", [:mix], [], "hexpm", "970a3cd19503f5e8e527a190662be2cee5d98eed1ff72ed9b3d1a3d466692de8"},
"erlexec": {:hex, :erlexec, "2.0.8", "301184cdcc83d51fd6aa4ee5f9c23dc96930d68501100bcd580d950f40169a5e"... |
08e58d2efeef032f97a5362df7fb29c9f4e31ba6 | 2,857 | [
251330528
] | [
"test",
"ecto"
] | defmodule MyHive.AccountsTest do
use MyHive.DataCase
alias MyHive.Accounts
describe "users" do
alias MyHive.Accounts.User
@valid_attrs %{email: "some email", encrypted_password: "some encrypted_password", first_name: "some first_name", is_active: true, last_name: "some last_name", phone_number: "some p... |
08e5b2884081f11938d4a993654c30692fb8074a | 4,677 | [
98358981
] | [
"documented"
] | defmodule Codebattle.GameProcess.Fsm do
@moduledoc """
Finit state machine for game process.
fsm -> data: %{}, state :initial
states -> [:initial, :waiting_opponent, :playing, :game_over]
Player.game_result -> [:undefined, :gave_up, :won, :lost]
"""
import CodebattleWeb.Gettext
import Codebattle.GamePr... |
08e603208643c43d85e57d98614333b0a0540ab5 | 2,709 | [
334238196
] | [
"genserver"
] | defmodule ClientConection do
use GenServer
def connect(ip, port) do
case :gen_tcp.connect(ip,port,[:binary, packet: :line, active: false, reuseaddr: true]) do
{:ok,socket} -> {:ok,pid} = GenServer.start_link(__MODULE__, [socket])
Process.register(pid,:clien... |
08e630a534dad8952ca077df2e9c7efccf665bb6 | 6,466 | [
962708721
] | [
"documented"
] | defmodule FlixBackend.ProfileService do
import Ecto.Query, warn: false
alias FlixBackend.PaymentService
alias FlixBackend.Repo
alias FlixBackend.Data.User
alias FlixBackend.Data.Order # 添加 Order 的引用
@doc """
获取用户完整资料
"""
def get_user_profile(user_id) do
case Repo.get(User, user_id) do
nil ... |
08e6649153da87de82f07cc8a9cbcbda2be00d5a | 1,972 | [
350517260
] | [
"phoenix",
"ecto"
] | defmodule EventAppSpaWeb.CommentController do
use EventAppSpaWeb, :controller
alias EventAppSpa.Comments
alias EventAppSpa.Comments.Comment
alias EventAppSpaWeb.Helpers
action_fallback EventAppSpaWeb.FallbackController
alias EventAppSpaWeb.Plugs
plug Plugs.RequireAuth
def create(conn, comment_params... |
08e6f59d931d17a0e2235021e24231659642bd41 | 8,085 | [
132878376
] | [
"macro",
"documented"
] | defmodule ExAliyunOts.Constants do
@moduledoc false
defmacro __using__(_opts \\ []) do
quote do
alias ExAliyunOts.Const.{
OperationType,
PKType,
ReturnType,
Direction,
RowExistence,
FilterType,
VariantType,
LogicOperator,
ComparatorT... |
08e7036c3460a686b519206ab841e2bb9aee3318 | 1,654 | [
877242231
] | [
"phoenix"
] | defmodule Web.Socket do
use Phoenix.Socket
## Channels
channel "doctor", Web.DoctorChannel
channel "external", Web.DoctorChannel
channel "nurse", Web.NurseChannel
channel "gp", Web.GPChannel
channel "patient", Web.PatientChannel
channel "record:*", Web.RecordChannel
channel "call:*", Web.CallChannel... |
08e7f6541944fefae9e4ad8ee2e3913ab76801b0 | 3,134 | [
819658431
] | [
"typespec",
"liveview",
"documented"
] | defmodule Tornex.Telemetry do
@moduledoc """
Telemetry for Tornex using `:telemetry`.
`Tornex.Telemetry` defaults to using `Logger` to handle telemetry events, but this behavior can be
customized by not attaching the default logger.
"""
require Logger
@handler_id "tornex-default-telemetry-handler"
... |
08e802d1053b3871c8c2418174069355999016cf | 4,610 | [
295339427
] | [
"documented"
] | defmodule Numato.Responses do
@doc ~S"""
Parser response received from COM port.
## Examples
iex> Numato.Responses.parse("ABCDZDFF")
{:id, "ABCDZDFF"}
iex> Numato.Responses.parse("gpio notify enabled")
{:notify, true}
iex> Numato.Responses.parse("gpio notify disabled")
{:notify, false}... |
08e84e7fecc0999a0f1a4a4c455b8fbc448bbd40 | 2,225 | [
815757756
] | [
"documented"
] | defmodule Credo.Check.Refactor.Apply do
use Credo.Check,
id: "EX4003",
base_priority: :low,
explanations: [
check: """
Prefer calling functions directly if the number of arguments is known
at compile time instead of using `apply/2` and `apply/3`.
Example:
# preferred
... |
08e9069acbfbc970216be39bfb4c30578a0ba26a | 5,283 | [
343209812,
345517080,
356964182,
357334716,
379507262,
406732766,
433464550,
452045121,
459182862,
475343077,
341577165,
343815695,
384108404,
495424310,
610034669,
823294387,
341934035,
423405342,
424070340,
531890950,
599689212,
670103538,
681629586,
695267858,
7046... | [
"documented"
] | defmodule Plug.BasicAuth do
@moduledoc """
Functionality for providing Basic HTTP authentication.
It is recommended to only use this module in production
if SSL is enabled and enforced. See `Plug.SSL` for more
information.
## Compile-time usage
If you have a single username and password, you can use
... |
08e935074c54fc863d6eacb3eb1b96cec1310c6a | 3,866 | [
712825761
] | [] | defmodule Chip.Benchmark do
@clock :artifacts@clock
@chip :chip
@process :gleam@erlang@process
def run_benchmark() do
inputs = %{
"10000 records" => 10000
}
Benchee.run(
%{
"chip.members (bag) #(group, subject)" => fn {registry, group} ->
@chip.members(registry, group... |
08e9380fe7a69c9f13721f4f50d2e455e11e9f20 | 7,060 | [
314728671
] | [
"test"
] | defmodule ExNylas.HostedAuthenticationTest do
use ExUnit.Case, async: true
alias ExNylas.{HostedAuthentication, Connection}
import Plug.Conn
import ExNylasTest.Helper
setup do
bypass = Bypass.open()
{:ok, bypass: bypass}
end
test "get_auth_url/2 returns the correct URL on success", %{bypass: byp... |
08e945e45d9178a18d88760e0e5df8d2b7e66447 | 2,587 | [
99860320
] | [
"test"
] | defmodule AddUserCommandTest do
use ExUnit.Case, async: false
import TestHelper
@command RabbitMQ.CLI.Ctl.Commands.AddUserCommand
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:ok
end
setup context do
on_exit(context, fn -> delete_user(context[:user]) end)
{:ok, opts: %{node: get_r... |
08e966d74119a479255e1df049805528c52e090b | 7,961 | [
756340681
] | [
"test",
"ecto"
] | defmodule DAU.FeedTest do
alias DAU.Feed
alias DAU.Feed.Common
alias DAU.Feed.AssessmentReport
use DAU.DataCase
alias DAU.UserMessageFixtures
alias DAU.FeedFixtures
describe "inbox and common" do
test "add message from inbox to common" do
_feed_of_five = FeedFixtures.common_feed_of_five()
... |
08e9e64db4bfb03ea4095913ed6fb690a274b316 | 3,653 | [
47198583
] | [
"genserver"
] | defmodule StreamWeaver.Combine do
use GenServer
alias StreamWeaver.SubscriberList
alias StreamWeaver.Subscriber
def start_link(options \\ []) do
args = case Keyword.get(options, :follow) do
nil -> %{streams: %{}}
follow -> %{streams: follow}
end
GenServer.start_link(__... |
08ea1a67bd2c4092d04f296455ed140ce24b03e1 | 1,624 | [
57462040
] | [
"test"
] | defmodule AmnesiaTest do
use ExUnit.Case
use Physics.Database
setup_all do
Amnesia.Schema.create
Amnesia.start
Physics.Database.create!
res = Amnesia.transaction! do
planets = [
%Planet{name: "Mercury", type: :rocky, mass: 3.3e23, radius: 2.439e6},
%Planet{name: "Venus", ty... |
08ea546273169bce47cd08f727eedabe8cbeb5e1 | 15,001 | [
168377385
] | [
"test"
] | defmodule Ello.V3.Resolvers.FindPostTest do
use Ello.V3.Case
setup do
Ecto.Adapters.SQL.Sandbox.mode(Repo, {:shared, self()})
cat1 = Script.insert(:lacross_category)
staff = Factory.insert(:user, is_staff: true)
user = Factory.insert(:user)
post = Factory.insert(:post, author: user)
Factor... |
08ea8a1fa16722ff548a6bffe0101842c9c5d05f | 5,948 | [
725971743
] | [] | defmodule AdventOfCode.Day13 do
def input(test \\ false) do
if test do
# """
# #.##.#..#...#..
# .#...#.....#...
# #.#..#.#.##.###
# .#####.#.#..#.#
# .#####.#.#..#.#
# #.#..#.#.##.###
# .#...#.#...#...
# #.##.#..#...#..
# #.#.#.###.####.
# #..###.... |
08ea8cf693732a5f614c198bfe6d137d5811ecf7 | 1,643 | [
51089901
] | [] | %{"certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0df0979153cbafcd853ababaf", [:rebar3], []},
"elixir_mbcs": {:hex, :elixir_mbcs, "0.1.2"},
"hackney": {:hex, :hackney, "1.6.5", "8c025ee397ac94a184b0743c73b33b96465e85f90a02e210e86df6cbafaa5065", [:rebar3], [{:certifi, "0.7.0", [hex: :cer... |
08eaa4370076cac0e13dcffe8307128eda0f5129 | 1,847 | [
730301683
] | [] | defmodule Membrane.PrecompiledDependencyProvider.MixProject do
use Mix.Project
@version "0.1.2"
@github_url "https://github.com/membraneframework/membrane_precompiled_dependency_provider"
def project do
[
app: :membrane_precompiled_dependency_provider,
version: @version,
elixir: "~> 1.12... |
08eae074dcf7f312897f20000c7904f1b742c3f2 | 2,375 | [
124926473
] | [] | use Mix.Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :console, ConsoleWeb.Endpoint,
http: [port: 40... |
08eb23776f8505a5717753f0e5b484c3f2613342 | 3,603 | [
184338071
] | [
"documented"
] | defmodule Bamboo.SentEmail do
@moduledoc """
Used for storing and retrieving sent emails when used with Bamboo.LocalAdapter
When emails are sent with the Bamboo.LocalAdapter, they are stored in
Bamboo.SentEmail. Use the functions in this module to store and retrieve the emails.
Remember to start the Bamboo ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.