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 |
|---|---|---|---|---|
0b4696e6792c3285c7b50d522f4a87a434ba42ed | 4,872 | [
559744925,
815757756,
43247111,
995397072,
1008054178,
884066936,
1018310553,
951535898
] | [
"macro",
"documented"
] | defmodule Credo.CLI.Output.Summary do
@moduledoc false
# This module is responsible for printing the summary at the end of the analysis.
@category_wording [
{:consistency, "consistency issue", "consistency issues"},
{:warning, "warning", "warnings"},
{:refactor, "refactoring opportunity", "refactori... |
0b46c4d7db31d11126a70a8d5d4a252fbf93df40 | 3,328 | [
993653045
] | [] | defmodule Offtherecord.MixProject do
use Mix.Project
def project do
[
app: :offtherecord,
version: "0.1.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
consolidate_protocols: Mix.env() != :dev,
aliases: aliases(),
... |
0b4742164e75ea45f2010c8b52d649bba1c8ae9e | 2,649 | [
490805348
] | [] | defmodule Job.Payload do
defstruct(
client: nil,
scheduler: nil,
id: nil,
arrival_time: nil,
duration: nil,
start_time: nil,
finish_time: nil
)
def new(
client,
job_id,
duration) do
%Job.Payload {
client: client,
scheduler: nil,
id: job_id,
dura... |
0b4749d07b74cf5d9dfc60e580403baaa4dc3480 | 1,516 | [
534288869
] | [
"phoenix"
] | defmodule ExapiWeb.Router do
use ExapiWeb, :router
alias ExapiWeb.Plugs.UUIDChecker
pipeline :api do
plug :accepts, ["json"]
plug UUIDChecker
end
pipeline :auth do
plug ExapiWeb.Auth.Pipeline
end
scope "/", ExapiWeb do
pipe_through [:api, :auth]
get "/:user", DataController, :show... |
0b47cd13fe18582818ddd15f60f398e70a5c5f26 | 11,356 | [
343209812,
356964182,
357334716,
364300342,
379507262,
406732766,
436100750,
303031166,
341577165,
343815695,
384108404,
341934035,
423405342,
704658418,
341590671,
345802943,
352394402,
376778742,
379678050,
407445450,
712071186,
404104258,
645931572,
304673085,
3051... | [
"documented",
"phoenix"
] | defmodule Phoenix.Logger do
@moduledoc """
Instrumenter to handle logging of various instrumentation events.
## Instrumentation
Phoenix uses the `:telemetry` library for instrumentation. The following events
are published by Phoenix with the following measurements and metadata:
* `[:phoenix, :endpoint,... |
0b48352f437f21da3272730169db3cd475201d67 | 3,026 | [
857095922
] | [
"macro",
"documented"
] | defmodule Mariner.DSL do
@doc false
defmacro __using__(_opts) do
quote do
import Mariner.DSL
end
end
defmacro container(name, do: block) do
quote do
var!(config) = %{Name: unquote(name)}
unquote(block)
IO.inspect(var!(config), label: "DSL <> Container Configuration")
end... |
0b4848a32166dc73651a896fd5cdb97f355d9aa3 | 2,671 | [
104223581
] | [] | defmodule IcdCode.ICDCode.Codes_F80 do
alias IcdCode.ICDCode
def _F800 do
%ICDCode{full_code: "F800",
category_code: "F80",
short_code: "0",
full_name: "Phonological disorder",
short_name: "Phonological disorder",
category_name: "Phonological disorder"
... |
0b488571516fd58ac073995d530be214e915085d | 16,037 | [
239822890,
459291087
] | [
"typespec",
"documented",
"ecto"
] | defmodule Oli.Authoring.Course do
import Ecto.Query, warn: false
alias Oli.Accounts.Author
alias Oli.Authoring.Authors.AuthorProject
alias Oli.Authoring.{Collaborators, ProjectSearch}
alias Oli.Authoring.Course.{Project, Family, ProjectResource, ProjectAttributes}
alias Oli.Groups.CommunityVisibility
ali... |
0b48c9f9f91d36b4e02caf70212b7f03311c30bb | 3,225 | [
29540624
] | [
"macro"
] | defmodule Base58Check do
b58_alphabet = Enum.with_index('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz')
for {encoding, value} <- b58_alphabet do
defp do_encode58(unquote(value)), do: unquote(encoding)
defp do_decode58(unquote(encoding)), do: unquote(value)
end
defp do_decode58(c), do: r... |
0b48ed9694c762b29388124b100599789580218e | 5,497 | [
742644590
] | [
"test"
] | defmodule Backend.Notifications.WebhookHandlerTest do
use ExUnit.Case, async: true
alias Backend.Notifications.WebhookHandler
alias Backend.Projections.Dbpa.Alert
describe "Request building" do
def make_alert(),
do: %Alert{
id: "alert id",
state: :down,
is_instance_specific: ... |
0b48ee762f94393752debae6deec82de4f8ce7b7 | 1,555 | [
658215221
] | [
"liveview",
"test"
] | defmodule RemindlyWeb.EditOrgLiveTest do
use RemindlyWeb.ConnCase, async: true
import Phoenix.LiveViewTest
import Remindly.OrgsFixtures
alias Remindly.Orgs.Org
alias Remindly.Repo
setup :register_and_sign_in_user
describe "valid params" do
test "can edit an org", %{conn: conn, org: org, user: _user... |
0b48f3dfe01e63a0a5f22aeea8befbd9231b324b | 1,740 | [
828087786,
212487543
] | [
"macro",
"documented"
] | defmodule Ash.Type.Comparable do
@moduledoc "Helpers for working with `Comparable`"
defmacro defcomparable(
{:"::", _, [left_expression, quoted_left_type]},
{:"::", _, [right_expression, quoted_right_type]},
do: code
) do
{left_type, []} = Code.eval_quoted(quote... |
0b4976915751de06fb226ba4f1c865dc8792795c | 2,931 | [
918070238
] | [] | # 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 :ash,
allow_forbidden_field_for_relationship... |
0b4a75e6efacce88567f61d535c198b8873849d4 | 6,699 | [
287224981
] | [
"macro",
"documented"
] | defmodule TransparencyAndConsent.Segment do
@moduledoc false
alias TransparencyAndConsent.{VendorList, DecodeError}
@segments %{
0 => :core,
1 => :vendors_disclosed,
2 => :vendors_allowed,
3 => :publisher_tc
}
@v1_core_fields [
:created,
:last_updated,
:cmp_id,
:cmp_version,
... |
0b4ae5b28353d4ec2d5671dab24fc1a130f95bdd | 3,792 | [
708950292
] | [
"liveview"
] | defmodule TarragonWeb.PageLive.Ecspanse.Battles.Play.BoardComponent do
use TarragonWeb, :live_component
@board_width 640
@board_height 360
@cell_count 20
@cell_width @board_width / 20
@cell_height @board_height / 10
defp board_dimensions() do
[
width: @board_width,
height: @board_height,... |
0b4b327d8fcfc74b9ae5a0051ff826eeb0ee9ff8 | 2,075 | [
214190490
] | [
"documented"
] | defmodule Randomizer do
def person do
%{
name: string(Enum.random(2..16), :downcase),
surname: string(Enum.random(2..20), :downcase),
age: Enum.random(0..125),
company: string(Enum.random(2..24), :alpha),
cars: list(Enum.random(0..4), fn ->
%{
brand: string(Enum.ran... |
0b4bab5ced343fff107cf9e38594fb0ee277bee8 | 2,511 | [
317622230
] | [] | defmodule AdventOfCode.Day17 do
def part1(input) do
input
|> parse_map
|> play_round
|> MapSet.size()
end
def play_round(set, round \\ 0, stop_at_round \\ 6)
def play_round(set, round, stop_at_round) when round == stop_at_round, do: set
def play_round(set, round, stop_at_round) do
new_se... |
0b4bd097b5b4fa065d8218d24c4fb2f273887af2 | 1,582 | [
411726210
] | [
"supervisor",
"documented"
] | defmodule ForthVM.Supervisor do
@moduledoc """
Ssupervisor providing Cores, IO capture, IO logger, and registry.
"""
use Supervisor
def start_link(init_arg) do
Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
end
@impl true
def init(num_cores: num_cores) do
children = [
{Reg... |
0b4c016ac006c941890a912092637f1a03a30062 | 1,580 | [
456097102
] | [] | import Config
# ###################################################################
# This is an example of all the configuration settings in Blunt.
#
# The values set here are for testing the libraries.
# They are *not* recommendations.
# ###################################################################
config :blu... |
0b4c6ad7128e910afe6748209ea7ac460c09e0dc | 2,913 | [
45922821
] | [
"test"
] | defmodule ElixirExamples.FractionTest do
use ExUnit.Case, async: true
alias ElixirExamples.Fraction, as: Fraction
doctest Fraction #ElixirExamples.Fraction
setup do
half = Fraction.new!(1, 2)
quarter = Fraction.new!(1, 4)
half_tuple = { 1, 2 }
quarter_tuple = { 1, 4 }
{ :ok,
half: h... |
0b4d025b552a1c2c26068d28d15e83666aace760 | 1,538 | [
87229763
] | [
"documented"
] | defmodule PryIn.EctoLogger do
require Logger
alias PryIn.{Wormhole, InteractionStore}
import PryIn.TimeHelper
@moduledoc """
Collects metrics for ecto queries inside a tracked interaction.
Activate via:
```elixir
config :my_app, MyApp.Repo,
loggers: [PryIn.EctoLogger, Ecto.LogEntry]
```
"""
... |
0b4d2a6935ce622d7bb327fcec963367aed640e7 | 2,585 | [
25167191
] | [
"documented"
] | defmodule Imagineer.Image.PNG.Filter.Basic.Sub do
import Imagineer.Image.PNG.Helpers, only: [null_binary: 1]
@moduledoc """
The Sub filter transmits the difference between each byte and the value of the
corresponding byte of the prior pixel.
"""
@doc """
Takes in the uncompressed binary for a sub-filter... |
0b4d544ada5e0e639340e91c0e0969d73f4e95c4 | 2,369 | [
63497734
] | [
"test"
] | defmodule CodeCorpsWeb.CategoryControllerTest do
use CodeCorpsWeb.ApiCase, resource_name: :category
@valid_attrs %{name: "Technology"}
@invalid_attrs %{name: nil}
describe "index" do
test "lists all entries on index", %{conn: conn} do
[category_1, category_2] = insert_pair(:category)
conn
... |
0b4e0c4e03f1c8874acb3c733752ab5e4d50ae98 | 3,782 | [
859180331
] | [
"phoenix",
"ecto"
] | defmodule WebappWeb.Controllers.Web.AdminController do
use WebappWeb, :controller
alias Webapp.Administradores
alias Webapp.JWTConfig
def index(conn, params) do
nome = Map.get(params, "nome", nil)
administradores = Administradores.list_administradores_by_nome_or_email(nome)
render(conn, :index, nom... |
0b4e5f84859c4e8fdc403672ffd2ed3de4177b3c | 1,974 | [
141810379
] | [
"test"
] | defmodule PlatformWeb.GithubRepoControllerTest do
use PlatformWeb.ConnCase
@create_attrs Factory.params_for(:github_repo)
@invalid_attrs %{full_name: nil}
setup :login_as_admin
setup :create_currency
describe "#new" do
test "renders form", %{conn: conn, currency: currency} do
conn = get conn, c... |
0b4e9950bbd480a2800795d2b53568bf8f35738c | 1,701 | [
407358607
] | [] | defmodule Chainz do
def generate_sentences(input_file_path, sentence_count \\ 4) do
text = File.read!(input_file_path)
wordlist = build_wordlist(text)
frequencies = build_frequencies(wordlist)
1..sentence_count
|> Enum.map(fn _ -> build_sentence(frequencies) end)
|> Enum.join("\n")
end
d... |
0b4ea11ba2bdde466648a0944c390a0f4d3d4703 | 3,167 | [
666122416
] | [
"test"
] | defmodule ElixirconfChat.UsersTest do
use ElixirconfChat.DataCase
alias ElixirconfChat.Repo
alias ElixirconfChat.Users
alias ElixirconfChat.Users.User
test "get_user/1 returns a User when given a valid id" do
{:ok, user} =
Repo.insert(%User{
email: "<EMAIL>",
first_name: "May",
... |
0b4ee1dd69b8f75282408990a837f07d8913f0ca | 3,932 | [
580445588
] | [
"typespec",
"documented"
] | defmodule PasswordGenerator do
@moduledoc """
Generates random password depending on parameters, Module main funtion is `generate(options)`
That function takes the options map.
Options example:
options = %{
"length" => "5",
"numbers" => "false",
"uppercase" => "false",
... |
0b4f2a7f465498e34b26bce6cd7fdea5ee98e06b | 2,359 | [
76021710
] | [
"macro",
"test",
"documented"
] | defmodule CaosTsdb.MigrationTest.MigrationCase do
@moduledoc """
This module defines the test case to be used by
tests that involve DB migrations.
Finally, every test runs on a clean DB.
"""
use ExUnit.CaseTemplate
alias CaosTsdb.Repo
using(opts) do
target_migration = opts[:target_migration] || ... |
0b4f420e6e451d3826602ea7c8fa447b3a372206 | 3,587 | [
211946408
] | [
"test"
] | defmodule HttpApi.Resources.MatchesTest do
use ExUnit.Case, async: true
use Plug.Test
alias HttpApi.{Protobuf, Resources.Matches}
@opts Matches.init([])
test "without query params returns matches" do
conn =
:get
|> conn("/matches")
|> TestHelper.fetch_params()
|> Matches.call(@o... |
0b4f5ad5eb022f5794580f286c0c204ff62d2746 | 16,494 | [
811497199
] | [
"typespec",
"documented"
] | defmodule Turboprop.Variants do
@moduledoc """
Turboprop Variants adds a feature-rich variant API for TailwindCSS to Elixir.
Variants allow you to define all possible styles and options for a component, even one that spans multiple HTML elements, in one place,
and then apply them based on your assigns.
## E... |
0b4fc8df24d53d30466e6cf2f309b11af8530e67 | 4,402 | [
361755973
] | [
"supervisor",
"phoenix"
] | Application.put_env(:phoenix_live_dashboard, Phoenix.LiveDashboardTest.Endpoint,
url: [host: "localhost", port: 4002],
secret_key_base: "Hu4qQN3iKzTV4fJxhorPQlA/osH9fAMtbtjVS58PFgfw3ja5Z18Q/WSNR9wP4OfW",
live_view: [signing_salt: "hMegieSe"],
render_errors: [view: Phoenix.LiveDashboardTest.ErrorView],
check_o... |
0b4fd0b7d3b0d51611dd010b52c12440f897aedc | 15,107 | [
942811655,
920024200
] | [
"ecto"
] | defmodule Support.Stubs.Deployments do
alias Support.Stubs.{DB, UUID}
alias Support.Stubs.Time, as: StubTime
def init do
DB.add_table(:deployment_targets, ~w(id project_id name unique_token api_model history)a)
__MODULE__.Grpc.init()
end
def create(project, user, name, params \\ []) do
target_i... |
0b50a92452ba9a91efd41780a647f72a009d551b | 4,053 | [
651180247
] | [] | defmodule Grabakey.UserApi do
alias Grabakey.UserDb
alias Grabakey.Mailer
@max_body_len 256
@token_header "gak-token"
@headers %{"content-type" => "text/plain"}
@fail_delay 1000
def init(req, {:new, _} = state) do
method = :cowboy_req.method(req)
dos_delay(method, state)
case method do
... |
0b50c46450518a18e698144ca7c3b49e375dfe99 | 2,476 | [
194750185
] | [
"typespec",
"documented"
] | defmodule Erlef.Storage do
@moduledoc false
alias ExAws.S3
@spec upload_event_org_image(String.t(), binary(), Keyword.t()) ::
{:ok, String.t()} | {:error, term()}
def upload_event_org_image(filename, binary, opts \\ []) do
new_opts = [{:content_type, file_type(binary)}, {:acl, :public_read}] ++ o... |
0b510472a7fa675921c70321b6932565d51eace9 | 1,575 | [
177404120
] | [
"genserver"
] | defmodule Cache.EmailConfirmations do
use GenServer
def start_link(state) do
GenServer.start_link(__MODULE__, state, name: EmailConfirmationCache)
end
def init(state) do
:ets.new(:email_confirmations, [:set, :public, :named_table])
schedule_cleanup()
{:ok, state}
end
def handle_call(... |
0b5115cbd2bad26154300ed72cb043b4b8689e00 | 2,410 | [
573565992,
896711144
] | [] | defmodule AOC22.Day5 do
def part1(input) do
input
|> String.split("\n")
|> Enum.drop(10)
|> Enum.map(fn cmd ->
Regex.run(~r/move (.+?) from (.+?) to (.+?)/, cmd, capture: :all_but_first)
|> List.to_tuple()
end)
|> Enum.reduce(
# left: top of the stack, right: bottom of the st... |
0b51a0b8e8a1ad4608b94532839228419ea8e538 | 1,838 | [
138947639
] | [
"typespec",
"macro",
"documented",
"test"
] | defmodule TypeClass.Property do
@moduledoc "A *very* simple prop checker"
alias TypeClass.Utility.Module, as: TC
@doc "Ensure that the type class has defined properties"
@spec ensure!() :: no_return()
defmacro ensure! do
quote do
case Code.ensure_loaded(__MODULE__.Property) do
{:module, _p... |
0b51c71625a05d037d6336c94a0853146d00489c | 4,036 | [
981784524
] | [
"typespec",
"macro",
"documented"
] | defmodule Protobuf.DSL.Typespecs do
@moduledoc false
alias Protobuf.{FieldProps, MessageProps}
@spec quoted_enum_typespec(MessageProps.t()) :: Macro.t()
def quoted_enum_typespec(%MessageProps{field_props: field_props}) do
atom_specs =
field_props
|> Enum.sort_by(fn {fnum, _prop} -> fnum end)
... |
0b51f40b77daf96b28c44252c6dba270ab876bd7 | 5,509 | [
917123261
] | [
"typespec",
"documented"
] | defmodule Level.Posts.Query do
@moduledoc """
Functions for building post queries.
"""
import Ecto.Query
alias Level.Schemas.GroupUser
alias Level.Schemas.Post
alias Level.Schemas.SpaceUser
alias Level.Schemas.User
@doc """
Builds a query for posts accessible to a particular user.
"""
@spec b... |
0b52469d30015473426a25b19e080146f4fc12ad | 3,578 | [
1001122744
] | [
"phoenix"
] | defmodule GestaoFinanceiraApiWeb.Router do
use GestaoFinanceiraApiWeb, :router
import GestaoFinanceiraApiWeb.UserAuth
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {GestaoFinanceiraApiWeb.Layouts, :root}
plug :protect_fro... |
0b52479529cf8bec6b3c0251ada015eb4e5d7170 | 4,808 | [
953445761
] | [
"typespec",
"documented"
] | defmodule Point do
import CustomOperators
@moduledoc """
Represents a point on the elliptic curve
Provides operations for point addition and scalar multiplication.
The point at infinity is represented as x: nil, y: nil.
"""
@enforce_keys [:x, :y, :a, :b]
defstruct [:x, :y, :a, :b]
@type t :: %__MOD... |
0b52482c590bc3c9df1318889c26eac86c0b6940 | 1,802 | [
341451853
] | [
"macro",
"documented",
"phoenix"
] | defmodule PaypleWeb 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 PaypleWeb, :controller
use PaypleWeb, :view
The definitions below will be executed for every view,
controller, etc... |
0b5288fa7ecad386e05142358e60326375e63db7 | 1,758 | [
215585253
] | [] | defmodule Strings do
def userstring do
commonalphabets("aditya", "chaturvedia", 0, "", [])
end
def commonalphabets(firststring, secondstring, counter, character, listofcommonalphabets) do
if counter < String.length(firststring) do
character = String.at(firststring, counter)
che... |
0b528f1e30270780aca403c5e652d6fc0bf4fbbb | 1,933 | [
367278931
] | [
"documented"
] | defmodule Google.Cloud.Orgpolicy.V1.Policy.ListPolicy.AllValues do
@moduledoc false
use Protobuf, enum: true, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :ALL_VALUES_UNSPECIFIED, 0
field :ALLOW, 1
field :DENY, 2
end
defmodule Google.Cloud.Orgpolicy.V1.Policy.ListPolicy do
@moduledoc false
... |
0b52f30ae17b8d14275d5b2415fa0054d25a5861 | 4,690 | [
563322590
] | [
"typespec",
"documented"
] | defmodule Helper.Types do
@moduledoc """
custom @types
"""
alias GroupherServer.{Accounts}
alias Accounts.Model.User
@typedoc """
general response conventions
"""
@type done ::
{:ok, :pass} | {:ok, Map} | {:error, List.t()} | {:error, String} | {:error, Map.t()}
@typedoc """
Type Gra... |
0b532e830cac0248497b3ae67e0556ce5efd0ca0 | 1,829 | [
555225235
] | [] | defmodule ApartmanWeb.Resolvers.FacilityResolver do
alias Apartman.Facility
def buildings(_parent, _args, _resolution) do
{:ok, Facility.list_buildings()}
end
def building(_parent, %{id: id}, _resolution) do
{:ok, Facility.get_building!(id) |> node_to_absinthe()}
end
# |++++++++++++++++++++++++++... |
0b5337e97e306bd5898dc22c19eb235d4a018a34 | 1,603 | [
492752264,
554455380
] | [
"test"
] | defmodule LivebookWeb.UserPlugTest do
use ExUnit.Case, async: true
use Plug.Test
defp call(conn) do
LivebookWeb.UserPlug.call(conn, LivebookWeb.UserPlug.init([]))
end
test "given no user id in the session, generates a new user id" do
conn =
conn(:get, "/")
|> init_test_session(%{})
... |
0b534e16e7240a5f3586f149a7fbd0ce6dce3e23 | 2,559 | [
339163032
] | [
"documented"
] | defmodule Cards do
@moduledoc """
Provides methods for creating and handling a deck of cards
"""
@doc """
Returns a list of strings representing a deck of playing cards
"""
def create_deck do
values = ["Ace", "Two", "Three", "Four", "Five"]
suits = ["Spades", "Clubs", "Hearts", "Diamonds"]
... |
0b53624081ae0986f1de8ce668823fadee583722 | 7,086 | [
798027185
] | [
"test"
] | defmodule Grades.CalculatorTest do
use ExUnit.Case
alias Grades.Calculator
describe "percentage_grade/1" do
test "TC1" do
assert 85 ==
Calculator.percentage_grade(%{
homework: [0.8],
labs: [1, 1, 1],
midterm: 0.70,
final: ... |
0b54e0182b5bf146dd8b42c3c3c1e0cfea804eff | 4,561 | [
226497411
] | [
"documented"
] | defmodule DaySixPartTwo do
@moduledoc false
def solve(input) do
input |>
Helper.splitStringByNewLine() |>
parseInput |>
findLargestArea |>
Enum.filter(fn item -> item < 10000 end) |>
Kernel.length |>
IO.inspect
end
def parseInput(word = [first|rest]) when word |> Kernel... |
0b54ee22df1fc61403b38a4c42c639e64ec225b4 | 10,995 | [
29387790
] | [] | # 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:
#
# E2eProject.Repo.insert!(%SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail... |
0b552f8bbb6d32de5ec35cb408b4f97764c3d4b9 | 17,766 | [
239822890,
459291087
] | [
"test",
"ecto",
"liveview"
] | defmodule OliWeb.Delivery.StudentDashboard.CourseContentLiveTest do
use ExUnit.Case, async: true
use OliWeb.ConnCase
import Phoenix.LiveViewTest
import Ecto.Query
alias OliWeb.Common.FormatDateTime
alias OliWeb.Delivery.StudentDashboard.CourseContentLive
alias Lti_1p3.Roles.ContextRoles
alias Oli.Deli... |
0b5538dfa4ec8433b91b17baa12fc4710f3579aa | 1,821 | [
721358570
] | [] | defmodule CodeStoragePlatform.Utils do
alias CodeStoragePlatform.Client
def repo_exists?(repo_path) do
with response <- Client.get_repo(repo_path),
:ok <- check_if_repo_exists(response) do
{:ok, repo_path}
else
:error ->
{:error, "O repositório " <> repo_path <> " não existe."}... |
0b55491fa20c790585e4a417ba4b4170323a87d9 | 5,482 | [
257787813
] | [
"test"
] | defmodule Web.SidebarTest do
use Web.ConnCase, async: true
setup do
account = Fixtures.Accounts.create_account()
actor = Fixtures.Actors.create_actor(type: :account_admin_user, account: account)
identity = Fixtures.Auth.create_identity(account: account, actor: actor)
%{
account: account,
... |
0b5566ed241f2b78ce8e2405dcbc312b1a5a5585 | 2,642 | [
202240521
] | [
"genserver"
] | defmodule Pooly.Server do
use GenServer
import Supervisor.Spec
defstruct sup: nil, worker_sup: nil, size: nil, workers: nil, mfa: nil, monitors: nil
def start_link(sup, pool_config) do
GenServer.start_link(__MODULE__, [sup, pool_config], name: __MODULE__)
end
def status do
GenServer.call(__MODULE... |
0b5569460e3b6ebf876e124a0251e17841f19f24 | 2,688 | [
726099843
] | [] | defmodule Day03 do
defp process_input(file_name) do
file_name
|> File.read!()
|> String.split("\n", trim: true)
end
defp graph_to_map(graph, rows, cols) do
0..(rows - 1)
|> Enum.reduce(%{}, fn i, acc1 ->
0..(cols - 1)
|> Enum.reduce(%{}, fn j, acc2 ->
Map.put(acc2, {i, j},... |
0b55b5384654c94e880070b53388e4e75a8ea3f0 | 1,839 | [
115302761
] | [
"phoenix"
] | require IEx
defmodule PmApiWeb.ProjectroleController do
use PmApiWeb, :controller
alias PmApi.Projectmode
alias PmApi.Projectmode.Projectrole
alias PmApi.Projectmode.Role
action_fallback PmApiWeb.FallbackController
def index(conn, _params) do
projectroles = Projectmode.list_projectroles()
render(... |
0b55ccc0017584b89a6fb6f1fd92e7f3e95e687e | 1,510 | [
328194918
] | [
"liveview"
] | defmodule LemonadeWeb.TeamSettingsFormComponent do
use LemonadeWeb, :live_component
alias Lemonade.Teams
def update(%{current_team_member: current_team_member, team: team}, socket) do
changeset = Teams.edit_team_changeset(team)
{:ok,
socket
|> assign(:changeset, changeset)
|> assign(:... |
0b56da0a7427f16582a62714390c4600bb463679 | 1,730 | [
640438983
] | [
"documented",
"ecto"
] | defmodule RetroBoard.Boards do
@moduledoc """
The Boards context.
"""
import Ecto.Query, warn: false
alias RetroBoard.Repo
alias RetroBoard.Boards.Board
@doc """
Returns the list of boards.
## Examples
iex> list_boards()
[%Board{}, ...]
"""
def list_boards do
Repo.all(Board)
... |
0b56fc8b313a2596a7782f95c15bef2d5256a9b7 | 9,618 | [
949664843
] | [
"documented"
] | defmodule Raxol.Terminal.Input.Processor do
import Raxol.Guards
alias Raxol.Terminal.Input.Event.{MouseEvent, KeyEvent}
@moduledoc """
Processes input events for the terminal emulator.
"""
@doc """
Creates a new input processor.
"""
def new do
%{
state: :normal,
buffer: ""
}
e... |
0b57504655e833c07ff4f8d5d0f3e17b97874169 | 2,070 | [
74876905
] | [] | defmodule ExTestDoc.Formatter.Latex do
def run([], _opts) do
end
def run(modules_list, opts) do
File.mkdir_p output_dir
for module <- modules_list do
write_docs_for module
end
create_main_file modules_list, opts[:doc_level]
modules_list
end
defp write_docs_for(module) do
modul... |
0b5797d7afdf8ca4e57886363aeeec58095463fd | 4,974 | [
896126851
] | [
"test"
] | defmodule PhoenixStorybook.TemplateHelpersTest do
use ExUnit.Case, async: true
import PhoenixStorybook.TemplateHelpers
test "set_variation_dom_id/2" do
template =
set_variation_dom_id(
"""
<div id=":variation_id">
<.psb-variation phx-click={JS.push("psb-assign", value: %{foo:... |
0b57b1f20b89b08c812bf5d2143707db9090e42f | 1,948 | [
351964527
] | [
"test",
"ecto"
] | defmodule EventApp.InvitesTest do
use Eventapp.DataCase
alias EventApp.Invites
describe "invites" do
alias EventApp.Invites.Invite
@valid_attrs %{attending: 42}
@update_attrs %{attending: 43}
@invalid_attrs %{attending: nil}
def invite_fixture(attrs \\ %{}) do
{:ok, invite} =
... |
0b57b9c68d9bb3819dbb0b8b94b6de6608fff126 | 1,743 | [
508451521
] | [
"phoenix",
"ecto"
] | defmodule BlogWeb.PostController do
use BlogWeb, :controller
alias Blog.Journal
alias Blog.Journal.Post
def index(conn, _params) do
posts = Journal.list_posts()
render(conn, "index.html", posts: posts)
end
def new(conn, _params) do
changeset = Journal.change_post(%Post{})
render(conn, "ne... |
0b57d457ddb11e571eff80d27fd61d2c19d97ce2 | 14,814 | [
324814335
] | [] | %{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hex... |
0b57f605ac783f81e56e53625e37f816e957f68a | 3,829 | [
452996503
] | [
"typespec",
"macro",
"documented"
] | defmodule Konvex.Implementation.Riak.AnyBucketWithKeyAggregate do
@doc """
Regular Riak bucket with any values (stored as binaries) CRUD-client extended with get-all-keys ability
implemented using two-bucket-setup (second one is used for key aggregation of the first one)
"""
defmacro __using__(
[... |
0b5837974e077a6a6cf4e6a2101d96e94537ea13 | 1,629 | [
564359760
] | [
"macro",
"liveview",
"documented",
"test"
] | defmodule HydepwnsLiveviewWeb.LiveViewCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a LiveView connection.
Such tests rely on `Phoenix.LiveViewTest` and also
import other functionality to make it easier
to build common data structures and query the dat... |
0b5882813771867a7a35126bdf9f521b81c0a0c3 | 1,722 | [
395150602
] | [
"phoenix",
"ecto"
] | defmodule PoliticiansWeb.PollController do
use PoliticiansWeb, :controller
alias Politicians.Polling
alias Politicians.Polling.Poll
def index(conn, _params) do
polls = Polling.list_polls()
render(conn, "index.html", polls: polls)
end
def new(conn, _params) do
changeset = Polling.change_poll(%... |
0b5882ecf349eeff373553c2ecf2b95d76b63e1f | 6,319 | [
57192889
] | [
"test",
"phoenix"
] | defmodule VutuvWeb.PostControllerTest do
use VutuvWeb.ConnCase
alias Vutuv.{UserConnections, Publications}
@create_attrs %{
body: Faker.Company.bs(),
title: Faker.Company.name(),
visibility_level: "private"
}
@update_attrs %{
visibility_level: "public"
}
setup %{conn: conn} do
conn ... |
0b58a101538eb3d8dcdbf8e505c35e6bada4b480 | 7,639 | [
142089506
] | [] | %{"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"},
"combine": {:hex, :combine, "0.9.6", "8d1034a127d4cbf6924c8a5010d3534d958085575fa4d9b878f200d79ac78335", [:mix], [], "hexpm"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0e... |
0b58b5c47d9f40c216c733b1aa639d3f0110ead3 | 2,674 | [
959183525
] | [
"test"
] | defmodule PlateSlateWeb.Schema.Query.SearchTest do
use PlateSlateWeb.ConnCase, async: true
setup do
PlateSlate.Seeds.run()
end
@query """
query Search($term: String!) {
search(matching: $term) {
name
__typename
}
}
"""
@variables %{term: "e"}
test "Search returns a list of me... |
0b58c27f0d4ee6a5525f37e309b9237fa8817614 | 2,575 | [
121648558
] | [
"phoenix",
"ecto"
] | defmodule ElephantInTheRoomWeb.AuthorController do
use ElephantInTheRoomWeb, :controller
alias ElephantInTheRoom.{Repo, Sites, Sites.Author}
def index(conn, params) do
page =
case params do
%{"page" => page} ->
Author |> Repo.paginate(page: page)
%{} ->
Author |> Re... |
0b590eba99cee81b86b30c4ed3bedc9b5638ff52 | 1,908 | [
622070737
] | [
"documented"
] | defmodule ToyRobot.Robot do
defstruct north: 0, east: 0, facing: :north
alias ToyRobot.Robot
@doc """
Moves the robot forward one space in the direction it is facing
## Examples
iex> alias ToyRobot.Robot
ToyRobot.Robot
iex> robot = %Robot{north: 0, facing: :north}
%Robot{north: 0, facing: :... |
0b598d178352a88fd5104edf3827b2621803604a | 20,358 | [
990806953
] | [
"liveview"
] | defmodule BrsWeb.OfficialReceiverLive.ApplicationHistoryComponent do
use BrsWeb, :live_component
@impl true
def mount(socket) do
{:ok, socket}
end
@impl true
def render(assigns) do
~H"""
<div class="space-y-4">
<!-- table content -->
<div class="flex flex-col mb-4">
<div cla... |
0b59c5fb39b13b932ee4c2c4742a65104124c841 | 3,011 | [
650698680
] | [
"test",
"phoenix"
] | defmodule CoreWeb.SettingControllerTest do
use CoreWeb.ConnCase
alias Core.Settings
@create_attrs %{fields: %{}, slug: "some slug", title: "some title", "type,": "some type,"}
@update_attrs %{
fields: %{},
slug: "some updated slug",
title: "some updated title",
"type,": "some updated type,"
... |
0b5a1d79018de367de99ce741a37c2c11154179c | 2,443 | [
269890945
] | [] | 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 webpack to recompile .js and .css sources.
config :mariechen, MariechenWeb.Endpoint,
http: [port: ... |
0b5a1ec587bd175437c271086fbb3c0ed3d0e1b2 | 1,884 | [
466255799
] | [
"liveview",
"ecto"
] | defmodule HackathonWeb.CommunityLive.Create do
use HackathonWeb, :live_view
alias Hackathon.Communities
alias Hackathon.Communities.Community
@impl true
def mount(_params, _session, socket) do
community = %Community{
coordinates: %{}
}
changeset = Communities.change_community(community)
... |
0b5a5291cee9cc1489ecd4a656cf6b10ce710f23 | 4,908 | [
367278931
] | [
"documented"
] | defmodule Google.Ads.Googleads.V20.Resources.OfflineConversionUploadClientSummary do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3
field :resource_name, 1, type: :string, json_name: "resourceName", deprecated: false
field :client, 2,
type: Google.Ads.Googleads.V20.En... |
0b5a87b204290ce3bd3add59c7511206dfda9ecb | 4,508 | [
119977028
] | [
"genserver"
] | defmodule Collector do
use GenServer
def start_link(_args) do
GenServer.start_link(__MODULE__, %{})
end
def init(state) do
# Setup ETS table
:ets.new(:metric, [:named_table])
Enum.each([:cpu, :memory, :disk, :network, :uptime, :loadavg, :userlist], fn key ->
:ets.insert(:metric, {key, {... |
0b5ae990f563d33ec54e6fa2fe17dca222bf7146 | 1,580 | [
436267088
] | [
"test",
"supervisor"
] | defmodule ExshomeWebTest.App.AppSupervisorTest do
use ExshomeTest.DataCase, async: true
alias Exshome.Service
alias ExshomeWeb.App
alias ExshomeWeb.App.AppSupervisor
describe "AppSupervisor" do
test "start_link/1 works fine" do
{:ok, pid} =
%{}
|> ExshomeTest.TestRegistry.prepare_ch... |
0b5b891311a29a30d27b05c33ceaac04af759d11 | 3,615 | [
359664266
] | [
"genserver",
"documented"
] | defmodule Fona do
@moduledoc """
Documentation for Fona.
"""
use GenServer
require Logger
alias Fona.Commands
# CLIENT
def connect(device_path) do
start_link(device_path)
end
def connect_to_network(apn, username \\ "", password \\ "") do
GenServer.call(__MODULE__, {:enable_gprs, apn, usern... |
0b5c2898c8d6e10cfd9c928f5a8867a682a859ef | 1,586 | [
725942960
] | [] | # defmodule Day17 do
# # defstruct
# @up {-1, 0}
# @down {1, 0}
# @left {0, -1}
# @right {0, 1}
# def parse_to_graph(lines) do
# grid = lines |> AOC.parse_grid()
# goal =
# Enum.max(grid |> Map.keys())
# graph =
# for {current, _weight} <- grid, reduce: %{} do
# acc -> Ma... |
0b5c5f50085a6fe2e4696ba19367716b9dbee5f6 | 1,721 | [
723520140
] | [] | defmodule AdventOfCode.Y2024.D20 do
use AdventOfCode.Puzzle, year: 2024, day: 20
@timesave 100
@max_cheat_1 2
@max_cheat_2 20
@impl true
def title, do: "Race Condition"
@impl true
def solve(input) do
{solve_1(input), solve_2(input)}
end
@impl true
def parse(input) do
{vs, start} =
... |
0b5c7151d4dc27500c1e7f5374a2a23af015e14e | 16,871 | [
897152983
] | [] | defmodule AdventOfCode.Day12 do
import AdventOfCode.Utils
# --- Day 12: Garden Groups ---
#
# Why not search for the Chief Historian near the gardener and his massive farm? There's plenty of food, so The Historians grab something to eat while they search.
#
# You're about to settle near a complex arrangeme... |
0b5c7f4b924fbf7b9a5a4d6bf3aae10db082ef0a | 1,714 | [
53193985
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule Commander.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use Commander.Web, :controller
use Commander.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep th... |
0b5d03df71aeba1fa3f352c763622bb1d9f4f38a | 1,752 | [
317546749
] | [
"test"
] | defmodule AdventOfCode.Solutions.Y23.Day18Test do
alias AdventOfCode.Solutions.Y23.Day18, as: Solution
alias AoC.Input
use ExUnit.Case, async: true
# To run the test, run one of the following commands:
#
# mix AoC.test --year 2023 --day 18
#
# mix test test/2023/day18_test.exs
#
# To run th... |
0b5da9f81ef0581b834b5f68f1a1733b309e7250 | 1,630 | [
630910241
] | [
"phoenix"
] | defmodule PetStoreWeb.Router do
use PetStoreWeb, :router
import PetStoreWeb.UserAuth
pipeline :api do
plug :accepts, ["json"]
end
scope "/", PetStoreWeb do
pipe_through [:api, :require_authenticated_user]
put "/users/settings", UserSettingsController, :update
get "/users/settings/confirm_e... |
0b5e32fcb5d27baa14e7f3d04f5fa4763e685630 | 1,782 | [
284148446
] | [
"documented",
"ecto"
] | defmodule TimetrackergqlWeb.Resolver.Timer do
alias Timetrackergql.TimerContext
@doc """
Returns the list of timers.
## Examples
iex> list_timers()
[%Timer{}, ...]
"""
def list_timers(_, attrs, _) do
{:ok, TimerContext.list_timers(attrs)}
end
@doc """
Gets a single timer.
Raises... |
0b5ea2caf6619bc1d789f2cab1f948458ab60cc1 | 3,260 | [
275466745
] | [
"macro",
"test"
] | defmodule Credo.Check.Readability.SeparateAliasImportRequireUseTest do
use Credo.Test.Case
@described_check Credo.Check.Readability.SeparateAliasRequire
test "it should NOT report violation on consecutive aliases" do
"""
defmodule Test do
alias App.Module1
alias App.Module2
end
"""
... |
0b5eec94e5f94ba79c2001d4783844d90d1cae3d | 1,725 | [
54917993
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule BlogEngine.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use BlogEngine.Web, :controller
use BlogEngine.Web, :view
The definitions below will be executed for every view,
controller, etc, so keep... |
0b5ef94d7770f587080fb3c03fe73606aa160ede | 5,454 | [
294769035
] | [] | %{
"cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "... |
0b601bbe9e9b11bab93a65dec0c512dafd4dd0a8 | 1,948 | [
648530090
] | [
"liveview",
"phoenix"
] | defmodule LiveWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :live
# 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: "_live_key",
... |
0b604963d77d78c2a36f6d7b32e04d5f2219a985 | 12,432 | [
436607985
] | [] | defmodule AOC18 do
def part1(input) do
grid = input
|> String.split("\n", trim: true)
|> Enum.map(&String.split(&1,"", trim: true))
Enum.reduce(1..100, grid, fn(_step, grid) -> next(grid) end)
|> List.flatten()
|> Enum.filter(fn(e)-> e == "#" end)
|> Enum.count()
end
def part2(input) ... |
0b605d114ef466bb28c91b13b0b95865ed59feb0 | 1,768 | [
59170706
] | [
"macro",
"documented",
"ecto",
"phoenix"
] | defmodule PhoenixGraphql.Web do
@moduledoc """
A module that keeps using definitions for controllers,
views and so on.
This can be used in your application as:
use PhoenixGraphql.Web, :controller
use PhoenixGraphql.Web, :view
The definitions below will be executed for every view,
controller, ... |
0b607f7389457d335eb063e531747835adca13f7 | 4,011 | [
932945673
] | [
"phoenix"
] | defmodule IeeeTamuPortalWeb.Router do
use IeeeTamuPortalWeb, :router
import IeeeTamuPortalWeb.Auth.{MemberAuth, AdminAuth}
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, html: {IeeeTamuPortalWeb.Layouts, :root}
plug :protect_fro... |
0b609684ec1e3b8c1cc469a130683382bcbd24f6 | 9,379 | [
298609118
] | [
"genserver",
"typespec",
"liveview",
"supervisor"
] | defmodule BirdsAgainstMortalityWeb.GameLive do
use BirdsAgainstMortalityWeb, :live_view
alias BirdsAgainstMortality.Game
@default_player %{id: "user.id", name: "user.name", hand: [], points: 0}
@impl true
def mount(params, session, socket) do
user = session["user"]
{:ok,
assign(socket, user: user... |
0b610b18d7c1cbd18f9ec3ff660e37e46b5bf62e | 2,291 | [
329438118
] | [
"test"
] | defmodule Datix.NaiveDateTimeTest do
use ExUnit.Case
import Prove
alias Datix.ValidationError
doctest Datix.NaiveDateTime
describe "parse/3" do
batch "parses valid date-string with format-string" do
prove Datix.NaiveDateTime.parse("2018/12/30 11:23:55", "%Y/%m/%d %H:%M:%S") ==
{:ok... |
0b612848e35cc158ffe9198cf47ceb00b93707d7 | 1,977 | [
62261877
] | [
"typespec"
] | defmodule ListOps do
# Please don't use any external modules (especially List) in your
# implementation. The point of this exercise is to create these basic functions
# yourself.
#
# Note that `++` is a function from an external module (Kernel, which is
# automatically imported) and so shouldn't be used eit... |
0b62418a13309ec4b1eb5bd7015069ea46615216 | 2,457 | [
71174933
] | [
"test",
"ecto"
] | defmodule NelixmoHTTPMessageResposeTest do
use ExUnit.Case
doctest Nelixmo.HTTP.Message.Response
test "can parse result" do
import Nelixmo.HTTP.Message.Response
response = """
{
"message-count":"3",
"messages":[
{
"status":"0",
"message-id":"00000124",
"to":"441234... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.